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

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

Functions

wiced_thread_t * wiced_rtos_create_thread (void)
 Allocates memory for a new thread instance and returns the pointer. More...
 
wiced_result_t wiced_rtos_init_thread (wiced_thread_t *thread, uint8_t priority, const char *name, wiced_thread_function_t function, uint32_t stack_size, void *arg)
 Initializes the thread instance created by wiced_rtos_create_thread . More...
 
wiced_result_t wiced_rtos_delay_milliseconds (uint32_t milliseconds, wiced_delay_type_t delay_type)
 Causes the current thread to block for AT LEAST the specified number of milliseconds. More...
 
wiced_result_t wiced_rtos_delay_microseconds (uint32_t microseconds)
 Causes the current thread to block for AT LEAST the specified number of microseconds. More...
 
wiced_result_t wiced_rtos_thread_join (wiced_thread_t *thread)
 Causes the current thread to sleep until the specified other thread has terminated. More...
 
wiced_result_t wiced_rtos_thread_force_awake (wiced_thread_t *thread)
 Causes the specified thread to wake from suspension. More...
 
wiced_result_t wiced_rtos_is_current_thread (wiced_thread_t *thread)
 Checks if a specified thread is the currently running thread. More...
 
wiced_bool_t wiced_rtos_check_for_stack_overflow (void)
 Verifies if the stack of current thread is corrupted. More...
 
uint32_t wiced_rtos_thread_stack_size (wiced_thread_t *thread)
 Returns stack size if thread signature is valid, else returns 0. More...
 
uint32_t wiced_bt_rtos_max_stack_use (wiced_thread_t *thread)
 Returns maximum stack usage size if thread signature is valid, else returns 0. More...
 

Detailed Description

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

Function Documentation

uint32_t wiced_bt_rtos_max_stack_use ( wiced_thread_t *  thread)

Returns maximum stack usage size if thread signature is valid, else returns 0.

Parameters
[in]thread: point to the thread context Note: thread is a return value from wiced_rtos_create_thread()
Returns
maximum stack usage
wiced_bool_t wiced_rtos_check_for_stack_overflow ( void  )

Verifies if the stack of current thread is corrupted.

Parameters
void
Returns
  • WICED_TRUE
  • WICED_FALSE
wiced_thread_t* wiced_rtos_create_thread ( void  )

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

Parameters
void
Returns
  • NULL an error occured and the instance was not allocated, do not init
  • valid pointer to thread instance, which can now we initialized
wiced_result_t wiced_rtos_delay_microseconds ( uint32_t  microseconds)

Causes the current thread to block for AT LEAST the specified number of microseconds.

If the processor is heavily loaded with higher priority tasks, the delay may be much longer than requested.

Parameters
[in]microsecondsmicroseconds to delay current thread
Returns
  • WICED_SUCCESS
  • WICED_ERROR
Note
All threads with equal or lower priority than the current thread will not be able to run while the delay is occurring.
wiced_result_t wiced_rtos_delay_milliseconds ( uint32_t  milliseconds,
wiced_delay_type_t  delay_type 
)

Causes the current thread to block for AT LEAST the specified number of milliseconds.

If the processor is heavily loaded with higher priority tasks, the delay may be much longer than requested.

Parameters
[in]millisecondsmilliseconds to delay current thread
[in]delay_typeALLOW_THREAD_TO_SLEEP or KEEP_THREAD_ACTIVE
Returns
  • WICED_SUCCESS
  • WICED_ERROR
wiced_result_t wiced_rtos_init_thread ( wiced_thread_t *  thread,
uint8_t  priority,
const char *  name,
wiced_thread_function_t  function,
uint32_t  stack_size,
void *  arg 
)

Initializes the thread instance created by wiced_rtos_create_thread .

Thread is then started in callback 'function' using given parameters.

Parameters
[in]threadpointer to thread instance to wait for
[in]priorityTHREAD_PRIORITY_MIN=0 to THREAD_PRIORITY_MAX=7
[in]nameASCII name for the thread (NULL is allowed)
[in]functionmain thread function
[in]stack_sizenum bytes allocated for thread stack
[in]argargument which will be passed to thread function
Returns
  • WICED_SUCCESS
  • WICED_ERROR
wiced_result_t wiced_rtos_is_current_thread ( wiced_thread_t *  thread)

Checks if a specified thread is the currently running thread.

Parameters
[in]threadpointer to thread instance
Returns
  • WICED_SUCCESS indicates that the current thread is that passed as param
  • WICED_ERROR indicates that the current thread is not that passed as param
wiced_result_t wiced_rtos_thread_force_awake ( wiced_thread_t *  thread)

Causes the specified thread to wake from suspension.

This will usually cause an error or timeout in that thread, since the task it was waiting on is not complete.

Parameters
[in]threadpointer to thread instance
Returns
  • WICED_SUCCESS
  • WICED_ERROR
wiced_result_t wiced_rtos_thread_join ( wiced_thread_t *  thread)

Causes the current thread to sleep until the specified other thread has terminated.

If the processor is heavily loaded with higher priority tasks, this thread may not wake until significantly after the thread termination.

Parameters
[in]threadpointer to thread instance to wait for
Returns
  • WICED_SUCCESS
  • WICED_ERROR
uint32_t wiced_rtos_thread_stack_size ( wiced_thread_t *  thread)

Returns stack size if thread signature is valid, else returns 0.

Parameters
wiced_thread_t*
Returns
  • size as uint32_t
  • 0 if thread pointer is invalid