Go to the documentation of this file.
30 #define TRACE_LEVEL TRACE_LEVEL_OFF
40 typedef void *(*PthreadTaskCode) (
void *param);
62 px5_pthread_start(1, NULL, 0);
93 px5_pthread_attr_t threadAttr;
96 ret = pthread_attr_init(&threadAttr);
99 if(ret == PX5_SUCCESS)
102 if(params->
stack != NULL)
105 ret = px5_pthread_attr_setstackaddr(&threadAttr, params->
stack);
110 if(ret == PX5_SUCCESS)
113 ret = px5_pthread_attr_setstacksize(&threadAttr,
118 if(ret == PX5_SUCCESS)
121 ret = px5_pthread_attr_setpriority(&threadAttr, params->
priority);
125 ret = px5_pthread_create(&thread, &threadAttr, (
PthreadTaskCode) taskCode,
129 if(ret == PX5_SUCCESS)
151 px5_pthread_exit(NULL);
156 pthread_cancel(taskId);
216 ret = px5_sem_init(event, 0, 0);
219 if(ret == PX5_SUCCESS)
238 px5_sem_destroy(event);
267 ret = px5_sem_trywait(event);
270 }
while(ret == PX5_SUCCESS);
291 ret = px5_sem_trywait(event);
296 ret = px5_sem_wait(event);
305 if(ret == PX5_SUCCESS)
311 ret = px5_sem_trywait(event);
314 }
while(ret == PX5_SUCCESS);
358 ret = px5_sem_init(semaphore, 0, count);
361 if(ret == PX5_SUCCESS)
380 px5_sem_destroy(semaphore);
400 ret = px5_sem_trywait(semaphore);
405 ret = px5_sem_wait(semaphore);
414 if(ret == PX5_SUCCESS)
433 px5_sem_post(semaphore);
449 ret = px5_pthread_mutex_init(mutex, NULL);
452 if(ret == PX5_SUCCESS)
471 px5_pthread_mutex_destroy(mutex);
483 px5_pthread_mutex_lock(mutex);
495 px5_pthread_mutex_unlock(mutex);
509 time = px5_pthread_ticks_get();
536 size, (uintptr_t)
p);
554 TRACE_DEBUG(
"Freeing memory at 0x%08" PRIXPTR
"\r\n", (uintptr_t)
p);
bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout)
Wait for the specified semaphore to be available.
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
void osReleaseSemaphore(OsSemaphore *semaphore)
Release the specified semaphore object.
void osDeleteMutex(OsMutex *mutex)
Delete a mutex object.
void osSuspendAllTasks(void)
Suspend scheduler activity.
void osDelayTask(systime_t delay)
Delay routine.
#define OS_INVALID_TASK_ID
void osDeleteSemaphore(OsSemaphore *semaphore)
Delete a semaphore object.
void osSwitchTask(void)
Yield control to the next task.
void osResumeAllTasks(void)
Resume scheduler activity.
void *(* PthreadTaskCode)(void *param)
void(* OsTaskCode)(void *arg)
Task routine.
void osResetEvent(OsEvent *event)
Set the specified event object to the nonsignaled state.
void osDeleteEvent(OsEvent *event)
Delete an event object.
void osInitKernel(void)
Kernel initialization.
bool_t osCreateSemaphore(OsSemaphore *semaphore, uint_t count)
Create a semaphore object.
#define OS_SYSTICKS_TO_MS(n)
#define OS_MS_TO_SYSTICKS(n)
void osDeleteTask(OsTaskId taskId)
Delete a task.
uint32_t systime_t
System time.
RTOS abstraction layer (PX5)
OsTaskId osCreateTask(const char_t *name, OsTaskCode taskCode, void *arg, const OsTaskParameters *params)
Create a task.
bool_t osCreateEvent(OsEvent *event)
Create an event object.
void osFreeMemCallback(u_int type, void *p)
Memory manager release function.
__weak_func void * osAllocMem(size_t size)
Allocate a memory block.
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex object.
__weak_func void osFreeMem(void *p)
Release a previously allocated memory block.
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
systime_t osGetSystemTime(void)
Retrieve system time.
void * osAllocMemCallback(u_int type, u_long size)
Memory manager allocate function.
bool_t osCreateMutex(OsMutex *mutex)
Create a mutex object.
void osStartKernel(void)
Start kernel.
thread_t * OsTaskId
Task identifier.
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.
const OsTaskParameters OS_TASK_DEFAULT_PARAMS