IAR PowerPac RTOS User Guide
IAR PowerPac RTOS User Guide
IAR PowerPac RTOS User Guide
- No tags were found...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Resource semaphoresOS_Request()DescriptionRequests a specified semaphore and blocks it for other tasks if it is available. Continues execution in any case.Prototypechar OS_Request (OS_RSEMA* pRSema);ParameterDescriptionpRSemaPointer to the data structure for a resource semaphore.Table 44: OS-Request() parameter listReturn value1: Resource was available, now in use by calling task0: Resource was not available.Additional InformationThe following diagram illustrates how OS_Request() works:OS_Request (RSEMA*ps)Resource in use by other task ?Yesreturn 0NoIn use by this task ?NoMark current taskas ownerYesInc Usage counterUsage counter = 1return 1return 1Exampleif (!OS_Request(&RSEMA_LCD) ) {LED_LCDBUSY = 1; /* Indicate that task is waiting for *//* resource */OS_Use(&RSEMA_LCD); /* Wait for resource */LED_LCDBUSY = 0; /* Indicate task is no longer waiting */}DispTime(); /* Access the resource LCD */OS_Unuse(&RSEMA_LCD); /* Resource LCD is no longer needed */PP<strong>RTOS</strong>-253