written 5.8 years ago by | • modified 2.8 years ago |
OSInit()
OSSemPend() & OSSemPost()
OSTaskCreate()
OSMBoxPost() & OSMBoxPend()
Mumbai University > Electronics Engineering > Sem 6 > Embedded System and RTOS
written 5.8 years ago by | • modified 2.8 years ago |
OSInit()
OSSemPend() & OSSemPost()
OSTaskCreate()
OSMBoxPost() & OSMBoxPend()
Mumbai University > Electronics Engineering > Sem 6 > Embedded System and RTOS
written 5.8 years ago by |
a. OSInit():
Function description: void OSI nit(void);
b. OSSemPend() & OSSemPost()
The timeout parameter is specified in terms of the clock ticks. This parameter can take any value ranging till 65535. A ‘0’ value indicates block until semaphore becomes available
Function description: void OSSemPend(OS_EVENT *pevent, INT16U timeout, INT8U *err); pevent: is a pointer to the semaphore.
timeout: allows the task to resume execution if a message is not received from the mailbox within the specified number of clock ticks
err: is a pointer to a variable that holds an error code. Errors codes signify timeout, call from ISR error, pevent is NULL pointer error, pevent is not pointing to mailbox error or no error.
If the task signaling the availability of semaphore has the lower priority than the task waiting for the semaphore them the lower priority task is preempted, i.e. the lower priority task is blocked and the higher priority task is allowed to execute.
Function description: INT8U OSSemPost(OS_EVENT *pevent);
pevent: is a pointer to the semaphore.
c. OSTaskCreate():
Enabled or disabled.
Function description: INT8U OSTaskCreate(void (*task)(void *pd), void *pdata,OS_STK *ptos,INT8U prio); task: is a pointer to the task’s code. pdata: is a pointer to an optional data area used to pass parameters to the task when it is created ptos: is a pointer to the task’s top-of-stack. The stack is used to store local variables, function parameters, return addresses, and CPU registers during an interrupt. The size of the stack is determined by the task’s requirements. prio: is the task priority. A unique priority number must be assigned to each task, and the lower the number, the higher the priority
d. OSMboxPost() & OSMboxPend()
If the message is successfully posted to the mailbox then it is routed to the highest priority task waiting for the message.
Function description: INT8U OSMboxPost(OS_EVENT *pevent, void *msg); pevent: is a pointer to the mailbox into which the message is deposited msg: is the actual message sent to the task. It is a pointer-sized variable and is application specific.
There is a timeout parameter associated with the waiting time of the task in the mailbox. This parameter can take values ranging from 0 to 65535. A ‘0’ value indicates blocking until the message is available to the task.
Function description: void *OSMboxPend(OS_EVENT *pevent, INT16U timeout, INT8U *err); pevent: is a pointer to the mailbox into which the message is deposited timeout: allows the task to resume execution if a message is not received from the mailbox within the specified number of clock ticks. err: is a pointer to a variable that holds an error code. Errors codes signify timeout, call from ISR error, pevent is NULL pointer error, pevent is not pointing to mailbox error or no error.