![]() |
NMSIS-Core
Version 1.0.0-HummingBird
NMSIS-Core support for HummingBird RISC-V 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... | |
Functions | |
__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 uint64_t | __get_rv_cycle (void) |
Read whole 64 bits value of mcycle counter. More... | |
__STATIC_FORCEINLINE uint64_t | __get_rv_instret (void) |
Read whole 64 bits value of machine instruction-retired counter. More... | |
__STATIC_FORCEINLINE uint64_t | __get_rv_time (void) |
Read whole 64 bits value of real-time clock. More... | |
Functions to access the Core CSR Registers.
The following functions or macros provide access to Core CSR registers.
#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 337 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 245 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 319 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 282 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 300 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 227 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 263 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 475 of file core_feature_base.h.
References __RV_CSR_SET, and CSR_MIP.
__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 441 of file core_feature_base.h.
References __RV_CSR_CLEAR, and CSR_MIE.
__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 386 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_MIE, and MIE_MEIE.
__STATIC_FORCEINLINE void __disable_irq | ( | void | ) |
Disable IRQ Interrupts.
Disables IRQ interrupts by clearing the MIE-bit in the MSTATUS Register.
Definition at line 364 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_MSTATUS, and MSTATUS_MIE.
__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 430 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_MIE, and MIE_MSIE.
__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 408 of file core_feature_base.h.
References __RV_CSR_CLEAR, CSR_MIE, and MIE_MTIE.
__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 452 of file core_feature_base.h.
References __RV_CSR_SET, and CSR_MIE.
__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 375 of file core_feature_base.h.
References __RV_CSR_SET, CSR_MIE, and MIE_MEIE.
Referenced by PLIC_Register_IRQ().
__STATIC_FORCEINLINE void __enable_irq | ( | void | ) |
Enable IRQ Interrupts.
Enables IRQ interrupts by setting the MIE-bit in the MSTATUS Register.
Definition at line 353 of file core_feature_base.h.
References __RV_CSR_SET, CSR_MSTATUS, and MSTATUS_MIE.
__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 419 of file core_feature_base.h.
References __RV_CSR_SET, CSR_MIE, and MIE_MSIE.
Referenced by Core_Register_IRQ().
__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 397 of file core_feature_base.h.
References __RV_CSR_SET, CSR_MIE, and MIE_MTIE.
Referenced by Core_Register_IRQ(), and SysTick_Config().
__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 463 of file core_feature_base.h.
References __RV_CSR_READ, and CSR_MIP.
__STATIC_FORCEINLINE uint64_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 486 of file core_feature_base.h.
References __RV_CSR_READ, CSR_MCYCLE, and CSR_MCYCLEH.
__STATIC_FORCEINLINE uint64_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 513 of file core_feature_base.h.
References __RV_CSR_READ, CSR_MINSTRET, and CSR_MINSTRETH.
__STATIC_FORCEINLINE uint64_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 541 of file core_feature_base.h.
References __RV_CSR_READ, CSR_TIME, and CSR_TIMEH.