/usr/include/aroarfw/msg.h is in aroarfw-dev 0.1~beta5-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | //msg.h:
/*
* Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2013
*
* This file is part of aroarfw, a RoarAudio framework for
* embedded systems (µControlers).
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3
* or (at your option) any later version as published by
* the Free Software Foundation.
*
* aroarfw is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _AROARFW_MSG_H_
#define _AROARFW_MSG_H_
#include <aroarfw/types.h>
#include <aroarfw/proto.h>
#include <aroarfw/byteorder.h>
//! Maximum length of version 0 message header
#define RMSG_V0_MAX_HEADER_LEN 10
//! Maximum length of version 1 message header
#define RMSG_V1_MAX_HEADER_LEN 11
//! Maximum length of version 2 message header
#define RMSG_V2_MAX_HEADER_LEN 20
//! RoarAudio Message version 0 type
typedef unsigned char rmsg_v0_t[RMSG_V0_MAX_HEADER_LEN];
//! RoarAudio Message version 1 type
typedef unsigned char rmsg_v1_t[RMSG_V1_MAX_HEADER_LEN];
//! RoarAudio Message version 2 type
typedef unsigned char rmsg_v2_t[RMSG_V2_MAX_HEADER_LEN];
//! RoarAudio Message type, version independed.
typedef union {
//! Version of message
unsigned char version;
//! Version 0 message
rmsg_v0_t v0;
//! Version 1 message
rmsg_v1_t v1;
//! Version 2 message
rmsg_v2_t v2;
} rmsg_t;
/** \brief Create a RoarAudio version 0 message
\param msg The Message object to create
\param cmd The command for the new message
*/
//void rmsg0_init (rmsg_v0_t msg, rcmd_t cmd);
#define rmsg0_init(msg,cmd) ((msg)[1]= \
((msg)[0]= \
(msg)[2]=(msg)[3]= \
(msg)[4]=(msg)[5]= \
(msg)[6]=(msg)[7]= \
(msg)[8]=(msg)[9]= 0) + \
(cmd))
/** \brief Get the command of a version 0 RoarAudio message
\param msg The Message object to be used
\return The command
*/
#define rmsg0_getcmd(msg) (((unsigned char*)(msg))[1])
/** \brief Set the data length of a version 0 RoarAudio message
\param msg The Message object to be used
\param len The data length
*/
//void rmsg0_setlen(rmsg_v0_t msg, size_t len);
#define rmsg0_setlen(msg, len) ((void)RBO_H2NB16(&(((unsigned char*)(msg))[8]), (len)))
/** \brief Get the data length of a version 0 RoarAudio message
\param msg The Message object to be used
\return The data length
*/
//size_t rmsg0_getlen(rmsg_v0_t msg);
#define rmsg0_getlen(msg) RBO_NB2H16(&(((unsigned char*)(msg))[8]))
/** \brief Set the stream ID of a version 0 RoarAudio message
\param msg The Message object to be used
\param sid The stream ID
*/
//void rmsg0_setsid(rmsg_v0_t msg, rsid_t sid);
#define rmsg0_setsid(msg, sid) ((void)RBO_H2NB16(&(((unsigned char*)(msg))[2]), (sid)))
/** \brief Get the stream ID of a version 0 RoarAudio message
\param msg The Message object to be used
\return The stream ID
*/
//rsid_t rmsg0_getsid(rmsg_v0_t msg);
#define rmsg0_getsid(msg) RBO_NB2H16(&(((unsigned char*)(msg))[2]))
/** \brief Set the stream possition of a version 0 RoarAudio message
\param msg The Message object to be used
\param pos The stream possition
*/
//void rmsg0_setpos(rmsg_v0_t msg, rpos_t pos);
#define rmsg0_setpos(msg, pos) ((void)RBO_H2NB32(&(((unsigned char*)(msg))[4]), (pos)))
/** \brief Get the stream possition of a version 0 RoarAudio message
\param msg The Message object to be used
\return The stream possition
*/
//rpos_t rmsg0_getpos(rmsg_v0_t msg);
#define rmsg0_getpos(msg) RBO_NB2H16(&(((unsigned char*)(msg))[4]))
/** \brief Get the header length of a version 0 RoarAudio message
This function is used to get the length of the message header.
Use This function togeter with rmsg0_header().
\param msg The Message object to be used
\return The header length
*/
//size_t rmsg0_len (rmsg_v0_t msg);
#define rmsg0_len(msg) RMSG_V0_MAX_HEADER_LEN
/** \brief Get the header data of a version 0 RoarAudio message
This function is used to get a pointer to a ready-to-send
version of the message header.
Use This function togeter with rmsg0_header().
\param msg The Message object to be used
\return The pointer to the header
*/
#define rmsg0_header(msg) (msg)
// Message version independed:
/** \brief Get the version of a RoarAudio message
This function returns the version number of the message buffer provided.
\param msg The Message object to be used
\return The version number
*/
#define rmsg_version(msg) (((unsigned char*)msg)[0])
#endif
//ll
|