11 #if !defined(__DOXYGEN__) 14 #ifndef __BEGIN_C_DECLS 15 # if defined(__cplusplus) 16 # define __BEGIN_C_DECLS extern "C" { 17 # define __END_C_DECLS } 19 # define __BEGIN_C_DECLS 20 # define __END_C_DECLS 33 #define BOARD_GENERIC_LINUX 0 34 #define BOARD_RASPBERRYPI 1 35 #define BOARD_NANOPI_NEO 2 36 #define BOARD_NANOPI_AIR 3 37 #define BOARD_NANOPI_M1 4 38 #define BOARD_NANOPI_M1PLUS 5 39 #define BOARD_NANOPI_NEO2 6 40 #define BOARD_NANOPI_NEOPLUS2 7 42 #ifdef SYSIO_WITH_CONFIG_H 52 #if !defined(__DOXYGEN__) 59 # define __need_size_t 66 #define BASENAME(f) (f) 68 #if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__))) 70 # define SYSIO_OS_UNIX 73 # define BASENAME(f) basename(f) 75 # if defined(_POSIX_VERSION) 77 # define SYSIO_OS_POSIX 80 # if defined(__linux__) 81 # define SYSIO_OS_LINUX 84 # if defined(__APPLE__) 85 # define SYSIO_OS_APPLE 88 #elif defined(_WIN32) || defined(WIN32) 89 # define SYSIO_OS_WIN32 92 # error Unable to detect operating system ! 97 #include <arpa/inet.h> 101 #if defined(SYSIO_OS_LINUX) 102 #include <byteswap.h> 104 #if BYTE_ORDER == LITTLE_ENDIAN 105 #define be64_to_cpu(val) bswap_64(val) 106 #elif BYTE_ORDER == BIG_ENDIAN 107 #define be64_to_cpu(val) (val) 109 #error unknwon BYTE_ORDER 112 #elif defined(SYSIO_OS_APPLE) 113 #warning TODO: be64_to_cpu(val) for darwin 115 #elif defined(SYSIO_OS_WIN32) 116 #warning TODO: be64_to_cpu(val) for win32 120 #define ntohll(x) be64_to_cpu(x) 121 #define htonll(x) ntohll(x) 126 extern int iSysIoError;
132 int iSysIoSetStrError (
const char *format, ...);
136 #define _BV(i) (1<<(i)) 140 # define ABS(n) (((n) < 0) ? -(n) : (n)) 144 #define MIN(a,b) ((a) < (b) ? a : b) 148 #define MAX(a,b) ((a) > (b) ? a : b) 152 #define MSB16(x) ((uint8_t) (x >> 8) & 0xFF) 156 #define LSB(x) ((uint8_t) (x & 0xFF)) 160 # define COUNTOF(a) (sizeof(a) / sizeof(*(a))) 163 #ifndef STRUCT_FIELD_OFFSET 164 # define STRUCT_FIELD_OFFSET(s,f) ((size_t)&(((s *)0)->f)) 167 #define PERROR(fmt,...) do { \ 168 vLog (LOG_ERR, "%s:%d: %s(): " fmt, BASENAME(__FILE__), __LINE__, __FUNCTION__, ##__VA_ARGS__); \ 169 iSysIoSetStrError ("%s:%d: %s(): Error: " fmt "\n", \ 170 BASENAME(__FILE__), __LINE__, __FUNCTION__, ##__VA_ARGS__); \ 173 #define PWARNING(fmt,...) do { \ 174 vLog (LOG_WARNING, "%s:%d: %s(): " fmt, BASENAME(__FILE__), __LINE__, __FUNCTION__, ##__VA_ARGS__); \ 175 iSysIoSetStrError ("%s:%d: %s(): Warning: " fmt "\n", \ 176 BASENAME(__FILE__), __LINE__, __FUNCTION__, ##__VA_ARGS__); \ 179 #define PNOTICE(fmt,...) vLog (LOG_NOTICE, fmt, ##__VA_ARGS__) 183 #define PINFO(fmt,...) vLog (LOG_INFO, "%s:%d: %s(): " fmt, BASENAME(__FILE__), __LINE__, __FUNCTION__, ##__VA_ARGS__) 184 #define PDEBUG(fmt,...) vLog (LOG_DEBUG, "%s:%d: %s(): " fmt, BASENAME(__FILE__), __LINE__, __FUNCTION__, ##__VA_ARGS__) 186 #define PDEBUG(fmt,...) vLog (LOG_DEBUG, fmt, ##__VA_ARGS__) 187 #define PINFO(fmt,...) vLog (LOG_INFO, fmt, ##__VA_ARGS__) 190 #include <sysio/log.h> 193 #define FORMAT(type,fmt,first) __attribute__((__format__(type, fmt, first))) 194 #define NORETURN __attribute__((__noreturn__)) 195 #define UNUSED_ARG(type,arg) __attribute__((__unused__)) type arg 196 #define UNUSED_VAR(type,name) __attribute__((__unused__)) type name 197 #define USED_VAR(type,name) __attribute__((__used__)) type name 198 #define INLINE static inline __attribute__((__always_inline__)) 199 #define NOINLINE __attribute__((noinline)) 200 #define LIKELY(x) __builtin_expect(!!(x), 1) 201 #define UNLIKELY(x) __builtin_expect(!!(x), 0) 202 #define PURE_FUNC __attribute__((pure)) 203 #define CONST_FUNC __attribute__((const)) 204 #define UNUSED_FUNC __attribute__((unused)) 205 #define USED_FUNC __attribute__((__used__)) 206 #define RESTRICT __restrict__ 207 #define MUST_CHECK __attribute__((warn_unused_result)) 208 #define PACKED __attribute__((packed)) 209 #define ALIGNED(x) __attribute__ ((__aligned__(x))) const char * sSysIoGitCommit(void)
Renvoie l'identifiant de commit git de la bibliothèque.
const char * sSysIoStrError(void)
Renvoie le message de la dernière erreur.
const char * sSysIoVersion(void)
Renvoie la version de la bibliothèque sous forme de string.
int iSysIoBuild(void)
Renvoie le numéro de build de la version de la bibliothèque.
int iSysIoMajor(void)
Renvoie le majeur de la version de la bibliothèque.
bool bSysIoLogAssert(void)
Renvoie true si LOG_ASSERT a été défini lors de la compilation.
int iSysIoMinor(void)
Renvoie le mineur de la version de la bibliothèque.