System RTC#
Modules#
Enumerations#
Enumeration to represent sysrtc group numbers.
Enumeration to represent sysrtc channel numbers.
Typedefs#
Typedef for the function pointer of the interrupt callback function.
Functions#
Initializes SYSRTC and enables the peripheral.
Configures SYSRTC input clock source.
Configures SYSRTC compare and capture channel's groups, configures group number, and enables its compare & capture channels.
Registers callback of timer interrupt and enables respective interrupts as per selected interrupt flag.
Unregisters timer interrupt callback and disables interrupts as per selected interrupt flag.
Sets SYSRTC compare value for the selected channel of the given group.
Gets SYSRTC compare register value for the selected channel of the given group.
Sets register input high for the capture channel of the passed group of SYSRTC.
Configures SYSRTC input GPIO pins for SYSRTC capture channel input.
Configures SYSRTC compare output GPIO pins of the given channel of the given group.
Gets SYSRTC current counter register value.
Gets SYSRTC capture register value of the given group.
Gets SYSRTC compare register value of the given group and channel.
Gets SYSRTC running status, status is true if running else false if stopped.
Gets SYSRTC lock status, status is true if locked else false if unlocked.
Enables SYSRTC IO through GPIO if passed true else through register if passed false.
Starts SYSRTC counter.
Stops the SYSRTC counter.
Restores SYSRTC to its reset state.
Locks SYSRTC registers.
Unlocks SYSRTC registers.
Sets the SYSRTC counter register value of counter.
To get the release version of SYSRTC.
De-initializes SYSRTC by disabling its clock.
Enumeration Documentation#
sl_sysrtc_group_number_t#
sl_sysrtc_group_number_t
Enumeration to represent sysrtc group numbers.
Enumerator | |
---|---|
SL_SYSRTC_GROUP_0 | enum for SYSRTC group-0 |
SL_SYSRTC_GROUP_1 | enum for SYSRTC group-1 |
SL_SYSRTC_GROUP_LAST | Last member of enum for validation. |
sl_sysrtc_channel_number_t#
sl_sysrtc_channel_number_t
Enumeration to represent sysrtc channel numbers.
Enumerator | |
---|---|
SL_SYSRTC_CHANNEL_0 | enum for SYSRTC channel-0 |
SL_SYSRTC_CHANNEL_1 | enum for SYSRTC channel-1 |
SL_SYSRTC_CHANNEL_LAST | Last member of enum for validation. |
Typedef Documentation#
sl_sysrtc_group_compare_channel_action_config_t#
typedef rsi_sysrtc_group_channel_compare_config_t sl_sysrtc_group_compare_channel_action_config_t
sl_sysrtc_group_capture_channel_input_edge_config_t#
typedef rsi_sysrtc_group_channel_capture_config_t sl_sysrtc_group_capture_channel_input_edge_config_t
sl_sysrtc_callback_t#
typedef void(* sl_sysrtc_callback_t) (void *callback_flag) )(void *callback_flag)
Typedef for the function pointer of the interrupt callback function.
Type | Direction | Argument Name | Description |
---|---|---|---|
N/A | callback_flag | (void *) parameter for updating flag values |
Function Documentation#
sl_si91x_sysrtc_init#
sl_status_t sl_si91x_sysrtc_init (const sl_sysrtc_config_t * config_ptr)
Initializes SYSRTC and enables the peripheral.
Type | Direction | Argument Name | Description |
---|---|---|---|
const sl_sysrtc_config_t * | [in] | config_ptr | Pointer to SYSRTC config structure sl_sysrtc_config_t. |
Pre-conditions:
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.
SL_STATUS_OK (0x0000) - Success, SYSRTC initialized properly.
sl_si91x_sysrtc_configure_clock#
sl_status_t sl_si91x_sysrtc_configure_clock (sl_sysrtc_clock_config_t * clk_ptr)
Configures SYSRTC input clock source.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_clock_config_t * | [in] | clk_ptr | Pointer to clock configuration structure sl_sysrtc_clock_config_t. |
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER (0x0021) - Clock source parameter has an invalid value.
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.
SL_STATUS_OK (0x0000) - Success, timer clock-source parameters configured properly.
sl_si91x_sysrtc_configure_group#
sl_status_t sl_si91x_sysrtc_configure_group (sl_sysrtc_group_number_t group_number, sl_sysrtc_group_config_t const * config_ptr)
Configures SYSRTC compare and capture channel's groups, configures group number, and enables its compare & capture channels.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_group_number_t | [in] | group_number | SYSRTC group number to be used. |
sl_sysrtc_group_config_t const * | [in] | config_ptr | (const *) Pointer to group configuration structure sl_sysrtc_group_config_t. |
Also configures match out actions for respective compare channel and input events for capture.
Pre-conditions:
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER (0x0021) - Counter direction parameter has an invalid value.
SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_register_callback#
sl_status_t sl_si91x_sysrtc_register_callback (sl_sysrtc_callback_t on_sysrtc_callback, void * callback_flag_value, sl_sysrtc_group_number_t group_number, sl_sysrtc_interrupt_enables_t * interrupt_enable_ptr)
Registers callback of timer interrupt and enables respective interrupts as per selected interrupt flag.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_callback_t | [in] | on_sysrtc_callback | (function pointer) Callback function pointer to be called when timer interrupt occurred. |
void * | [in] | callback_flag_value | (void *) pointer to interrupt flag value variable sl_sysrtc_callback_t. |
sl_sysrtc_group_number_t | [in] | group_number | SYSRTC group number whose interrupts needs to be enabled. |
sl_sysrtc_interrupt_enables_t * | [in] | interrupt_enable_ptr | pointer to interrupt enable structure sl_sysrtc_interrupt_enables_t. |
Pre-conditions:
sl_si91x_sysrtc_configure_group(), keep respective interrupt channel enable
sl_si91x_sysrtc_unregister_timeout_callback(), if already registered for any interrupt
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - interrupt_enable_ptr parameter is a null pointer.
SL_STATUS_BUSY (0x0004) - The callback is already registered, unregister previous callback before registering a new one.
SL_STATUS_INVALID_PARAMETER (0x0021) - group_number parameter has an invalid value.
SL_STATUS_OK (0x0000) - Successfully registered timer timeout callback.
sl_si91x_sysrtc_unregister_callback#
sl_status_t sl_si91x_sysrtc_unregister_callback (sl_sysrtc_group_number_t group_number, sl_sysrtc_interrupt_enables_t * interrupt_enabled_handle)
Unregisters timer interrupt callback and disables interrupts as per selected interrupt flag.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_group_number_t | [in] | group_number | pointer to interrupts enable structure sl_sysrtc_interrupt_enables_t. |
sl_sysrtc_interrupt_enables_t * | [in] | interrupt_enabled_handle | SYSRTC group number whose interrupts needs to be enabled. |
Pre-conditions:
sl_si91x_sysrtc_register_callback(), first register a particular interrupt flag.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER (0x0021) - group_number parameter has an invalid value.
SL_STATUS_NULL_POINTER (0x0022) - parameter is a null pointer.
SL_STATUS_OK (0x0000) - Successfully unregistered timer interrupt callback.
sl_si91x_sysrtc_set_compare_value#
sl_status_t sl_si91x_sysrtc_set_compare_value (sl_sysrtc_group_number_t group_number, sl_sysrtc_channel_number_t channel, uint32_t compare_value)
Sets SYSRTC compare value for the selected channel of the given group.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_group_number_t | [in] | group_number | SYSRTC group number to use. |
sl_sysrtc_channel_number_t | [in] | channel | Channel number to use. |
uint32_t | [in] | compare_value | Compare register value. |
Pre-conditions:
First enable the compare channel of the respective group through sl_si91x_sysrtc_configure_group.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER (0x0021) - group_number or channel parameter has an invalid value.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_get_compare_value#
sl_status_t sl_si91x_sysrtc_get_compare_value (sl_sysrtc_group_number_t group_number, sl_sysrtc_channel_number_t channel, uint32_t * compare_value)
Gets SYSRTC compare register value for the selected channel of the given group.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_group_number_t | [in] | group_number | SYSRTC group number to use. |
sl_sysrtc_channel_number_t | [in] | channel | Channel number to use. |
uint32_t * | [in] | compare_value | Pointer to the variable to store compare value read. |
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER (0x0021) - group_number or channel parameter has an invalid value.
SL_STATUS_NULL_POINTER (0x0022) - compare_value parameter is a null pointer.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_sets_register_capture_input#
sl_status_t sl_si91x_sysrtc_sets_register_capture_input (sl_sysrtc_group_number_t group_number)
Sets register input high for the capture channel of the passed group of SYSRTC.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_group_number_t | [in] | group_number | SYSRTC group number to use. |
Pre-conditions:
First enable & config capture channel of the respective group through sl_si91x_sysrtc_configure_group.
Disable GPIO input through sl_si91x_sysrtc_enable_input_output_gpio, by passing false.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER (0x0021) - group_number parameter has an invalid value.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_set_gpio_as_capture_input#
sl_status_t sl_si91x_sysrtc_set_gpio_as_capture_input (sl_sysrtc_group_number_t group_number)
Configures SYSRTC input GPIO pins for SYSRTC capture channel input.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_group_number_t | [in] | group_number | SYSRTC group number to use. |
Pre-conditions:
First enable & config capture channel of the respective group through sl_si91x_sysrtc_configure_group.
Enable GPIO IO through sl_si91x_sysrtc_enable_input_output_gpio, by passing true.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER (0x0021) - group_number parameter has an invalid value.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_set_compare_output_gpio#
sl_status_t sl_si91x_sysrtc_set_compare_output_gpio (sl_sysrtc_group_number_t group_number, sl_sysrtc_channel_number_t channel)
Configures SYSRTC compare output GPIO pins of the given channel of the given group.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_group_number_t | [in] | group_number | SYSRTC group number to use. |
sl_sysrtc_channel_number_t | [in] | channel | Channel number to use. |
Pre-conditions:
First enable & config output action of compare channel of the respective group through sl_si91x_sysrtc_configure_group.
Returns
status 0 if successful, else error code as follows:
SL_STATUS_INVALID_PARAMETER (0x0021) - group_number or channel parameter has an invalid value.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_get_count#
sl_status_t sl_si91x_sysrtc_get_count (uint32_t * count_value)
Gets SYSRTC current counter register value.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t * | [in] | count_value | Pointer to the variable to store count value read. |
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - count_value parameter is a null pointer.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_get_capture_value#
sl_status_t sl_si91x_sysrtc_get_capture_value (sl_sysrtc_group_number_t group_number, uint32_t * capture_value)
Gets SYSRTC capture register value of the given group.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_group_number_t | [in] | group_number | SYSRTC group number to use. |
uint32_t * | [in] | capture_value | Pointer to the variable to store capture value read. |
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - count_value parameter is a null pointer.
SL_STATUS_INVALID_PARAMETER (0x0021) - group_number parameter has an invalid value.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_get_compare_output#
sl_status_t sl_si91x_sysrtc_get_compare_output (sl_sysrtc_group_number_t group_number, sl_sysrtc_channel_number_t channel, uint32_t * compare_output_bit)
Gets SYSRTC compare register value of the given group and channel.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sysrtc_group_number_t | [in] | group_number | SYSRTC group number to use. |
sl_sysrtc_channel_number_t | [in] | channel | Channel number to use. |
uint32_t * | [in] | compare_output_bit | Pointer to the variable to store compare output. |
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - compare_output parameter is a null pointer.
SL_STATUS_INVALID_PARAMETER (0x0021) - group_number or channel parameter has an invalid value.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_is_running#
sl_status_t sl_si91x_sysrtc_is_running (boolean_t * running_status)
Gets SYSRTC running status, status is true if running else false if stopped.
Type | Direction | Argument Name | Description |
---|---|---|---|
boolean_t * | [in] | running_status | Pointer to the variable to store SYSRTC running status. |
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - running_status parameter is a null pointer.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_is_locked#
sl_status_t sl_si91x_sysrtc_is_locked (boolean_t * lock_status)
Gets SYSRTC lock status, status is true if locked else false if unlocked.
Type | Direction | Argument Name | Description |
---|---|---|---|
boolean_t * | [in] | lock_status | Pointer to the variable to store SYSRTC lock status. |
Returns
status 0 if successful, else error code as follows:
SL_STATUS_NULL_POINTER (0x0022) - lock_status parameter is a null pointer.
SL_STATUS_OK (0x0000) - Success, parameters configured properly.
sl_si91x_sysrtc_enable_input_output_gpio#
void sl_si91x_sysrtc_enable_input_output_gpio (bool is_gpio_enabled)
Enables SYSRTC IO through GPIO if passed true else through register if passed false.
Type | Direction | Argument Name | Description |
---|---|---|---|
bool | [in] | is_gpio_enabled | Bool to enable or disable IO through GPIO. |
Returns
none
sl_si91x_sysrtc_start#
__STATIC_INLINE void sl_si91x_sysrtc_start (void )
Starts SYSRTC counter.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Pre-conditions:
sl_si91x_sysrtc_configure_clock(), keep software trigger disable here
sl_si91x_sysrtc_configure_group(), keep respective interrupt channel enable
sl_si91x_sysrtc_register_callback, keep respective interrupt enabled
Note
This function will send a start command to the SYSRTC peripheral. The SYSRTC peripheral will use some LF clock ticks before the command is executed. The rsi_sysrtc_wait_sync() function is used to wait for the start command to be executed.
Returns
none
sl_si91x_sysrtc_stop#
__STATIC_INLINE void sl_si91x_sysrtc_stop (void )
Stops the SYSRTC counter.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function will send a stop command to the SYSRTC peripheral. The SYSRTC peripheral will use some LF clock ticks before the command is executed. The rsi_sysrtc_wait_sync() function can be used to wait for the stop command to be executed.
Note
This function requires the SYSRTC to be enabled.
Returns
none
sl_si91x_sysrtc_reset#
__STATIC_INLINE void sl_si91x_sysrtc_reset (void )
Restores SYSRTC to its reset state.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
none
sl_si91x_sysrtc_lock#
__STATIC_INLINE void sl_si91x_sysrtc_lock (void )
Locks SYSRTC registers.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Note
When SYSRTC registers are locked SYSRTC_EN, SYSRTC_CFG, SYSRTC_CMD, SYSRTC_SWRST, SYSRTC_CNT and SYSRTC_TOPCNT registers cannot be written to.
Returns
none
sl_si91x_sysrtc_unlock#
__STATIC_INLINE void sl_si91x_sysrtc_unlock (void )
Unlocks SYSRTC registers.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Pre-conditions:
Returns
none
sl_si91x_sysrtc_set_count#
__STATIC_INLINE void sl_si91x_sysrtc_set_count (uint32_t value)
Sets the SYSRTC counter register value of counter.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | value | The new SYSRTC counter value. |
Pre-conditions:
Returns
none
sl_si91x_sysrtc_get_version#
sl_sysrtc_version_t sl_si91x_sysrtc_get_version (void )
To get the release version of SYSRTC.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | [in] |
Returns
(sl_sysrtc_version_t) type structure.
sl_si91x_sysrtc_deinit#
void sl_si91x_sysrtc_deinit (void )
De-initializes SYSRTC by disabling its clock.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | [in] |
Returns
none