EPPL example libraries  0.1 alpha
 All Files Functions Variables Groups Pages
macros.h
1 #ifndef MACROS_H_INCLUDED
2 #define MACROS_H_INCLUDED
3 /*
4  Copyright (c) 2014, Radoslaw Koppel
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without
8  modification, are permitted provided that the following conditions are met:
9 
10  - Redistributions of source code must retain the above copyright
11  notice, this list of conditions and the following disclaimer.
12 
13  - Redistributions in binary form must reproduce the above copyright
14  notice, this list of conditions and the following disclaimer in the
15  documentation and/or other materials provided with the distribution.
16 
17  - Neither the name of the copyright holders nor the
18  names of its contributors may be used to endorse or promote products
19  derived from this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE FOR ANY
25  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
44 #define NOP() {asm volatile("nop"::);}
45 
51 #define ELEMS(p) (sizeof(p)/sizeof(p[0]))
52 
58 #ifndef NOINIT
59 #define NOINIT __attribute__ ((section (".noinit")))
60 #endif
61 
67 #define CONNECT_NAMES(a, b) XCONNECT_NAMES(a, b)
68 #define XCONNECT_NAMES(a, b) a ## b
69 
75 #define MAKE_TEXT(x) XMAKE_TEXT(x)
76 #define XMAKE_TEXT(x) #x
77 
85 #define MIN(a,b) ( (a) < (b) ? (a) : (b) )
86 
93 #define MAX(a,b) ( (a) > (b) ? (a) : (b) )
94 
96 #endif /* MACROS_H_INCLUDED */