ChibiOS  21.6.0
ST Driver

Generic System Tick Driver. More...

Collaboration diagram for ST Driver:

Detailed Description

Generic System Tick Driver.

This module implements a system tick timer in order to support the underlying operating system.

Functions

void stInit (void)
 ST Driver initialization. More...
 
void stBind (void)
 Enables an alarm interrupt on the invoking core. More...
 
systime_t stGetCounter (void)
 Returns the time counter value. More...
 
void stStartAlarm (systime_t abstime)
 Starts the alarm zero. More...
 
void stStopAlarm (void)
 Stops the alarm zero interrupt. More...
 
void stSetAlarm (systime_t abstime)
 Sets the alarm zero time. More...
 
systime_t stGetAlarm (void)
 Returns the alarm zero current time. More...
 
bool stIsAlarmActive (void)
 Determines if the alarm zero is active. More...
 
void stSetCallback (unsigned alarm, st_callback_t cb)
 Associates a callback to an alarm. More...
 
void stBindAlarmN (unsigned alarm)
 Enables an alarm interrupt on the invoking core. More...
 
void stStartAlarmN (unsigned alarm, systime_t abstime)
 Starts an additional alarm. More...
 
void stStopAlarmN (unsigned alarm)
 Stops an additional alarm. More...
 
void stSetAlarmN (unsigned alarm, systime_t abstime)
 Sets an additional alarm time. More...
 
systime_t stGetAlarmN (unsigned alarm)
 Returns an additional alarm current time. More...
 
bool stIsAlarmActiveN (unsigned alarm)
 Determines if the specified alarm is active. More...
 
void st_lld_init (void)
 Low level ST driver initialization. More...
 
static systime_t st_lld_get_counter (void)
 Returns the time counter value. More...
 
static void st_lld_start_alarm (systime_t abstime)
 Starts the alarm. More...
 
static void st_lld_stop_alarm (void)
 Stops the alarm interrupt. More...
 
static void st_lld_set_alarm (systime_t abstime)
 Sets the alarm time. More...
 
static systime_t st_lld_get_alarm (void)
 Returns the current alarm time. More...
 
static bool st_lld_is_alarm_active (void)
 Determines if the alarm is active. More...
 

Variables

st_callback_t st_callbacks [ST_LLD_NUM_ALARMS]
 Callback pointers for each alarm. More...
 

Function Documentation

◆ stInit()

void stInit ( void  )

ST Driver initialization.

Note
This function is implicitly invoked by halInit(), there is no need to explicitly initialize the driver.
Function Class:
Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 69 of file hal_st.c.

Referenced by halInit().

◆ stBind()

void stBind ( void  )

Enables an alarm interrupt on the invoking core.

Note
Must be called before any other alarm-related function.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 87 of file hal_st.c.

◆ stGetCounter()

systime_t stGetCounter ( void  )

Returns the time counter value.

Note
This functionality is only available in free running mode, the behaviour in periodic mode is undefined.
Returns
The counter value.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 103 of file hal_st.c.

References st_lld_get_counter().

Here is the call graph for this function:

◆ stStartAlarm()

void stStartAlarm ( systime_t  abstime)

Starts the alarm zero.

Note
Makes sure that no spurious alarms are triggered after this call.
This functionality is only available in free running mode, the behavior in periodic mode is undefined.
Parameters
[in]abstimethe time to be set for the first alarm
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 119 of file hal_st.c.

References osalDbgAssert, st_lld_start_alarm(), and stIsAlarmActive().

Here is the call graph for this function:

◆ stStopAlarm()

void stStopAlarm ( void  )

Stops the alarm zero interrupt.

Note
This functionality is only available in free running mode, the behavior in periodic mode is undefined.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 133 of file hal_st.c.

References st_lld_stop_alarm().

Here is the call graph for this function:

◆ stSetAlarm()

void stSetAlarm ( systime_t  abstime)

Sets the alarm zero time.

Note
This functionality is only available in free running mode, the behavior in periodic mode is undefined.
Parameters
[in]abstimethe time to be set for the next alarm
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 147 of file hal_st.c.

References osalDbgAssert, st_lld_set_alarm(), and stIsAlarmActive().

Here is the call graph for this function:

◆ stGetAlarm()

systime_t stGetAlarm ( void  )

Returns the alarm zero current time.

Note
This functionality is only available in free running mode, the behavior in periodic mode is undefined.
Returns
The currently set alarm time.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 163 of file hal_st.c.

References osalDbgAssert, st_lld_get_alarm(), and stIsAlarmActive().

Here is the call graph for this function:

◆ stIsAlarmActive()

bool stIsAlarmActive ( void  )

Determines if the alarm zero is active.

Returns
The alarm status.
Return values
falseif the alarm is not active.
trueis the alarm is active
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 179 of file hal_st.c.

References st_lld_is_alarm_active().

Referenced by stGetAlarm(), stSetAlarm(), and stStartAlarm().

Here is the call graph for this function:

◆ stSetCallback()

void stSetCallback ( unsigned  alarm,
st_callback_t  cb 
)

Associates a callback to an alarm.

Note
Makes sure that no spurious alarms are triggered after this call.
This functionality is only available in free running mode, the behavior in periodic mode is undefined.
Parameters
[in]alarmalarm channel number (0..ST_LLD_NUM_ALARMS-1)
[in]cbalarm callback or NULL
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 197 of file hal_st.c.

◆ stBindAlarmN()

void stBindAlarmN ( unsigned  alarm)

Enables an alarm interrupt on the invoking core.

Note
Must be called before any other alarm-related function.
Parameters
[in]alarmalarm channel number (0..ST_LLD_NUM_ALARMS-1)
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 213 of file hal_st.c.

References osalDbgCheck.

◆ stStartAlarmN()

void stStartAlarmN ( unsigned  alarm,
systime_t  abstime 
)

Starts an additional alarm.

Note
Makes sure that no spurious alarms are triggered after this call.
This functionality is only available in free running mode, the behavior in periodic mode is undefined.
Parameters
[in]alarmalarm channel number (0..ST_LLD_NUM_ALARMS-1)
[in]abstimethe time to be set for the first alarm
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 234 of file hal_st.c.

References osalDbgCheck.

◆ stStopAlarmN()

void stStopAlarmN ( unsigned  alarm)

Stops an additional alarm.

Note
This functionality is only available in free running mode, the behavior in periodic mode is undefined.
Parameters
[in]alarmalarm channel number (0..ST_LLD_NUM_ALARMS-1)
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 251 of file hal_st.c.

References osalDbgCheck.

◆ stSetAlarmN()

void stSetAlarmN ( unsigned  alarm,
systime_t  abstime 
)

Sets an additional alarm time.

Note
This functionality is only available in free running mode, the behavior in periodic mode is undefined.
Parameters
[in]alarmalarm channel number (0..ST_LLD_NUM_ALARMS-1)
[in]abstimethe time to be set for the next alarm
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 268 of file hal_st.c.

References osalDbgCheck.

◆ stGetAlarmN()

systime_t stGetAlarmN ( unsigned  alarm)

Returns an additional alarm current time.

Note
This functionality is only available in free running mode, the behavior in periodic mode is undefined.
Parameters
[in]alarmalarm channel number (0..ST_LLD_NUM_ALARMS-1)
Returns
The currently set alarm time.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 286 of file hal_st.c.

References osalDbgCheck.

◆ stIsAlarmActiveN()

bool stIsAlarmActiveN ( unsigned  alarm)

Determines if the specified alarm is active.

Parameters
[in]alarmalarm channel number (0..ST_LLD_NUM_ALARMS-1)
Returns
The alarm status.
Return values
falseif the alarm is not active.
trueis the alarm is active
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 304 of file hal_st.c.

References osalDbgCheck.

◆ st_lld_init()

void st_lld_init ( void  )

Low level ST driver initialization.

Function Class:
Not an API, this function is for internal use only.

Definition at line 62 of file hal_st_lld.c.

◆ st_lld_get_counter()

static systime_t st_lld_get_counter ( void  )
inlinestatic

Returns the time counter value.

Returns
The counter value.
Function Class:
Not an API, this function is for internal use only.

Definition at line 73 of file hal_st_lld.h.

Referenced by stGetCounter().

◆ st_lld_start_alarm()

static void st_lld_start_alarm ( systime_t  abstime)
inlinestatic

Starts the alarm.

Note
Makes sure that no spurious alarms are triggered after this call.
Parameters
[in]abstimethe time to be set for the first alarm
Function Class:
Not an API, this function is for internal use only.

Definition at line 87 of file hal_st_lld.h.

Referenced by stStartAlarm().

◆ st_lld_stop_alarm()

static void st_lld_stop_alarm ( void  )
inlinestatic

Stops the alarm interrupt.

Function Class:
Not an API, this function is for internal use only.

Definition at line 97 of file hal_st_lld.h.

Referenced by stStopAlarm().

◆ st_lld_set_alarm()

static void st_lld_set_alarm ( systime_t  abstime)
inlinestatic

Sets the alarm time.

Parameters
[in]abstimethe time to be set for the next alarm
Function Class:
Not an API, this function is for internal use only.

Definition at line 108 of file hal_st_lld.h.

Referenced by stSetAlarm().

◆ st_lld_get_alarm()

static systime_t st_lld_get_alarm ( void  )
inlinestatic

Returns the current alarm time.

Returns
The currently set alarm time.
Function Class:
Not an API, this function is for internal use only.

Definition at line 120 of file hal_st_lld.h.

Referenced by stGetAlarm().

◆ st_lld_is_alarm_active()

static bool st_lld_is_alarm_active ( void  )
inlinestatic

Determines if the alarm is active.

Returns
The alarm status.
Return values
falseif the alarm is not active.
trueis the alarm is active
Function Class:
Not an API, this function is for internal use only.

Definition at line 134 of file hal_st_lld.h.

Referenced by stIsAlarmActive().

Variable Documentation

◆ st_callbacks

st_callback_t st_callbacks[ST_LLD_NUM_ALARMS]

Callback pointers for each alarm.

Note
If some alarms have static callbacks defined in the LLD then some of the pointers might be unused (never called through).

Definition at line 51 of file hal_st.c.