System RTC#

Modules#

sl_sysrtc_clock_config_t

sl_sysrtc_interrupt_enables_t

sl_sysrtc_version_t

Enumerations#

enum
SL_SYSRTC_GROUP_0
SL_SYSRTC_GROUP_1
SL_SYSRTC_GROUP_LAST
}

Enumeration to represent SYSRTC group numbers.

enum
SL_SYSRTC_CHANNEL_0
SL_SYSRTC_CHANNEL_1
SL_SYSRTC_CHANNEL_LAST
}

Enumeration to represent SYSRTC channel numbers.

Typedefs#

typedef rsi_sysrtc_clk_inp_t
typedef rsi_sysrtc_config_t
typedef rsi_sysrtc_group_config_t
typedef rsi_sysrtc_group_channel_compare_config_t
typedef rsi_sysrtc_group_channel_capture_config_t
typedef void(*
sl_sysrtc_callback_t)(void *callback_flag)

Typedef for the function pointer of the interrupt callback function.

Functions#

sl_status_t
sl_si91x_sysrtc_init(const sl_sysrtc_config_t *config_ptr)

Initializes SYSRTC and enables the peripheral.

sl_status_t
sl_si91x_sysrtc_configure_clock(sl_sysrtc_clock_config_t *clk_ptr)

Configures the SYSRTC input clock source frequency It configures clock source as 32khz RC, 32khz RO or 1Khz RO clock source as per user input.

sl_status_t
sl_si91x_sysrtc_configure_group(sl_sysrtc_group_number_t group_number, sl_sysrtc_group_config_t const *config_ptr)

To configure the SYSRTC groups of compare and capture channels Configures group number and enables its compare & capture channels.

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)

To register the callback of the timer interrupt.

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.

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.

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 current compare register value for selected channel of selected group.

sl_status_t
sl_si91x_sysrtc_sets_register_capture_input(sl_sysrtc_group_number_t group_number)

Sets register-input for the capture channel of the selected group of SYSRTC.

sl_status_t
sl_si91x_sysrtc_set_gpio_as_capture_input(sl_sysrtc_group_number_t group_number)

Configures input pins for the SYSRTC capture channel of selected group.

sl_status_t
sl_si91x_sysrtc_set_compare_output_gpio(sl_sysrtc_group_number_t group_number, sl_sysrtc_channel_number_t channel)

Configures the output pins of the selected compare channel of given group.

sl_status_t
sl_si91x_sysrtc_get_count(uint32_t *count_value)

Gets the SYSRTC current counter register value.

sl_status_t
sl_si91x_sysrtc_get_capture_value(sl_sysrtc_group_number_t group_number, uint32_t *capture_value)

Gets the SYSRTC capture register value of a given group.

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)

Reads the SYSRTC compare channel output bit value of a given group.

sl_status_t
sl_si91x_sysrtc_is_running(boolean_t *running_status)

Gets the SYSRTC running status, status is true if running, false if stopped.

sl_status_t
sl_si91x_sysrtc_is_locked(boolean_t *lock_status)

Gets the SYSRTC lock status.

void

Sets the SYSRTC input output mode for the capture and compare channels.

__STATIC_INLINE void

Starts the SYSRTC counter.

__STATIC_INLINE void

Stops the SYSRTC counter.

__STATIC_INLINE void

Restores the SYSRTC to its reset state.

__STATIC_INLINE void

Locks the SYSRTC registers.

__STATIC_INLINE void

Unlocks the SYSRTC registers.

__STATIC_INLINE void

Sets the SYSRTC counter register value of counter This can be used to change the count of SYSRTC, when it is stopped.

Gets the SYSRTC version It returns API version of SYSRTC.

void

De-initializes the 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.


Definition at line 70 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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.


Definition at line 77 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

Typedef Documentation#

sl_clock_sources_t#

typedef rsi_sysrtc_clk_inp_t sl_clock_sources_t

Definition at line 54 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_sysrtc_config_t#

typedef rsi_sysrtc_config_t sl_sysrtc_config_t

Definition at line 55 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_sysrtc_group_config_t#

typedef rsi_sysrtc_group_config_t sl_sysrtc_group_config_t

Definition at line 56 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_sysrtc_group_compare_channel_action_config_t#

typedef rsi_sysrtc_group_channel_compare_config_t sl_sysrtc_group_compare_channel_action_config_t

Definition at line 58 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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

Definition at line 60 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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.

Parameters
N/Acallback_flag

(void *) parameter for updating flag values


Definition at line 67 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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.

Parameters
[in]config_ptr

Pointer to SYSRTC config structure sl_sysrtc_config_t.

Also configures that SYSRTC should run during debug halt, as per user input.

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.


Definition at line 122 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_configure_clock#

sl_status_t sl_si91x_sysrtc_configure_clock (sl_sysrtc_clock_config_t * clk_ptr)

Configures the SYSRTC input clock source frequency It configures clock source as 32khz RC, 32khz RO or 1Khz RO clock source as per user input.

Parameters
[in]clk_ptr

Pointer to clock configuration structure sl_sysrtc_clock_config_t.

For using 1KHz clock source, pass division factor value as '16' else pass '0'.

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.


Definition at line 135 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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)

To configure the SYSRTC groups of compare and capture channels Configures group number and enables its compare & capture channels.

Parameters
[in]group_number

SYSRTC group number to be used.

[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

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.


Definition at line 153 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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)

To register the callback of the timer interrupt.

Parameters
[in]on_sysrtc_callback

(function pointer) Callback function pointer to be called when timer interrupt occurred.

[in]callback_flag_value

(void *) pointer to interrupt flag value variable sl_sysrtc_callback_t.

[in]group_number

SYSRTC group number whose interrupts needs to be enabled.

[in]interrupt_enable_ptr

pointer to interrupt enable structure sl_sysrtc_interrupt_enables_t.

Also enables the respective interrupts as per selected interrupt flags.

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.


Definition at line 178 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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.

Parameters
[in]group_number

pointer to interrupts enable structure sl_sysrtc_interrupt_enables_t.

[in]interrupt_enabled_handle

SYSRTC group number whose interrupts needs to be enabled.

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.


Definition at line 197 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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.

Parameters
[in]group_number

SYSRTC group number to use.

[in]channel

Channel number to use.

[in]compare_value

Compare register value.

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.


Definition at line 214 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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 current compare register value for selected channel of selected group.

Parameters
[in]group_number

SYSRTC group number to use.

[in]channel

Channel number to use.

[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.


Definition at line 229 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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 for the capture channel of the selected group of SYSRTC.

Parameters
[in]group_number

SYSRTC group number to use.

In other words, configures the SYSRTC Input (Capture) from register.

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.


Definition at line 248 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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 input pins for the SYSRTC capture channel of selected group.

Parameters
[in]group_number

SYSRTC group number to use.

Configures gpio-0 and gpio-1 as input pins for the capture channel of group0 & group-1 respectively. Sets pins mode, mux and direction.

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.


Definition at line 267 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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 the output pins of the selected compare channel of given group.

Parameters
[in]group_number

SYSRTC group number to use.

[in]channel

Channel number to use.

Configures gpio-3 and gpio-4 as output pins for compare channel 0 & 1 of group0 respectively. Configures gpio-1 and gpio-2 as output pins for compare channel 0 & 1 of group1 respectively.. Sets pins mode, mux and direction. Also enables pins input buffer.

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.


Definition at line 286 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_get_count#

sl_status_t sl_si91x_sysrtc_get_count (uint32_t * count_value)

Gets the SYSRTC current counter register value.

Parameters
[in]count_value

Pointer to the variable to store count value read.

Updates the current count of the timer to count_value input parameter. 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.


Definition at line 297 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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 the SYSRTC capture register value of a given group.

Parameters
[in]group_number

SYSRTC group number to use.

[in]capture_value

Pointer to the variable to store capture value read.

Updates the capture count value of timer to capture_value input parameter.

Returns

  • status 0 if successful, else error code as follows:

    • SL_STATUS_NULL_POINTER (0x0022) - capture_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.


Definition at line 310 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

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)

Reads the SYSRTC compare channel output bit value of a given group.

Parameters
[in]group_number

SYSRTC group number to use.

[in]channel

Channel number to use.

[in]compare_output_bit

Pointer to the variable to store compare output.

Updates the bit value to compare_output_bit input parameter.

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.


Definition at line 324 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_is_running#

sl_status_t sl_si91x_sysrtc_is_running (boolean_t * running_status)

Gets the SYSRTC running status, status is true if running, false if stopped.

Parameters
[in]running_status

Pointer to the variable to store the SYSRTC running status.

Updates 'true' if SYSRTC is running else 'false' if not running, to the running_status input parameter.

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.


Definition at line 338 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_is_locked#

sl_status_t sl_si91x_sysrtc_is_locked (boolean_t * lock_status)

Gets the SYSRTC lock status.

Parameters
[in]lock_status

Pointer to the variable to store SYSRTC lock status.

Updates 'true' if SYSRTC is locked, 'false' if unlocked, to the lock_status input parameter.

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.


Definition at line 350 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_enable_input_output_gpio#

void sl_si91x_sysrtc_enable_input_output_gpio (bool is_gpio_enabled)

Sets the SYSRTC input output mode for the capture and compare channels.

Parameters
[in]is_gpio_enabled

Bool to enable or disable IO through GPIO.

If passed true, then input to capture channel and output of compare channel will be through GPIO, else disabled.

Returns

  • none


Definition at line 360 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_start#

__STATIC_INLINE void sl_si91x_sysrtc_start (void )

Starts the SYSRTC counter.

Parameters
N/A

This function will send a start command to the SYSRTC peripheral. It waits till the start command to be executed.

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


Definition at line 383 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_stop#

__STATIC_INLINE void sl_si91x_sysrtc_stop (void )

Stops the SYSRTC counter.

Parameters
N/A

This function will send a stop command to the SYSRTC peripheral. It waits till the stop command to be executed.

Note

  • This function requires the SYSRTC to be enabled.

Returns

  • none


Definition at line 398 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_reset#

__STATIC_INLINE void sl_si91x_sysrtc_reset (void )

Restores the SYSRTC to its reset state.

Parameters
N/A

Returns

  • none


Definition at line 409 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_lock#

__STATIC_INLINE void sl_si91x_sysrtc_lock (void )

Locks the SYSRTC registers.

Parameters
N/A

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


Definition at line 422 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_unlock#

__STATIC_INLINE void sl_si91x_sysrtc_unlock (void )

Unlocks the SYSRTC registers.

Parameters
N/A

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


Definition at line 438 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_set_count#

__STATIC_INLINE void sl_si91x_sysrtc_set_count (uint32_t value)

Sets the SYSRTC counter register value of counter This can be used to change the count of SYSRTC, when it is stopped.

Parameters
[in]value

The new SYSRTC counter value.

After calling this API user should start SYSRTC.

Returns

  • none


Definition at line 454 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_get_version#

sl_sysrtc_version_t sl_si91x_sysrtc_get_version (void )

Gets the SYSRTC version It returns API version of SYSRTC.

Parameters
[in]

Returns


Definition at line 467 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h

sl_si91x_sysrtc_deinit#

void sl_si91x_sysrtc_deinit (void )

De-initializes the SYSRTC by disabling its clock.

Parameters
[in]

Returns

  • none

Note

  • Unregisters the SYSRTC callback and disables all interrupts.


Definition at line 475 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_sysrtc.h