aroarfw
include/aroarfw/basic.h
Go to the documentation of this file.
00001 //basic.h:
00002 
00003 /*
00004  *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2012
00005  *
00006  *  This file is part of aroarfw, a RoarAudio framework for
00007  *  embedded systems (µControlers).
00008  *
00009  *  This file is free software; you can redistribute it and/or modify
00010  *  it under the terms of the GNU General Public License version 3
00011  *  or (at your option) any later version as published by
00012  *  the Free Software Foundation.
00013  *
00014  *  aroarfw is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *  GNU General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public License
00020  *  along with this software; see the file COPYING.  If not, write to
00021  *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
00022  *  Boston, MA 02110-1301, USA.
00023  */
00024 
00025 #ifndef _AROARFW_BASIC_H_
00026 #define _AROARFW_BASIC_H_
00027 
00028 #include <aroarfw/byteorder.h>
00029 #include <aroarfw/msg.h>
00030 
00032 #define rmsg0_msg_noop(msg) rmsg0_init((msg), RCMD_NOOP)
00033 
00035 #define rmsg0_msg_auth(msg) rmsg0_init((msg), RCMD_AUTH)
00036 
00038 #define rmsg0_msg_quit(msg) rmsg0_init((msg), RCMD_QUIT)
00039 
00041 #define rmsg0_is_ok(msg) (rmsg0_getcmd(msg) == RCMD_OK)
00042 
00044 #define rmsg0_is_error(msg) (rmsg0_getcmd(msg) == RCMD_ERROR)
00045 
00046 // IDENTIFY helper macros:
00047 
00049 #define RPROTO_IDENTIFY_PREFIX_LEN 5
00050 
00052 #define rproto_identify_name(buf) (((char*)(buf)) + RPROTO_IDENTIFY_PREFIX_LEN)
00053 
00055 #define rproto_identify_prefix(buf, pid) ((void)((((unsigned char*)(buf))[0] = 1) + \
00056                                                RBO_H2NB32(&(((unsigned char*)(buf))[1]), (pid))))
00057 #endif
00058 
00059 //ll