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

Thread management functions. More...

Functions

wiced_thread_t * wiced_rtos_create_thread (void)
 Creates a new instance of thread. 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 and starts a new thread. More...
 
wiced_bool_t wiced_rtos_check_for_stack_overflow (void)
 Checks if there is a stackoverflow. More...
 
uint32_t wiced_rtos_thread_stack_size (wiced_thread_t *thread)
 Return the thread stack size. More...
 
uint32_t wiced_bt_rtos_max_stack_use (wiced_thread_t *thread)
 Returns maximum stack usage of the thread. More...
 
wiced_result_t wiced_rtos_delay_milliseconds (uint32_t milliseconds, wiced_delay_type_t delay_type)
 Sleep for a given period of milliseconds. More...
 
wiced_result_t wiced_rtos_delay_microseconds (uint32_t microseconds)
 Delay for a given period of microseconds. More...
 
wiced_result_t wiced_rtos_thread_join (wiced_thread_t *thread)
 Sleeps until another thread has terminated. More...
 
wiced_result_t wiced_rtos_thread_force_awake (wiced_thread_t *thread)
 Forcibly wakes another thread. More...
 
wiced_result_t wiced_rtos_is_current_thread (wiced_thread_t *thread)
 Checks if a thread is the current thread. More...
 

Detailed Description

Thread management functions.

Function Documentation

uint32_t wiced_bt_rtos_max_stack_use ( wiced_thread_t *  thread)

Returns maximum stack usage of the 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  )

Checks if there is a stackoverflow.

Verifies if the stack of the thread from which this API is invoked is corrupted

Returns
TRUE : stack overflow
FALSE : not stack overflow
wiced_thread_t* wiced_rtos_create_thread ( void  )

Creates a new instance of thread.

Creates a new thread (Allocates memory for a new thread instance and returns the pointer)

Returns
valid pointer : on success.
NULL : if an error occurred
wiced_result_t wiced_rtos_delay_microseconds ( uint32_t  microseconds)

Delay for a given period of 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.

NOTE: All threads with equal or lower priority than the current thread will not be able to run while the delay is occurring.

Parameters
microseconds: the time to delay in microseconds
Returns
WICED_SUCCESS : on success.
WICED_ERROR : if an error occurred
wiced_result_t wiced_rtos_delay_milliseconds ( uint32_t  milliseconds,
wiced_delay_type_t  delay_type 
)

Sleep for a given period of milliseconds.

Causes the current thread to sleep 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
milliseconds: the time to sleep in milliseconds
delay_type: delay type to be used during the duration of the delay. Use the delay type as ALLOW_THREAD_TO_SLEEP to allow the current running thread to sleep or as KEEP_THREAD_ACTIVE to keep the current running thread active
Returns
WICED_SUCCESS : on success.
WICED_ERROR : if an error occurred
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 and starts a new thread.

Initializes and starts a new thread

Parameters
thread: Pointer to variable that will receive the thread handle
priority: A priority number or WICED_DEFAULT_APP_THREAD_PRIORITY.
name: a text name for the thread (can be null)
function: the main thread function
stack_size: stack size for this thread
arg: argument which will be passed to thread function
Returns
WICED_SUCCESS : on success.
WICED_ERROR : if an error occurred
wiced_result_t wiced_rtos_is_current_thread ( wiced_thread_t *  thread)

Checks if a thread is the current thread.

Checks if a specified thread is the currently running thread

Parameters
thread: the handle of the other thread against which the current thread will be compared
Returns
WICED_SUCCESS : specified thread is the current thread
WICED_ERROR : specified thread is not currently running
wiced_result_t wiced_rtos_thread_force_awake ( wiced_thread_t *  thread)

Forcibly wakes another 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
thread: the handle of the other thread which will be woken
Returns
WICED_SUCCESS : on success.
WICED_ERROR : if an error occurred
wiced_result_t wiced_rtos_thread_join ( wiced_thread_t *  thread)

Sleeps until another thread has terminated.

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
thread: the handle of the other thread which will terminate
Returns
WICED_SUCCESS : on success.
WICED_ERROR : if an error occurred
uint32_t wiced_rtos_thread_stack_size ( wiced_thread_t *  thread)

Return the thread stack size.

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

Returns
uint32_t : size
0 : invalid thread pointer