0
1.6kviews
Operation and significance of OSInit(); , OSSemPend(); , OSSemPost(); , OSTaskCreate(); , OSMboxPost(); , OSMboxPend();
1 Answer
0
64views

(a) OSInit();

This function initialize uCOS - II . It doesn't require any arguments and doesn't return any value.

(b) OSSemPend();

This function is used when a task:

(i) wants exclusive access to a resource.

(ii) synchronize the activities with ISR/task.

(iii) waits for an event to occur.

  • The different arguments possible are prevent(a pointer to semaphore), timeout(for a task to resume execution) or err(different types of errors).

(c) OSSemPost();

This function is used to signal a semaphore. If semaphore value is '0' or more, its value is incremented. If a task is waiting for the semaphore, then the highest priority task gets the semaphore.

(d) OSTaskCreate();

This function is used to create a task.

Function prototype -

INT8U OSTaskCreate (void(*task) (void(*pdata) ) );

Arguments:

  • task $\to$ ptr to task's code that must be declared as void Task (void*).

  • pdata $\to$ pointer to data that is passed to task when it is created.

(e) OSMBoxPost()

This function is used to send a message to a task through a mailbox.

Arguments:

  • prevent: ptr to the mailbox into which msg is deposited.

  • msg: actual msg send to a task.

(f) OSMBoxPend()

is used when a task requires a message to be received. This function does not return anything.

Arguments:

  • prevent: ptr to the mailbox from which msg is received.

  • timeout: signifies waiting period.

  • err: errors.

Please log in to add an answer.