TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
os_wrapper_cmsis_rtos_v2.c File Reference
#include "os_wrapper/thread.h"
#include "os_wrapper/mutex.h"
#include "os_wrapper/semaphore.h"
#include <string.h>
#include "cmsis_os2.h"
Include dependency graph for os_wrapper_cmsis_rtos_v2.c:

Go to the source code of this file.

Functions

void * os_wrapper_thread_new (const char *name, int32_t stack_size, os_wrapper_thread_func func, void *arg, uint32_t priority)
 Creates a new thread. More...
 
void * os_wrapper_semaphore_create (uint32_t max_count, uint32_t initial_count, const char *name)
 Creates a new semaphore. More...
 
uint32_t os_wrapper_semaphore_acquire (void *handle, uint32_t timeout)
 Acquires the semaphore. More...
 
uint32_t os_wrapper_semaphore_release (void *handle)
 Releases the semaphore. More...
 
uint32_t os_wrapper_semaphore_delete (void *handle)
 Deletes the semaphore. More...
 
void * os_wrapper_mutex_create (void)
 Creates a mutex for mutual exclusion of resources. More...
 
uint32_t os_wrapper_mutex_acquire (void *handle, uint32_t timeout)
 Acquires a mutex that is created by os_wrapper_mutex_create() More...
 
uint32_t os_wrapper_mutex_release (void *handle)
 Releases the mutex acquired previously. More...
 
uint32_t os_wrapper_mutex_delete (void *handle)
 Deletes a mutex that is created by os_wrapper_mutex_create() More...
 
void * os_wrapper_thread_get_handle (void)
 Gets current thread handle. More...
 
uint32_t os_wrapper_thread_get_priority (void *handle, uint32_t *priority)
 Gets thread priority. More...
 
void os_wrapper_thread_exit (void)
 Exits the calling thread. More...
 
uint32_t os_wrapper_thread_set_flag (void *handle, uint32_t flags)
 Set the event flags for synchronizing a thread specified by handle. More...
 
uint32_t os_wrapper_thread_set_flag_isr (void *handle, uint32_t flags)
 Set the event flags in an interrupt handler for synchronizing a thread specified by handle. More...
 
uint32_t os_wrapper_thread_wait_flag (uint32_t flags, uint32_t timeout)
 Wait for the event flags for synchronizing threads. More...
 
uint32_t os_wrapper_get_tick (void)
 Return RTOS current tick count. More...
 

Function Documentation

uint32_t os_wrapper_get_tick ( void  )

Return RTOS current tick count.

Returns
The current tick count

Definition at line 214 of file os_wrapper_cmsis_rtos_v2.c.

uint32_t os_wrapper_mutex_acquire ( void *  handle,
uint32_t  timeout 
)

Acquires a mutex that is created by os_wrapper_mutex_create()

Parameters
[in]handleThe handle of the mutex to acquire. Should be one of the handles returned by os_wrapper_mutex_create()
[in]timeoutThe maximum amount of time(in tick periods) for the thread to wait for the mutex to be available. If timeout is zero, the function will return immediately. Setting timeout to OS_WRAPPER_WAIT_FOREVER will cause the thread to wait indefinitely
Returns
OS_WRAPPER_SUCCESS on success or OS_WRAPPER_ERROR on error

Definition at line 98 of file os_wrapper_cmsis_rtos_v2.c.

Here is the caller graph for this function:

void* os_wrapper_mutex_create ( void  )

Creates a mutex for mutual exclusion of resources.

Returns
The handle of the created mutex on success or NULL on error

Definition at line 81 of file os_wrapper_cmsis_rtos_v2.c.

Here is the caller graph for this function:

uint32_t os_wrapper_mutex_delete ( void *  handle)

Deletes a mutex that is created by os_wrapper_mutex_create()

Parameters
[in]handleThe handle of the mutex to be deleted
Returns
OS_WRAPPER_SUCCESS on success or OS_WRAPPER_ERROR on error

Definition at line 132 of file os_wrapper_cmsis_rtos_v2.c.

uint32_t os_wrapper_mutex_release ( void *  handle)

Releases the mutex acquired previously.

Parameters
[in]handleThe handle of the mutex that has been acquired
Returns
OS_WRAPPER_SUCCESS on success or OS_WRAPPER_ERROR on error

Definition at line 116 of file os_wrapper_cmsis_rtos_v2.c.

Here is the caller graph for this function:

uint32_t os_wrapper_semaphore_acquire ( void *  handle,
uint32_t  timeout 
)

Acquires the semaphore.

Parameters
[in]handleSemaphore handle
[in]timeoutTimeout value
Returns
OS_WRAPPER_SUCCESS in case of successful acquisition, or OS_WRAPPER_ERROR in case of error

Definition at line 43 of file os_wrapper_cmsis_rtos_v2.c.

Here is the caller graph for this function:

void* os_wrapper_semaphore_create ( uint32_t  max_count,
uint32_t  initial_count,
const char *  name 
)

Creates a new semaphore.

Parameters
[in]max_countHighest count of the semaphore
[in]initial_countStarting count of the available semaphore
[in]nameName of the semaphore
Returns
Returns handle of the semaphore created, or NULL in case of error

Definition at line 33 of file os_wrapper_cmsis_rtos_v2.c.

Here is the caller graph for this function:

uint32_t os_wrapper_semaphore_delete ( void *  handle)

Deletes the semaphore.

Parameters
[in]handleSemaphore handle
Returns
OS_WRAPPER_SUCCESS in case of successful release, or OS_WRAPPER_ERROR in case of error

Definition at line 69 of file os_wrapper_cmsis_rtos_v2.c.

Here is the caller graph for this function:

uint32_t os_wrapper_semaphore_release ( void *  handle)

Releases the semaphore.

Parameters
[in]handleSemaphore handle
Returns
OS_WRAPPER_SUCCESS in case of successful release, or OS_WRAPPER_ERROR in case of error

Definition at line 57 of file os_wrapper_cmsis_rtos_v2.c.

Here is the caller graph for this function:

void os_wrapper_thread_exit ( void  )

Exits the calling thread.

Definition at line 167 of file os_wrapper_cmsis_rtos_v2.c.

void* os_wrapper_thread_get_handle ( void  )

Gets current thread handle.

Returns
Returns the thread handle, or NULL in case of error

Definition at line 148 of file os_wrapper_cmsis_rtos_v2.c.

Here is the caller graph for this function:

uint32_t os_wrapper_thread_get_priority ( void *  handle,
uint32_t *  priority 
)

Gets thread priority.

Parameters
[in]handleThread handle
[out]priorityThe priority of the thread
Returns
Returns OS_WRAPPER_SUCCESS on success, or OS_WRAPPER_ERROR in case of error

Definition at line 153 of file os_wrapper_cmsis_rtos_v2.c.

Here is the caller graph for this function:

void* os_wrapper_thread_new ( const char *  name,
int32_t  stack_size,
os_wrapper_thread_func  func,
void *  arg,
uint32_t  priority 
)

Creates a new thread.

Parameters
[in]nameName of the thread
[in]stack_sizeSize of stack to be allocated for this thread. It can be OS_WRAPPER_DEFAULT_STACK_SIZE to use the default value provided by the underlying RTOS
[in]funcPointer to the function invoked by thread
[in]argArgument to pass to the function invoked by thread
[in]priorityInitial thread priority
Returns
Returns the thread handle created, or NULL in case of error

Definition at line 17 of file os_wrapper_cmsis_rtos_v2.c.

Here is the caller graph for this function:

uint32_t os_wrapper_thread_set_flag ( void *  handle,
uint32_t  flags 
)

Set the event flags for synchronizing a thread specified by handle.

Note
This function may not be allowed to be called from Interrupt Service Routines.
Parameters
[in]handleThread handle to be notified
[in]flagsEvent flags value
Returns
Returns OS_WRAPPER_SUCCESS on success, or OS_WRAPPER_ERROR in case of error

Definition at line 172 of file os_wrapper_cmsis_rtos_v2.c.

uint32_t os_wrapper_thread_set_flag_isr ( void *  handle,
uint32_t  flags 
)

Set the event flags in an interrupt handler for synchronizing a thread specified by handle.

Parameters
[in]handleThread handle to be notified
[in]flagsEvent flags value
Returns
Returns OS_WRAPPER_SUCCESS on success, or OS_WRAPPER_ERROR in case of error

Definition at line 188 of file os_wrapper_cmsis_rtos_v2.c.

uint32_t os_wrapper_thread_wait_flag ( uint32_t  flags,
uint32_t  timeout 
)

Wait for the event flags for synchronizing threads.

Note
This function may not be allowed to be called from Interrupt Service Routines.
Parameters
[in]flagsSpecify the flags to wait for
[in]timeoutTimeout value
Returns
Returns OS_WRAPPER_SUCCESS on success, or OS_WRAPPER_ERROR in case of error

Definition at line 200 of file os_wrapper_cmsis_rtos_v2.c.