Go to the documentation of this file.
30 #define TRACE_LEVEL TRACE_LEVEL_OFF
46 taskIDLE_PRIORITY + 1,
71 xTaskStartScheduler(pdTRUE);
88 portTaskHandleType handle;
89 xTaskParameters taskParams;
92 if(params->
tcb != NULL && params->
stack != NULL)
95 memset(&taskParams, 0,
sizeof(taskParams));
98 taskParams.pvTaskCode = (pdTASK_CODE) taskCode;
99 taskParams.pcTaskName =
name;
100 taskParams.pxTCB = params->
tcb;
101 taskParams.pcStackBuffer = params->
stack;
102 taskParams.ulStackDepthBytes = params->
stackSize;
103 taskParams.pvParameters = arg;
104 taskParams.uxPriority = params->
priority;
105 taskParams.xUsingFPU = pdTRUE;
106 taskParams.xMPUParameters.uxPrivilegeLevel = mpuPRIVILEGED_TASK;
109 status = xTaskCreate(&taskParams, &handle);
136 xTaskDelete((portTaskHandleType) taskId);
170 if(xTaskIsSchedulerStarted() == pdTRUE)
173 vTaskSuspendScheduler();
185 if(xTaskIsSchedulerStarted() == pdTRUE)
188 xTaskResumeScheduler();
205 uint32_t
p = (uint32_t) event->
buffer;
206 n =
p % portQUEUE_OVERHEAD_BYTES;
207 p += portQUEUE_OVERHEAD_BYTES -
n;
210 status = xSemaphoreCreateBinary((portInt8Type *)
p, &
event->handle);
216 xSemaphoreTake(event->
handle, 0);
247 xSemaphoreGive(event->
handle);
259 xSemaphoreTake(event->
handle, 0);
280 status = xSemaphoreTake(event->
handle, portMAX_DELAY);
309 portBaseType flag =
FALSE;
312 xSemaphoreGiveFromISR(event->
handle, &flag);
333 uint32_t
p = (uint32_t) semaphore->
buffer;
334 n =
p % portQUEUE_OVERHEAD_BYTES;
335 p += portQUEUE_OVERHEAD_BYTES -
n;
338 status = xSemaphoreCreateCounting(count, count, (portInt8Type *)
p,
380 status = xSemaphoreTake(semaphore->
handle, portMAX_DELAY);
408 xSemaphoreGive(semaphore->
handle);
424 uint32_t
p = (uint32_t) mutex->
buffer;
425 n =
p % portQUEUE_OVERHEAD_BYTES;
426 p += portQUEUE_OVERHEAD_BYTES -
n;
429 status = xSemaphoreCreateBinary((portInt8Type *)
p, &mutex->
handle);
435 xSemaphoreGive(mutex->
handle);
467 xSemaphoreTake(mutex->
handle, portMAX_DELAY);
479 xSemaphoreGive(mutex->
handle);
493 time = xTaskGetTickCount();
#define OS_INVALID_TASK_ID
portInt8Type buffer[portQUEUE_OVERHEAD_BYTES *2]
void osDeleteMutex(OsMutex *mutex)
Delete a mutex object.
bool_t osCreateEvent(OsEvent *event)
Create an event object.
systime_t osGetSystemTime(void)
Retrieve system time.
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
portInt8Type buffer[portQUEUE_OVERHEAD_BYTES *2]
const OsTaskParameters OS_TASK_DEFAULT_PARAMS
void osInitKernel(void)
Kernel initialization.
void(* OsTaskCode)(void *arg)
Task routine.
void osDelayTask(systime_t delay)
Delay routine.
void osResetEvent(OsEvent *event)
Set the specified event object to the nonsignaled state.
RTOS abstraction layer (SafeRTOS)
__weak_func void osFreeMem(void *p)
Release a previously allocated memory block.
bool_t osCreateMutex(OsMutex *mutex)
Create a mutex object.
#define OS_SYSTICKS_TO_MS(n)
bool_t osCreateSemaphore(OsSemaphore *semaphore, uint_t count)
Create a semaphore object.
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
#define OS_MS_TO_SYSTICKS(n)
portInt8Type buffer[portQUEUE_OVERHEAD_BYTES *2]
bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout)
Wait for the specified semaphore to be available.
void osStartKernel(void)
Start kernel.
uint32_t systime_t
System time.
void osSuspendAllTasks(void)
Suspend scheduler activity.
bool_t osWaitForEvent(OsEvent *event, systime_t timeout)
Wait until the specified event is in the signaled state.
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex object.
void osDeleteEvent(OsEvent *event)
Delete an event object.
__weak_func void * osAllocMem(size_t size)
Allocate a memory block.
void osDeleteTask(OsTaskId taskId)
Delete a task.
void osDeleteSemaphore(OsSemaphore *semaphore)
Delete a semaphore object.
void osReleaseSemaphore(OsSemaphore *semaphore)
Release the specified semaphore object.
void osSwitchTask(void)
Yield control to the next task.
thread_t * OsTaskId
Task identifier.
portBaseType xInitializeScheduler(void)
void osResumeAllTasks(void)
Resume scheduler activity.
bool_t osSetEventFromIsr(OsEvent *event)
Set an event object to the signaled state from an interrupt service routine.
__weak_func OsTaskId osCreateTask(const char_t *name, OsTaskCode taskCode, void *arg, const OsTaskParameters *params)
Create a task.