0
5.0kviews
Explain operation and significance of: i) OSInit(); ii) OSSemPend(); iii) OSSemPost(); iv) OSTaskCreate(); v) OSMBoxPost(); vi) OSMBoxPend();
1 Answer
0
120views

i) OSInit();

It initializes uCOS – II. It does not require any arguments. It does not return any value.

ii) OSSemPend();

This function is used when a task wants an exclusive access to a resource, synchronize the activities with ISR/ task or waits for an event to occur.

Argument:

  • prevent (a pointer to semaphore),

  • timeout (for a task to resume execution)

  • err (different types of errors)

iii) OSSemPost();

This function is used to signal a semaphore. If semaphore value is ‘0’ or more, its value is increased. If a task is waiting for semaphore, highest priority task gets semaphore.

iv) OSTaskCreate();

It is used to create task.

Function prototype-

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

Arguments:

  • task - pointer to task’s code that must be declared as void task (void*)
  • pdata - pointer to data that is passed to task when it is created

v) OSMBoxPost();

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

Arguments:

  • prevent - pointer to mailbox into which message is deposited
  • msg - actual message sent to the task

vi) OSMBoxPend();

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

Arguments:

  • prevent - pointer to mailbox from which message is received
  • timeout - signifies waiting period
  • err - errors
Please log in to add an answer.