Hardware Abstraction Layer for FreeRTOS
|
Go to the documentation of this file.
15 # include <framaC/freeRTOS.h>
53 #ifdef CONFIG_INSTANCE_NAME
59 #ifdef CONFIG_USE_RECURSIVE_MUTEXES
72 #ifdef CONFIG_USE_RECURSIVE_MUTEXES
75 if (
hal->lock == NULL) {
87 #ifdef CONFIG_USE_RECURSIVE_MUTEXES
89 vSemaphoreDelete(
hal->lock);
108 inline int32_t
hal_lock(
void *data, TickType_t waittime) {
109 #ifdef CONFIG_USE_RECURSIVE_MUTEXES
111 return xSemaphoreTakeRecursive(
hal->lock, waittime);
123 #ifdef CONFIG_USE_RECURSIVE_MUTEXES
125 return xSemaphoreGiveRecursive(
hal->lock);
130 #ifdef CONFIG_INSTANCE_NAME
136 int32_t hal_printNames();
140 #define HAL_DEFINE_GLOBAL_ARRAY(gns) \
141 extern uintptr_t _devs[]; \
142 extern uintptr_t *_devs_end
143 extern uint32_t _devs_size;
149 #define HAL_DEFINE_GLOBAL_ARRAY(gns) \
150 extern uintptr_t *_devs; \
151 extern uintptr_t *_devs_end
161 inline uintptr_t *
hal_getDev(uintptr_t **devs, uintptr_t **end, uint32_t index) {
163 if (index >= _devs_size) {
168 if ((devs + index) >= end) {
182 #define HAL_GET_DEV(gns, index) (void *) hal_getDev((uintptr_t **) &_devs, &_devs_end, index)
189 #define HAL_LOCK(data, waittime, errcode) do { \
190 int32_t lock_ret = hal_lock(data, waittime); \
191 if (lock_ret != 1) { \
201 #define HAL_UNLOCK(data, errcode) do { \
202 int32_t unlock_ret = hal_unlock(data); \
203 if (unlock_ret != 1) { \
213 #define HAL_DEFINE_DEVICE_ENTRY(gns, ns, p) extern struct gns##_generic const * const ns##_##p
221 #define HAL_ADDDEV(gns, ns, p) struct gns##_generic SECTION(".rodata.devs") USED NO_REORDER const * const ns##_##p = (void const *) &p
226 #define HAL_ADD(ns, p) HAL_ADDDEV(hal, ns, p)
231 #define HAL_GET_GLOBAL_DEV(index) HAL_GET_DEV(hal, index)
232 #ifdef CONFIG_INSTANCE_NAME
237 # define HAL_NAME(n) .gen.name = n,
247 #define HAL_GET_ID(gns, ns, p) ({ \
248 HAL_DEFINE_DEVICE_ENTRY(gns, ns, p); \
250 ret = (uint32_t) ((((uintptr_t) (&ns##_##p)) - ((uintptr_t) (&_devs))) / sizeof(uintptr_t)); \
254 #ifdef CONFIG_GEN_VERSION
255 extern const char *versionDriver;
256 extern const char *versionMach;
257 extern const char *versionArch;
258 extern const char *versionKernel;
#define OS_DEFINE_MUTEX_RECURSIVE(name)
Definition: os.h:59
#define HAL_DEFINE_GLOBAL_ARRAY(gns)
Definition: hal.h:149
#define OS_CREATE_MUTEX_RECURSIVE(handleName)
Definition: os.h:68
uintptr_t * hal_getDev(uintptr_t **devs, uintptr_t **end, uint32_t index)
Definition: hal.h:161
bool init
Definition: hal.h:52
int32_t hal_deinit(void *data)
Definition: hal.h:86
int32_t hal_lock(void *data, TickType_t waittime)
Definition: hal.h:108
int32_t hal_init(void *data)
Definition: hal.h:71
bool hal_isInit(void *data)
Definition: hal.h:98
int32_t hal_unlock(void *data)
Definition: hal.h:122