Go to the documentation of this file.00001
00023 #ifndef LEGATO_BASICS_INCLUDE_GUARD
00024 #define LEGATO_BASICS_INCLUDE_GUARD
00025
00026
00033
00034 typedef enum
00035 {
00036 LE_OK = 0,
00037 LE_NOT_FOUND = -1,
00038 LE_NOT_POSSIBLE = -2,
00039 LE_OUT_OF_RANGE = -3,
00040 LE_NO_MEMORY = -4,
00041 LE_NOT_PERMITTED = -5,
00042 LE_FAULT = -6,
00043 LE_COMM_ERROR = -7,
00044 LE_TIMEOUT = -8,
00045 LE_OVERFLOW = -9,
00046 LE_UNDERFLOW = -10,
00047 LE_WOULD_BLOCK = -11,
00048 LE_DEADLOCK = -12,
00049 LE_FORMAT_ERROR = -13,
00050 LE_DUPLICATE = -14,
00051 LE_BAD_PARAMETER = -15,
00052 LE_CLOSED = -16,
00053 LE_BUSY = -17,
00054 }
00055 le_result_t;
00056
00057
00058
00063
00064 typedef enum
00065 {
00066 LE_OFF = 0,
00067 LE_ON = 1,
00068 }
00069 le_onoff_t;
00070
00071
00072
00078
00079 #define BIT0 0x01
00080 #define BIT1 0x02
00081 #define BIT2 0x04
00082 #define BIT3 0x08
00083 #define BIT4 0x10
00084 #define BIT5 0x20
00085 #define BIT6 0x40
00086 #define BIT7 0x80
00087
00088
00089
00100
00101 #define CONTAINER_OF(memberPtr, type, member) \
00102 ((type*)(((uint8_t*)(memberPtr))-((size_t)(&(((type*)0)->member)))))
00103
00104
00105
00134
00135 #define NUM_ARRAY_MEMBERS(array) \
00136 (sizeof(array) / sizeof((array)[0]))
00137
00138
00139
00161
00162 #define INDEX_OF_ARRAY_MEMBER(array, memberPtr) \
00163 ((((size_t)memberPtr) - ((size_t)array)) / sizeof(*(memberPtr)))
00164
00165
00166
00196
00197 #define STRINGIZE(x) STRINGIZE_EXPAND(x)
00198
00199
00203
00204 #define STRINGIZE_EXPAND(x) #x // Needed to expand macros.
00205
00206
00207 #endif // LEGATO_BASICS_INCLUDE_GUARD