Interrupts and Exceptions
Interrupt and Exception API
-
enum IRQn
Values:
-
enumerator Reserved0_IRQn
-
enumerator Reserved1_IRQn
-
enumerator Reserved2_IRQn
-
enumerator SysTimerSW_IRQn
-
enumerator Reserved4_IRQn
-
enumerator Reserved5_IRQn
-
enumerator Reserved6_IRQn
-
enumerator SysTimer_IRQn
-
enumerator Reserved8_IRQn
-
enumerator Reserved9_IRQn
-
enumerator Reserved10_IRQn
-
enumerator Reserved11_IRQn
-
enumerator Reserved12_IRQn
-
enumerator Reserved13_IRQn
-
enumerator Reserved14_IRQn
-
enumerator Reserved15_IRQn
-
enumerator PLIC_INT0_IRQn
-
enumerator PLIC_INT1_IRQn
-
enumerator PLIC_INT_MAX
-
enumerator Reserved0_IRQn
- __STATIC_FORCEINLINE void PLIC_SetThreshold (uint32_t thresh)
- __STATIC_FORCEINLINE uint32_t PLIC_GetThreshold (void)
- __STATIC_FORCEINLINE void PLIC_EnableInterrupt (uint32_t source)
- __STATIC_FORCEINLINE void PLIC_DisableInterrupt (uint32_t source)
- __STATIC_FORCEINLINE uint32_t PLIC_GetInterruptEnable (uint32_t source)
- __STATIC_FORCEINLINE void PLIC_SetPriority (uint32_t source, uint32_t priority)
- __STATIC_FORCEINLINE uint32_t PLIC_GetPriority (uint32_t source, uint32_t priority)
- __STATIC_FORCEINLINE uint32_t PLIC_ClaimInterrupt (void)
- __STATIC_FORCEINLINE void PLIC_CompleteInterrupt (uint32_t source)
- __STATIC_FORCEINLINE void PLIC_Init (uint32_t num_sources)
- __STATIC_FORCEINLINE void __set_trap_entry (rv_csr_t addr)
- __STATIC_FORCEINLINE rv_csr_t __get_trap_entry (void)
- group NMSIS_Core_IntExc
Functions that manage interrupts and exceptions via the PLIC.
Enums
-
enum IRQn
Definition of IRQn numbers.
The core interrupt enumeration names for IRQn values are defined in the file <Device>.h.
Interrupt ID(IRQn) from 0 to 18 are reserved for core internal interrupts.
Interrupt ID(IRQn) start from 19 represent device-specific external interrupts.
The first device-specific interrupt has the IRQn value 19.
The table below describes the core interrupt names and their availability in various Nuclei Cores.
Values:
-
enumerator Reserved0_IRQn
Internal reserved.
-
enumerator Reserved1_IRQn
Internal reserved.
-
enumerator Reserved2_IRQn
Internal reserved.
-
enumerator SysTimerSW_IRQn
System Timer SW interrupt.
-
enumerator Reserved4_IRQn
Internal reserved.
-
enumerator Reserved5_IRQn
Internal reserved.
-
enumerator Reserved6_IRQn
Internal reserved.
-
enumerator SysTimer_IRQn
System Timer Interrupt.
-
enumerator Reserved8_IRQn
Internal reserved.
-
enumerator Reserved9_IRQn
Internal reserved.
-
enumerator Reserved10_IRQn
Internal reserved.
-
enumerator Reserved11_IRQn
Internal reserved.
-
enumerator Reserved12_IRQn
Internal reserved.
-
enumerator Reserved13_IRQn
Internal reserved.
-
enumerator Reserved14_IRQn
Internal reserved.
-
enumerator Reserved15_IRQn
Internal reserved.
-
enumerator PLIC_INT0_IRQn
0 plic interrupt, means no interrupt
-
enumerator PLIC_INT1_IRQn
1st plic interrupt
-
enumerator PLIC_INT_MAX
Number of total plic interrupts.
Functions
- __STATIC_FORCEINLINE void PLIC_SetThreshold (uint32_t thresh)
Set priority threshold value of plic.
This function set priority threshold value of plic for current hart.
Remark
See also
PLIC_GetThreshold
- Parameters
thresh – [in] threshold value
- __STATIC_FORCEINLINE uint32_t PLIC_GetThreshold (void)
Get priority threshold value of plic.
This function get priority threshold value of plic.
Remark
See also
PLIC_SetThreshold
- Returns
priority threshold value for current hart
- __STATIC_FORCEINLINE void PLIC_EnableInterrupt (uint32_t source)
Enable interrupt for selected source plic.
This function enable interrupt for selected source plic of current hart.
Remark
See also
PLIC_DisableInterrupt
- Parameters
source – [in] interrupt source
- __STATIC_FORCEINLINE void PLIC_DisableInterrupt (uint32_t source)
Disable interrupt for selected source plic.
This function disable interrupt for selected source plic of current hart.
Remark
See also
PLIC_EnableInterrupt
- Parameters
source – [in] interrupt source
- __STATIC_FORCEINLINE uint32_t PLIC_GetInterruptEnable (uint32_t source)
Get interrupt enable status for selected source plic.
This function get interrupt enable for selected source plic of current hart.
Remark
See also
PLIC_EnableInterrupt
PLIC_DisableInterrupt
- Parameters
source – [in] interrupt source
- Returns
enable status for selected interrupt source for current hart
- __STATIC_FORCEINLINE void PLIC_SetPriority (uint32_t source, uint32_t priority)
Set interrupt priority for selected source plic.
This function set interrupt priority for selected source plic of current hart.
Remark
See also
PLIC_GetPriority
- Parameters
source – [in] interrupt source
priority – [in] interrupt priority
- __STATIC_FORCEINLINE uint32_t PLIC_GetPriority (uint32_t source, uint32_t priority)
Get interrupt priority for selected source plic.
This function get interrupt priority for selected source plic of current hart.
Remark
See also
PLIC_SetPriority
- Parameters
source – [in] interrupt source
priority – [in] interrupt priority
- __STATIC_FORCEINLINE uint32_t PLIC_ClaimInterrupt (void)
Claim interrupt for plic of current hart.
This function claim interrupt for plic of current hart.
Remark
A successful claim will also atomically clear the corresponding pending bit on the interrupt source. The PLIC can perform a claim at any time and the claim operation is not affected by the setting of the priority threshold register.
See also
PLIC_CompleteInterrupt
- Returns
the ID of the highest priority pending interrupt or zero if there is no pending interrupt
- __STATIC_FORCEINLINE void PLIC_CompleteInterrupt (uint32_t source)
Complete interrupt for plic of current hart.
This function complete interrupt for plic of current hart.
Remark
The PLIC signals it has completed executing an interrupt handler by writing the interrupt ID it received from the claim to the claim/complete register. The PLIC does not check whether the completion ID is the same as the last claim ID for that target. If the completion ID does not match an interrupt source that is currently enabled for the target, the completion is silently ignored.
See also
PLIC_ClaimInterrupt
- Returns
the ID of the highest priority pending interrupt or zero if there is no pending interrupt
- __STATIC_FORCEINLINE void PLIC_Init (uint32_t num_sources)
Perform init for plic of current hart.
This function perform initialization steps for plic of current hart.
Remark
Disable all interrupts
Set all priorities to zero
Set priority threshold to zero
- __STATIC_FORCEINLINE void __set_trap_entry (rv_csr_t addr)
Set Trap entry address.
This function set trap entry address to ‘CSR_MTVEC’.
Remark
This function use to set trap entry address to ‘CSR_MTVEC’.
See also
__get_trap_entry
- Parameters
addr – [in] trap entry address
- __STATIC_FORCEINLINE rv_csr_t __get_trap_entry (void)
Get trap entry address.
This function get trap entry address from ‘CSR_MTVEC’.
Remark
This function use to get trap entry address from ‘CSR_MTVEC’.
See also
__set_trap_entry
- Returns
trap entry address
-
enum IRQn