Mistake on this page?
Report an issue in GitHub or email us
Data Structures | Functions | Variables
rtos::Kernel Namespace Reference

Functions in the Kernel namespace control RTOS kernel information. More...

Data Structures

struct  Clock
 A C++11 chrono TrivialClock for the kernel millisecond tick count. More...
 

Functions

uint64_t get_ms_count ()
 Read the current RTOS kernel millisecond tick count. More...
 
void attach_idle_hook (void(*fptr)(void))
 Attach a function to be called by the RTOS idle task. More...
 
void attach_thread_terminate_hook (void(*fptr)(osThreadId_t id))
 Attach a function to be called when a thread terminates. More...
 

Variables

constexpr Clock::duration_u32 wait_for_u32_max {osWaitForever - 1}
 Maximum duration for Kernel::Clock::duration_u32-based APIs. More...
 
constexpr Clock::duration_u32 wait_for_u32_forever {osWaitForever}
 Magic "wait forever" constant for Kernel::Clock::duration_u32-based APIs. More...
 

Detailed Description

Functions in the Kernel namespace control RTOS kernel information.

Function Documentation

void rtos::Kernel::attach_idle_hook ( void(*)(void)  fptr)

Attach a function to be called by the RTOS idle task.

Parameters
fptrpointer to the function to be called
Note
You may call this function from ISR context.
Bare metal profile: This API is not supported.
void rtos::Kernel::attach_thread_terminate_hook ( void(*)(osThreadId_t id)  fptr)

Attach a function to be called when a thread terminates.

Parameters
fptrpointer to the function to be called
Note
You may call this function from ISR context.
Bare metal profile: This API is not supported.
uint64_t rtos::Kernel::get_ms_count ( )

Read the current RTOS kernel millisecond tick count.

The tick count corresponds to the tick count the RTOS uses for timing purposes. It increments monotonically from 0 at boot, so it effectively never wraps. If the underlying RTOS only provides a 32-bit tick count, this method expands it to 64 bits.

Returns
RTOS kernel current tick count
Note
Mbed OS always uses millisecond RTOS ticks, and this could only wrap after half a billion years.
You cannot call this function from ISR context.
Deprecated:
Use Kernel::Clock::now() to get a chrono time_point instead of an integer millisecond count.

Variable Documentation

constexpr Clock::duration_u32 wait_for_u32_forever {osWaitForever}

Magic "wait forever" constant for Kernel::Clock::duration_u32-based APIs.

Many duration_u32-based APIs treat duration_u32(0xFFFFFFFF) as "wait forever".

Definition at line 120 of file Kernel.h.

constexpr Clock::duration_u32 wait_for_u32_max {osWaitForever - 1}

Maximum duration for Kernel::Clock::duration_u32-based APIs.

Note
As duration_u32-based APIs pass through straight to CMSIS-RTOS, they will interpret duration_u32(0xFFFFFFFF) as "wait forever". Indicate maximum wait time of 0xFFFFFFFE for these calls (which is ~49 days).

Definition at line 114 of file Kernel.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.