All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
le_basics.h
Go to the documentation of this file.
1 
23 #ifndef LEGATO_BASICS_INCLUDE_GUARD
24 #define LEGATO_BASICS_INCLUDE_GUARD
25 
26 //--------------------------------------------------------------------------------------------------
33 //--------------------------------------------------------------------------------------------------
34 typedef enum
35 {
36  LE_OK = 0,
37  LE_NOT_FOUND = -1,
40  LE_NO_MEMORY = -4,
42  LE_FAULT = -6,
44  LE_TIMEOUT = -8,
45  LE_OVERFLOW = -9,
46  LE_UNDERFLOW = -10,
48  LE_DEADLOCK = -12,
50  LE_DUPLICATE = -14,
52  LE_CLOSED = -16,
53  LE_BUSY = -17,
54 }
56 
57 
58 //--------------------------------------------------------------------------------------------------
63 //--------------------------------------------------------------------------------------------------
64 typedef enum
65 {
66  LE_OFF = 0,
67  LE_ON = 1,
68 }
70 
71 
72 //--------------------------------------------------------------------------------------------------
78 //--------------------------------------------------------------------------------------------------
79 #define BIT0 0x01
80 #define BIT1 0x02
81 #define BIT2 0x04
82 #define BIT3 0x08
83 #define BIT4 0x10
84 #define BIT5 0x20
85 #define BIT6 0x40
86 #define BIT7 0x80
87 // @}
88 
89 //--------------------------------------------------------------------------------------------------
100 //--------------------------------------------------------------------------------------------------
101 #define CONTAINER_OF(memberPtr, type, member) \
102  ((type*)(((uint8_t*)(memberPtr))-((size_t)(&(((type*)0)->member)))))
103 
104 
105 //--------------------------------------------------------------------------------------------------
134 //--------------------------------------------------------------------------------------------------
135 #define NUM_ARRAY_MEMBERS(array) \
136  (sizeof(array) / sizeof((array)[0]))
137 
138 
139 //--------------------------------------------------------------------------------------------------
161 //--------------------------------------------------------------------------------------------------
162 #define INDEX_OF_ARRAY_MEMBER(array, memberPtr) \
163  ((((size_t)memberPtr) - ((size_t)array)) / sizeof(*(memberPtr)))
164 
165 
166 //--------------------------------------------------------------------------------------------------
196 //--------------------------------------------------------------------------------------------------
197 #define STRINGIZE(x) STRINGIZE_EXPAND(x)
198 
199 //--------------------------------------------------------------------------------------------------
203 //--------------------------------------------------------------------------------------------------
204 #define STRINGIZE_EXPAND(x) #x // Needed to expand macros.
205 
206 
207 #endif // LEGATO_BASICS_INCLUDE_GUARD
Format error.
Definition: le_basics.h:49
Current user does not have permission to perform requested action.
Definition: le_basics.h:41
Unspecified internal error.
Definition: le_basics.h:42
Duplicate entry found or operation already performed.
Definition: le_basics.h:50
Insufficient memory is available.
Definition: le_basics.h:40
le_result_t
Definition: le_basics.h:34
Would have caused a deadlock.
Definition: le_basics.h:48
Successful.
Definition: le_basics.h:36
An overflow occurred or would have occurred.
Definition: le_basics.h:45
A time-out occurred.
Definition: le_basics.h:44
An underflow occurred or would have occurred.
Definition: le_basics.h:46
Referenced item does not exist or could not be found.
Definition: le_basics.h:37
The resource is closed.
Definition: le_basics.h:52
It is not possible to perform the requested action.
Definition: le_basics.h:38
The resource is busy or unavailable.
Definition: le_basics.h:53
An index or other value is out of range.
Definition: le_basics.h:39
Parameter is invalid.
Definition: le_basics.h:51
Would have blocked if non-blocking behaviour was not requested.
Definition: le_basics.h:47
Communications error.
Definition: le_basics.h:43
le_onoff_t
Definition: le_basics.h:64