![]() |
NMSIS-Core
Version 1.5.0
NMSIS-Core support for Nuclei processor-based devices
|
Functions to access the Core CSR Registers. More...
Macros | |
| #define | __RV_CSR_SWAP(csr, val) |
| CSR operation Macro for csrrw instruction. More... | |
| #define | __RV_CSR_READ(csr) |
| CSR operation Macro for csrr instruction. More... | |
| #define | __RV_CSR_WRITE(csr, val) |
| CSR operation Macro for csrw instruction. More... | |
| #define | __RV_CSR_READ_SET(csr, val) |
| CSR operation Macro for csrrs instruction. More... | |
| #define | __RV_CSR_SET(csr, val) |
| CSR operation Macro for csrs instruction. More... | |
| #define | __RV_CSR_READ_CLEAR(csr, val) |
| CSR operation Macro for csrrc instruction. More... | |
| #define | __RV_CSR_CLEAR(csr, val) |
| CSR operation Macro for csrc instruction. More... | |
| #define | __FENCE(p, s) __ASM volatile ("fence " #p "," #s : : : "memory") |
| Execute fence instruction, p -> pred, s -> succ. More... | |
| #define | __RWMB() __FENCE(iorw,iorw) |
| Read & Write Memory barrier. More... | |
| #define | __RMB() __FENCE(ir,ir) |
| Read Memory barrier. More... | |
| #define | __WMB() __FENCE(ow,ow) |
| Write Memory barrier. More... | |
| #define | __SMP_RWMB() __FENCE(rw,rw) |
| SMP Read & Write Memory barrier. More... | |
| #define | __SMP_RMB() __FENCE(r,r) |
| SMP Read Memory barrier. More... | |
| #define | __SMP_WMB() __FENCE(w,w) |
| SMP Write Memory barrier. More... | |
| #define | __CPU_RELAX() __ASM volatile ("" : : : "memory") |
| CPU relax for busy loop. More... | |
Functions | |
| __STATIC_FORCEINLINE void | __FENCE_I (void) |
| Fence.i Instruction. More... | |
| __STATIC_INLINE void | __switch_mode (uint8_t mode, uintptr_t stack, void(*entry_point)(void)) |
| switch privilege from machine mode to others. More... | |
| __STATIC_INLINE void | __s_switch_mode (uint8_t mode, uintptr_t stack, void(*entry_point)(void)) |
| switch privilege from supervisor mode to others. More... | |
| __STATIC_FORCEINLINE void | __enable_irq (void) |
| Enable IRQ Interrupts. More... | |
| __STATIC_FORCEINLINE void | __disable_irq (void) |
| Disable IRQ Interrupts. More... | |
| __STATIC_FORCEINLINE void | __enable_ext_irq (void) |
| Enable External IRQ Interrupts. More... | |
| __STATIC_FORCEINLINE void | __disable_ext_irq (void) |
| Disable External IRQ Interrupts. More... | |
| __STATIC_FORCEINLINE void | __enable_timer_irq (void) |
| Enable Timer IRQ Interrupts. More... | |
| __STATIC_FORCEINLINE void | __disable_timer_irq (void) |
| Disable Timer IRQ Interrupts. More... | |
| __STATIC_FORCEINLINE void | __enable_sw_irq (void) |
| Enable software IRQ Interrupts. More... | |
| __STATIC_FORCEINLINE void | __disable_sw_irq (void) |
| Disable software IRQ Interrupts. More... | |
| __STATIC_FORCEINLINE void | __disable_core_irq (uint32_t irq) |
| Disable Core IRQ Interrupt. More... | |
| __STATIC_FORCEINLINE void | __enable_core_irq (uint32_t irq) |
| Enable Core IRQ Interrupt. More... | |
| __STATIC_FORCEINLINE uint32_t | __get_core_irq_pending (uint32_t irq) |
| Get Core IRQ Interrupt Pending status. More... | |
| __STATIC_FORCEINLINE void | __clear_core_irq_pending (uint32_t irq) |
| Clear Core IRQ Interrupt Pending status. More... | |
| __STATIC_FORCEINLINE void | __enable_irq_s (void) |
| Enable IRQ Interrupts in supervisor mode. More... | |
| __STATIC_FORCEINLINE void | __disable_irq_s (void) |
| Disable IRQ Interrupts in supervisor mode. More... | |
| __STATIC_FORCEINLINE void | __enable_ext_irq_s (void) |
| Enable External IRQ Interrupts in supervisor mode. More... | |
| __STATIC_FORCEINLINE void | __disable_ext_irq_s (void) |
| Disable External IRQ Interrupts in supervisor mode. More... | |
| __STATIC_FORCEINLINE void | __enable_timer_irq_s (void) |
| Enable Timer IRQ Interrupts in supervisor mode. More... | |
| __STATIC_FORCEINLINE void | __disable_timer_irq_s (void) |
| Disable Timer IRQ Interrupts in supervisor mode. More... | |
| __STATIC_FORCEINLINE void | __enable_sw_irq_s (void) |
| Enable software IRQ Interrupts in supervisor mode. More... | |
| __STATIC_FORCEINLINE void | __disable_sw_irq_s (void) |
| Disable software IRQ Interrupts in supervisor mode. More... | |
| __STATIC_FORCEINLINE void | __disable_core_irq_s (uint32_t irq) |
| Disable Core IRQ Interrupt in supervisor mode. More... | |
| __STATIC_FORCEINLINE void | __enable_core_irq_s (uint32_t irq) |
| Enable Core IRQ Interrupt in supervisor mode. More... | |
| __STATIC_FORCEINLINE uint32_t | __get_core_irq_pending_s (uint32_t irq) |
| Get Core IRQ Interrupt Pending status in supervisor mode. More... | |
| __STATIC_FORCEINLINE void | __clear_core_irq_pending_s (uint32_t irq) |
| Clear Core IRQ Interrupt Pending status in supervisor mode. More... | |
| __STATIC_INLINE rv_counter_t | __get_rv_cycle (void) |
| Read whole 64 bits value of mcycle counter. More... | |
| __STATIC_FORCEINLINE void | __set_rv_cycle (rv_counter_t cycle) |
| Set whole 64 bits value of mcycle counter. More... | |
| __STATIC_INLINE rv_counter_t | __get_rv_instret (void) |
| Read whole 64 bits value of machine instruction-retired counter. More... | |
| __STATIC_FORCEINLINE void | __set_rv_instret (rv_counter_t instret) |
| Set whole 64 bits value of machine instruction-retired counter. More... | |
| __STATIC_INLINE rv_counter_t | __get_rv_time (void) |
| Read whole 64 bits value of real-time clock. More... | |
| __STATIC_FORCEINLINE unsigned long | __read_cycle_csr (void) |
| Read the CYCLE register. More... | |
| __STATIC_FORCEINLINE unsigned long | __read_instret_csr (void) |
| Read the INSTRET register. More... | |
| __STATIC_FORCEINLINE unsigned long | __read_time_csr (void) |
| Read the TIME register. More... | |
| __STATIC_FORCEINLINE unsigned long | __get_cluster_id (void) |
| Get cluster id of current cluster. More... | |
| __STATIC_FORCEINLINE unsigned long | __get_hart_index (void) |
| Get hart index of current cluster. More... | |
| __STATIC_FORCEINLINE unsigned long | __get_hart_id (void) |
| Get hart id of current cluster. More... | |
| __STATIC_FORCEINLINE unsigned long | __get_cluster_id_s (void) |
| Get cluster id of current cluster in supervisor mode. More... | |
| __STATIC_FORCEINLINE unsigned long | __get_hart_index_s (void) |
| Get hart index of current cluster in supervisor mode. More... | |
| __STATIC_FORCEINLINE unsigned long | __get_hart_id_s (void) |
| Get hart id of current cluster in supervisor mode. More... | |
Functions to access the Core CSR Registers.
The following functions or macros provide access to Core CSR registers.
| #define __CPU_RELAX | ( | ) | __ASM volatile ("" : : : "memory") |
CPU relax for busy loop.
Definition at line 868 of file core_feature_base.h.
| #define __FENCE | ( | p, | |
| s | |||
| ) | __ASM volatile ("fence " #p "," #s : : : "memory") |
Execute fence instruction, p -> pred, s -> succ.
the FENCE instruction ensures that all memory accesses from instructions preceding the fence in program order (the predecessor set) appear earlier in the global memory order than memory accesses from instructions appearing after the fence in program order (the successor set). For details, please refer to The RISC-V Instruction Set Manual
| p | predecessor set, such as iorw, rw, r, w |
| s | successor set, such as iorw, rw, r, w |
Definition at line 833 of file core_feature_base.h.
| #define __RMB | ( | ) | __FENCE(ir,ir) |
Read Memory barrier.
Definition at line 853 of file core_feature_base.h.
| #define __RV_CSR_CLEAR | ( | csr, | |
| val | |||
| ) |
CSR operation Macro for csrc instruction.
Set csr register to be csr_content & ~val
| csr | CSR macro definition defined in Core CSR Registers, eg. CSR_MSTATUS |
| val | Mask value to be used wih csrc instruction |
Definition at line 799 of file core_feature_base.h.
| #define __RV_CSR_READ | ( | csr | ) |
CSR operation Macro for csrr instruction.
Read the content of csr register to __v and return it
| csr | CSR macro definition defined in Core CSR Registers, eg. CSR_MSTATUS |
Definition at line 707 of file core_feature_base.h.
| #define __RV_CSR_READ_CLEAR | ( | csr, | |
| val | |||
| ) |
CSR operation Macro for csrrc instruction.
Read the content of csr register to __v, then set csr register to be __v & ~val, then return __v
| csr | CSR macro definition defined in Core CSR Registers, eg. CSR_MSTATUS |
| val | Mask value to be used wih csrrc instruction |
Definition at line 781 of file core_feature_base.h.
| #define __RV_CSR_READ_SET | ( | csr, | |
| val | |||
| ) |
CSR operation Macro for csrrs instruction.
Read the content of csr register to __v, then set csr register to be __v | val, then return __v
| csr | CSR macro definition defined in Core CSR Registers, eg. CSR_MSTATUS |
| val | Mask value to be used wih csrrs instruction |
Definition at line 744 of file core_feature_base.h.
| #define __RV_CSR_SET | ( | csr, | |
| val | |||
| ) |
CSR operation Macro for csrs instruction.
Set csr register to be csr_content | val
| csr | CSR macro definition defined in Core CSR Registers, eg. CSR_MSTATUS |
| val | Mask value to be used wih csrs instruction |
Definition at line 762 of file core_feature_base.h.
| #define __RV_CSR_SWAP | ( | csr, | |
| val | |||
| ) |
CSR operation Macro for csrrw instruction.
Read the content of csr register to __v, then write content of val into csr register, then return __v
| csr | CSR macro definition defined in Core CSR Registers, eg. CSR_MSTATUS |
| val | value to store into the CSR register |
Definition at line 689 of file core_feature_base.h.
| #define __RV_CSR_WRITE | ( | csr, | |
| val | |||
| ) |
CSR operation Macro for csrw instruction.
Write the content of val to csr register
| csr | CSR macro definition defined in Core CSR Registers, eg. CSR_MSTATUS |
| val | value to store into the CSR register |
Definition at line 725 of file core_feature_base.h.
| #define __RWMB | ( | ) | __FENCE(iorw,iorw) |
Read & Write Memory barrier.
Definition at line 850 of file core_feature_base.h.
| #define __SMP_RMB | ( | ) | __FENCE(r,r) |
SMP Read Memory barrier.
Definition at line 862 of file core_feature_base.h.
| #define __SMP_RWMB | ( | ) | __FENCE(rw,rw) |
SMP Read & Write Memory barrier.
Definition at line 859 of file core_feature_base.h.
| #define __SMP_WMB | ( | ) | __FENCE(w,w) |
SMP Write Memory barrier.
Definition at line 865 of file core_feature_base.h.
| #define __WMB | ( | ) | __FENCE(ow,ow) |
Write Memory barrier.
Definition at line 856 of file core_feature_base.h.
| __STATIC_FORCEINLINE void __clear_core_irq_pending | ( | uint32_t | irq | ) |
Clear Core IRQ Interrupt Pending status.
Clear Core IRQ interrupt pending status of irq bit.
Definition at line 1057 of file core_feature_base.h.
References __RV_CSR_CLEAR, and CSR_MIP.
| __STATIC_FORCEINLINE void __clear_core_irq_pending_s | ( | uint32_t | irq | ) |
Clear Core IRQ Interrupt Pending status in supervisor mode.
Clear Core IRQ interrupt pending status of irq bit.
Definition at line 1189 of file core_feature_base.h.
References __RV_CSR_CLEAR, and CSR_SIP.
| __STATIC_FORCEINLINE void __disable_core_irq | ( | uint32_t | irq | ) |
Disable Core IRQ Interrupt.
Disable Core IRQ interrupt by clearing the irq bit in the MIE Register.
Definition at line 1024 of file core_feature_base.h.
References __RV_CSR_CLEAR, and CSR_MIE.
| __STATIC_FORCEINLINE void __disable_core_irq_s | ( | uint32_t | irq | ) |
Disable Core IRQ Interrupt in supervisor mode.
Disable Core IRQ interrupt by clearing the irq bit in the SIE Register.
Definition at line 1156 of file core_feature_base.h.
References __RV_CSR_CLEAR, and CSR_SIE.
| __STATIC_FORCEINLINE void __disable_ext_irq | ( | void | ) |
Disable External IRQ Interrupts.
Disables External IRQ interrupts by clearing the MEIE-bit in the MIE Register.
Definition at line 969 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_MIE, and MIE_MEIE.
| __STATIC_FORCEINLINE void __disable_ext_irq_s | ( | void | ) |
Disable External IRQ Interrupts in supervisor mode.
Disables External IRQ interrupts by clearing the SEIE-bit in the SIE Register.
Definition at line 1101 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_SIE, and SIE_SEIE.
| __STATIC_FORCEINLINE void __disable_irq | ( | void | ) |
Disable IRQ Interrupts.
Disables IRQ interrupts by clearing the MIE-bit in the MSTATUS Register.
Definition at line 947 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_MSTATUS, and MSTATUS_MIE.
| __STATIC_FORCEINLINE void __disable_irq_s | ( | void | ) |
Disable IRQ Interrupts in supervisor mode.
Disables IRQ interrupts by clearing the SIE-bit in the SSTATUS Register.
Definition at line 1079 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_SSTATUS, and SSTATUS_SIE.
| __STATIC_FORCEINLINE void __disable_sw_irq | ( | void | ) |
Disable software IRQ Interrupts.
Disables software IRQ interrupts by clearing the MSIE-bit in the MIE Register.
Definition at line 1013 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_MIE, and MIE_MSIE.
| __STATIC_FORCEINLINE void __disable_sw_irq_s | ( | void | ) |
Disable software IRQ Interrupts in supervisor mode.
Disables software IRQ interrupts by clearing the SSIE-bit in the SIE Register.
Definition at line 1145 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_SIE, and SIE_SSIE.
| __STATIC_FORCEINLINE void __disable_timer_irq | ( | void | ) |
Disable Timer IRQ Interrupts.
Disables Timer IRQ interrupts by clearing the MTIE-bit in the MIE Register.
Definition at line 991 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_MIE, and MIE_MTIE.
| __STATIC_FORCEINLINE void __disable_timer_irq_s | ( | void | ) |
Disable Timer IRQ Interrupts in supervisor mode.
Disables Timer IRQ interrupts by clearing the STIE-bit in the SIE Register.
Definition at line 1123 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_SIE, and SIE_STIE.
| __STATIC_FORCEINLINE void __enable_core_irq | ( | uint32_t | irq | ) |
Enable Core IRQ Interrupt.
Enable Core IRQ interrupt by setting the irq bit in the MIE Register.
Definition at line 1035 of file core_feature_base.h.
References __RV_CSR_SET, and CSR_MIE.
| __STATIC_FORCEINLINE void __enable_core_irq_s | ( | uint32_t | irq | ) |
Enable Core IRQ Interrupt in supervisor mode.
Enable Core IRQ interrupt by setting the irq bit in the MIE Register.
Definition at line 1167 of file core_feature_base.h.
References __RV_CSR_SET, and CSR_SIE.
| __STATIC_FORCEINLINE void __enable_ext_irq | ( | void | ) |
Enable External IRQ Interrupts.
Enables External IRQ interrupts by setting the MEIE-bit in the MIE Register.
Definition at line 958 of file core_feature_base.h.
References __RV_CSR_SET, CSR_MIE, and MIE_MEIE.
Referenced by PLIC_Register_IRQ().
| __STATIC_FORCEINLINE void __enable_ext_irq_s | ( | void | ) |
Enable External IRQ Interrupts in supervisor mode.
Enables External IRQ interrupts by setting the SEIE-bit in the SIE Register.
Definition at line 1090 of file core_feature_base.h.
References __RV_CSR_SET, CSR_SIE, and SIE_SEIE.
Referenced by PLIC_Register_IRQ_S().
| __STATIC_FORCEINLINE void __enable_irq | ( | void | ) |
Enable IRQ Interrupts.
Enables IRQ interrupts by setting the MIE-bit in the MSTATUS Register.
Definition at line 936 of file core_feature_base.h.
References __RV_CSR_SET, CSR_MSTATUS, and MSTATUS_MIE.
| __STATIC_FORCEINLINE void __enable_irq_s | ( | void | ) |
Enable IRQ Interrupts in supervisor mode.
Enables IRQ interrupts by setting the SIE-bit in the SSTATUS Register.
Definition at line 1068 of file core_feature_base.h.
References __RV_CSR_SET, CSR_SSTATUS, and SSTATUS_SIE.
| __STATIC_FORCEINLINE void __enable_sw_irq | ( | void | ) |
Enable software IRQ Interrupts.
Enables software IRQ interrupts by setting the MSIE-bit in the MIE Register.
Definition at line 1002 of file core_feature_base.h.
References __RV_CSR_SET, CSR_MIE, and MIE_MSIE.
Referenced by Core_Register_IRQ().
| __STATIC_FORCEINLINE void __enable_sw_irq_s | ( | void | ) |
Enable software IRQ Interrupts in supervisor mode.
Enables software IRQ interrupts by setting the SSIE-bit in the SIE Register.
Definition at line 1134 of file core_feature_base.h.
References __RV_CSR_SET, CSR_SIE, and SIE_SSIE.
Referenced by Core_Register_IRQ_S().
| __STATIC_FORCEINLINE void __enable_timer_irq | ( | void | ) |
Enable Timer IRQ Interrupts.
Enables Timer IRQ interrupts by setting the MTIE-bit in the MIE Register.
Definition at line 980 of file core_feature_base.h.
References __RV_CSR_SET, CSR_MIE, and MIE_MTIE.
Referenced by Core_Register_IRQ().
| __STATIC_FORCEINLINE void __enable_timer_irq_s | ( | void | ) |
Enable Timer IRQ Interrupts in supervisor mode.
Enables Timer IRQ interrupts by setting the STIE-bit in the SIE Register.
Definition at line 1112 of file core_feature_base.h.
References __RV_CSR_SET, CSR_SIE, and SIE_STIE.
Referenced by Core_Register_IRQ_S().
| __STATIC_FORCEINLINE void __FENCE_I | ( | void | ) |
Fence.i Instruction.
The FENCE.I instruction is used to synchronize the instruction and data streams.
Definition at line 841 of file core_feature_base.h.
References __ASM.
Referenced by __ECLIC_SetVector(), __ECLIC_SetVector_S(), _premain_init(), and PMA_SetRegion().
| __STATIC_FORCEINLINE unsigned long __get_cluster_id | ( | void | ) |
Get cluster id of current cluster.
This function will get cluster id of current cluster in a multiple cluster system
Definition at line 1392 of file core_feature_base.h.
References __RV_CSR_READ, and CSR_MHARTID.
| __STATIC_FORCEINLINE unsigned long __get_cluster_id_s | ( | void | ) |
Get cluster id of current cluster in supervisor mode.
This function will get cluster id of current cluster in a multiple cluster system
Definition at line 1444 of file core_feature_base.h.
References __RV_CSR_READ, and CSR_SHARTID.
| __STATIC_FORCEINLINE uint32_t __get_core_irq_pending | ( | uint32_t | irq | ) |
Get Core IRQ Interrupt Pending status.
Get Core IRQ interrupt pending status of irq bit.
Definition at line 1046 of file core_feature_base.h.
References __RV_CSR_READ, and CSR_MIP.
| __STATIC_FORCEINLINE uint32_t __get_core_irq_pending_s | ( | uint32_t | irq | ) |
Get Core IRQ Interrupt Pending status in supervisor mode.
Get Core IRQ interrupt pending status of irq bit.
Definition at line 1178 of file core_feature_base.h.
References __RV_CSR_READ, and CSR_SIP.
| __STATIC_FORCEINLINE unsigned long __get_hart_id | ( | void | ) |
Get hart id of current cluster.
This function will get hart id of current cluster in a multiple cluster system
Definition at line 1428 of file core_feature_base.h.
References __RV_CSR_READ, and CSR_MHARTID.
Referenced by _premain_init(), system_default_exception_handler(), and SystemBannerPrint().
| __STATIC_FORCEINLINE unsigned long __get_hart_id_s | ( | void | ) |
Get hart id of current cluster in supervisor mode.
This function will get hart id of current cluster in a multiple cluster system
Definition at line 1482 of file core_feature_base.h.
References __RV_CSR_READ, and CSR_SHARTID.
| __STATIC_FORCEINLINE unsigned long __get_hart_index | ( | void | ) |
Get hart index of current cluster.
This function will get hart index of current cluster in a multiple cluster system, hart index is hartid - hartid offset, for example if your hartid is 1, and offset is 1, then hart index is 0
Definition at line 1408 of file core_feature_base.h.
References __RV_CSR_READ, and CSR_MHARTID.
| __STATIC_FORCEINLINE unsigned long __get_hart_index_s | ( | void | ) |
Get hart index of current cluster in supervisor mode.
This function will get hart index of current cluster in a multiple cluster system, hart index is hartid - hartid offset, for example if your hartid is 1, and offset is 1, then hart index is 0
Definition at line 1461 of file core_feature_base.h.
References __RV_CSR_READ, and CSR_SHARTID.
| __STATIC_INLINE rv_counter_t __get_rv_cycle | ( | void | ) |
Read whole 64 bits value of mcycle counter.
This function will read the whole 64 bits of MCYCLE register
Definition at line 1200 of file core_feature_base.h.
References __RV_CSR_READ, __RWMB, CSR_MCYCLE, and CSR_MCYCLEH.
Referenced by __get_hpm_counter().
| __STATIC_INLINE rv_counter_t __get_rv_instret | ( | void | ) |
Read whole 64 bits value of machine instruction-retired counter.
This function will read the whole 64 bits of MINSTRET register
Definition at line 1255 of file core_feature_base.h.
References __RV_CSR_READ, __RWMB, CSR_MINSTRET, and CSR_MINSTRETH.
Referenced by __get_hpm_counter().
| __STATIC_INLINE rv_counter_t __get_rv_time | ( | void | ) |
Read whole 64 bits value of real-time clock.
This function will read the whole 64 bits of TIME register
Definition at line 1309 of file core_feature_base.h.
References __RV_CSR_READ, __RWMB, CSR_MIRGB_INFO, CSR_MTIME, CSR_TIME, and CSR_TIMEH.
Referenced by SysTick_Config_S(), and SysTick_Reload_S().
| __STATIC_FORCEINLINE unsigned long __read_cycle_csr | ( | void | ) |
Read the CYCLE register.
This function will read the CYCLE register without taking the CYCLEH register into account
Definition at line 1351 of file core_feature_base.h.
References __RV_CSR_READ, __RWMB, and CSR_CYCLE.
Referenced by __read_hpm_counter().
| __STATIC_FORCEINLINE unsigned long __read_instret_csr | ( | void | ) |
Read the INSTRET register.
This function will read the INSTRET register without taking the INSTRETH register into account
Definition at line 1365 of file core_feature_base.h.
References __RV_CSR_READ, __RWMB, and CSR_INSTRET.
Referenced by __read_hpm_counter().
| __STATIC_FORCEINLINE unsigned long __read_time_csr | ( | void | ) |
Read the TIME register.
This function will read the TIME register without taking the TIMEH register into account
Definition at line 1379 of file core_feature_base.h.
References __RV_CSR_READ, __RWMB, and CSR_TIME.
| __STATIC_INLINE void __s_switch_mode | ( | uint8_t | mode, |
| uintptr_t | stack, | ||
| void(*)(void) | entry_point | ||
| ) |
switch privilege from supervisor mode to others.
Execute into entry_point in mode(user) with given stack
| mode | privilege mode |
| stack | predefined stack, size should set enough |
| entry_point | a function pointer to execute |
Definition at line 908 of file core_feature_base.h.
References __ASM, __RV_CSR_READ, __RV_CSR_WRITE, CSR_SEPC, CSR_SSTATUS, SSTATUS_SPIE, and SSTATUS_SPP.
| __STATIC_FORCEINLINE void __set_rv_cycle | ( | rv_counter_t | cycle | ) |
Set whole 64 bits value of mcycle counter.
This function will set the whole 64 bits of MCYCLE register
Definition at line 1233 of file core_feature_base.h.
References __RV_CSR_WRITE, CSR_MCYCLE, and CSR_MCYCLEH.
| __STATIC_FORCEINLINE void __set_rv_instret | ( | rv_counter_t | instret | ) |
Set whole 64 bits value of machine instruction-retired counter.
This function will set the whole 64 bits of MINSTRET register
Definition at line 1286 of file core_feature_base.h.
References __RV_CSR_WRITE, CSR_MINSTRET, and CSR_MINSTRETH.
| __STATIC_INLINE void __switch_mode | ( | uint8_t | mode, |
| uintptr_t | stack, | ||
| void(*)(void) | entry_point | ||
| ) |
switch privilege from machine mode to others.
Execute into entry_point in mode(supervisor or user) with given stack
| mode | privilege mode |
| stack | predefined stack, size should set enough |
| entry_point | a function pointer to execute |
Definition at line 878 of file core_feature_base.h.
References __ASM, __RV_CSR_READ, __RV_CSR_WRITE, CSR_MEPC, CSR_MSTATUS, MSTATUS_MPIE, and MSTATUS_MPP.