RTOS APIs#

This section describes the RTOS APIs

Functions#

rsi_reg_flags_t

Disable interrupt to enter crtical section.

void
rsi_critical_section_exit(rsi_reg_flags_t xflags)

Exit critical section by restoring interrupts.

rsi_error_t
rsi_mutex_create(rsi_mutex_handle_t *mutex)

Create and initialize the mutex.

rsi_error_t
rsi_mutex_lock(volatile rsi_mutex_handle_t *mutex)

Take the mutex.

void
rsi_mutex_lock_from_isr(volatile rsi_mutex_handle_t *mutex)

Take the mutex from ISR context.

rsi_error_t
rsi_mutex_unlock(volatile rsi_mutex_handle_t *mutex)

Give the mutex.

void
rsi_mutex_unlock_from_isr(volatile rsi_mutex_handle_t *mutex)

Give the mutex from ISR context.

rsi_error_t
rsi_mutex_destroy(rsi_mutex_handle_t *mutex)

Destroye the mutex.

rsi_error_t
rsi_semaphore_create(rsi_semaphore_handle_t *semaphore, uint32_t count)

Create and initialize the semaphore instance.

rsi_error_t
rsi_semaphore_destroy(rsi_semaphore_handle_t *semaphore)

Destroy the semaphore instance.

rsi_error_t
rsi_semaphore_check_and_destroy(rsi_semaphore_handle_t *semaphore)

Check whether semaphore is created or not, It destroys the semaphore instance,if its created, otherwise should return Success.

rsi_error_t
rsi_semaphore_wait(rsi_semaphore_handle_t *semaphore, uint32_t timeout_ms)

Wireless library to acquire or wait for semaphore.

rsi_error_t
rsi_semaphore_post(rsi_semaphore_handle_t *semaphore)

Wireless library to release semaphore, which was acquired.

rsi_error_t
rsi_semaphore_post_from_isr(rsi_semaphore_handle_t *semaphore)

Wireless library to release semaphore, which was acquired.

rsi_error_t
rsi_semaphore_reset(rsi_semaphore_handle_t *semaphore)

Used by Wireless Library to reset the semaphore.

rsi_error_t
rsi_task_create(rsi_task_function_t task_function, uint8_t *task_name, uint32_t stack_size, void *parameters, uint32_t task_priority, rsi_task_handle_t *task_handle)

Wireless Library to create platform specific OS task/thread.

void
rsi_task_destroy(rsi_task_handle_t *task_handle)

Delete the task created.

void
rsi_os_task_delay(uint32_t timeout_ms)

Induce required delay in milli seconds.

void

Schedule the tasks created.

void
rsi_set_os_errno(int32_t error)

Sets the os error .

rsi_base_type_t
rsi_task_notify_wait(uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, uint32_t timeout)

Allow a task to wait with optional timeout.

rsi_base_type_t
rsi_task_notify(rsi_task_handle_t xTaskToNotify, uint32_t ulValue)

Notify to a task.

rsi_base_type_t
rsi_task_notify_from_isr(rsi_task_handle_t xTaskToNotify, uint32_t ulValue, rsi_base_type_t *pxHigherPriorityTaskWoken)

Notification directly to a task and should be used in ISR only.

uint32_t
rsi_os_task_notify_take(BaseType_t xClearCountOnExit, TickType_t xTicksToWait)

Allow a task in wait in blocked state for its notification value >0.

BaseType_t
rsi_os_task_notify_give(rsi_task_handle_t xTaskToNotify)

Notify to a task.

int32_t
rsi_get_error(int32_t sockID)

Return wlan status.

void *
rsi_malloc(uint32_t size)

Allocate memory from the buffer which is maintained by freertos

void
rsi_free(void *ptr)

Free the memory pointed by 'ptr'.

void

Enter into critical section.

void

Enter into exit section.

void
rsi_task_suspend(rsi_task_handle_t *task_handle)

Exit into critical section.

Function Documentation#

rsi_critical_section_entry#

rsi_reg_flags_t rsi_critical_section_entry ()

Disable interrupt to enter crtical section.

Parameters
[in]

Returns

  • flags - interrupt status before entering critical section


Definition at line 45 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_critical_section_exit#

void rsi_critical_section_exit (rsi_reg_flags_t xflags)

Exit critical section by restoring interrupts.

Parameters
[in]xflags

- interrupt status to restore interrupt on exit from critical section

Returns

  • Void


Definition at line 71 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_mutex_create#

rsi_error_t rsi_mutex_create (rsi_mutex_handle_t *mutex)

Create and initialize the mutex.

Parameters
[in]mutex

- Mutex handle pointer

Returns

  • 0 - Success Negative Value - Failure


Definition at line 90 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_mutex_lock#

rsi_error_t rsi_mutex_lock (volatile rsi_mutex_handle_t *mutex)

Take the mutex.

Parameters
[in]mutex

- Mutex handle pointer

Returns

  • 0 - Success Negative Value - Failure


Definition at line 116 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_mutex_lock_from_isr#

void rsi_mutex_lock_from_isr (volatile rsi_mutex_handle_t *mutex)

Take the mutex from ISR context.

Parameters
[in]mutex

- Mutex handle pointer

Returns

  • 0 - Success Negative Value - Failure


Definition at line 143 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_mutex_unlock#

rsi_error_t rsi_mutex_unlock (volatile rsi_mutex_handle_t *mutex)

Give the mutex.

Parameters
[in]mutex

- Mutex handle pointer

Returns

  • 0 - Success Negative Value - Failure


Definition at line 158 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_mutex_unlock_from_isr#

void rsi_mutex_unlock_from_isr (volatile rsi_mutex_handle_t *mutex)

Give the mutex from ISR context.

Parameters
[in]mutex

- Mutex handle pointer

Returns

  • none


Definition at line 178 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_mutex_destroy#

rsi_error_t rsi_mutex_destroy (rsi_mutex_handle_t *mutex)

Destroye the mutex.

Parameters
[in]mutex

- Mutex handle pointer

Returns

  • 0 - Success Negative Value - Failure


Definition at line 193 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_semaphore_create#

rsi_error_t rsi_semaphore_create (rsi_semaphore_handle_t *semaphore, uint32_t count)

Create and initialize the semaphore instance.

Parameters
[in]semaphore

- Semaphore handle pointer

[in]count

- Resource count

Returns

  • 0 - Success Negative Value - Failure


Definition at line 215 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_semaphore_destroy#

rsi_error_t rsi_semaphore_destroy (rsi_semaphore_handle_t *semaphore)

Destroy the semaphore instance.

Parameters
[in]semaphore

- Semaphore handle pointer

Returns

  • 0 - Success Negative Value - Failure


Definition at line 240 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_semaphore_check_and_destroy#

rsi_error_t rsi_semaphore_check_and_destroy (rsi_semaphore_handle_t *semaphore)

Check whether semaphore is created or not, It destroys the semaphore instance,if its created, otherwise should return Success.

Parameters
[in]semaphore

- Semaphore handle pointer

Returns

  • 0 - Success Negative Value - Failure


Definition at line 260 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_semaphore_wait#

rsi_error_t rsi_semaphore_wait (rsi_semaphore_handle_t *semaphore, uint32_t timeout_ms)

Wireless library to acquire or wait for semaphore.

Parameters
[in]semaphore

- Semaphore handle pointer

[in]timeout_ms

- Maximum time to wait to acquire semaphore. If timeout_ms is 0 then wait till acquire semaphore.

Returns

  • 0 - Success Negative Value - Failure


Definition at line 286 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_semaphore_post#

rsi_error_t rsi_semaphore_post (rsi_semaphore_handle_t *semaphore)

Wireless library to release semaphore, which was acquired.

Parameters
[in]semaphore

- Semaphore handle pointer

Returns

  • 0 - Success Negative Value - Failure


Definition at line 314 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_semaphore_post_from_isr#

rsi_error_t rsi_semaphore_post_from_isr (rsi_semaphore_handle_t *semaphore)

Wireless library to release semaphore, which was acquired.

Parameters
[in]semaphore

- Semaphore handle pointer

Returns

  • 0 - Success Negative Value - Failure


Definition at line 339 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_semaphore_reset#

rsi_error_t rsi_semaphore_reset (rsi_semaphore_handle_t *semaphore)

Used by Wireless Library to reset the semaphore.

Parameters
[in]semaphore

- Semaphore handle pointer

Returns

  • 0 - Success Negative Value - Failure


Definition at line 364 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_task_create#

rsi_error_t rsi_task_create (rsi_task_function_t task_function, uint8_t *task_name, uint32_t stack_size, void *parameters, uint32_t task_priority, rsi_task_handle_t *task_handle)

Wireless Library to create platform specific OS task/thread.

Parameters
[in]task_function

- Pointer to function to be executed by created thread. Prototype of the function

[in]task_name

- Name of the created task

[in]stack_size

- Stack size given to the created task

[in]parameters

- Pointer to the parameters to be passed to task function

[in]task_priority

- task priority

[in]task_handle

- task handle/instance created

Returns

  • 0 - Success Negative Value - Failure


Definition at line 395 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_task_destroy#

void rsi_task_destroy (rsi_task_handle_t *task_handle)

Delete the task created.

Parameters
[in]task_handle

- Task handle/instance to be deleted

Returns

  • void


Definition at line 427 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_os_task_delay#

void rsi_os_task_delay (uint32_t timeout_ms)

Induce required delay in milli seconds.

Parameters
[in]timeout_ms

- Expected delay in milli seconds

Returns

  • void


Definition at line 439 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_start_os_scheduler#

void rsi_start_os_scheduler ()

Schedule the tasks created.

Parameters
[in]

Returns

  • void


Definition at line 451 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_set_os_errno#

void rsi_set_os_errno (int32_t error)

Sets the os error .

Parameters
[in]error

- Error

Returns

  • void


Definition at line 462 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_task_notify_wait#

rsi_base_type_t rsi_task_notify_wait (uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, uint32_t timeout)

Allow a task to wait with optional timeout.

Parameters
[in]ulBitsToClearOnEntry

- bits set here will be cleared in the task’s notification value on entry to the function.

[in]ulBitsToClearOnExit

- used to pass out the task notification value and an optional paramter

[in]pulNotificationValue

- bits to clear on exit

[in]timeout

- maximum amount of time the calling task should remain in blocked state

Returns

  • 0 - Success Negative Value - Failure


Definition at line 478 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_task_notify#

rsi_base_type_t rsi_task_notify (rsi_task_handle_t xTaskToNotify, uint32_t ulValue)

Notify to a task.

Parameters
[in]xTaskToNotify

- The handle of the task to which the notification is being sent

[in]ulValue

- How ulValue is used is dependent on the eNotifyAction value

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 504 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_task_notify_from_isr#

rsi_base_type_t rsi_task_notify_from_isr (rsi_task_handle_t xTaskToNotify, uint32_t ulValue, rsi_base_type_t *pxHigherPriorityTaskWoken)

Notification directly to a task and should be used in ISR only.

Parameters
[in]xTaskToNotify

- The handle of the task to which the notification is being sent

[in]ulValue

- How ulValue is used is dependent on the eNotifyAction value

[in]pxHigherPriorityTaskWoken

- Sets,if sending the notification caused a task to unblock, and the unblocked task has a priority higher than the currently running task.

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 525 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_os_task_notify_take#

uint32_t rsi_os_task_notify_take (BaseType_t xClearCountOnExit, TickType_t xTicksToWait)

Allow a task in wait in blocked state for its notification value >0.

Parameters
[in]xClearCountOnExit

- Based on this value calling task notification value will be decremented/zero

[in]xTicksToWait

- maximum amount of time calling task should remain in blocked state

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 548 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_os_task_notify_give#

BaseType_t rsi_os_task_notify_give (rsi_task_handle_t xTaskToNotify)

Notify to a task.

Parameters
[in]xTaskToNotify

- Task handle to notify

Returns

  • Task notification value -1 - Failure


Definition at line 561 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_get_error#

int32_t rsi_get_error (int32_t sockID)

Return wlan status.

Parameters
[in]sockID

- Socket Id

Returns

  • wlan status


Definition at line 580 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_malloc#

void* rsi_malloc (uint32_t size)

Allocate memory from the buffer which is maintained by freertos

Parameters
[in]size

- required bytes in size

Returns

  • void


Definition at line 643 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_free#

void rsi_free (void *ptr)

Free the memory pointed by 'ptr'.

Parameters
[in]ptr

- starting address of the memory to be freed

Returns

  • void


Definition at line 659 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_vport_enter_critical#

void rsi_vport_enter_critical (void)

Enter into critical section.

Parameters
[in]

Returns

  • void


Definition at line 674 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_vport_exit_critical#

void rsi_vport_exit_critical (void)

Enter into exit section.

Parameters
[in]

Returns

  • void


Definition at line 687 of file rtos/freertos_wrapper/rsi_os_wrapper.c

rsi_task_suspend#

void rsi_task_suspend (rsi_task_handle_t *task_handle)

Exit into critical section.

Parameters
[in]task_handle

- Task handle to be suspended

Returns

  • void


Definition at line 699 of file rtos/freertos_wrapper/rsi_os_wrapper.c