Go to the documentation of this file.
29 #ifndef _OS_PORT_CHIBIOS_H
30 #define _OS_PORT_CHIBIOS_H
36 #define OS_INVALID_TASK_ID NULL
38 #define OS_SELF_TASK_ID NULL
41 #ifndef OS_TASK_PRIORITY_NORMAL
42 #define OS_TASK_PRIORITY_NORMAL NORMALPRIO
46 #ifndef OS_TASK_PRIORITY_HIGH
47 #define OS_TASK_PRIORITY_HIGH HIGHPRIO
51 #ifndef OS_MS_TO_SYSTICKS
52 #define OS_MS_TO_SYSTICKS(n) (n)
56 #ifndef OS_SYSTICKS_TO_MS
57 #define OS_SYSTICKS_TO_MS(n) (n)
61 #ifndef osGetSystemTime64
62 #define osGetSystemTime64() osGetSystemTime()
70 #define osEnterIsr() CH_IRQ_PROLOGUE(); chSysLockFromISR()
72 #define osExitIsr(flag) chSysUnlockFromISR(); CH_IRQ_EPILOGUE()
75 #if (CH_KERNEL_MAJOR < 3)
76 #define thread_t Thread
77 #define semaphore_t Semaphore
78 #define binary_semaphore_t BinarySemaphore
80 #define chThdTerminatedX chThdTerminated
81 #define chSemObjectInit chSemInit
82 #define chBSemObjectInit chBSemInit
83 #define chMtxObjectInit chMtxInit
84 #define chVTGetSystemTime chTimeNow
85 #define chSysLockFromISR chSysLockFromIsr
86 #define chSysUnlockFromISR chSysUnlockFromIsr
87 #define THD_WORKING_AREA_SIZE THD_WA_SIZE
systime_t osGetSystemTime(void)
Retrieve system time.
OsTaskId osCreateTask(const char_t *name, OsTaskCode taskCode, void *arg, const OsTaskParameters *params)
Create a task.
void osReleaseSemaphore(OsSemaphore *semaphore)
Release the specified semaphore object.
bool_t osCreateMutex(OsMutex *mutex)
Create a mutex object.
bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout)
Wait for the specified semaphore to be available.
void osDeleteSemaphore(OsSemaphore *semaphore)
Delete a semaphore object.
void osFreeMem(void *p)
Release a previously allocated memory block.
void osSwitchTask(void)
Yield control to the next task.
void osStartKernel(void)
Start kernel.
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex object.
#define binary_semaphore_t
mutex_t OsMutex
Mutex object.
bool_t osCreateSemaphore(OsSemaphore *semaphore, uint_t count)
Create a semaphore object.
void(* OsTaskCode)(void *arg)
Task routine.
void osResetEvent(OsEvent *event)
Set the specified event object to the nonsignaled state.
binary_semaphore_t OsEvent
Event object.
void osResumeAllTasks(void)
Resume scheduler activity.
void osDeleteEvent(OsEvent *event)
Delete an event object.
void osDeleteTask(OsTaskId taskId)
Delete a task.
bool_t osWaitForEvent(OsEvent *event, systime_t timeout)
Wait until the specified event is in the signaled state.
bool_t osSetEventFromIsr(OsEvent *event)
Set an event object to the signaled state from an interrupt service routine.
void osDeleteMutex(OsMutex *mutex)
Delete a mutex object.
uint32_t systime_t
System time.
void osSuspendAllTasks(void)
Suspend scheduler activity.
void * osAllocMem(size_t size)
Allocate a memory block.
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
void osDelayTask(systime_t delay)
Delay routine.
bool_t osCreateEvent(OsEvent *event)
Create an event object.
void osInitKernel(void)
Kernel initialization.
const OsTaskParameters OS_TASK_DEFAULT_PARAMS
thread_t * OsTaskId
Task identifier.
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
semaphore_t OsSemaphore
Semaphore object.