]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/include/types.h
c9a2fd594f1f9edbfd81b04662fb612c1ada13e2
[pes-rpp/rpp-lib.git] / rpp / include / types.h
1 /**
2  * RPP API types definition header file.
3  *
4  * @file types.h
5  *
6  * @copyright Copyright (C) 2013, 2014 Czech Technical University in Prague
7  *
8  * @author Carlos Jenkins <carlos@jenkins.co.cr>
9  */
10
11 #ifndef __RPP_TYPES_H
12 #define __RPP_TYPES_H
13
14
15 #ifndef NULL
16 /**
17  * NULL definition
18  */
19 #define NULL ((void *)0U)
20 #endif
21
22
23 #ifndef TRUE
24 /**
25  * Boolean definition for TRUE
26  */
27 #define TRUE 1
28 #endif
29
30
31 #ifndef FALSE
32 /**
33  * Boolean definition for FALSE
34  */
35 #define FALSE 0
36 #endif
37
38
39 /**
40  * Logic definition for logic HIGH
41  */
42 #define HIGH TRUE
43
44
45 /**
46  * Logic definition for logic LOW
47  */
48 #define LOW FALSE
49
50
51 /**
52  * Value indicating a closed switch
53  */
54 #define RPP_CLOSED TRUE
55
56
57 /**
58  * Value indicating an open switch
59  */
60 #define RPP_OPEN FALSE
61
62
63 /**
64  * Definition for SUCCESS
65  */
66 #define SUCCESS 0
67
68
69 /**
70  * Definition for FAILURE (oldschool code)
71  */
72 #define FAILURE -1
73
74
75 // Error codes used instead of FAILURE in new code (as negative numbers)
76 #define RPP_EINVAL  2           /**< Input value error */
77 #define RPP_EBUSY   3           /**< Hardware is busy */
78 #define RPP_ENOMEM  4           /**< Not enough memory */
79 #define RPP_ENODATA 5           /**< No data were reveived */
80
81 // Note: Sadly <stdint.h> is not available with CCS tools.
82 #ifdef __GNUC__
83
84 #include <stdint.h>
85 #include <stdbool.h>
86 typedef bool boolean_t;
87
88 #else
89
90 /**
91  * Unsigned 64 bits integer datatype definition.
92  */
93 typedef unsigned long long uint64_t;
94
95
96 /**
97  * Unsigned 32 bits integer datatype definition.
98  */
99 typedef unsigned int uint32_t;
100
101
102 /**
103  * Unsigned 16 bits integer datatype definition.
104  */
105 typedef unsigned short uint16_t;
106
107
108 /**
109  * Unsigned 8 bits integer datatype definition.
110  */
111 typedef unsigned char uint8_t;
112
113
114 /**
115  * Signed 64 bits integer datatype definition.
116  */
117 typedef signed long long int64_t;
118
119
120 /**
121  * Signed 32 bits integer datatype definition.
122  */
123 typedef signed int int32_t;
124
125
126 /**
127  * Signed 16 bits integer datatype definition.
128  */
129 typedef signed short int16_t;
130
131
132 /**
133  * Signed 8 bits integer datatype definition.
134  */
135 typedef signed char int8_t;
136
137
138 /**
139  * Boolean datatype definition.
140  */
141 typedef unsigned char boolean_t;
142
143 #endif /* __GNUC__ */
144
145 #endif /* __RPP_TYPES_H */