|  | MCUXpresso SDK API Reference Manual
    Rev. 0
    NXP Semiconductors | 
| Modules | |
| OSA BM | |
| OSA FreeRTOS | |
| Data Structures | |
| struct | osa_task_def_t | 
| Thread Definition structure contains startup information of a thread.  More... | |
| struct | osa_thread_link_handle_t | 
| Thread Link Definition structure .  More... | |
| struct | osa_time_def_t | 
| Definition structure contains timer parameters.  More... | |
| Macros | |
| #define | USE_RTOS (0) | 
| More... | |
| #define | osaWaitForever_c ((uint32_t)(-1)) | 
| Constant to pass as timeout value in order to wait indefinitely.  More... | |
| #define | SEMAPHORE_HANDLE_BUFFER_DEFINE(name) uint32_t semaphoreHandleBuffer##name[((OSA_SEM_HANDLE_SIZE - 1) >> 2) + 1] = {0} | 
| Defines the semaphore handle buffer.  More... | |
| #define | SEMAPHORE_HANDLE_BUFFER_GET(name) (osa_semaphore_handle_t *)&semaphoreHandleBuffer##name[0] | 
| \  More... | |
| #define | MUTEX_HANDLE_BUFFER_DEFINE(name) uint32_t mutexHandleBuffer##name[((OSA_MUTEX_HANDLE_SIZE - 1) >> 2) + 1] = {0} | 
| Defines the mutex handle buffer.  More... | |
| #define | MUTEX_HANDLE_BUFFER_GET(name) (osa_mutex_handle_t *)&mutexHandleBuffer##name[0] | 
| \  More... | |
| #define | EVENT_HANDLE_BUFFER_DEFINE(name) uint32_t eventHandleBuffer##name[((OSA_EVENT_HANDLE_SIZE - 1) >> 2) + 1] = {0} | 
| Defines the enent handle buffer.  More... | |
| #define | EVENT_HANDLE_BUFFER_GET(name) (osa_event_handle_t *)&eventHandleBuffer##name[0] | 
| \  More... | |
| #define | MSGQ_HANDLE_BUFFER_DEFINE(name, msgNo, msgSize) uint32_t g_msgQbuffer##name[(((OSA_MSGQ_HANDLE_SIZE + msgNo * msgSize) - 1) >> 2) + 1] = {0} | 
| Defines the message handle buffer.  More... | |
| #define | MSGQ_HANDLE_BUFFER_GET(name) (osa_msgq_handle_t) & g_msgQbuffer##name[0] | 
| \  More... | |
| #define | TASK_HANDLE_BUFFER_DEFINE(name) uint32_t tasktHandleBuffer##name[((OSA_TASK_HANDLE_SIZE - 1) >> 2) + 1] = {0} | 
| Defines the task handle buffer.  More... | |
| #define | TASK_HANDLE_BUFFER_GET(name) (osa_task_handle_t) & tasktHandleBuffer##name[0] | 
| \  More... | |
| Typedefs | |
| typedef uint16_t | osa_task_priority_t | 
| More... | |
| typedef void * | osa_task_handle_t | 
| Type for a task handler. | |
| typedef void * | osa_task_param_t | 
| Type for the parameter to be passed to the task at its creation. | |
| typedef void(* | osa_task_ptr_t )(osa_task_param_t task_param) | 
| Type for task pointer.  More... | |
| typedef void * | osa_semaphore_handle_t | 
| Type for the semaphore handler. | |
| typedef void * | osa_mutex_handle_t | 
| Type for the mutex handler. | |
| typedef void * | osa_event_handle_t | 
| Type for the event handler. | |
| typedef uint32_t | osa_event_flags_t | 
| Type for an event flags group, bit 32 is reserved.  More... | |
| typedef void * | osa_msg_handle_t | 
| Message definition.  More... | |
| typedef void * | osa_msgq_handle_t | 
| Type for the message queue handler. | |
| typedef void * | osa_timer_handle_t | 
| Type for the Timer handler. | |
| typedef void(* | osa_timer_fct_ptr_t )(void const *argument) | 
| Type for the Timer callback function pointer.  More... | |
| Enumerations | |
| enum | osa_timer_t { KOSA_TimerOnce = 0, KOSA_TimerPeriodic = 1 } | 
| Type for the timer definition.  More... | |
| enum | osa_status_t { KOSA_StatusSuccess = kStatus_Success, KOSA_StatusError = MAKE_STATUS(kStatusGroup_OSA, 1), KOSA_StatusTimeout = MAKE_STATUS(kStatusGroup_OSA, 2), KOSA_StatusIdle = MAKE_STATUS(kStatusGroup_OSA, 3) } | 
| Defines the return status of OSA's functions.  More... | |
| Task management | |
| Public functions | |
| osa_status_t | OSA_TaskCreate (osa_task_handle_t taskHandle, osa_task_def_t *thread_def, osa_task_param_t task_param) | 
| Creates a task.  More... | |
| osa_task_handle_t | OSA_TaskGetCurrentHandle (void) | 
| Gets the handler of active task.  More... | |
| osa_status_t | OSA_TaskYield (void) | 
| Puts the active task to the end of scheduler's queue.  More... | |
| osa_task_priority_t | OSA_TaskGetPriority (osa_task_handle_t taskHandle) | 
| Gets the priority of a task.  More... | |
| osa_status_t | OSA_TaskSetPriority (osa_task_handle_t taskHandle, osa_task_priority_t taskPriority) | 
| Sets the priority of a task.  More... | |
| osa_status_t | OSA_TaskDestroy (osa_task_handle_t taskHandle) | 
| Destroys a previously created task.  More... | |
| osa_status_t | OSA_SemaphoreCreate (osa_semaphore_handle_t semaphoreHandle, uint32_t initValue) | 
| Creates a semaphore with a given value.  More... | |
| osa_status_t | OSA_SemaphoreDestroy (osa_semaphore_handle_t semaphoreHandle) | 
| Destroys a previously created semaphore.  More... | |
| osa_status_t | OSA_SemaphoreWait (osa_semaphore_handle_t semaphoreHandle, uint32_t millisec) | 
| Pending a semaphore with timeout.  More... | |
| osa_status_t | OSA_SemaphorePost (osa_semaphore_handle_t semaphoreHandle) | 
| Signals for someone waiting on the semaphore to wake up.  More... | |
| osa_status_t | OSA_MutexCreate (osa_mutex_handle_t mutexHandle) | 
| Create an unlocked mutex.  More... | |
| osa_status_t | OSA_MutexLock (osa_mutex_handle_t mutexHandle, uint32_t millisec) | 
| Waits for a mutex and locks it.  More... | |
| osa_status_t | OSA_MutexUnlock (osa_mutex_handle_t mutexHandle) | 
| Unlocks a previously locked mutex.  More... | |
| osa_status_t | OSA_MutexDestroy (osa_mutex_handle_t mutexHandle) | 
| Destroys a previously created mutex.  More... | |
| osa_status_t | OSA_EventCreate (osa_event_handle_t eventHandle, uint8_t autoClear) | 
| Initializes an event object with all flags cleared.  More... | |
| osa_status_t | OSA_EventSet (osa_event_handle_t eventHandle, osa_event_flags_t flagsToSet) | 
| Sets one or more event flags.  More... | |
| osa_status_t | OSA_EventClear (osa_event_handle_t eventHandle, osa_event_flags_t flagsToClear) | 
| Clears one or more flags.  More... | |
| osa_status_t | OSA_EventWait (osa_event_handle_t eventHandle, osa_event_flags_t flagsToWait, uint8_t waitAll, uint32_t millisec, osa_event_flags_t *pSetFlags) | 
| Waits for specified event flags to be set.  More... | |
| osa_status_t | OSA_EventDestroy (osa_event_handle_t eventHandle) | 
| Destroys a previously created event object.  More... | |
| osa_status_t | OSA_MsgQCreate (osa_msgq_handle_t msgqHandle, uint32_t msgNo, uint32_t msgSize) | 
| Initializes a message queue.  More... | |
| osa_status_t | OSA_MsgQPut (osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage) | 
| Puts a message at the end of the queue.  More... | |
| osa_status_t | OSA_MsgQGet (osa_msgq_handle_t msgqHandle, osa_msg_handle_t pMessage, uint32_t millisec) | 
| Reads and remove a message at the head of the queue.  More... | |
| osa_status_t | OSA_MsgQDestroy (osa_msgq_handle_t msgqHandle) | 
| Destroys a previously created queue.  More... | |
| void | OSA_InterruptEnable (void) | 
| Enable all interrupts. | |
| void | OSA_InterruptDisable (void) | 
| Disable all interrupts. | |
| void | OSA_EnableIRQGlobal (void) | 
| Enable all interrupts using PRIMASK. | |
| void | OSA_DisableIRQGlobal (void) | 
| Disable all interrupts using PRIMASK. | |
| void | OSA_TimeDelay (uint32_t millisec) | 
| Delays execution for a number of milliseconds.  More... | |
| uint32_t | OSA_TimeGetMsec (void) | 
| This function gets current time in milliseconds.  More... | |
| void | OSA_InstallIntHandler (uint32_t IRQNumber, void(*handler)(void)) | 
| Installs the interrupt handler.  More... | |
| struct osa_task_def_t | 
| Data Fields | |
| osa_task_ptr_t | pthread | 
| start address of thread function | |
| uint32_t | tpriority | 
| initial thread priority | |
| uint32_t | instances | 
| maximum number of instances of that thread function | |
| uint32_t | stacksize | 
| stack size requirements in bytes; 0 is default stack size | |
| uint32_t * | tstack | 
| stack pointer | |
| void * | tlink | 
| link pointer | |
| uint8_t * | tname | 
| name pointer | |
| uint8_t | useFloat | 
| is use float | |
| struct osa_thread_link_t | 
| Data Fields | |
| uint8_t | link [12] | 
| link | |
| osa_task_handle_t | osThreadId | 
| thread id | |
| osa_task_def_t * | osThreadDefHandle | 
| pointer of thread define handle | |
| uint32_t * | osThreadStackHandle | 
| pointer of thread stack handle | |
| struct osa_time_def_t | 
| #define USE_RTOS (0) | 
Public macros
| #define osaWaitForever_c ((uint32_t)(-1)) | 
| #define SEMAPHORE_HANDLE_BUFFER_DEFINE | ( | name | ) | uint32_t semaphoreHandleBuffer##name[((OSA_SEM_HANDLE_SIZE - 1) >> 2) + 1] = {0} | 
This macro is used to define the semaphore handle buffer for semaphore queue. And then uses the macro SEMAPHORE_HANDLE_BUFFER_GET to get the semaphore handle buffer pointer. The macro should not be used in a suitable position for its user.
This macro is optional, semaphore handle buffer could also be defined by yourself.
This is a example,
| name | The name string of the semaphore handle buffer. | 
| #define SEMAPHORE_HANDLE_BUFFER_GET | ( | name | ) | (osa_semaphore_handle_t *)&semaphoreHandleBuffer##name[0] | 
Gets the semaphore buffer pointer \ \ This macro is used to get the semaphore buffer pointer. The macro should \ not be used before the macro SEMAPHORE_HANDLE_BUFFER_DEFINE is used. \ \
| name | The memory name string of the buffer. \ | 
| #define MUTEX_HANDLE_BUFFER_DEFINE | ( | name | ) | uint32_t mutexHandleBuffer##name[((OSA_MUTEX_HANDLE_SIZE - 1) >> 2) + 1] = {0} | 
This macro is used to define the mutex handle buffer for mutex queue. And then uses the macro MUTEX_HANDLE_BUFFER_GET to get the mutex handle buffer pointer. The macro should not be used in a suitable position for its user.
This macro is optional, mutex handle buffer could also be defined by yourself.
This is a example,
| name | The name string of the mutex handle buffer. | 
| #define MUTEX_HANDLE_BUFFER_GET | ( | name | ) | (osa_mutex_handle_t *)&mutexHandleBuffer##name[0] | 
Gets the mutex buffer pointer \ \ This macro is used to get the mutex buffer pointer. The macro should \ not be used before the macro MUTEX_HANDLE_BUFFER_DEFINE is used. \ \
| name | The memory name string of the buffer. \ | 
| #define EVENT_HANDLE_BUFFER_DEFINE | ( | name | ) | uint32_t eventHandleBuffer##name[((OSA_EVENT_HANDLE_SIZE - 1) >> 2) + 1] = {0} | 
This macro is used to define the enent handle buffer for enent queue. And then uses the macro EVENT_HANDLE_BUFFER_GET to get the enent handle buffer pointer. The macro should not be used in a suitable position for its user.
This macro is optional, enent handle buffer could also be defined by yourself.
This is a example,
| name | The name string of the enent handle buffer. | 
| #define EVENT_HANDLE_BUFFER_GET | ( | name | ) | (osa_event_handle_t *)&eventHandleBuffer##name[0] | 
Gets the event buffer pointer \ \ This macro is used to get the event buffer pointer. The macro should \ not be used before the macro EVENT_HANDLE_BUFFER_DEFINE is used. \ \
| name | The memory name string of the buffer. \ | 
| #define MSGQ_HANDLE_BUFFER_DEFINE | ( | name, | |
| msgNo, | |||
| msgSize | |||
| ) | uint32_t g_msgQbuffer##name[(((OSA_MSGQ_HANDLE_SIZE + msgNo * msgSize) - 1) >> 2) + 1] = {0} | 
This macro is used to define the message handle buffer for message queue. And then uses the macro MSGQ_HANDLE_BUFFER_GET to get the message handle buffer pointer. The macro should not be used in a suitable position for its user.
This macro is optional, message handle buffer could also be defined by yourself.
This is a example,
| name | The name string of the message handle buffer. | 
| numberOfMsgs | The number Of messages. | 
| msgSize | The size of a single message structure. | 
| #define MSGQ_HANDLE_BUFFER_GET | ( | name | ) | (osa_msgq_handle_t) & g_msgQbuffer##name[0] | 
Gets the message buffer pointer \ \ This macro is used to get the message buffer pointer. The macro should \ not be used before the macro MSGQ_HANDLE_BUFFER_DEFINE is used. \ \
| name | The memory name string of the buffer. \ | 
| #define TASK_HANDLE_BUFFER_DEFINE | ( | name | ) | uint32_t tasktHandleBuffer##name[((OSA_TASK_HANDLE_SIZE - 1) >> 2) + 1] = {0} | 
This macro is used to define the task handle buffer for task queue. And then uses the macro TASK_HANDLE_BUFFER_GET to get the task handle buffer pointer. The macro should not be used in a suitable position for its user.
This macro is optional, task handle buffer could also be defined by yourself.
This is a example,
| name | The name string of the task handle buffer. | 
| #define TASK_HANDLE_BUFFER_GET | ( | name | ) | (osa_task_handle_t) & tasktHandleBuffer##name[0] | 
Gets the task buffer pointer \ \ This macro is used to get the task buffer pointer. The macro should \ not be used before the macro TASK_HANDLE_BUFFER_DEFINE is used. \ \
| name | The memory name string of the buffer. \ | 
| typedef uint16_t osa_task_priority_t | 
Public type definitions
Type for the Task Priority
| typedef void(* osa_task_ptr_t)(osa_task_param_t task_param) | 
Task prototype declaration
| typedef uint32_t osa_event_flags_t | 
| typedef void* osa_msg_handle_t | 
| typedef void(* osa_timer_fct_ptr_t)(void const *argument) | 
| enum osa_timer_t | 
| enum osa_status_t | 
| osa_status_t OSA_TaskCreate | ( | osa_task_handle_t | taskHandle, | 
| osa_task_def_t * | thread_def, | ||
| osa_task_param_t | task_param | ||
| ) | 
This function is used to create task based on the resources defined by the macro OSA_TASK_DEFINE.
| taskHandle | Pointer to a memory space of size #OSA_TASK_HANDLE_SIZE allocated by the caller, task handle. The macro TASK_HANDLE_BUFFER_GET is used to get the task buffer pointer, and should not be used before the macro TASK_HANDLE_BUFFER_DEFINE is used. | 
| thread_def | pointer to theosa_task_def_t structure which defines the task. | 
| task_param | Pointer to be passed to the task when it is created. | 
| KOSA_StatusSuccess | The task is successfully created. | 
| KOSA_StatusError | The task can not be created. Example: uint8_t taskHandle[OSA_TASK_HANDLE_SIZE]; OSA_TASK_DEFINE( Job1, OSA_PRIORITY_HIGH,  1,   800, 0); | 
| osa_task_handle_t OSA_TaskGetCurrentHandle | ( | void | ) | 
| osa_status_t OSA_TaskYield | ( | void | ) | 
When a task calls this function, it gives up the CPU and puts itself to the end of a task ready list.
| KOSA_StatusSuccess | The function is called successfully. | 
| KOSA_StatusError | Error occurs with this function. | 
| osa_task_priority_t OSA_TaskGetPriority | ( | osa_task_handle_t | taskHandle | ) | 
| taskHandle | The handler of the task whose priority is received. The macro TASK_HANDLE_BUFFER_GET is used to get the task buffer pointer, and should not be used before the macro TASK_HANDLE_BUFFER_DEFINE is used. | 
| osa_status_t OSA_TaskSetPriority | ( | osa_task_handle_t | taskHandle, | 
| osa_task_priority_t | taskPriority | ||
| ) | 
| taskHandle | The handler of the task whose priority is set. The macro TASK_HANDLE_BUFFER_GET is used to get the task buffer pointer, and should not be used before the macro TASK_HANDLE_BUFFER_DEFINE is used. | 
| taskPriority | The priority to set. | 
| KOSA_StatusSuccess | Task's priority is set successfully. | 
| KOSA_StatusError | Task's priority can not be set. | 
| osa_status_t OSA_TaskDestroy | ( | osa_task_handle_t | taskHandle | ) | 
| taskHandle | The handler of the task to destroy. The macro TASK_HANDLE_BUFFER_GET is used to get the task buffer pointer, and should not be used before the macro TASK_HANDLE_BUFFER_DEFINE is used. | 
| KOSA_StatusSuccess | The task was successfully destroyed. | 
| KOSA_StatusError | Task destruction failed or invalid parameter. | 
| osa_status_t OSA_SemaphoreCreate | ( | osa_semaphore_handle_t | semaphoreHandle, | 
| uint32_t | initValue | ||
| ) | 
This function creates a semaphore and sets the value to the parameter initValue.
| semaphoreHandle | Pointer to a memory space of size #OSA_SEM_HANDLE_SIZE allocated by the caller, semaphore handle. The macro SEMAPHORE_HANDLE_BUFFER_GET is used to get the semaphore buffer pointer, and should not be used before the macro SEMAPHORE_HANDLE_BUFFER_DEFINE is used. | 
| initValue | Initial value the semaphore will be set to. | 
| KOSA_StatusSuccess | the new semaphore if the semaphore is created successfully. | 
| KOSA_StatusError | if the semaphore can not be created. | 
| osa_status_t OSA_SemaphoreDestroy | ( | osa_semaphore_handle_t | semaphoreHandle | ) | 
| semaphoreHandle | The semaphore handle. The macro SEMAPHORE_HANDLE_BUFFER_GET is used to get the semaphore buffer pointer, and should not be used before the macro SEMAPHORE_HANDLE_BUFFER_DEFINE is used. | 
| KOSA_StatusSuccess | The semaphore is successfully destroyed. | 
| KOSA_StatusError | The semaphore can not be destroyed. | 
| osa_status_t OSA_SemaphoreWait | ( | osa_semaphore_handle_t | semaphoreHandle, | 
| uint32_t | millisec | ||
| ) | 
This function checks the semaphore's counting value. If it is positive, decreases it and returns KOSA_StatusSuccess. Otherwise, a timeout is used to wait.
| semaphoreHandle | The semaphore handle. The macro SEMAPHORE_HANDLE_BUFFER_GET is used to get the semaphore buffer pointer, and should not be used before the macro SEMAPHORE_HANDLE_BUFFER_DEFINE is used. | 
| millisec | The maximum number of milliseconds to wait if semaphore is not positive. Pass osaWaitForever_c to wait indefinitely, pass 0 will return KOSA_StatusTimeout immediately. | 
| KOSA_StatusSuccess | The semaphore is received. | 
| KOSA_StatusTimeout | The semaphore is not received within the specified 'timeout'. | 
| KOSA_StatusError | An incorrect parameter was passed. | 
| osa_status_t OSA_SemaphorePost | ( | osa_semaphore_handle_t | semaphoreHandle | ) | 
Wakes up one task that is waiting on the semaphore. If no task is waiting, increases the semaphore's counting value.
| semaphoreHandle | The semaphore handle to signal. The macro SEMAPHORE_HANDLE_BUFFER_GET is used to get the semaphore buffer pointer, and should not be used before the macro SEMAPHORE_HANDLE_BUFFER_DEFINE is used. | 
| KOSA_StatusSuccess | The semaphore is successfully signaled. | 
| KOSA_StatusError | The object can not be signaled or invalid parameter. | 
| osa_status_t OSA_MutexCreate | ( | osa_mutex_handle_t | mutexHandle | ) | 
This function creates a non-recursive mutex and sets it to unlocked status.
| mutexHandle | Pointer to a memory space of size #OSA_MUTEX_HANDLE_SIZE allocated by the caller, mutex handle. The macro MUTEX_HANDLE_BUFFER_GET is used to get the mutex buffer pointer, and should not be used before the macro MUTEX_HANDLE_BUFFER_DEFINE is used. | 
| KOSA_StatusSuccess | the new mutex if the mutex is created successfully. | 
| KOSA_StatusError | if the mutex can not be created. | 
| osa_status_t OSA_MutexLock | ( | osa_mutex_handle_t | mutexHandle, | 
| uint32_t | millisec | ||
| ) | 
This function checks the mutex's status. If it is unlocked, locks it and returns the KOSA_StatusSuccess. Otherwise, waits for a timeout in milliseconds to lock.
| mutexHandle | The mutex handle. The macro MUTEX_HANDLE_BUFFER_GET is used to get the message mutex pointer, and should not be used before the macro MUTEX_HANDLE_BUFFER_DEFINE is used. | 
| millisec | The maximum number of milliseconds to wait for the mutex. If the mutex is locked, Pass the value osaWaitForever_c will wait indefinitely, pass 0 will return KOSA_StatusTimeout immediately. | 
| KOSA_StatusSuccess | The mutex is locked successfully. | 
| KOSA_StatusTimeout | Timeout occurred. | 
| KOSA_StatusError | Incorrect parameter was passed. | 
| osa_status_t OSA_MutexUnlock | ( | osa_mutex_handle_t | mutexHandle | ) | 
| mutexHandle | The mutex handle. The macro MUTEX_HANDLE_BUFFER_GET is used to get the mutex buffer pointer, and should not be used before the macro MUTEX_HANDLE_BUFFER_DEFINE is used. | 
| KOSA_StatusSuccess | The mutex is successfully unlocked. | 
| KOSA_StatusError | The mutex can not be unlocked or invalid parameter. | 
| osa_status_t OSA_MutexDestroy | ( | osa_mutex_handle_t | mutexHandle | ) | 
| mutexHandle | The mutex handle. The macro MUTEX_HANDLE_BUFFER_GET is used to get the mutex buffer pointer, and should not be used before the macro MUTEX_HANDLE_BUFFER_DEFINE is used. | 
| KOSA_StatusSuccess | The mutex is successfully destroyed. | 
| KOSA_StatusError | The mutex can not be destroyed. | 
| osa_status_t OSA_EventCreate | ( | osa_event_handle_t | eventHandle, | 
| uint8_t | autoClear | ||
| ) | 
This function creates an event object and set its clear mode. If autoClear is TRUE, when a task gets the event flags, these flags will be cleared automatically. Otherwise these flags must be cleared manually.
| eventHandle | Pointer to a memory space of size #OSA_EVENT_HANDLE_SIZE allocated by the caller, Event handle. The macro EVENT_HANDLE_BUFFER_GET is used to get the event buffer pointer, and should not be used before the macro EVENT_HANDLE_BUFFER_DEFINE is used. | 
| autoClear | TRUE The event is auto-clear. FALSE The event manual-clear | 
| KOSA_StatusSuccess | the new event if the event is created successfully. | 
| KOSA_StatusError | if the event can not be created. | 
| osa_status_t OSA_EventSet | ( | osa_event_handle_t | eventHandle, | 
| osa_event_flags_t | flagsToSet | ||
| ) | 
Sets specified flags of an event object.
| eventHandle | The event handle. The macro EVENT_HANDLE_BUFFER_GET is used to get the event buffer pointer, and should not be used before the macro EVENT_HANDLE_BUFFER_DEFINE is used. | 
| flagsToSet | Flags to be set. | 
| KOSA_StatusSuccess | The flags were successfully set. | 
| KOSA_StatusError | An incorrect parameter was passed. | 
| osa_status_t OSA_EventClear | ( | osa_event_handle_t | eventHandle, | 
| osa_event_flags_t | flagsToClear | ||
| ) | 
Clears specified flags of an event object.
| eventHandle | The event handle. The macro EVENT_HANDLE_BUFFER_GET is used to get the event buffer pointer, and should not be used before the macro EVENT_HANDLE_BUFFER_DEFINE is used. | 
| flagsToClear | Flags to be clear. | 
| KOSA_StatusSuccess | The flags were successfully cleared. | 
| KOSA_StatusError | An incorrect parameter was passed. | 
| osa_status_t OSA_EventWait | ( | osa_event_handle_t | eventHandle, | 
| osa_event_flags_t | flagsToWait, | ||
| uint8_t | waitAll, | ||
| uint32_t | millisec, | ||
| osa_event_flags_t * | pSetFlags | ||
| ) | 
This function waits for a combination of flags to be set in an event object. Applications can wait for any/all bits to be set. Also this function could obtain the flags who wakeup the waiting task.
| eventHandle | The event handle. The macro EVENT_HANDLE_BUFFER_GET is used to get the event buffer pointer, and should not be used before the macro EVENT_HANDLE_BUFFER_DEFINE is used. | 
| flagsToWait | Flags that to wait. | 
| waitAll | Wait all flags or any flag to be set. | 
| millisec | The maximum number of milliseconds to wait for the event. If the wait condition is not met, pass osaWaitForever_c will wait indefinitely, pass 0 will return KOSA_StatusTimeout immediately. | 
| setFlags | Flags that wakeup the waiting task are obtained by this parameter. | 
| KOSA_StatusSuccess | The wait condition met and function returns successfully. | 
| KOSA_StatusTimeout | Has not met wait condition within timeout. | 
| KOSA_StatusError | An incorrect parameter was passed. | 
| osa_status_t OSA_EventDestroy | ( | osa_event_handle_t | eventHandle | ) | 
| eventHandle | The event handle. The macro EVENT_HANDLE_BUFFER_GET is used to get the event buffer pointer, and should not be used before the macro EVENT_HANDLE_BUFFER_DEFINE is used. | 
| KOSA_StatusSuccess | The event is successfully destroyed. | 
| KOSA_StatusError | Event destruction failed. | 
| osa_status_t OSA_MsgQCreate | ( | osa_msgq_handle_t | msgqHandle, | 
| uint32_t | msgNo, | ||
| uint32_t | msgSize | ||
| ) | 
This function allocates memory for and initializes a message queue. Message queue elements are hardcoded as void*.
| msgqHandle | Pointer to a memory space of size #(OSA_MSGQ_HANDLE_SIZE + msgNo*msgSize) on bare-matel and #(OSA_MSGQ_HANDLE_SIZE) on FreeRTOS allocated by the caller, message queue handle. The macro MSGQ_HANDLE_BUFFER_GET is used to get the message buffer pointer, and should not be used before the macro MSGQ_HANDLE_BUFFER_DEFINE is used. | 
| msgNo | :number of messages the message queue should accommodate. | 
| msgSize | :size of a single message structure. | 
| KOSA_StatusSuccess | Message queue successfully Create. | 
| KOSA_StatusError | Message queue create failure. | 
| osa_status_t OSA_MsgQPut | ( | osa_msgq_handle_t | msgqHandle, | 
| osa_msg_handle_t | pMessage | ||
| ) | 
This function puts a message to the end of the message queue. If the queue is full, this function returns the KOSA_StatusError;
| msgqHandle | Message Queue handler. The macro MSGQ_HANDLE_BUFFER_GET is used to get the message buffer pointer, and should not be used before the macro MSGQ_HANDLE_BUFFER_DEFINE is used. | 
| pMessage | Pointer to the message to be put into the queue. | 
| KOSA_StatusSuccess | Message successfully put into the queue. | 
| KOSA_StatusError | The queue was full or an invalid parameter was passed. | 
| osa_status_t OSA_MsgQGet | ( | osa_msgq_handle_t | msgqHandle, | 
| osa_msg_handle_t | pMessage, | ||
| uint32_t | millisec | ||
| ) | 
This function gets a message from the head of the message queue. If the queue is empty, timeout is used to wait.
| msgqHandle | Message Queue handler. The macro MSGQ_HANDLE_BUFFER_GET is used to get the message buffer pointer, and should not be used before the macro MSGQ_HANDLE_BUFFER_DEFINE is used. | 
| pMessage | Pointer to a memory to save the message. | 
| millisec | The number of milliseconds to wait for a message. If the queue is empty, pass osaWaitForever_c will wait indefinitely, pass 0 will return KOSA_StatusTimeout immediately. | 
| KOSA_StatusSuccess | Message successfully obtained from the queue. | 
| KOSA_StatusTimeout | The queue remains empty after timeout. | 
| KOSA_StatusError | Invalid parameter. | 
| osa_status_t OSA_MsgQDestroy | ( | osa_msgq_handle_t | msgqHandle | ) | 
| msgqHandle | Message Queue handler. The macro MSGQ_HANDLE_BUFFER_GET is used to get the message buffer pointer, and should not be used before the macro MSGQ_HANDLE_BUFFER_DEFINE is used. | 
| KOSA_StatusSuccess | The queue was successfully destroyed. | 
| KOSA_StatusError | Message queue destruction failed. | 
| void OSA_TimeDelay | ( | uint32_t | millisec | ) | 
| millisec | The time in milliseconds to wait. | 
| uint32_t OSA_TimeGetMsec | ( | void | ) | 
| current | time in milliseconds | 
| void OSA_InstallIntHandler | ( | uint32_t | IRQNumber, | 
| void(*)(void) | handler | ||
| ) | 
| IRQNumber | IRQ number of the interrupt. | 
| handler | The interrupt handler to install. |