Abstraction RTOS
Scheduler

General Description

APIs for working with Scheduler.

Enumerations

enum  cy_scheduler_state_t {
  CY_SCHEDULER_STATE_NOT_STARTED ,
  CY_SCHEDULER_STATE_INACTIVE ,
  CY_SCHEDULER_STATE_LOCKED ,
  CY_SCHEDULER_STATE_READY ,
  CY_SCHEDULER_STATE_SUSPENDED ,
  CY_SCHEDULER_STATE_RUNNING ,
  CY_SCHEDULER_STATE_UNKNOWN
}
 The state a scheduler can be in. More...
 
cy_rslt_t cy_rtos_scheduler_suspend (void)
 Suspend the scheduler. More...
 
cy_rslt_t cy_rtos_scheduler_resume (void)
 Resume the scheduler. More...
 
cy_rslt_t cy_rtos_scheduler_get_state (cy_scheduler_state_t *state)
 Gets the state the scheduler is currently in. More...
 

Enumeration Type Documentation

◆ cy_scheduler_state_t

The state a scheduler can be in.

Enumerator
CY_SCHEDULER_STATE_NOT_STARTED 

Scheduler has not started.

CY_SCHEDULER_STATE_INACTIVE 

Scheduler is not ready yet.

CY_SCHEDULER_STATE_LOCKED 

Scheduler is locked.

CY_SCHEDULER_STATE_READY 

Scheduler is ready but not running.

CY_SCHEDULER_STATE_SUSPENDED 

Scheduler has been suspended.

CY_SCHEDULER_STATE_RUNNING 

Scheduler is currently running.

CY_SCHEDULER_STATE_UNKNOWN 

An error occurred.

Function Documentation

◆ cy_rtos_scheduler_suspend()

cy_rslt_t cy_rtos_scheduler_suspend ( void  )

Suspend the scheduler.

This function suspends the scheduler and makes sure that the code executed after the call does not get interrupted by a task switch. Multiple suspend calls can be done making nesting possible granted that the same number of resume calls are made.

Note
API functions that have the potential to cause a context switch must not be called while the scheduler is suspended.
Returns
The status of scheduler suspend request. Same across all RTOS kernels [CY_RSLT_SUCCESS].
Specific for kernel:

◆ cy_rtos_scheduler_resume()

cy_rslt_t cy_rtos_scheduler_resume ( void  )

Resume the scheduler.

This function resumes the scheduler after it was suspended. If incorrectly called (called more times than cy_rtos_scheduler_suspend) it fails returning CY_RTOS_BAD_PARAM

Returns
The status of scheduler resume request. Same across all RTOS kernels [CY_RSLT_SUCCESS, CY_RTOS_BAD_PARAM].

◆ cy_rtos_scheduler_get_state()

cy_rslt_t cy_rtos_scheduler_get_state ( cy_scheduler_state_t state)

Gets the state the scheduler is currently in.

This function is called to determine if the scheduler is running/suspend/not started.

Parameters
[out]stateReturns the state the scheduler is currently in
Returns
The status of the scheduler state check. Same across all RTOS kernels [CY_RSLT_SUCCESS, CY_RTOS_BAD_PARAM].