aroarfw
basic.h
Go to the documentation of this file.
1 //basic.h:
2 
3 /*
4  * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2013
5  *
6  * This file is part of aroarfw, a RoarAudio framework for
7  * embedded systems (µControlers).
8  *
9  * This file is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 3
11  * or (at your option) any later version as published by
12  * the Free Software Foundation.
13  *
14  * aroarfw is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this software; see the file COPYING. If not, write to
21  * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  */
24 
25 #ifndef _AROARFW_BASIC_H_
26 #define _AROARFW_BASIC_H_
27 
28 #include <aroarfw/byteorder.h>
29 #include <aroarfw/msg.h>
30 
32 #define rmsg0_msg_noop(msg) rmsg0_init((msg), RCMD_NOOP)
33 
35 #define rmsg0_msg_auth(msg) rmsg0_init((msg), RCMD_AUTH)
36 
38 #define rmsg0_msg_quit(msg) rmsg0_init((msg), RCMD_QUIT)
39 
41 #define rmsg0_is_ok(msg) (rmsg0_getcmd(msg) == RCMD_OK)
42 
44 #define rmsg0_is_error(msg) (rmsg0_getcmd(msg) == RCMD_ERROR)
45 
46 // IDENTIFY helper macros:
47 
49 #define RPROTO_IDENTIFY_PREFIX_LEN 5
50 
52 #define rproto_identify_name(buf) (((char*)(buf)) + RPROTO_IDENTIFY_PREFIX_LEN)
53 
55 #define rproto_identify_prefix(buf, pid) ((void)((((unsigned char*)(buf))[0] = 1) + \
56  RBO_H2NB32(&(((unsigned char*)(buf))[1]), (pid))))
57 #endif
58 
59 //ll
byteorder.h
msg.h