Infineon Logo AIROC BTSDK v4.9 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Semaphore

Defines a group of APIs, which interface to RTOS semaphore functionality contained in ROM. More...

Functions

wiced_semaphore_t * wiced_rtos_create_semaphore (void)
 Allocates memory for a new semaphore instance and returns the pointer. More...
 
wiced_result_t wiced_rtos_init_semaphore (wiced_semaphore_t *semaphore)
 Initializes a counting semaphore created by wiced_rtos_create_semaphore. More...
 
wiced_result_t wiced_rtos_set_semaphore (wiced_semaphore_t *semaphore)
 Set (post/put/increment) a semaphore. More...
 
wiced_result_t wiced_rtos_get_semaphore (wiced_semaphore_t *semaphore, uint32_t timeout_ms)
 Attempts to get (wait/decrement) a semaphore. More...
 

Detailed Description

Defines a group of APIs, which interface to RTOS semaphore functionality contained in ROM.

Semaphores are primarily utilized for synchronization between threads. Asynchronous events can be triggered across threads because a semaphore can be incremented or decremented by any thread.

Note
This is set of APIs implements a counting semaphore.

Function Documentation

wiced_semaphore_t* wiced_rtos_create_semaphore ( void  )

Allocates memory for a new semaphore instance and returns the pointer.

Once created, the semaphore must be initialized before use by calling wiced_rtos_init_semaphore .

Parameters
void
Returns
  • NULL an error occurred and the instance was not allocated, do not init
  • valid pointer to samphore instance, which can now we initialized
wiced_result_t wiced_rtos_get_semaphore ( wiced_semaphore_t *  semaphore,
uint32_t  timeout_ms 
)

Attempts to get (wait/decrement) a semaphore.

If semaphore is at zero already, then the calling thread will be suspended until another thread sets the semaphore with wiced_rtos_set_semaphore

Parameters
[in]semaphorepointer to semaphore instance
[in]timeout_msmilliseconds to wait for semaphore
Returns
  • WICED_SUCCESS
  • WICED_ERROR
wiced_result_t wiced_rtos_init_semaphore ( wiced_semaphore_t *  semaphore)

Initializes a counting semaphore created by wiced_rtos_create_semaphore.

Parameters
[in]semaphorepointer to semaphore instance
Returns
  • WICED_SUCCESS
  • WICED_ERROR
wiced_result_t wiced_rtos_set_semaphore ( wiced_semaphore_t *  semaphore)

Set (post/put/increment) a semaphore.

Parameters
[in]semaphorepointer to semaphore instance
Returns
  • WICED_SUCCESS
  • WICED_ERROR