Go to the documentation of this file.
29 #ifndef _OS_PORT_FREERTOS_H
30 #define _OS_PORT_FREERTOS_H
34 #include "freertos/FreeRTOS.h"
35 #include "freertos/task.h"
36 #include "freertos/semphr.h"
44 #ifndef OS_STATIC_TASK_SUPPORT
45 #define OS_STATIC_TASK_SUPPORT DISABLED
46 #elif (OS_STATIC_TASK_SUPPORT != ENABLED && OS_STATIC_TASK_SUPPORT != DISABLED)
47 #error OS_STATIC_TASK_SUPPORT parameter is not valid
51 #define OS_INVALID_TASK_ID NULL
53 #define OS_SELF_TASK_ID NULL
56 #ifndef OS_TASK_PRIORITY_NORMAL
57 #define OS_TASK_PRIORITY_NORMAL (tskIDLE_PRIORITY + 1)
61 #ifndef OS_TASK_PRIORITY_HIGH
62 #define OS_TASK_PRIORITY_HIGH (tskIDLE_PRIORITY + 2)
66 #ifndef OS_MS_TO_SYSTICKS
67 #define OS_MS_TO_SYSTICKS(n) (n)
71 #ifndef OS_SYSTICKS_TO_MS
72 #define OS_SYSTICKS_TO_MS(n) (n)
76 #ifndef osGetSystemTime64
77 #define osGetSystemTime64() osGetSystemTime()
92 #if defined(portENTER_SWITCHING_ISR)
93 #define osEnterIsr() portENTER_SWITCHING_ISR()
101 #if defined(__XTENSA__)
102 #define osExitIsr(flag) if(flag) portYIELD_FROM_ISR()
103 #elif defined(portEXIT_SWITCHING_ISR)
104 #define osExitIsr(flag) portEXIT_SWITCHING_ISR()
105 #elif defined(portEND_SWITCHING_ISR)
106 #define osExitIsr(flag) portEND_SWITCHING_ISR(flag)
107 #elif defined(portYIELD_FROM_ISR)
108 #define osExitIsr(flag) portYIELD_FROM_ISR(flag)
110 #define osExitIsr(flag)
115 #ifndef configSUPPORT_STATIC_ALLOCATION
116 #define configSUPPORT_STATIC_ALLOCATION 0
143 #if (configSUPPORT_STATIC_ALLOCATION == 1)
168 #if (configSUPPORT_STATIC_ALLOCATION == 1)
169 StaticSemaphore_t buffer;
181 #if (configSUPPORT_STATIC_ALLOCATION == 1)
182 StaticSemaphore_t buffer;
194 #if (configSUPPORT_STATIC_ALLOCATION == 1)
195 StaticSemaphore_t buffer;
OsTaskId osCreateTask(const char_t *name, OsTaskCode taskCode, void *param, size_t stackSize, int_t priority)
Create a task.
systime_t osGetSystemTime(void)
Retrieve system time.
void osReleaseSemaphore(OsSemaphore *semaphore)
Release the specified semaphore object.
void osDeleteSemaphore(OsSemaphore *semaphore)
Delete a semaphore object.
OsTaskId osCreateStaticTask(const char_t *name, OsTaskCode taskCode, void *param, OsTaskTcb *tcb, OsStackType *stack, size_t stackSize, int_t priority)
Create a task with statically allocated memory.
bool_t osSetEventFromIsr(OsEvent *event)
Set an event object to the signaled state from an interrupt service routine.
void * osAllocMem(size_t size)
Allocate a memory block.
void osSuspendAllTasks(void)
Suspend scheduler activity.
void OsTaskTcb
Task control block.
mutex_t OsMutex
Mutex object.
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
binary_semaphore_t OsEvent
Event object.
void osSwitchTask(void)
Yield control to the next task.
StackType_t OsStackType
Stack data type.
TaskHandle_t OsTaskId
Task identifier.
bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout)
Wait for the specified semaphore to be available.
uint32_t OsStackType
Stack data type.
void osDelayTask(systime_t delay)
Delay routine.
uint32_t systime_t
System time.
void osInitKernel(void)
Kernel initialization.
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
bool_t osCreateSemaphore(OsSemaphore *semaphore, uint_t count)
Create a semaphore object.
void(* OsTaskCode)(void *param)
Task routine.
void osDeleteMutex(OsMutex *mutex)
Delete a mutex object.
TickType_t systime_t
System time.
void osResetEvent(OsEvent *event)
Set the specified event object to the nonsignaled state.
void osStartKernel(void)
Start kernel.
void osDeleteEvent(OsEvent *event)
Delete an event object.
void osResumeAllTasks(void)
Resume scheduler activity.
void osFreeMem(void *p)
Release a previously allocated memory block.
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex object.
thread_t * OsTaskId
Task identifier.
bool_t osWaitForEvent(OsEvent *event, systime_t timeout)
Wait until the specified event is in the signaled state.
void osDeleteTask(OsTaskId taskId)
Delete a task.
bool_t osCreateMutex(OsMutex *mutex)
Create a mutex object.
bool_t osCreateEvent(OsEvent *event)
Create an event object.
semaphore_t OsSemaphore
Semaphore object.