Systick Timer(SysTimer)

SysTimer API

__STATIC_FORCEINLINE void SysTimer_SetLoadValue (uint64_t value)
__STATIC_FORCEINLINE uint64_t SysTimer_GetLoadValue (void)
__STATIC_FORCEINLINE void SysTimer_SetCompareValue (uint64_t value)
__STATIC_FORCEINLINE uint64_t SysTimer_GetCompareValue (void)
__STATIC_FORCEINLINE void SysTimer_SetSWIRQ (void)
__STATIC_FORCEINLINE void SysTimer_ClearSWIRQ (void)
__STATIC_FORCEINLINE uint32_t SysTimer_GetMsipValue (void)
__STATIC_FORCEINLINE void SysTimer_SetMsipValue (uint32_t msip)
__STATIC_INLINE uint32_t SysTick_Config (uint64_t ticks)
__STATIC_FORCEINLINE uint32_t SysTick_Reload (uint64_t ticks)
group NMSIS_Core_SysTimer

Functions that configure the Core System Timer.

Functions

__STATIC_FORCEINLINE void SysTimer_SetLoadValue (uint64_t value)

Set system timer load value.

This function set the system timer load value in MTIMER register.

Remark

  • Load value is 64bits wide.

  • SysTimer_GetLoadValue

Parameters

value[in] value to set system timer MTIMER register.

__STATIC_FORCEINLINE uint64_t SysTimer_GetLoadValue (void)

Get system timer load value.

This function get the system timer current value in MTIMER register.

Remark

  • Load value is 64bits wide.

  • SysTimer_SetLoadValue

Returns

current value(64bit) of system timer MTIMER register.

__STATIC_FORCEINLINE void SysTimer_SetCompareValue (uint64_t value)

Set system timer compare value.

This function set the system Timer compare value in MTIMERCMP register.

Remark

  • Compare value is 64bits wide.

  • If compare value is larger than current value timer interrupt generate.

  • Modify the load value or compare value less to clear the interrupt.

  • SysTimer_GetCompareValue

Parameters

value[in] compare value to set system timer MTIMERCMP register.

__STATIC_FORCEINLINE uint64_t SysTimer_GetCompareValue (void)

Get system timer compare value.

This function get the system timer compare value in MTIMERCMP register.

Remark

  • Compare value is 64bits wide.

  • SysTimer_SetCompareValue

Returns

compare value of system timer MTIMERCMP register.

__STATIC_FORCEINLINE void SysTimer_SetSWIRQ (void)

Trigger or set software interrupt via system timer.

This function set the system timer MSIP bit in MSIP register.

Remark

  • Set system timer MSIP bit and generate a SW interrupt.

  • SysTimer_ClearSWIRQ

  • SysTimer_GetMsipValue

__STATIC_FORCEINLINE void SysTimer_ClearSWIRQ (void)

Clear system timer software interrupt pending request.

This function clear the system timer MSIP bit in MSIP register.

Remark

  • Clear system timer MSIP bit in MSIP register to clear the software interrupt pending.

  • SysTimer_SetSWIRQ

  • SysTimer_GetMsipValue

__STATIC_FORCEINLINE uint32_t SysTimer_GetMsipValue (void)

Get system timer MSIP register value.

This function get the system timer MSIP register value.

Remark

  • Bit0 is SW interrupt flag. Bit0 is 1 then SW interrupt set. Bit0 is 0 then SW interrupt clear.

  • SysTimer_SetSWIRQ

  • SysTimer_ClearSWIRQ

Returns

Value of Timer MSIP register.

__STATIC_FORCEINLINE void SysTimer_SetMsipValue (uint32_t msip)

Set system timer MSIP register value.

This function set the system timer MSIP register value.

Parameters

msip[in] value to set MSIP register

__STATIC_INLINE uint32_t SysTick_Config (uint64_t ticks)

System Tick Configuration.

Initializes the System Timer and its non-vector interrupt, and starts the System Tick Timer.

In our default implementation, the timer counter will be set to zero, and it will start a timer compare non-vector interrupt when it matchs the ticks user set, during the timer interrupt user should reload the system tick using SysTick_Reload function or similar function written by user, so it can produce period timer interrupt.

See also

  • SysTimer_SetCompareValue; SysTimer_SetLoadValue

Parameters

ticks[in] Number of ticks between two interrupts.

Returns

0 Function succeeded.

Returns

1 Function failed.

__STATIC_FORCEINLINE uint32_t SysTick_Reload (uint64_t ticks)

System Tick Reload.

Reload the System Timer Tick when the MTIMECMP reached TIME value

See also

  • SysTimer_SetCompareValue

  • SysTimer_SetLoadValue

Parameters

ticks[in] Number of ticks between two interrupts.

Returns

0 Function succeeded.

Returns

1 Function failed.