NMSIS-Core
Version 1.3.1
NMSIS-Core support for Nuclei processor-based devices
|
Functions that configure the Core System Timer. More...
Macros | |
#define | SysTimer_GetHartID() (__get_hart_index()) |
SysTimer_GetHartID() is used to get timer hartid which might not be the same as cpu hart id, for example, cpu hartid may be 1, but timer hartid may be 0, then timer hartid offset is 1. More... | |
Functions | |
__STATIC_FORCEINLINE void | SysTimer_SetLoadValue (uint64_t value) |
Set system timer load value. More... | |
__STATIC_FORCEINLINE uint64_t | SysTimer_GetLoadValue (void) |
Get system timer load value. More... | |
__STATIC_FORCEINLINE void | SysTimer_SetHartCompareValue (uint64_t value, unsigned long hartid) |
Set system timer compare value by hartid. More... | |
__STATIC_FORCEINLINE void | SysTimer_SetCompareValue (uint64_t value) |
Set system timer compare value in machine mode. More... | |
__STATIC_FORCEINLINE uint64_t | SysTimer_GetHartCompareValue (unsigned long hartid) |
Get system timer compare value by hartid. More... | |
__STATIC_FORCEINLINE uint64_t | SysTimer_GetCompareValue (void) |
Get system timer compare value in machine mode. More... | |
__STATIC_FORCEINLINE void | SysTimer_Start (void) |
Enable system timer counter running. More... | |
__STATIC_FORCEINLINE void | SysTimer_Stop (void) |
Stop system timer counter running. More... | |
__STATIC_FORCEINLINE void | SysTimer_SetControlValue (uint32_t mctl) |
Set system timer control value. More... | |
__STATIC_FORCEINLINE uint32_t | SysTimer_GetControlValue (void) |
Get system timer control value. More... | |
__STATIC_FORCEINLINE void | SysTimer_SetHartSWIRQ (unsigned long hartid) |
Trigger or set software interrupt via system timer by hartid. More... | |
__STATIC_FORCEINLINE void | SysTimer_SetSWIRQ (void) |
Trigger or set software interrupt via system timer in machine mode. More... | |
__STATIC_FORCEINLINE void | SysTimer_ClearHartSWIRQ (unsigned long hartid) |
Clear system timer software interrupt pending request by hartid. More... | |
__STATIC_FORCEINLINE void | SysTimer_ClearSWIRQ (void) |
Clear system timer software interrupt pending request in machine mode. More... | |
__STATIC_FORCEINLINE uint32_t | SysTimer_GetHartMsipValue (unsigned long hartid) |
Get system timer MSIP register value by hartid. More... | |
__STATIC_FORCEINLINE uint32_t | SysTimer_GetMsipValue (void) |
Get system timer MSIP register value in machine mode. More... | |
__STATIC_FORCEINLINE void | SysTimer_SetHartMsipValue (uint32_t msip, unsigned long hartid) |
Set system timer MSIP register value by hartid. More... | |
__STATIC_FORCEINLINE void | SysTimer_SetMsipValue (uint32_t msip) |
Set system timer MSIP register value in machine mode. More... | |
__STATIC_FORCEINLINE void | SysTimer_SoftwareReset (void) |
Do software reset request. More... | |
__STATIC_FORCEINLINE void | SysTimer_SendIPI (unsigned long hartid) |
send ipi to target hart using Systimer Clint More... | |
__STATIC_FORCEINLINE void | SysTimer_ClearIPI (unsigned long hartid) |
clear ipi to target hart using Systimer Clint More... | |
__STATIC_INLINE uint32_t | SysTick_Config (uint64_t ticks) |
System Tick Configuration. More... | |
__STATIC_INLINE uint32_t | SysTick_HartConfig (uint64_t ticks, unsigned long hartid) |
System Tick Configuration By hartid. More... | |
__STATIC_FORCEINLINE uint32_t | SysTick_Reload (uint64_t ticks) |
System Tick Reload. More... | |
__STATIC_FORCEINLINE uint32_t | SysTick_HartReload (uint64_t ticks, unsigned long hartid) |
System Tick Reload. More... | |
Functions that configure the Core System Timer.
#define SysTimer_GetHartID | ( | ) | (__get_hart_index()) |
SysTimer_GetHartID() is used to get timer hartid which might not be the same as cpu hart id, for example, cpu hartid may be 1, but timer hartid may be 0, then timer hartid offset is 1.
If defined __SYSTIMER_HARTID, it will use __SYSTIMER_HARTID as timer hartid, otherwise, it will use __get_hart_index(). The cpu hartid is get by using __get_hart_id function
Definition at line 118 of file core_feature_timer.h.
__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.
[in] | ticks | Number of ticks between two interrupts. |
Definition at line 545 of file core_feature_timer.h.
References ECLIC_EnableIRQ, ECLIC_NON_VECTOR_INTERRUPT, ECLIC_SetLevelIRQ, ECLIC_SetShvIRQ, SysTimer_GetLoadValue(), SysTimer_IRQn, and SysTimer_SetCompareValue().
__STATIC_INLINE uint32_t SysTick_HartConfig | ( | uint64_t | ticks, |
unsigned long | hartid | ||
) |
System Tick Configuration By hartid.
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.
[in] | ticks | Number of ticks between two interrupts. |
[in] | hartid | hart ID, one hart is required to have a known hart ID of 0, other harts ID can be in 1~1023. |
Definition at line 581 of file core_feature_timer.h.
References ECLIC_EnableIRQ, ECLIC_NON_VECTOR_INTERRUPT, ECLIC_SetLevelIRQ, ECLIC_SetShvIRQ, SysTimer_GetLoadValue(), SysTimer_IRQn, and SysTimer_SetHartCompareValue().
__STATIC_FORCEINLINE uint32_t SysTick_HartReload | ( | uint64_t | ticks, |
unsigned long | hartid | ||
) |
System Tick Reload.
Reload the System Timer Tick when the MTIMECMP reached TIME value
[in] | ticks | Number of ticks between two interrupts. |
[in] | hartid | hart ID, one hart is required to have a known hart ID of 0, other harts ID can be in 1~1023. |
Definition at line 657 of file core_feature_timer.h.
References __USUALLY, SysTimer_GetLoadValue(), SysTimer_SetHartCompareValue(), and SysTimer_SetLoadValue().
__STATIC_FORCEINLINE uint32_t SysTick_Reload | ( | uint64_t | ticks | ) |
System Tick Reload.
Reload the System Timer Tick when the MTIMECMP reached TIME value
[in] | ticks | Number of ticks between two interrupts. |
Definition at line 614 of file core_feature_timer.h.
References __USUALLY, SysTimer_GetLoadValue(), SysTimer_SetCompareValue(), and SysTimer_SetLoadValue().
__STATIC_FORCEINLINE void SysTimer_ClearHartSWIRQ | ( | unsigned long | hartid | ) |
Clear system timer software interrupt pending request by hartid.
This function clear the system timer MSIP bit in MSIP register.
[in] | hartid | hart ID, one hart is required to have a known hart ID of 0, other harts ID can be in 1~1023. |
Definition at line 379 of file core_feature_timer.h.
References __SW(), SysTimer, SysTimer_CLINT_MSIP_BASE, and SysTimer_MSIP_MSIP_Msk.
Referenced by SysTimer_ClearSWIRQ().
__STATIC_FORCEINLINE void SysTimer_ClearIPI | ( | unsigned long | hartid | ) |
clear ipi to target hart using Systimer Clint
This function clear ipi using Systimer clint timer.
[in] | hart | target hart |
Definition at line 514 of file core_feature_timer.h.
References __SW(), and SysTimer_CLINT_MSIP_BASE.
__STATIC_FORCEINLINE void SysTimer_ClearSWIRQ | ( | void | ) |
Clear system timer software interrupt pending request in machine mode.
This function clear the system timer MSIP bit in MSIP register.
Definition at line 398 of file core_feature_timer.h.
References SysTimer_ClearHartSWIRQ(), and SysTimer_GetHartID.
__STATIC_FORCEINLINE uint64_t SysTimer_GetCompareValue | ( | void | ) |
Get system timer compare value in machine mode.
This function get the system timer compare value in MTIMERCMP register.
Definition at line 272 of file core_feature_timer.h.
References SysTimer_GetHartCompareValue(), and SysTimer_GetHartID.
__STATIC_FORCEINLINE uint32_t SysTimer_GetControlValue | ( | void | ) |
Get system timer control value.
This function get the system timer MTIMECTL register value.
Definition at line 327 of file core_feature_timer.h.
References SysTimer, and SysTimer_MTIMECTL_Msk.
__STATIC_FORCEINLINE uint64_t SysTimer_GetHartCompareValue | ( | unsigned long | hartid | ) |
Get system timer compare value by hartid.
This function get the system timer compare value in MTIMERCMP register.
[in] | hartid | hart ID, one hart is required to have a known hart ID of 0, other harts ID can be in 1~1023. |
Definition at line 242 of file core_feature_timer.h.
References __LW(), SysTimer, and SysTimer_CLINT_MTIMECMP_BASE.
Referenced by SysTimer_GetCompareValue().
__STATIC_FORCEINLINE uint32_t SysTimer_GetHartMsipValue | ( | unsigned long | hartid | ) |
Get system timer MSIP register value by hartid.
This function get the system timer MSIP register value.
[in] | hartid | hart ID, one hart is required to have a known hart ID of 0, other harts ID can be in 1~1023. |
Definition at line 418 of file core_feature_timer.h.
References __LW(), SysTimer, SysTimer_CLINT_MSIP_BASE, and SysTimer_MSIP_Msk.
Referenced by SysTimer_GetMsipValue().
__STATIC_FORCEINLINE uint64_t SysTimer_GetLoadValue | ( | void | ) |
Get system timer load value.
This function get the system timer current value in MTIMER register.
Definition at line 154 of file core_feature_timer.h.
References __LW(), and SysTimer.
Referenced by SysTick_Config(), SysTick_HartConfig(), SysTick_HartReload(), and SysTick_Reload().
__STATIC_FORCEINLINE uint32_t SysTimer_GetMsipValue | ( | void | ) |
Get system timer MSIP register value in machine mode.
This function get the system timer MSIP register value.
Definition at line 440 of file core_feature_timer.h.
References SysTimer_GetHartID, and SysTimer_GetHartMsipValue().
__STATIC_FORCEINLINE void SysTimer_SendIPI | ( | unsigned long | hartid | ) |
send ipi to target hart using Systimer Clint
This function send ipi using clint timer.
[in] | hart | target hart |
Definition at line 502 of file core_feature_timer.h.
References __SW(), and SysTimer_CLINT_MSIP_BASE.
__STATIC_FORCEINLINE void SysTimer_SetCompareValue | ( | uint64_t | value | ) |
Set system timer compare value in machine mode.
This function set the system Timer compare value in MTIMERCMP register.
[in] | value | compare value to set system timer MTIMERCMP register. |
Definition at line 225 of file core_feature_timer.h.
References SysTimer_GetHartID, and SysTimer_SetHartCompareValue().
Referenced by SysTick_Config(), and SysTick_Reload().
__STATIC_FORCEINLINE void SysTimer_SetControlValue | ( | uint32_t | mctl | ) |
Set system timer control value.
This function set the system timer MTIMECTL register value.
[in] | mctl | value to set MTIMECTL register |
Definition at line 314 of file core_feature_timer.h.
References SysTimer, and SysTimer_MTIMECTL_Msk.
__STATIC_FORCEINLINE void SysTimer_SetHartCompareValue | ( | uint64_t | value, |
unsigned long | hartid | ||
) |
Set system timer compare value by hartid.
This function set the system Timer compare value in MTIMERCMP register.
[in] | value | compare value to set system timer MTIMERCMP register. |
[in] | hartid | hart ID, one hart is required to have a known hart ID of 0, other harts ID can be in 1~1023. |
Definition at line 189 of file core_feature_timer.h.
References __SW(), SysTimer, and SysTimer_CLINT_MTIMECMP_BASE.
Referenced by SysTick_HartConfig(), SysTick_HartReload(), and SysTimer_SetCompareValue().
__STATIC_FORCEINLINE void SysTimer_SetHartMsipValue | ( | uint32_t | msip, |
unsigned long | hartid | ||
) |
Set system timer MSIP register value by hartid.
This function set the system timer MSIP register value.
[in] | msip | value to set MSIP register |
[in] | hartid | hart ID, one hart is required to have a known hart ID of 0, other harts ID can be in 1~1023. |
Definition at line 456 of file core_feature_timer.h.
References __SW(), SysTimer, SysTimer_CLINT_MSIP_BASE, and SysTimer_MSIP_Msk.
Referenced by SysTimer_SetMsipValue().
__STATIC_FORCEINLINE void SysTimer_SetHartSWIRQ | ( | unsigned long | hartid | ) |
Trigger or set software interrupt via system timer by hartid.
This function set the system timer MSIP bit in MSIP register.
[in] | hartid | hart ID, one hart is required to have a known hart ID of 0, other harts ID can be in 1~1023. |
Definition at line 343 of file core_feature_timer.h.
References __SW(), SysTimer, SysTimer_CLINT_MSIP_BASE, and SysTimer_MSIP_MSIP_Msk.
Referenced by SysTimer_SetSWIRQ().
__STATIC_FORCEINLINE void SysTimer_SetLoadValue | ( | uint64_t | value | ) |
Set system timer load value.
This function set the system timer load value in MTIMER register.
[in] | value | value to set system timer MTIMER register. |
Definition at line 132 of file core_feature_timer.h.
References __SW(), and SysTimer.
Referenced by SysTick_HartReload(), and SysTick_Reload().
__STATIC_FORCEINLINE void SysTimer_SetMsipValue | ( | uint32_t | msip | ) |
Set system timer MSIP register value in machine mode.
This function set the system timer MSIP register value.
[in] | msip | value to set MSIP register |
Definition at line 473 of file core_feature_timer.h.
References SysTimer_GetHartID, and SysTimer_SetHartMsipValue().
__STATIC_FORCEINLINE void SysTimer_SetSWIRQ | ( | void | ) |
Trigger or set software interrupt via system timer in machine mode.
This function set the system timer MSIP bit in MSIP register.
Definition at line 362 of file core_feature_timer.h.
References SysTimer_GetHartID, and SysTimer_SetHartSWIRQ().
__STATIC_FORCEINLINE void SysTimer_SoftwareReset | ( | void | ) |
Do software reset request.
This function will do software reset request through MTIMER
Definition at line 489 of file core_feature_timer.h.
References SysTimer, and SysTimer_MSFRST_KEY.
__STATIC_FORCEINLINE void SysTimer_Start | ( | void | ) |
Enable system timer counter running.
Enable system timer counter running by clear TIMESTOP bit in MTIMECTL register.
Definition at line 284 of file core_feature_timer.h.
References SysTimer, and SysTimer_MTIMECTL_TIMESTOP_Msk.
__STATIC_FORCEINLINE void SysTimer_Stop | ( | void | ) |
Stop system timer counter running.
Stop system timer counter running by set TIMESTOP bit in MTIMECTL register.
Definition at line 295 of file core_feature_timer.h.
References SysTimer, and SysTimer_MTIMECTL_TIMESTOP_Msk.