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 //--------------------------------------------------------------------------------------------------
34 //--------------------------------------------------------------------------------------------------
35 typedef enum
36 {
37  LE_OK = 0,
38  LE_NOT_FOUND = -1,
41  LE_NO_MEMORY = -4,
43  LE_FAULT = -6,
45  LE_TIMEOUT = -8,
46  LE_OVERFLOW = -9,
47  LE_UNDERFLOW = -10,
49  LE_DEADLOCK = -12,
51  LE_DUPLICATE = -14,
53  LE_CLOSED = -16,
54  LE_BUSY = -17,
56  LE_IO_ERROR = -19,
59  LE_TERMINATED = -22,
60 }
62 
63 
64 //--------------------------------------------------------------------------------------------------
69 //--------------------------------------------------------------------------------------------------
70 typedef enum
71 {
72  LE_OFF = 0,
73  LE_ON = 1,
74 }
76 
77 
78 //--------------------------------------------------------------------------------------------------
84 //--------------------------------------------------------------------------------------------------
85 #define BIT0 0x01
86 #define BIT1 0x02
87 #define BIT2 0x04
88 #define BIT3 0x08
89 #define BIT4 0x10
90 #define BIT5 0x20
91 #define BIT6 0x40
92 #define BIT7 0x80
93 // @}
94 
95 //--------------------------------------------------------------------------------------------------
106 //--------------------------------------------------------------------------------------------------
107 #define CONTAINER_OF(memberPtr, type, member) \
108  ((type*)(((uint8_t*)(memberPtr))-((size_t)(&(((type*)0)->member)))))
109 
110 
111 //--------------------------------------------------------------------------------------------------
140 //--------------------------------------------------------------------------------------------------
141 #define NUM_ARRAY_MEMBERS(array) \
142  (sizeof(array) / sizeof((array)[0]))
143 
144 
145 //--------------------------------------------------------------------------------------------------
167 //--------------------------------------------------------------------------------------------------
168 #define INDEX_OF_ARRAY_MEMBER(array, memberPtr) \
169  ((((size_t)memberPtr) - ((size_t)array)) / sizeof(*(memberPtr)))
170 
171 
172 //--------------------------------------------------------------------------------------------------
205 //--------------------------------------------------------------------------------------------------
206 #define STRINGIZE(x) STRINGIZE_EXPAND(x)
207 
208 //--------------------------------------------------------------------------------------------------
212 //--------------------------------------------------------------------------------------------------
213 #define STRINGIZE_EXPAND(x) #x // Needed to expand macros.
214 
215 
216 //--------------------------------------------------------------------------------------------------
239 //--------------------------------------------------------------------------------------------------
240 #define LE_SHARED __attribute__((visibility ("default")))
241 
242 
243 #endif // LEGATO_BASICS_INCLUDE_GUARD
Format error.
Definition: le_basics.h:50
The underlying resource does not support this operation.
Definition: le_basics.h:55
Current user does not have permission to perform requested action.
Definition: le_basics.h:42
Unspecified internal error.
Definition: le_basics.h:43
Duplicate entry found or operation already performed.
Definition: le_basics.h:51
Insufficient memory is available.
Definition: le_basics.h:41
le_result_t
Definition: le_basics.h:35
An IO operation failed.
Definition: le_basics.h:56
Would have caused a deadlock.
Definition: le_basics.h:49
Successful.
Definition: le_basics.h:37
Unimplemented functionality.
Definition: le_basics.h:57
An overflow occurred or would have occurred.
Definition: le_basics.h:46
A time-out occurred.
Definition: le_basics.h:45
An underflow occurred or would have occurred.
Definition: le_basics.h:47
Referenced item does not exist or could not be found.
Definition: le_basics.h:38
The resource is closed.
Definition: le_basics.h:53
A transient or temporary loss of a service or resource.
Definition: le_basics.h:58
Definition: le_basics.h:39
The resource is busy.
Definition: le_basics.h:54
An index or other value is out of range.
Definition: le_basics.h:40
Parameter is invalid.
Definition: le_basics.h:52
Would have blocked if non-blocking behaviour was not requested.
Definition: le_basics.h:48
The process, operation, data stream, session, etc. has stopped.
Definition: le_basics.h:59
Communications error.
Definition: le_basics.h:44
le_onoff_t
Definition: le_basics.h:70