![]() |
CMSIS-RTOS2
Version 2.0.0
Real-Time Operating System: API and RTX Reference Implementation
|
Provide version/system information and start the RTOS Kernel. More...
Data Structures | |
struct | osVersion_t |
Version information. More... | |
Enumerations | |
enum | osKernelState_t { osKernelInactive = 0, osKernelReady = 1, osKernelRunning = 2, osKernelLocked = 3, osKernelSuspended = 4, osKernelError = -1, osKernelReserved = 0x7FFFFFFFU } |
Kernel state. More... | |
Functions | |
osStatus_t | osKernelInitialize (void) |
Initialize the RTOS Kernel. More... | |
osStatus_t | osKernelGetInfo (osVersion_t *version, char *id_buf, uint32_t id_size) |
Get RTOS Kernel Information. More... | |
osKernelState_t | osKernelGetState (void) |
Get the current RTOS Kernel state. More... | |
osStatus_t | osKernelStart (void) |
Start the RTOS Kernel scheduler. More... | |
uint32_t | osKernelLock (void) |
Lock the RTOS Kernel scheduler. More... | |
void | osKernelUnlock (void) |
Unlock the RTOS Kernel scheduler. More... | |
uint32_t | osKernelSuspend (void) |
Suspend the RTOS Kernel scheduler. More... | |
void | osKernelResume (uint32_t sleep_ticks) |
Resume the RTOS Kernel scheduler. More... | |
uint64_t | osKernelGetTickCount (void) |
Get the RTOS kernel tick count. More... | |
uint32_t | osKernelGetTickFreq (void) |
Get the RTOS kernel tick frequency. More... | |
uint32_t | osKernelGetSysTimerCount (void) |
Get the RTOS kernel system timer count. More... | |
uint32_t | osKernelGetSysTimerFreq (void) |
Get the RTOS kernel system timer frequency. More... | |
The Kernel Information and Control function group allows to:
Code Example
struct osVersion_t |
Identifies the underlying RTOS kernel and API version number. The Version is represented in a combined decimal number in the format: major.minor.rev: mmnnnrrrr
Use osKernelGetInfo to retrieve the version numbers
Data Fields | ||
---|---|---|
uint32_t | api | API version (major.minor.rev: mmnnnrrrr dec). |
uint32_t | kernel | Kernel version (major.minor.rev: mmnnnrrrr dec). |
enum osKernelState_t |
State of the Kernel. Can be retrieved by osKernelGetState.
Enumerator | |
---|---|
osKernelInactive |
Inactive. The kernel is not ready yet. osKernelInitialize needs to be executed successfully. |
osKernelReady |
Ready. The kernel is not yet running. osKernelStart transfers the kernel to the running state. |
osKernelRunning |
Running. The kernel is initialized and running. |
osKernelLocked |
Locked. The kernel was locked with osKernelLock. The function osKernelUnlock unlocks it. |
osKernelSuspended |
Suspended. The kernel was suspended using osKernelSuspend. The function osKernelResume returns to normal operation. |
osKernelError |
Error. An error occurred. The kernel error handler should have been called in this state. |
osKernelReserved |
Prevents enum down-size compiler optimization. Reserved. |
osStatus_t osKernelInitialize | ( | void | ) |
Initialize the RTOS Kernel. Before osKernelInitialize is successfully executed no RTOS function may be called.
The RTOS kernel does not start thread switching until the function osKernelStart is called.
Code Example:
osStatus_t osKernelGetInfo | ( | osVersion_t * | version, |
char * | id_buf, | ||
uint32_t | id_size | ||
) |
[out] | version | pointer to buffer for retrieving version information. |
[out] | id_buf | pointer to buffer for retrieving kernel identification string. |
[in] | id_size | size of buffer for kernel identification string. |
Retrieve API and kernel version of the underlying RTOS kernel and a human readable identifier string for the kernel.
Code Example:
osKernelState_t osKernelGetState | ( | void | ) |
Code Example:
osStatus_t osKernelStart | ( | void | ) |
Start the RTOS Kernel and begin thread switching. The function osKernelStart will not return to its calling function in case of success.
Code Example:
uint32_t osKernelLock | ( | void | ) |
Allows to lock all task switches. Code Example:
void osKernelUnlock | ( | void | ) |
Resumes from osKernelLock.
uint32_t osKernelSuspend | ( | void | ) |
CMSIS-RTOS provides extension for tick-less operation which is useful for applications that use extensively low-power modes where the SysTick timer is also disabled. To provide a time-tick in such power-saving modes a wake-up timer is used to derive timer intervals. The functions osKernelSuspend and osKernelResume control the tick-less operation.
Code Example:
void osKernelResume | ( | uint32_t | sleep_ticks | ) |
[in] | sleep_ticks | time in ticks for how long the system was in sleep or power-down mode. |
See osKernelSuspend.
uint64_t osKernelGetTickCount | ( | void | ) |
uint32_t osKernelGetTickFreq | ( | void | ) |
uint32_t osKernelGetSysTimerCount | ( | void | ) |
uint32_t osKernelGetSysTimerFreq | ( | void | ) |