Go to the documentation of this file.
30 #define TRACE_LEVEL TRACE_LEVEL_OFF
42 #if (configSUPPORT_STATIC_ALLOCATION == 1)
46 configMINIMAL_STACK_SIZE,
67 vTaskStartScheduler();
89 stackSize = params->
stackSize *
sizeof(uint32_t);
94 #if (configSUPPORT_STATIC_ALLOCATION == 1)
96 if(params->
tcb != NULL && params->
stack != NULL)
99 handle = xTaskCreateStatic((TaskFunction_t) taskCode,
name,
100 stackSize, arg, params->
priority, (StackType_t *) params->
stack,
108 status = xTaskCreate((TaskFunction_t) taskCode,
name, stackSize, arg,
131 vTaskDelete((TaskHandle_t) taskId);
165 if(xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
180 if(xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
197 #if (configSUPPORT_STATIC_ALLOCATION == 1)
199 event->handle = xSemaphoreCreateBinaryStatic(&event->
buffer);
202 event->handle = xSemaphoreCreateBinary();
228 vSemaphoreDelete(event->
handle);
241 xSemaphoreGive(event->
handle);
253 xSemaphoreTake(event->
handle, 0);
274 ret = xSemaphoreTake(event->
handle, portMAX_DELAY);
296 portBASE_TYPE flag =
FALSE;
299 xSemaphoreGiveFromISR(event->
handle, &flag);
317 #if (configSUPPORT_STATIC_ALLOCATION == 1)
319 semaphore->
handle = xSemaphoreCreateCountingStatic(count, count,
323 semaphore->
handle = xSemaphoreCreateCounting(count, count);
327 if(semaphore->
handle != NULL)
346 if(semaphore->
handle != NULL)
349 vSemaphoreDelete(semaphore->
handle);
370 ret = xSemaphoreTake(semaphore->
handle, portMAX_DELAY);
391 xSemaphoreGive(semaphore->
handle);
404 #if (configSUPPORT_STATIC_ALLOCATION == 1)
406 mutex->
handle = xSemaphoreCreateMutexStatic(&mutex->
buffer);
409 mutex->
handle = xSemaphoreCreateMutex();
435 vSemaphoreDelete(mutex->
handle);
448 xSemaphoreTake(mutex->
handle, portMAX_DELAY);
460 xSemaphoreGive(mutex->
handle);
474 time = xTaskGetTickCount();
493 p = pvPortMalloc(size);
497 size, (uintptr_t)
p);
515 TRACE_DEBUG(
"Freeing memory at 0x%08" PRIXPTR
"\r\n", (uintptr_t)
p);
523 #if (configSUPPORT_STATIC_ALLOCATION == 1 && !defined(IDF_VER))
529 void vApplicationGetIdleTaskMemory(StaticTask_t **ppxIdleTaskTCBBuffer,
530 StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize)
532 static StaticTask_t xIdleTaskTCB;
533 static StackType_t uxIdleTaskStack[configMINIMAL_STACK_SIZE];
535 *ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
536 *ppxIdleTaskStackBuffer = uxIdleTaskStack;
537 *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
549 void vApplicationStackOverflowHook(TaskHandle_t pxTask,
char *pcTaskName)
554 taskDISABLE_INTERRUPTS();
566 void vAssertCalled(
const char *pcFile,
unsigned long ulLine)
568 volatile unsigned long ul = 0;
573 taskENTER_CRITICAL();
OsTaskId osCreateTask(const char_t *name, OsTaskCode taskCode, void *arg, const OsTaskParameters *params)
Create a task.
void osResetEvent(OsEvent *event)
Set the specified event object to the nonsignaled state.
void osDeleteEvent(OsEvent *event)
Delete an event object.
void osSuspendAllTasks(void)
Suspend scheduler activity.
#define OS_INVALID_TASK_ID
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
bool_t osCreateMutex(OsMutex *mutex)
Create a mutex object.
portInt8Type buffer[portQUEUE_OVERHEAD_BYTES *2]
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex 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]
bool_t osWaitForEvent(OsEvent *event, systime_t timeout)
Wait until the specified event is in the signaled state.
void osStartKernel(void)
Start kernel.
__weak_func void * osAllocMem(size_t size)
Allocate a memory block.
void(* OsTaskCode)(void *arg)
Task routine.
void osInitKernel(void)
Kernel initialization.
#define OS_SYSTICKS_TO_MS(n)
const OsTaskParameters OS_TASK_DEFAULT_PARAMS
#define OS_MS_TO_SYSTICKS(n)
void osDeleteMutex(OsMutex *mutex)
Delete a mutex object.
portInt8Type buffer[portQUEUE_OVERHEAD_BYTES *2]
RTOS abstraction layer (FreeRTOS)
void osDeleteSemaphore(OsSemaphore *semaphore)
Delete a semaphore object.
void osResumeAllTasks(void)
Resume scheduler activity.
uint32_t systime_t
System time.
bool_t osSetEventFromIsr(OsEvent *event)
Set an event object to the signaled state from an interrupt service routine.
void osDeleteTask(OsTaskId taskId)
Delete a task.
bool_t osCreateEvent(OsEvent *event)
Create an event object.
__weak_func void osFreeMem(void *p)
Release a previously allocated memory block.
void osReleaseSemaphore(OsSemaphore *semaphore)
Release the specified semaphore object.
void osSwitchTask(void)
Yield control to the next task.
thread_t * OsTaskId
Task identifier.
bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout)
Wait for the specified semaphore to be available.
void osDelayTask(systime_t delay)
Delay routine.
bool_t osCreateSemaphore(OsSemaphore *semaphore, uint_t count)
Create a semaphore object.