40#define PTR_OFFSET(addr, offset) ((void *) ((uint8_t *) (addr) + (offset)))
42#define timeCompare(t1, t2) ((int32_t) ((t1) - (t2)))
45#if !defined(__AT32F403A_407_LIBRARY_VERSION) && \
46 !defined(__AT32F435_437_LIBRARY_VERSION)
57 #define LSB(x) ((x) & 0xFF)
61 #define MSB(x) (((x) >> 8) & 0xFF)
65 #define MIN(a, b) ((a) < (b) ? (a) : (b))
69 #define MAX(a, b) ((a) > (b) ? (a) : (b))
73 #define arraysize(a) (sizeof(a) / sizeof(a[0]))
77#define INFINITE_DELAY ((uint_t) -1)
79#define MAX_DELAY (INFINITE_DELAY / 2)
82#if defined(USE_NO_RTOS)
85#elif defined(USE_CHIBIOS)
86 #include "os_port_chibios.h"
88#elif defined(USE_CMX_RTX)
89 #include "os_port_cmx_rtx.h"
91#elif defined(USE_CMSIS_RTOS)
92 #include "os_port_cmsis_rtos.h"
94#elif defined(USE_CMSIS_RTOS2)
95 #include "os_port_cmsis_rtos2.h"
97#elif defined(USE_FREERTOS)
98 #include "os_port_freertos.h"
100#elif defined(USE_SAFERTOS)
101 #include "os_port_safertos.h"
103#elif defined(USE_THREADX)
104 #include "os_port_threadx.h"
106#elif defined(USE_RTX)
107 #include "os_port_rtx.h"
109#elif defined(USE_UCOS2)
110 #include "os_port_ucos2.h"
112#elif defined(USE_UCOS3)
113 #include "os_port_ucos3.h"
115#elif defined(USE_PX5)
116 #include "os_port_px5.h"
118#elif defined(USE_EMBOS)
119 #include "os_port_embos.h"
121#elif defined(USE_SYS_BIOS)
122 #include "os_port_sys_bios.h"
124#elif defined(USE_ZEPHYR)
125 #include "os_port_zephyr.h"
128 #include "os_port_windows.h"
130#elif defined(__linux__) || defined(__FreeBSD__)
131 #include "os_port_posix.h"
137 #define osMemset(p, value, length) (void) memset(p, value, length)
143 #define osMemcpy(dest, src, length) (void) memcpy(dest, src, length)
149 #define osMemmove(dest, src, length) (void) memmove(dest, src, length)
155 #define osMemcmp(p1, p2, length) memcmp(p1, p2, length)
161 #define osMemchr(p, c, length) memchr(p, c, length)
167 #define osStrlen(s) strlen(s)
173 #define osStrcmp(s1, s2) strcmp(s1, s2)
179 #define osStrncmp(s1, s2, length) strncmp(s1, s2, length)
185 #define osStrcasecmp(s1, s2) strcasecmp(s1, s2)
191 #define osStrncasecmp(s1, s2, length) strncasecmp(s1, s2, length)
197 #define osStrchr(s, c) strchr(s, c)
203 #define osStrstr(s1, s2) strstr(s1, s2)
209 #define osStrcpy(s1, s2) (void) strcpy(s1, s2)
215 #define osStrncpy(s1, s2, length) (void) strncpy(s1, s2, length)
221 #define osStrcat(s1, s2) (void) strcat(s1, s2)
227 #define osStrtok_r(s, delim, last) strtok_r(s, delim, last)
233 #define osSprintf(dest, ...) sprintf(dest, __VA_ARGS__)
239 #define osSnprintf(dest, size, ...) snprintf(dest, size, __VA_ARGS__)
245 #define osVsnprintf(dest, size, format, ap) vsnprintf(dest, size, format, ap)
251 #define osStrtoul(s, endptr, base) strtoul(s, endptr, base)
257 #define osStrtoull(s, endptr, base) strtoull(s, endptr, base)
263 #define osTolower(c) tolower((uint8_t) (c))
269 #define osToupper(c) toupper((uint8_t) (c))
275 #define osIsupper(c) isupper((uint8_t) (c))
281 #define osIsdigit(c) isdigit((uint8_t) (c))
287 #define osIsspace(c) isspace((uint8_t) (c))
292 #define osIsblank(c) ((c) == ' ' || (c) == '\t')
295#if !defined(__linux__) && !defined(__FreeBSD__)
299 #define usleep(delay) {volatile uint32_t n = delay * 4; while(n > 0) n--;}
303 #define sleep(delay) {volatile uint32_t n = delay * 4000; while(n > 0) n--;}
311#define OS_INVALID_HANDLE OS_INVALID_TASK_ID
Compiler specific definitions.
RTOS port configuration file.