NMSIS-Core  Version 1.6.0
NMSIS-Core support for Nuclei processor-based devices
Interrupts and Exceptions

Functions that manage interrupts and exceptions via the ECLIC. More...

Macros

#define ECLIC_SetCfgNlbits   __ECLIC_SetCfgNlbits
 
#define ECLIC_GetCfgNlbits   __ECLIC_GetCfgNlbits
 
#define ECLIC_GetInfoVer   __ECLIC_GetInfoVer
 
#define ECLIC_GetInfoCtlbits   __ECLIC_GetInfoCtlbits
 
#define ECLIC_GetInfoNum   __ECLIC_GetInfoNum
 
#define ECLIC_GetInfoShadowNum   __ECLIC_GetInfoShadowNum
 
#define ECLIC_SetMth   __ECLIC_SetMth
 
#define ECLIC_GetMth   __ECLIC_GetMth
 
#define ECLIC_EnableIRQ   __ECLIC_EnableIRQ
 
#define ECLIC_GetEnableIRQ   __ECLIC_GetEnableIRQ
 
#define ECLIC_DisableIRQ   __ECLIC_DisableIRQ
 
#define ECLIC_SetPendingIRQ   __ECLIC_SetPendingIRQ
 
#define ECLIC_GetPendingIRQ   __ECLIC_GetPendingIRQ
 
#define ECLIC_ClearPendingIRQ   __ECLIC_ClearPendingIRQ
 
#define ECLIC_SetTrigIRQ   __ECLIC_SetTrigIRQ
 
#define ECLIC_GetTrigIRQ   __ECLIC_GetTrigIRQ
 
#define ECLIC_SetShvIRQ   __ECLIC_SetShvIRQ
 
#define ECLIC_GetShvIRQ   __ECLIC_GetShvIRQ
 
#define ECLIC_SetCtrlIRQ   __ECLIC_SetCtrlIRQ
 
#define ECLIC_GetCtrlIRQ   __ECLIC_GetCtrlIRQ
 
#define ECLIC_SetLevelIRQ   __ECLIC_SetLevelIRQ
 
#define ECLIC_GetLevelIRQ   __ECLIC_GetLevelIRQ
 
#define ECLIC_SetPriorityIRQ   __ECLIC_SetPriorityIRQ
 
#define ECLIC_GetPriorityIRQ   __ECLIC_GetPriorityIRQ
 
#define ECLIC_SetModeIRQ   __ECLIC_SetModeIRQ
 
#define ECLIC_SetSth   __ECLIC_SetSth
 
#define ECLIC_GetSth   __ECLIC_GetSth
 
#define ECLIC_SetPendingIRQ_S   __ECLIC_SetPendingIRQ_S
 
#define ECLIC_GetPendingIRQ_S   __ECLIC_GetPendingIRQ_S
 
#define ECLIC_ClearPendingIRQ_S   __ECLIC_ClearPendingIRQ_S
 
#define ECLIC_SetTrigIRQ_S   __ECLIC_SetTrigIRQ_S
 
#define ECLIC_GetTrigIRQ_S   __ECLIC_GetTrigIRQ_S
 
#define ECLIC_SetShvIRQ_S   __ECLIC_SetShvIRQ_S
 
#define ECLIC_GetShvIRQ_S   __ECLIC_GetShvIRQ_S
 
#define ECLIC_SetCtrlIRQ_S   __ECLIC_SetCtrlIRQ_S
 
#define ECLIC_GetCtrlIRQ_S   __ECLIC_GetCtrlIRQ_S
 
#define ECLIC_SetLevelIRQ_S   __ECLIC_SetLevelIRQ_S
 
#define ECLIC_GetLevelIRQ_S   __ECLIC_GetLevelIRQ_S
 
#define ECLIC_SetPriorityIRQ_S   __ECLIC_SetPriorityIRQ_S
 
#define ECLIC_GetPriorityIRQ_S   __ECLIC_GetPriorityIRQ_S
 
#define ECLIC_EnableIRQ_S   __ECLIC_EnableIRQ_S
 
#define ECLIC_GetEnableIRQ_S   __ECLIC_GetEnableIRQ_S
 
#define ECLIC_DisableIRQ_S   __ECLIC_DisableIRQ_S
 
#define ECLIC_SetVector   __ECLIC_SetVector
 
#define ECLIC_GetVector   __ECLIC_GetVector
 
#define ECLIC_SetVector_S   __ECLIC_SetVector_S
 
#define ECLIC_GetVector_S   __ECLIC_GetVector_S
 
#define SAVE_SSUBM_VAR()
 
#define RESTORE_SSUBM_VAR()
 
#define SAVE_IRQ_CSR_CONTEXT()
 Save necessary CSRs into variables for vector interrupt nesting. More...
 
#define SAVE_IRQ_CSR_CONTEXT_S()
 Save necessary CSRs into variables for vector interrupt nesting in supervisor mode. More...
 
#define RESTORE_IRQ_CSR_CONTEXT()
 Restore necessary CSRs from variables for vector interrupt nesting. More...
 
#define RESTORE_IRQ_CSR_CONTEXT_S()
 Restore necessary CSRs from variables for vector interrupt nesting in supervisor mode. More...
 

Enumerations

enum  IRQn {
  Reserved0_IRQn = 0,
  Reserved1_IRQn = 1,
  Reserved2_IRQn = 2,
  SysTimerSW_IRQn = 3,
  Reserved3_IRQn = 4,
  Reserved4_IRQn = 5,
  Reserved5_IRQn = 6,
  SysTimer_IRQn = 7,
  Reserved6_IRQn = 8,
  Reserved7_IRQn = 9,
  Reserved8_IRQn = 10,
  Reserved9_IRQn = 11,
  Reserved10_IRQn = 12,
  Reserved11_IRQn = 13,
  Reserved12_IRQn = 14,
  Reserved13_IRQn = 15,
  Reserved14_IRQn = 16,
  Reserved15_IRQn = 17,
  Reserved16_IRQn = 18,
  FirstDeviceSpecificInterrupt_IRQn = 19,
  SOC_INT_MAX
}
 Definition of IRQn numbers. More...
 

Functions

__STATIC_FORCEINLINE void __ECLIC_SetCfgNlbits (uint32_t nlbits)
 Set nlbits value. More...
 
__STATIC_FORCEINLINE uint32_t __ECLIC_GetCfgNlbits (void)
 Get nlbits value. More...
 
__STATIC_FORCEINLINE uint32_t __ECLIC_GetInfoVer (void)
 Get the ECLIC version number. More...
 
__STATIC_FORCEINLINE uint32_t __ECLIC_GetInfoCtlbits (void)
 Get CLICINTCTLBITS. More...
 
__STATIC_FORCEINLINE uint32_t __ECLIC_GetInfoNum (void)
 Get number of maximum interrupt inputs supported. More...
 
__STATIC_FORCEINLINE uint32_t __ECLIC_GetInfoShadowNum (void)
 Get number of shadow register groups. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetMth (uint8_t mth)
 Set Machine Mode Interrupt Level Threshold. More...
 
__STATIC_FORCEINLINE uint8_t __ECLIC_GetMth (void)
 Get Machine Mode Interrupt Level Threshold. More...
 
__STATIC_FORCEINLINE void __ECLIC_EnableIRQ (IRQn_Type IRQn)
 Enable a specific interrupt. More...
 
__STATIC_FORCEINLINE uint32_t __ECLIC_GetEnableIRQ (IRQn_Type IRQn)
 Get a specific interrupt enable status. More...
 
__STATIC_FORCEINLINE void __ECLIC_DisableIRQ (IRQn_Type IRQn)
 Disable a specific interrupt. More...
 
__STATIC_FORCEINLINE int32_t __ECLIC_GetPendingIRQ (IRQn_Type IRQn)
 Get the pending specific interrupt. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetPendingIRQ (IRQn_Type IRQn)
 Set a specific interrupt to pending. More...
 
__STATIC_FORCEINLINE void __ECLIC_ClearPendingIRQ (IRQn_Type IRQn)
 Clear a specific interrupt from pending. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetTrigIRQ (IRQn_Type IRQn, uint32_t trig)
 Set trigger mode and polarity for a specific interrupt. More...
 
__STATIC_FORCEINLINE uint32_t __ECLIC_GetTrigIRQ (IRQn_Type IRQn)
 Get trigger mode and polarity for a specific interrupt. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetShvIRQ (IRQn_Type IRQn, uint32_t shv)
 Set interrupt working mode for a specific interrupt. More...
 
__STATIC_FORCEINLINE uint32_t __ECLIC_GetShvIRQ (IRQn_Type IRQn)
 Get interrupt working mode for a specific interrupt. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetCtrlIRQ (IRQn_Type IRQn, uint8_t intctrl)
 Modify ECLIC Interrupt Input Control Register for a specific interrupt. More...
 
__STATIC_FORCEINLINE uint8_t __ECLIC_GetCtrlIRQ (IRQn_Type IRQn)
 Get ECLIC Interrupt Input Control Register value for a specific interrupt. More...
 
__STATIC_INLINE void __ECLIC_SetLevelIRQ (IRQn_Type IRQn, uint8_t lvl_abs)
 Set ECLIC Interrupt level of a specific interrupt. More...
 
__STATIC_INLINE uint8_t __ECLIC_GetLevelIRQ (IRQn_Type IRQn)
 Get ECLIC Interrupt level of a specific interrupt. More...
 
__STATIC_INLINE void __ECLIC_SetPriorityIRQ (IRQn_Type IRQn, uint8_t pri)
 Get ECLIC Interrupt priority of a specific interrupt. More...
 
__STATIC_INLINE uint8_t __ECLIC_GetPriorityIRQ (IRQn_Type IRQn)
 Get ECLIC Interrupt priority of a specific interrupt. More...
 
__STATIC_INLINE void __ECLIC_SetVector (IRQn_Type IRQn, rv_csr_t vector)
 Set Interrupt Vector of a specific interrupt. More...
 
__STATIC_FORCEINLINE rv_csr_t __ECLIC_GetVector (IRQn_Type IRQn)
 Get Interrupt Vector of a specific interrupt. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetModeIRQ (IRQn_Type IRQn, uint32_t mode)
 Set privilege mode of a specific interrupt. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetSth (uint8_t sth)
 Set supervisor-mode Interrupt Level Threshold in supervisor mode. More...
 
__STATIC_FORCEINLINE uint8_t __ECLIC_GetSth (void)
 Get supervisor-mode Interrupt Level Threshold in supervisor mode. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetPendingIRQ_S (IRQn_Type IRQn)
 Set a specific interrupt to pending in supervisor mode. More...
 
__STATIC_FORCEINLINE int32_t __ECLIC_GetPendingIRQ_S (IRQn_Type IRQn)
 Get the pending specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE void __ECLIC_ClearPendingIRQ_S (IRQn_Type IRQn)
 Clear a specific interrupt from pending in supervisor mode. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetTrigIRQ_S (IRQn_Type IRQn, uint32_t trig)
 Set trigger mode and polarity for a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE uint8_t __ECLIC_GetTrigIRQ_S (IRQn_Type IRQn)
 Get trigger mode and polarity for a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetShvIRQ_S (IRQn_Type IRQn, uint32_t shv)
 Set interrupt working mode for a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE uint8_t __ECLIC_GetShvIRQ_S (IRQn_Type IRQn)
 Get interrupt working mode for a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetCtrlIRQ_S (IRQn_Type IRQn, uint8_t intctrl)
 Modify ECLIC Interrupt Input Control Register for a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE uint8_t __ECLIC_GetCtrlIRQ_S (IRQn_Type IRQn)
 Get ECLIC Interrupt Input Control Register value for a specific interrupt in supervisor mode. More...
 
__STATIC_INLINE void __ECLIC_SetLevelIRQ_S (IRQn_Type IRQn, uint8_t lvl_abs)
 Set ECLIC Interrupt level of a specific interrupt in supervisor mode. More...
 
__STATIC_INLINE uint8_t __ECLIC_GetLevelIRQ_S (IRQn_Type IRQn)
 Get ECLIC Interrupt level of a specific interrupt. More...
 
__STATIC_INLINE void __ECLIC_SetPriorityIRQ_S (IRQn_Type IRQn, uint8_t pri)
 Set ECLIC Interrupt priority of a specific interrupt in supervisor mode. More...
 
__STATIC_INLINE uint8_t __ECLIC_GetPriorityIRQ_S (IRQn_Type IRQn)
 Get ECLIC Interrupt priority of a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE void __ECLIC_EnableIRQ_S (IRQn_Type IRQn)
 Enable a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE uint8_t __ECLIC_GetEnableIRQ_S (IRQn_Type IRQn)
 Get a specific interrupt enable status in supervisor mode. More...
 
__STATIC_FORCEINLINE void __ECLIC_DisableIRQ_S (IRQn_Type IRQn)
 Disable a specific interrupt in supervisor mode. More...
 
__STATIC_INLINE void __ECLIC_SetVector_S (IRQn_Type IRQn, rv_csr_t vector)
 Set Interrupt Vector of a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE rv_csr_t __ECLIC_GetVector_S (IRQn_Type IRQn)
 Get Interrupt Vector of a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE void __set_exc_entry (rv_csr_t addr)
 Set Exception entry address. More...
 
__STATIC_FORCEINLINE rv_csr_t __get_exc_entry (void)
 Get Exception entry address. More...
 
__STATIC_INLINE void __set_nonvec_entry (rv_csr_t addr)
 Set Non-vector interrupt entry address. More...
 
__STATIC_INLINE rv_csr_t __get_nonvec_entry (void)
 Get Non-vector interrupt entry address. More...
 
__STATIC_FORCEINLINE rv_csr_t __get_nmi_entry (void)
 Get NMI interrupt entry from 'CSR_MNVEC'. More...
 

Detailed Description

Functions that manage interrupts and exceptions via the ECLIC.

Macro Definition Documentation

◆ ECLIC_ClearPendingIRQ

#define ECLIC_ClearPendingIRQ   __ECLIC_ClearPendingIRQ

Definition at line 267 of file core_feature_eclic.h.

◆ ECLIC_ClearPendingIRQ_S

#define ECLIC_ClearPendingIRQ_S   __ECLIC_ClearPendingIRQ_S

Definition at line 294 of file core_feature_eclic.h.

◆ ECLIC_DisableIRQ

#define ECLIC_DisableIRQ   __ECLIC_DisableIRQ

Definition at line 264 of file core_feature_eclic.h.

◆ ECLIC_DisableIRQ_S

#define ECLIC_DisableIRQ_S   __ECLIC_DisableIRQ_S

Definition at line 307 of file core_feature_eclic.h.

◆ ECLIC_EnableIRQ

#define ECLIC_EnableIRQ   __ECLIC_EnableIRQ

Definition at line 262 of file core_feature_eclic.h.

◆ ECLIC_EnableIRQ_S

#define ECLIC_EnableIRQ_S   __ECLIC_EnableIRQ_S

Definition at line 305 of file core_feature_eclic.h.

◆ ECLIC_GetCfgNlbits

#define ECLIC_GetCfgNlbits   __ECLIC_GetCfgNlbits

Definition at line 255 of file core_feature_eclic.h.

◆ ECLIC_GetCtrlIRQ

#define ECLIC_GetCtrlIRQ   __ECLIC_GetCtrlIRQ

Definition at line 273 of file core_feature_eclic.h.

◆ ECLIC_GetCtrlIRQ_S

#define ECLIC_GetCtrlIRQ_S   __ECLIC_GetCtrlIRQ_S

Definition at line 300 of file core_feature_eclic.h.

◆ ECLIC_GetEnableIRQ

#define ECLIC_GetEnableIRQ   __ECLIC_GetEnableIRQ

Definition at line 263 of file core_feature_eclic.h.

◆ ECLIC_GetEnableIRQ_S

#define ECLIC_GetEnableIRQ_S   __ECLIC_GetEnableIRQ_S

Definition at line 306 of file core_feature_eclic.h.

◆ ECLIC_GetInfoCtlbits

#define ECLIC_GetInfoCtlbits   __ECLIC_GetInfoCtlbits

Definition at line 257 of file core_feature_eclic.h.

◆ ECLIC_GetInfoNum

#define ECLIC_GetInfoNum   __ECLIC_GetInfoNum

Definition at line 258 of file core_feature_eclic.h.

◆ ECLIC_GetInfoShadowNum

#define ECLIC_GetInfoShadowNum   __ECLIC_GetInfoShadowNum

Definition at line 259 of file core_feature_eclic.h.

◆ ECLIC_GetInfoVer

#define ECLIC_GetInfoVer   __ECLIC_GetInfoVer

Definition at line 256 of file core_feature_eclic.h.

◆ ECLIC_GetLevelIRQ

#define ECLIC_GetLevelIRQ   __ECLIC_GetLevelIRQ

Definition at line 275 of file core_feature_eclic.h.

◆ ECLIC_GetLevelIRQ_S

#define ECLIC_GetLevelIRQ_S   __ECLIC_GetLevelIRQ_S

Definition at line 302 of file core_feature_eclic.h.

◆ ECLIC_GetMth

#define ECLIC_GetMth   __ECLIC_GetMth

Definition at line 261 of file core_feature_eclic.h.

◆ ECLIC_GetPendingIRQ

#define ECLIC_GetPendingIRQ   __ECLIC_GetPendingIRQ

Definition at line 266 of file core_feature_eclic.h.

◆ ECLIC_GetPendingIRQ_S

#define ECLIC_GetPendingIRQ_S   __ECLIC_GetPendingIRQ_S

Definition at line 293 of file core_feature_eclic.h.

◆ ECLIC_GetPriorityIRQ

#define ECLIC_GetPriorityIRQ   __ECLIC_GetPriorityIRQ

Definition at line 277 of file core_feature_eclic.h.

◆ ECLIC_GetPriorityIRQ_S

#define ECLIC_GetPriorityIRQ_S   __ECLIC_GetPriorityIRQ_S

Definition at line 304 of file core_feature_eclic.h.

◆ ECLIC_GetShvIRQ

#define ECLIC_GetShvIRQ   __ECLIC_GetShvIRQ

Definition at line 271 of file core_feature_eclic.h.

◆ ECLIC_GetShvIRQ_S

#define ECLIC_GetShvIRQ_S   __ECLIC_GetShvIRQ_S

Definition at line 298 of file core_feature_eclic.h.

◆ ECLIC_GetSth

#define ECLIC_GetSth   __ECLIC_GetSth

Definition at line 291 of file core_feature_eclic.h.

◆ ECLIC_GetTrigIRQ

#define ECLIC_GetTrigIRQ   __ECLIC_GetTrigIRQ

Definition at line 269 of file core_feature_eclic.h.

◆ ECLIC_GetTrigIRQ_S

#define ECLIC_GetTrigIRQ_S   __ECLIC_GetTrigIRQ_S

Definition at line 296 of file core_feature_eclic.h.

◆ ECLIC_GetVector

#define ECLIC_GetVector   __ECLIC_GetVector

Definition at line 327 of file core_feature_eclic.h.

◆ ECLIC_GetVector_S

#define ECLIC_GetVector_S   __ECLIC_GetVector_S

Definition at line 331 of file core_feature_eclic.h.

◆ ECLIC_SetCfgNlbits

#define ECLIC_SetCfgNlbits   __ECLIC_SetCfgNlbits

Definition at line 254 of file core_feature_eclic.h.

◆ ECLIC_SetCtrlIRQ

#define ECLIC_SetCtrlIRQ   __ECLIC_SetCtrlIRQ

Definition at line 272 of file core_feature_eclic.h.

◆ ECLIC_SetCtrlIRQ_S

#define ECLIC_SetCtrlIRQ_S   __ECLIC_SetCtrlIRQ_S

Definition at line 299 of file core_feature_eclic.h.

◆ ECLIC_SetLevelIRQ

#define ECLIC_SetLevelIRQ   __ECLIC_SetLevelIRQ

Definition at line 274 of file core_feature_eclic.h.

◆ ECLIC_SetLevelIRQ_S

#define ECLIC_SetLevelIRQ_S   __ECLIC_SetLevelIRQ_S

Definition at line 301 of file core_feature_eclic.h.

◆ ECLIC_SetModeIRQ

#define ECLIC_SetModeIRQ   __ECLIC_SetModeIRQ

Definition at line 289 of file core_feature_eclic.h.

◆ ECLIC_SetMth

#define ECLIC_SetMth   __ECLIC_SetMth

Definition at line 260 of file core_feature_eclic.h.

◆ ECLIC_SetPendingIRQ

#define ECLIC_SetPendingIRQ   __ECLIC_SetPendingIRQ

Definition at line 265 of file core_feature_eclic.h.

◆ ECLIC_SetPendingIRQ_S

#define ECLIC_SetPendingIRQ_S   __ECLIC_SetPendingIRQ_S

Definition at line 292 of file core_feature_eclic.h.

◆ ECLIC_SetPriorityIRQ

#define ECLIC_SetPriorityIRQ   __ECLIC_SetPriorityIRQ

Definition at line 276 of file core_feature_eclic.h.

◆ ECLIC_SetPriorityIRQ_S

#define ECLIC_SetPriorityIRQ_S   __ECLIC_SetPriorityIRQ_S

Definition at line 303 of file core_feature_eclic.h.

◆ ECLIC_SetShvIRQ

#define ECLIC_SetShvIRQ   __ECLIC_SetShvIRQ

Definition at line 270 of file core_feature_eclic.h.

◆ ECLIC_SetShvIRQ_S

#define ECLIC_SetShvIRQ_S   __ECLIC_SetShvIRQ_S

Definition at line 297 of file core_feature_eclic.h.

◆ ECLIC_SetSth

#define ECLIC_SetSth   __ECLIC_SetSth

Definition at line 290 of file core_feature_eclic.h.

◆ ECLIC_SetTrigIRQ

#define ECLIC_SetTrigIRQ   __ECLIC_SetTrigIRQ

Definition at line 268 of file core_feature_eclic.h.

◆ ECLIC_SetTrigIRQ_S

#define ECLIC_SetTrigIRQ_S   __ECLIC_SetTrigIRQ_S

Definition at line 295 of file core_feature_eclic.h.

◆ ECLIC_SetVector

#define ECLIC_SetVector   __ECLIC_SetVector

Definition at line 326 of file core_feature_eclic.h.

◆ ECLIC_SetVector_S

#define ECLIC_SetVector_S   __ECLIC_SetVector_S

Definition at line 330 of file core_feature_eclic.h.

◆ RESTORE_IRQ_CSR_CONTEXT

#define RESTORE_IRQ_CSR_CONTEXT ( )

Restore necessary CSRs from variables for vector interrupt nesting.

This macro is used restore CSRs(MCAUSE, MEPC, MSUB) from pre-defined variables in SAVE_IRQ_CSR_CONTEXT macro.

Remarks
  • Interrupt will be disabled after this macro is called
  • It need to be used together with SAVE_IRQ_CSR_CONTEXT

Definition at line 1911 of file core_feature_eclic.h.

◆ RESTORE_IRQ_CSR_CONTEXT_S

#define RESTORE_IRQ_CSR_CONTEXT_S ( )

Restore necessary CSRs from variables for vector interrupt nesting in supervisor mode.

Definition at line 1918 of file core_feature_eclic.h.

◆ RESTORE_SSUBM_VAR

#define RESTORE_SSUBM_VAR ( )

Definition at line 1855 of file core_feature_eclic.h.

◆ SAVE_IRQ_CSR_CONTEXT

#define SAVE_IRQ_CSR_CONTEXT ( )

Save necessary CSRs into variables for vector interrupt nesting.

This macro is used to declare variables which are used for saving CSRs(MCAUSE, MEPC, MSUB), and it will read these CSR content into these variables, it need to be used in a vector-interrupt if nesting is required.

Remarks
  • Interrupt will be enabled after this macro is called
  • It need to be used together with RESTORE_IRQ_CSR_CONTEXT
  • Don't use variable names __mcause, __mpec, __msubm in your ISR code
  • If you want to enable interrupt nesting feature for vector interrupt, you can do it like this:
    // __INTERRUPT attribute will generates function entry and exit sequences suitable
    // for use in an interrupt handler when this attribute is present
    __INTERRUPT void eclic_mtip_handler(void)
    {
    // Must call this to save CSRs
    // !!!Interrupt is enabled here!!!
    // !!!Higher priority interrupt could nest it!!!
    // put you own interrupt handling code here
    // Must call this to restore CSRs
    }

Definition at line 1888 of file core_feature_eclic.h.

◆ SAVE_IRQ_CSR_CONTEXT_S

#define SAVE_IRQ_CSR_CONTEXT_S ( )

Save necessary CSRs into variables for vector interrupt nesting in supervisor mode.

Definition at line 1895 of file core_feature_eclic.h.

◆ SAVE_SSUBM_VAR

#define SAVE_SSUBM_VAR ( )

Definition at line 1854 of file core_feature_eclic.h.

Enumeration Type Documentation

◆ IRQn

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.

Enumerator
Reserved0_IRQn 

Internal reserved.

Reserved1_IRQn 

Internal reserved.

Reserved2_IRQn 

Internal reserved.

SysTimerSW_IRQn 

System Timer SW interrupt.

Reserved3_IRQn 

Internal reserved.

Reserved4_IRQn 

Internal reserved.

Reserved5_IRQn 

Internal reserved.

SysTimer_IRQn 

System Timer Interrupt.

Reserved6_IRQn 

Internal reserved.

Reserved7_IRQn 

Internal reserved.

Reserved8_IRQn 

Internal reserved.

Reserved9_IRQn 

Internal reserved.

Reserved10_IRQn 

Internal reserved.

Reserved11_IRQn 

Internal reserved.

Reserved12_IRQn 

Internal reserved.

Reserved13_IRQn 

Internal reserved.

Reserved14_IRQn 

Internal reserved.

Reserved15_IRQn 

Internal reserved.

Reserved16_IRQn 

Internal reserved.

FirstDeviceSpecificInterrupt_IRQn 

First Device Specific Interrupt.

SOC_INT_MAX 

Number of total interrupts.

Definition at line 214 of file core_feature_eclic.h.

214  {
215  /* ========= Nuclei N/NX Core Specific Interrupt Numbers =========== */
216  /* Core Internal Interrupt IRQn definitions */
217  Reserved0_IRQn = 0,
218  Reserved1_IRQn = 1,
219  Reserved2_IRQn = 2,
220  SysTimerSW_IRQn = 3,
221  Reserved3_IRQn = 4,
222  Reserved4_IRQn = 5,
223  Reserved5_IRQn = 6,
224  SysTimer_IRQn = 7,
225  Reserved6_IRQn = 8,
226  Reserved7_IRQn = 9,
227  Reserved8_IRQn = 10,
228  Reserved9_IRQn = 11,
229  Reserved10_IRQn = 12,
230  Reserved11_IRQn = 13,
231  Reserved12_IRQn = 14,
232  Reserved13_IRQn = 15,
233  Reserved14_IRQn = 16,
234  Reserved15_IRQn = 17,
235  Reserved16_IRQn = 18,
237  /* ========= Device Specific Interrupt Numbers =================== */
238  /* ToDo: add here your device specific external interrupt numbers.
239  * 19~max(NUM_INTERRUPT, 1023) is reserved number for user.
240  * Maxmum interrupt supported could get from clicinfo.NUM_INTERRUPT.
241  * According the interrupt handlers defined in startup_Device.S
242  * eg.: Interrupt for Timer#1 eclic_tim1_handler -> TIM1_IRQn */
244  SOC_INT_MAX,
245 } IRQn_Type;

Function Documentation

◆ __ECLIC_ClearPendingIRQ()

__STATIC_FORCEINLINE void __ECLIC_ClearPendingIRQ ( IRQn_Type  IRQn)

Clear a specific interrupt from pending.

This function removes the pending state of the specific interrupt IRQn. IRQn cannot be a negative number.

Parameters
[in]IRQnInterrupt number
Remarks
  • IRQn must not be negative.
See also

Definition at line 563 of file core_feature_eclic.h.

564 {
565  ECLIC->CTRL[IRQn].INTIP &= ~CLIC_INTIP_IP_Msk;
566 }

References CLIC_INTIP_IP_Msk, and ECLIC.

◆ __ECLIC_ClearPendingIRQ_S()

__STATIC_FORCEINLINE void __ECLIC_ClearPendingIRQ_S ( IRQn_Type  IRQn)

Clear a specific interrupt from pending in supervisor mode.

This function removes the pending state of the specific interrupt IRQn in supervisor mode. IRQn cannot be a negative number.

Parameters
[in]IRQnInterrupt number
Remarks
  • IRQn must not be negative.
See also

Definition at line 1185 of file core_feature_eclic.h.

1186 {
1187  ECLIC->SCTRL[IRQn].INTIP &= ~CLIC_INTIP_IP_Msk;
1188 }

References CLIC_INTIP_IP_Msk, and ECLIC.

◆ __ECLIC_DisableIRQ()

__STATIC_FORCEINLINE void __ECLIC_DisableIRQ ( IRQn_Type  IRQn)

Disable a specific interrupt.

This function disables the specific interrupt IRQn.

Parameters
[in]IRQnNumber of the external interrupt to disable
Remarks
  • IRQn must not be negative.
See also

Definition at line 511 of file core_feature_eclic.h.

512 {
513  ECLIC->CTRL[IRQn].INTIE &= ~CLIC_INTIE_IE_Msk;
514 }

References CLIC_INTIE_IE_Msk, and ECLIC.

◆ __ECLIC_DisableIRQ_S()

__STATIC_FORCEINLINE void __ECLIC_DisableIRQ_S ( IRQn_Type  IRQn)

Disable a specific interrupt in supervisor mode.

This function disables the specific interrupt IRQn.

Parameters
[in]IRQnNumber of the external interrupt to disable
Remarks
  • IRQn must not be negative.
See also

Definition at line 1476 of file core_feature_eclic.h.

1477 {
1478  ECLIC->SCTRL[IRQn].INTIE &= ~CLIC_INTIE_IE_Msk;
1479 }

References CLIC_INTIE_IE_Msk, and ECLIC.

◆ __ECLIC_EnableIRQ()

__STATIC_FORCEINLINE void __ECLIC_EnableIRQ ( IRQn_Type  IRQn)

Enable a specific interrupt.

This function enables the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Remarks
  • IRQn must not be negative.
See also

Definition at line 477 of file core_feature_eclic.h.

478 {
479  ECLIC->CTRL[IRQn].INTIE |= CLIC_INTIE_IE_Msk;
480 }

References CLIC_INTIE_IE_Msk, and ECLIC.

◆ __ECLIC_EnableIRQ_S()

__STATIC_FORCEINLINE void __ECLIC_EnableIRQ_S ( IRQn_Type  IRQn)

Enable a specific interrupt in supervisor mode.

This function enables the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Remarks
  • IRQn must not be negative.
See also

Definition at line 1442 of file core_feature_eclic.h.

1443 {
1444  ECLIC->SCTRL[IRQn].INTIE |= CLIC_INTIE_IE_Msk;
1445 }

References CLIC_INTIE_IE_Msk, and ECLIC.

◆ __ECLIC_GetCfgNlbits()

__STATIC_FORCEINLINE uint32_t __ECLIC_GetCfgNlbits ( void  )

Get nlbits value.

This function get the nlbits value of CLICCFG register.

Returns
nlbits value of CLICCFG register
Remarks
  • nlbits is used to set the width of level in the CLICINTCTL[i].
See also

Definition at line 363 of file core_feature_eclic.h.

364 {
365  return ((uint32_t)((ECLIC->CFG & CLIC_CLICCFG_NLBIT_Msk) >> CLIC_CLICCFG_NLBIT_Pos));
366 }

References CLIC_CLICCFG_NLBIT_Msk, CLIC_CLICCFG_NLBIT_Pos, and ECLIC.

Referenced by __ECLIC_GetLevelIRQ(), __ECLIC_GetLevelIRQ_S(), __ECLIC_GetPriorityIRQ(), __ECLIC_GetPriorityIRQ_S(), __ECLIC_SetLevelIRQ(), __ECLIC_SetLevelIRQ_S(), __ECLIC_SetPriorityIRQ(), and __ECLIC_SetPriorityIRQ_S().

◆ __ECLIC_GetCtrlIRQ()

__STATIC_FORCEINLINE uint8_t __ECLIC_GetCtrlIRQ ( IRQn_Type  IRQn)

Get ECLIC Interrupt Input Control Register value for a specific interrupt.

This function modify ECLIC Interrupt Input Control register of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
value of ECLIC Interrupt Input Control register
Remarks
  • IRQn must not be negative.
See also

Definition at line 678 of file core_feature_eclic.h.

679 {
680  return (ECLIC->CTRL[IRQn].INTCTRL);
681 }

References ECLIC.

Referenced by __ECLIC_GetLevelIRQ(), __ECLIC_GetPriorityIRQ(), __ECLIC_SetLevelIRQ(), and __ECLIC_SetPriorityIRQ().

◆ __ECLIC_GetCtrlIRQ_S()

__STATIC_FORCEINLINE uint8_t __ECLIC_GetCtrlIRQ_S ( IRQn_Type  IRQn)

Get ECLIC Interrupt Input Control Register value for a specific interrupt in supervisor mode.

This function modify ECLIC Interrupt Input Control register of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
value of ECLIC Interrupt Input Control register
Remarks
  • IRQn must not be negative.
See also

Definition at line 1301 of file core_feature_eclic.h.

1302 {
1303  return (ECLIC->SCTRL[IRQn].INTCTRL);
1304 }

References ECLIC.

Referenced by __ECLIC_GetLevelIRQ_S(), __ECLIC_GetPriorityIRQ_S(), __ECLIC_SetLevelIRQ_S(), and __ECLIC_SetPriorityIRQ_S().

◆ __ECLIC_GetEnableIRQ()

__STATIC_FORCEINLINE uint32_t __ECLIC_GetEnableIRQ ( IRQn_Type  IRQn)

Get a specific interrupt enable status.

This function returns the interrupt enable status for the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
  • 0 Interrupt is not enabled
  • 1 Interrupt is pending
Remarks
  • IRQn must not be negative.
See also

Definition at line 496 of file core_feature_eclic.h.

497 {
498  return ((uint32_t) (ECLIC->CTRL[IRQn].INTIE) & CLIC_INTIE_IE_Msk);
499 }

References CLIC_INTIE_IE_Msk, and ECLIC.

◆ __ECLIC_GetEnableIRQ_S()

__STATIC_FORCEINLINE uint8_t __ECLIC_GetEnableIRQ_S ( IRQn_Type  IRQn)

Get a specific interrupt enable status in supervisor mode.

This function returns the interrupt enable status for the specific interrupt IRQn in S MODE.

Parameters
[in]IRQnInterrupt number
Returns
  • 0 Interrupt is not masked
  • 1 Interrupt is enabled
Remarks
  • IRQn must not be negative.
See also

Definition at line 1461 of file core_feature_eclic.h.

1462 {
1463  return ((uint8_t) (ECLIC->SCTRL[IRQn].INTIE) & CLIC_INTIE_IE_Msk);
1464 }

References CLIC_INTIE_IE_Msk, and ECLIC.

◆ __ECLIC_GetInfoCtlbits()

__STATIC_FORCEINLINE uint32_t __ECLIC_GetInfoCtlbits ( void  )

Get CLICINTCTLBITS.

This function gets CLICINTCTLBITS from CLICINFO register.

Returns
CLICINTCTLBITS from CLICINFO register.
Remarks
  • In the CLICINTCTL[i] registers, with 2 <= CLICINTCTLBITS <= 8.
  • The implemented bits are kept left-justified in the most-significant bits of each 8-bit CLICINTCTL[I] register, with the lower unimplemented bits hardwired to 1.
See also

Definition at line 396 of file core_feature_eclic.h.

397 {
398  return ((uint32_t)((ECLIC->INFO & CLIC_CLICINFO_CTLBIT_Msk) >> CLIC_CLICINFO_CTLBIT_Pos));
399 }

References CLIC_CLICINFO_CTLBIT_Msk, CLIC_CLICINFO_CTLBIT_Pos, and ECLIC.

◆ __ECLIC_GetInfoNum()

__STATIC_FORCEINLINE uint32_t __ECLIC_GetInfoNum ( void  )

Get number of maximum interrupt inputs supported.

This function gets number of maximum interrupt inputs supported from CLICINFO register.

Returns
number of maximum interrupt inputs supported from CLICINFO register.
Remarks
  • This function gets number of maximum interrupt inputs supported from CLICINFO register.
  • The num_interrupt field specifies the actual number of maximum interrupt inputs supported in this implementation.
See also

Definition at line 412 of file core_feature_eclic.h.

413 {
414  return ((uint32_t)((ECLIC->INFO & CLIC_CLICINFO_NUM_Msk) >> CLIC_CLICINFO_NUM_Pos));
415 }

References CLIC_CLICINFO_NUM_Msk, CLIC_CLICINFO_NUM_Pos, and ECLIC.

◆ __ECLIC_GetInfoShadowNum()

__STATIC_FORCEINLINE uint32_t __ECLIC_GetInfoShadowNum ( void  )

Get number of shadow register groups.

This function gets the number of shadow register groups from the CLICINFO register. This includes both the first-come-first-served dedicated interrupt shadow registers and the shadow registers designed for different interrupt levels. This number represents the total count for M mode; if S Mode is present, the number is the same as M Mode. Note that shadow register 0 is fixed for first-come-first-served m/s-mode interrupt and cannot be configured.

Returns
number of shadow register groups from the CLICINFO register.
Remarks
  • This function is only valid for ECLICv2
  • This function gets the number of shadow register groups from the CLICINFO register.
See also

Definition at line 432 of file core_feature_eclic.h.

433 {
434  return ((uint32_t)((ECLIC->INFO & (CLIC_CLICINFO_SHD_NUM_Msk)) >> CLIC_CLICINFO_SHD_NUM_Pos));
435 }

References CLIC_CLICINFO_SHD_NUM_Msk, CLIC_CLICINFO_SHD_NUM_Pos, and ECLIC.

◆ __ECLIC_GetInfoVer()

__STATIC_FORCEINLINE uint32_t __ECLIC_GetInfoVer ( void  )

Get the ECLIC version number.

This function gets the hardware version information from CLICINFO register.

Returns
hardware version number in CLICINFO register.
Remarks
  • This function gets harware version information from CLICINFO register.
  • Bit 20:17 for architecture version, bit 16:13 for implementation version.
See also

Definition at line 379 of file core_feature_eclic.h.

380 {
381  return ((uint32_t)((ECLIC->INFO & CLIC_CLICINFO_VER_Msk) >> CLIC_CLICINFO_VER_Pos));
382 }

References CLIC_CLICINFO_VER_Msk, CLIC_CLICINFO_VER_Pos, and ECLIC.

◆ __ECLIC_GetLevelIRQ()

__STATIC_INLINE uint8_t __ECLIC_GetLevelIRQ ( IRQn_Type  IRQn)

Get ECLIC Interrupt level of a specific interrupt.

This function get interrupt level of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
Interrupt level
Remarks
  • IRQn must not be negative.
See also

Definition at line 732 of file core_feature_eclic.h.

733 {
734  uint8_t nlbits = __ECLIC_GetCfgNlbits();
735  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
736 
737  if (nlbits == 0) {
738  return 0;
739  }
740 
741  if (nlbits > intctlbits) {
742  nlbits = intctlbits;
743  }
744  uint8_t intctrl = __ECLIC_GetCtrlIRQ(IRQn);
745  uint8_t lvl_abs = intctrl >> (ECLIC_MAX_NLBITS - nlbits);
746  return lvl_abs;
747 }

References __ECLIC_GetCfgNlbits(), __ECLIC_GetCtrlIRQ(), and ECLIC_MAX_NLBITS.

◆ __ECLIC_GetLevelIRQ_S()

__STATIC_INLINE uint8_t __ECLIC_GetLevelIRQ_S ( IRQn_Type  IRQn)

Get ECLIC Interrupt level of a specific interrupt.

This function get interrupt level of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
Interrupt level
Remarks
  • IRQn must not be negative.
See also

Definition at line 1356 of file core_feature_eclic.h.

1357 {
1358  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1359  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1360 
1361  if (nlbits == 0) {
1362  return 0;
1363  }
1364 
1365  if (nlbits > intctlbits) {
1366  nlbits = intctlbits;
1367  }
1368  uint8_t intctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1369  uint8_t lvl_abs = intctrl >> (ECLIC_MAX_NLBITS - nlbits);
1370  return lvl_abs;
1371 }

References __ECLIC_GetCfgNlbits(), __ECLIC_GetCtrlIRQ_S(), and ECLIC_MAX_NLBITS.

◆ __ECLIC_GetMth()

__STATIC_FORCEINLINE uint8_t __ECLIC_GetMth ( void  )

Get Machine Mode Interrupt Level Threshold.

This function gets machine mode interrupt level threshold.

Returns
Interrupt Level Threshold.
See also

Definition at line 461 of file core_feature_eclic.h.

462 {
463  return (ECLIC->MTH);
464 }

References ECLIC.

◆ __ECLIC_GetPendingIRQ()

__STATIC_FORCEINLINE int32_t __ECLIC_GetPendingIRQ ( IRQn_Type  IRQn)

Get the pending specific interrupt.

This function returns the pending status of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
  • 0 Interrupt is not pending
  • 1 Interrupt is pending
Remarks
  • IRQn must not be negative.
See also

Definition at line 530 of file core_feature_eclic.h.

531 {
532  return ((uint32_t)(ECLIC->CTRL[IRQn].INTIP) & CLIC_INTIP_IP_Msk);
533 }

References CLIC_INTIP_IP_Msk, and ECLIC.

◆ __ECLIC_GetPendingIRQ_S()

__STATIC_FORCEINLINE int32_t __ECLIC_GetPendingIRQ_S ( IRQn_Type  IRQn)

Get the pending specific interrupt in supervisor mode.

This function returns the pending status of the specific interrupt IRQn in supervisor mode.

Parameters
[in]IRQnInterrupt number
Returns
  • 0 Interrupt is not pending
  • 1 Interrupt is pending
Remarks
  • IRQn must not be negative.
See also

Definition at line 1168 of file core_feature_eclic.h.

1169 {
1170  return ((uint32_t)(ECLIC->SCTRL[IRQn].INTIP) & CLIC_INTIP_IP_Msk);
1171 }

References CLIC_INTIP_IP_Msk, and ECLIC.

◆ __ECLIC_GetPriorityIRQ()

__STATIC_INLINE uint8_t __ECLIC_GetPriorityIRQ ( IRQn_Type  IRQn)

Get ECLIC Interrupt priority of a specific interrupt.

This function get interrupt priority of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
Interrupt priority
Remarks
  • IRQn must not be negative.
See also

Definition at line 793 of file core_feature_eclic.h.

794 {
795  uint8_t nlbits = __ECLIC_GetCfgNlbits();
796  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
797  if (nlbits < intctlbits) {
798  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ(IRQn);
799  uint8_t pri = cur_ctrl << nlbits;
800  pri = pri >> nlbits;
801  pri = pri >> (ECLIC_MAX_NLBITS - intctlbits);
802  return pri;
803  } else {
804  return 0;
805  }
806 }

References __ECLIC_GetCfgNlbits(), __ECLIC_GetCtrlIRQ(), and ECLIC_MAX_NLBITS.

◆ __ECLIC_GetPriorityIRQ_S()

__STATIC_INLINE uint8_t __ECLIC_GetPriorityIRQ_S ( IRQn_Type  IRQn)

Get ECLIC Interrupt priority of a specific interrupt in supervisor mode.

This function get interrupt priority of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
Interrupt priority
Remarks
  • IRQn must not be negative.
See also

Definition at line 1417 of file core_feature_eclic.h.

1418 {
1419  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1420  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1421  if (nlbits < intctlbits) {
1422  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1423  uint8_t pri = cur_ctrl << nlbits;
1424  pri = pri >> nlbits;
1425  pri = pri >> (ECLIC_MAX_NLBITS - intctlbits);
1426  return pri;
1427  } else {
1428  return 0;
1429  }
1430 }

References __ECLIC_GetCfgNlbits(), __ECLIC_GetCtrlIRQ_S(), and ECLIC_MAX_NLBITS.

◆ __ECLIC_GetShvIRQ()

__STATIC_FORCEINLINE uint32_t __ECLIC_GetShvIRQ ( IRQn_Type  IRQn)

Get interrupt working mode for a specific interrupt.

This function get selective hardware vector or non-vector working mode of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
shv
Remarks
  • IRQn must not be negative.
See also

Definition at line 646 of file core_feature_eclic.h.

647 {
648  return ((uint32_t)(((ECLIC->CTRL[IRQn].INTATTR) & CLIC_INTATTR_SHV_Msk) >> CLIC_INTATTR_SHV_Pos));
649 }

References CLIC_INTATTR_SHV_Msk, CLIC_INTATTR_SHV_Pos, and ECLIC.

◆ __ECLIC_GetShvIRQ_S()

__STATIC_FORCEINLINE uint8_t __ECLIC_GetShvIRQ_S ( IRQn_Type  IRQn)

Get interrupt working mode for a specific interrupt in supervisor mode.

This function get selective hardware vector or non-vector working mode of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
shv
Remarks
  • IRQn must not be negative.
See also
  • ECLIC_SMODE_SetShvIRQ

Definition at line 1269 of file core_feature_eclic.h.

1270 {
1271  return ((uint8_t)(((ECLIC->SCTRL[IRQn].INTATTR) & CLIC_INTATTR_SHV_Msk) >> CLIC_INTATTR_SHV_Pos));
1272 }

References CLIC_INTATTR_SHV_Msk, CLIC_INTATTR_SHV_Pos, and ECLIC.

◆ __ECLIC_GetSth()

__STATIC_FORCEINLINE uint8_t __ECLIC_GetSth ( void  )

Get supervisor-mode Interrupt Level Threshold in supervisor mode.

This function gets supervisor mode interrupt level threshold.

Returns
Interrupt Level Threshold.
Remarks
  • S-mode ECLIC region sintthresh'sth is a mirror to M-mode ECLIC region's mintthresh.sth, and will be updated synchronously, here operate on mintthresh.sth.
See also

Definition at line 1133 of file core_feature_eclic.h.

1134 {
1135  return (ECLIC->STH);
1136 }

References ECLIC.

◆ __ECLIC_GetTrigIRQ()

__STATIC_FORCEINLINE uint32_t __ECLIC_GetTrigIRQ ( IRQn_Type  IRQn)

Get trigger mode and polarity for a specific interrupt.

This function get trigger mode and polarity of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
Remarks
  • IRQn must not be negative.
See also

Definition at line 607 of file core_feature_eclic.h.

608 {
609  return ((uint32_t)(((ECLIC->CTRL[IRQn].INTATTR) & CLIC_INTATTR_TRIG_Msk) >> CLIC_INTATTR_TRIG_Pos));
610 }

References CLIC_INTATTR_TRIG_Msk, CLIC_INTATTR_TRIG_Pos, and ECLIC.

◆ __ECLIC_GetTrigIRQ_S()

__STATIC_FORCEINLINE uint8_t __ECLIC_GetTrigIRQ_S ( IRQn_Type  IRQn)

Get trigger mode and polarity for a specific interrupt in supervisor mode.

This function get trigger mode and polarity of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
Remarks
  • IRQn must not be negative.
See also

Definition at line 1229 of file core_feature_eclic.h.

1230 {
1231  return ((uint8_t)(((ECLIC->SCTRL[IRQn].INTATTR) & CLIC_INTATTR_TRIG_Msk) >> CLIC_INTATTR_TRIG_Pos));
1232 }

References CLIC_INTATTR_TRIG_Msk, CLIC_INTATTR_TRIG_Pos, and ECLIC.

◆ __ECLIC_GetVector()

__STATIC_FORCEINLINE rv_csr_t __ECLIC_GetVector ( IRQn_Type  IRQn)

Get Interrupt Vector of a specific interrupt.

This function get interrupt handler address of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
Interrupt handler address
Remarks
  • IRQn must not be negative.
  • You can read CSR_CSR_MTVT to get interrupt vector table entry address.
See also

Definition at line 1068 of file core_feature_eclic.h.

1069 {
1070 #if __RISCV_XLEN == 32
1071  return (*(uint32_t *)(__RV_CSR_READ(CSR_MTVT) + IRQn * 4));
1072 #elif __RISCV_XLEN == 64
1073  return (*(uint64_t *)(__RV_CSR_READ(CSR_MTVT) + IRQn * 8));
1074 #else // TODO Need cover for XLEN=128 case in future
1075  return (*(uint64_t *)(__RV_CSR_READ(CSR_MTVT) + IRQn * 8));
1076 #endif
1077 }

References __RV_CSR_READ, and CSR_MTVT.

◆ __ECLIC_GetVector_S()

__STATIC_FORCEINLINE rv_csr_t __ECLIC_GetVector_S ( IRQn_Type  IRQn)

Get Interrupt Vector of a specific interrupt in supervisor mode.

This function get interrupt handler address of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Returns
Interrupt handler address
Remarks
  • IRQn must not be negative.
  • You can read CSR_CSR_MTVT to get interrupt vector table entry address.
See also
  • ECLIC_SMODE_SetVector

Definition at line 1529 of file core_feature_eclic.h.

1530 {
1531 #if __RISCV_XLEN == 32
1532  return (*(uint32_t *)(__RV_CSR_READ(CSR_STVT) + IRQn * 4));
1533 #elif __RISCV_XLEN == 64
1534  return (*(uint64_t *)(__RV_CSR_READ(CSR_STVT) + IRQn * 8));
1535 #else // TODO Need cover for XLEN=128 case in future
1536  return (*(uint64_t *)(__RV_CSR_READ(CSR_STVT) + IRQn * 8));
1537 #endif
1538 }

References __RV_CSR_READ, and CSR_STVT.

◆ __ECLIC_SetCfgNlbits()

__STATIC_FORCEINLINE void __ECLIC_SetCfgNlbits ( uint32_t  nlbits)

Set nlbits value.

This function set the nlbits value of CLICCFG register.

Parameters
[in]nlbitsnlbits value
Remarks
  • nlbits is used to set the width of level in the CLICINTCTL[i].
See also

Definition at line 345 of file core_feature_eclic.h.

346 {
347  uint8_t temp = ECLIC->CFG;
348 
349  ECLIC->CFG = (temp & ~CLIC_CLICCFG_NLBIT_Msk) | \
350  ((uint8_t)((nlbits << CLIC_CLICCFG_NLBIT_Pos) & CLIC_CLICCFG_NLBIT_Msk));
351 }

References CLIC_CLICCFG_NLBIT_Msk, CLIC_CLICCFG_NLBIT_Pos, and ECLIC.

◆ __ECLIC_SetCtrlIRQ()

__STATIC_FORCEINLINE void __ECLIC_SetCtrlIRQ ( IRQn_Type  IRQn,
uint8_t  intctrl 
)

Modify ECLIC Interrupt Input Control Register for a specific interrupt.

This function modify ECLIC Interrupt Input Control(CLICINTCTL[i]) register of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]intctrlSet value for CLICINTCTL[i] register
Remarks
  • IRQn must not be negative.
See also

Definition at line 662 of file core_feature_eclic.h.

663 {
664  ECLIC->CTRL[IRQn].INTCTRL = intctrl;
665 }

References ECLIC.

Referenced by __ECLIC_SetLevelIRQ(), and __ECLIC_SetPriorityIRQ().

◆ __ECLIC_SetCtrlIRQ_S()

__STATIC_FORCEINLINE void __ECLIC_SetCtrlIRQ_S ( IRQn_Type  IRQn,
uint8_t  intctrl 
)

Modify ECLIC Interrupt Input Control Register for a specific interrupt in supervisor mode.

This function modify ECLIC Interrupt Input Control(CLICINTCTL[i]) register of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]intctrlSet value for CLICINTCTL[i] register
Remarks
  • IRQn must not be negative.
See also

Definition at line 1285 of file core_feature_eclic.h.

1286 {
1287  ECLIC->SCTRL[IRQn].INTCTRL = intctrl;
1288 }

References ECLIC.

Referenced by __ECLIC_SetLevelIRQ_S(), and __ECLIC_SetPriorityIRQ_S().

◆ __ECLIC_SetLevelIRQ()

__STATIC_INLINE void __ECLIC_SetLevelIRQ ( IRQn_Type  IRQn,
uint8_t  lvl_abs 
)

Set ECLIC Interrupt level of a specific interrupt.

This function set interrupt level of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]lvl_absInterrupt level
Remarks
  • IRQn must not be negative.
  • If lvl_abs to be set is larger than the max level allowed, it will be force to be max level.
  • When you set level value you need use clciinfo.nlbits to get the width of level. Then we could know the maximum of level. CLICINTCTLBITS is how many total bits are present in the CLICINTCTL register.
See also

Definition at line 698 of file core_feature_eclic.h.

699 {
700  uint8_t nlbits = __ECLIC_GetCfgNlbits();
701  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
702 
703  if (nlbits == 0) {
704  return;
705  }
706 
707  if (nlbits > intctlbits) {
708  nlbits = intctlbits;
709  }
710  uint8_t maxlvl = ((1UL << nlbits) - 1);
711  if (lvl_abs > maxlvl) {
712  lvl_abs = maxlvl;
713  }
714  uint8_t lvl = lvl_abs << (ECLIC_MAX_NLBITS - nlbits);
715  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ(IRQn);
716  cur_ctrl = cur_ctrl << nlbits;
717  cur_ctrl = cur_ctrl >> nlbits;
718  __ECLIC_SetCtrlIRQ(IRQn, (cur_ctrl | lvl));
719 }

References __ECLIC_GetCfgNlbits(), __ECLIC_GetCtrlIRQ(), __ECLIC_SetCtrlIRQ(), and ECLIC_MAX_NLBITS.

◆ __ECLIC_SetLevelIRQ_S()

__STATIC_INLINE void __ECLIC_SetLevelIRQ_S ( IRQn_Type  IRQn,
uint8_t  lvl_abs 
)

Set ECLIC Interrupt level of a specific interrupt in supervisor mode.

This function set interrupt level of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]lvl_absInterrupt level
Remarks
  • IRQn must not be negative.
  • If lvl_abs to be set is larger than the max level allowed, it will be force to be max level.
  • When you set level value you need use clciinfo.nlbits to get the width of level. Then we could know the maximum of level. CLICINTCTLBITS is how many total bits are present in the CLICINTCTL register.
See also

Definition at line 1321 of file core_feature_eclic.h.

1322 {
1323  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1324  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1325 
1326  if (nlbits == 0) {
1327  return;
1328  }
1329 
1330  if (nlbits > intctlbits) {
1331  nlbits = intctlbits;
1332  }
1333  uint8_t maxlvl = ((1UL << nlbits) - 1);
1334  if (lvl_abs > maxlvl) {
1335  lvl_abs = maxlvl;
1336  }
1337  uint8_t lvl = lvl_abs << (ECLIC_MAX_NLBITS - nlbits);
1338  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1339  cur_ctrl = cur_ctrl << nlbits;
1340  cur_ctrl = cur_ctrl >> nlbits;
1341  __ECLIC_SetCtrlIRQ_S(IRQn, (cur_ctrl | lvl));
1342 }

References __ECLIC_GetCfgNlbits(), __ECLIC_GetCtrlIRQ_S(), __ECLIC_SetCtrlIRQ_S(), and ECLIC_MAX_NLBITS.

◆ __ECLIC_SetModeIRQ()

__STATIC_FORCEINLINE void __ECLIC_SetModeIRQ ( IRQn_Type  IRQn,
uint32_t  mode 
)

Set privilege mode of a specific interrupt.

This function set in which privilege mode the interrupts IRQn should be taken.

Parameters
[in]IRQnInterrupt number
[in]modePrivilege mode
Remarks
  • IRQn must not be negative.
  • mode must be 1(Supervisor Mode) or 3(Machine Mode), other values are ignored.
  • M-mode can R/W this field, but S-mode can only read. And ECLIC with S-Mode does not reply on CSR mideleg to delegate interrupts.
  • Mode of S-mode ECLIC region's clicintattr can be omitted to set, which is mirror to M-mode ECLIC region's. Only the low 6 bits of clicintattr [i] can be written via the S-mode memory region.

Definition at line 1094 of file core_feature_eclic.h.

1095 {
1096  /*
1097  * only 1 or 3 can be assigned to mode in one step.the default value of mode is 3,
1098  * which can't be clear to 0 firstly, then OR it to 1
1099  */
1100  ECLIC->CTRL[IRQn].INTATTR = (uint8_t)(mode << CLIC_INTATTR_MODE_Pos) + \
1101  (ECLIC->CTRL[IRQn].INTATTR & (~CLIC_INTATTR_MODE_Msk));
1102 }

References CLIC_INTATTR_MODE_Msk, CLIC_INTATTR_MODE_Pos, and ECLIC.

◆ __ECLIC_SetMth()

__STATIC_FORCEINLINE void __ECLIC_SetMth ( uint8_t  mth)

Set Machine Mode Interrupt Level Threshold.

This function sets machine mode interrupt level threshold. This threshold is not effective immediately, if you want to safely change it, you need to disable all interrupts first, and then change it, and do fence and then enable all interrupts.

Parameters
[in]mthInterrupt Level Threshold.
See also

Definition at line 448 of file core_feature_eclic.h.

449 {
450  ECLIC->MTH = mth;
451 }

References ECLIC.

◆ __ECLIC_SetPendingIRQ()

__STATIC_FORCEINLINE void __ECLIC_SetPendingIRQ ( IRQn_Type  IRQn)

Set a specific interrupt to pending.

This function sets the pending bit for the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
Remarks
  • IRQn must not be negative.
See also

Definition at line 546 of file core_feature_eclic.h.

547 {
548  ECLIC->CTRL[IRQn].INTIP |= CLIC_INTIP_IP_Msk;
549 }

References CLIC_INTIP_IP_Msk, and ECLIC.

◆ __ECLIC_SetPendingIRQ_S()

__STATIC_FORCEINLINE void __ECLIC_SetPendingIRQ_S ( IRQn_Type  IRQn)

Set a specific interrupt to pending in supervisor mode.

This function sets the pending bit for the specific interrupt IRQn in supervisor mode.

Parameters
[in]IRQnInterrupt number
Remarks
  • IRQn must not be negative.
See also

Definition at line 1149 of file core_feature_eclic.h.

1150 {
1151  ECLIC->SCTRL[IRQn].INTIP |= CLIC_INTIP_IP_Msk;
1152 }

References CLIC_INTIP_IP_Msk, and ECLIC.

◆ __ECLIC_SetPriorityIRQ()

__STATIC_INLINE void __ECLIC_SetPriorityIRQ ( IRQn_Type  IRQn,
uint8_t  pri 
)

Get ECLIC Interrupt priority of a specific interrupt.

This function get interrupt priority of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]priInterrupt priority
Remarks
  • IRQn must not be negative.
  • If pri to be set is larger than the max priority allowed, it will be force to be max priority.
  • Priority width is CLICINTCTLBITS minus clciinfo.nlbits if clciinfo.nlbits is less than CLICINTCTLBITS. Otherwise priority width is 0.
See also

Definition at line 763 of file core_feature_eclic.h.

764 {
765  uint8_t nlbits = __ECLIC_GetCfgNlbits();
766  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
767  if (nlbits < intctlbits) {
768  uint8_t maxpri = ((1UL << (intctlbits - nlbits)) - 1);
769  if (pri > maxpri) {
770  pri = maxpri;
771  }
772  pri = pri << (ECLIC_MAX_NLBITS - intctlbits);
773  uint8_t mask = ((uint8_t)(-1)) >> intctlbits;
774  pri = pri | mask;
775  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ(IRQn);
776  cur_ctrl = cur_ctrl >> (ECLIC_MAX_NLBITS - nlbits);
777  cur_ctrl = cur_ctrl << (ECLIC_MAX_NLBITS - nlbits);
778  __ECLIC_SetCtrlIRQ(IRQn, (cur_ctrl | pri));
779  }
780 }

References __ECLIC_GetCfgNlbits(), __ECLIC_GetCtrlIRQ(), __ECLIC_SetCtrlIRQ(), and ECLIC_MAX_NLBITS.

◆ __ECLIC_SetPriorityIRQ_S()

__STATIC_INLINE void __ECLIC_SetPriorityIRQ_S ( IRQn_Type  IRQn,
uint8_t  pri 
)

Set ECLIC Interrupt priority of a specific interrupt in supervisor mode.

This function get interrupt priority of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]priInterrupt priority
Remarks
  • IRQn must not be negative.
  • If pri to be set is larger than the max priority allowed, it will be force to be max priority.
  • Priority width is CLICINTCTLBITS minus clciinfo.nlbits if clciinfo.nlbits is less than CLICINTCTLBITS. Otherwise priority width is 0.
See also

Definition at line 1387 of file core_feature_eclic.h.

1388 {
1389  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1390  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1391  if (nlbits < intctlbits) {
1392  uint8_t maxpri = ((1UL << (intctlbits - nlbits)) - 1);
1393  if (pri > maxpri) {
1394  pri = maxpri;
1395  }
1396  pri = pri << (ECLIC_MAX_NLBITS - intctlbits);
1397  uint8_t mask = ((uint8_t)(-1)) >> intctlbits;
1398  pri = pri | mask;
1399  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1400  cur_ctrl = cur_ctrl >> (ECLIC_MAX_NLBITS - nlbits);
1401  cur_ctrl = cur_ctrl << (ECLIC_MAX_NLBITS - nlbits);
1402  __ECLIC_SetCtrlIRQ_S(IRQn, (cur_ctrl | pri));
1403  }
1404 }

References __ECLIC_GetCfgNlbits(), __ECLIC_GetCtrlIRQ_S(), __ECLIC_SetCtrlIRQ_S(), and ECLIC_MAX_NLBITS.

◆ __ECLIC_SetShvIRQ()

__STATIC_FORCEINLINE void __ECLIC_SetShvIRQ ( IRQn_Type  IRQn,
uint32_t  shv 
)

Set interrupt working mode for a specific interrupt.

This function set selective hardware vector or non-vector working mode of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]shv
Remarks
  • IRQn must not be negative.
See also

Definition at line 625 of file core_feature_eclic.h.

626 {
627  uint8_t temp = ECLIC->CTRL[IRQn].INTATTR;
628 
629  ECLIC->CTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_SHV_Msk) | \
630  ((uint8_t)(shv << CLIC_INTATTR_SHV_Pos));
631 }

References CLIC_INTATTR_SHV_Msk, CLIC_INTATTR_SHV_Pos, and ECLIC.

◆ __ECLIC_SetShvIRQ_S()

__STATIC_FORCEINLINE void __ECLIC_SetShvIRQ_S ( IRQn_Type  IRQn,
uint32_t  shv 
)

Set interrupt working mode for a specific interrupt in supervisor mode.

This function set selective hardware vector or non-vector working mode of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]shv
Remarks
  • IRQn must not be negative.
See also

Definition at line 1248 of file core_feature_eclic.h.

1249 {
1250  uint8_t temp = ECLIC->SCTRL[IRQn].INTATTR;
1251 
1252  ECLIC->SCTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_SHV_Msk) | \
1253  ((uint8_t)(shv << CLIC_INTATTR_SHV_Pos));
1254 }

References CLIC_INTATTR_SHV_Msk, CLIC_INTATTR_SHV_Pos, and ECLIC.

◆ __ECLIC_SetSth()

__STATIC_FORCEINLINE void __ECLIC_SetSth ( uint8_t  sth)

Set supervisor-mode Interrupt Level Threshold in supervisor mode.

This function sets supervisor-mode interrupt level threshold.

Parameters
[in]sthInterrupt Level Threshold.
Remarks
  • S-mode ECLIC region sintthresh'sth is a mirror to M-mode ECLIC region's mintthresh.sth, and will be updated synchronously, here operate on mintthresh.sth.
  • Similiar to ECLIC_SetMth, also recommended to disable interrupts before setting interrupt level threshold.
See also

Definition at line 1117 of file core_feature_eclic.h.

1118 {
1119  ECLIC->STH = sth;
1120 }

References ECLIC.

◆ __ECLIC_SetTrigIRQ()

__STATIC_FORCEINLINE void __ECLIC_SetTrigIRQ ( IRQn_Type  IRQn,
uint32_t  trig 
)

Set trigger mode and polarity for a specific interrupt.

This function set trigger mode and polarity of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]trig
Remarks
  • IRQn must not be negative.
See also

Definition at line 584 of file core_feature_eclic.h.

585 {
586  uint8_t temp = ECLIC->CTRL[IRQn].INTATTR;
587 
588  ECLIC->CTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_TRIG_Msk) | \
589  ((uint8_t)(trig << CLIC_INTATTR_TRIG_Pos));
590 }

References CLIC_INTATTR_TRIG_Msk, CLIC_INTATTR_TRIG_Pos, and ECLIC.

◆ __ECLIC_SetTrigIRQ_S()

__STATIC_FORCEINLINE void __ECLIC_SetTrigIRQ_S ( IRQn_Type  IRQn,
uint32_t  trig 
)

Set trigger mode and polarity for a specific interrupt in supervisor mode.

This function set trigger mode and polarity of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]trig
Remarks
  • IRQn must not be negative.
See also

Definition at line 1206 of file core_feature_eclic.h.

1207 {
1208  uint8_t temp = ECLIC->SCTRL[IRQn].INTATTR;
1209 
1210  ECLIC->SCTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_TRIG_Msk) | \
1211  ((uint8_t)(trig << CLIC_INTATTR_TRIG_Pos));
1212 }

References CLIC_INTATTR_TRIG_Msk, CLIC_INTATTR_TRIG_Pos, and ECLIC.

◆ __ECLIC_SetVector()

__STATIC_INLINE void __ECLIC_SetVector ( IRQn_Type  IRQn,
rv_csr_t  vector 
)

Set Interrupt Vector of a specific interrupt.

This function set interrupt handler address of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]vectorInterrupt handler address
Remarks
  • IRQn must not be negative.
  • You can set the CSR_CSR_MTVT to set interrupt vector table entry address.
  • If your vector table is placed in readonly section, the vector for IRQn will not be modified. For this case, you need to use the correct irq handler name defined in your vector table as your irq handler function name.
  • This function will only work correctly when the vector table is placed in an read-write enabled section.
See also

Definition at line 1036 of file core_feature_eclic.h.

1037 {
1038  unsigned long vec_base;
1039  vec_base = ((unsigned long)__RV_CSR_READ(CSR_MTVT));
1040  vec_base += ((unsigned long)IRQn) * sizeof(unsigned long);
1041  (* (unsigned long *) vec_base) = vector;
1042 #if (defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1))
1043 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
1044  MFlushDCacheLine((unsigned long)vec_base);
1045 #endif
1046 #endif
1047 #if (defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1))
1048 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
1049  MInvalICacheLine((unsigned long)vec_base);
1050 #else
1051  __FENCE_I();
1052 #endif
1053 #endif
1054 }

References __FENCE_I(), __RV_CSR_READ, CSR_MTVT, MFlushDCacheLine(), and MInvalICacheLine().

◆ __ECLIC_SetVector_S()

__STATIC_INLINE void __ECLIC_SetVector_S ( IRQn_Type  IRQn,
rv_csr_t  vector 
)

Set Interrupt Vector of a specific interrupt in supervisor mode.

This function set interrupt handler address of the specific interrupt IRQn.

Parameters
[in]IRQnInterrupt number
[in]vectorInterrupt handler address
Remarks
  • IRQn must not be negative.
  • You can set the CSR_CSR_MTVT to set interrupt vector table entry address.
  • If your vector table is placed in readonly section, the vector for IRQn will not be modified. For this case, you need to use the correct irq handler name defined in your vector table as your irq handler function name.
  • This function will only work correctly when the vector table is placed in an read-write enabled section.
See also

Definition at line 1497 of file core_feature_eclic.h.

1498 {
1499  volatile unsigned long vec_base;
1500  vec_base = ((unsigned long)__RV_CSR_READ(CSR_STVT));
1501  vec_base += ((unsigned long)IRQn) * sizeof(unsigned long);
1502  (* (unsigned long *) vec_base) = vector;
1503 #if (defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1))
1504 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
1505  SFlushDCacheLine((unsigned long)vec_base);
1506 #endif
1507 #endif
1508 #if (defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1))
1509 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
1510  SInvalICacheLine((unsigned long)vec_base);
1511 #else
1512  __FENCE_I();
1513 #endif
1514 #endif
1515 }

References __FENCE_I(), __RV_CSR_READ, CSR_STVT, SFlushDCacheLine(), and SInvalICacheLine().

◆ __get_exc_entry()

__STATIC_FORCEINLINE rv_csr_t __get_exc_entry ( void  )

Get Exception entry address.

This function get exception handler address from 'CSR_MTVEC'.

Returns
Exception handler address
Remarks
  • This function use to get exception handler address from 'CSR_MTVEC'. Address need to be aligned to 64 bytes.
See also

Definition at line 1784 of file core_feature_eclic.h.

1785 {
1786  unsigned long addr = __RV_CSR_READ(CSR_MTVEC);
1787  return (addr & ~ECLIC_MODE_MTVEC_Msk);
1788 }

References __RV_CSR_READ, CSR_MTVEC, and ECLIC_MODE_MTVEC_Msk.

◆ __get_nmi_entry()

__STATIC_FORCEINLINE rv_csr_t __get_nmi_entry ( void  )

Get NMI interrupt entry from 'CSR_MNVEC'.

This function get NMI interrupt address from 'CSR_MNVEC'.

Returns
NMI interrupt handler address
Remarks
  • This function use to get NMI interrupt handler address from 'CSR_MNVEC'. If CSR_MMISC_CTL[9] = 1 'CSR_MNVEC'
  • will be equal as mtvec. If CSR_MMISC_CTL[9] = 0 'CSR_MNVEC' will be equal as reset vector.
  • NMI entry is defined via CSR_MMISC_CTL, writing to CSR_MNVEC will be ignored.

Definition at line 1843 of file core_feature_eclic.h.

1844 {
1845  return __RV_CSR_READ(CSR_MNVEC);
1846 }

References __RV_CSR_READ, and CSR_MNVEC.

◆ __get_nonvec_entry()

__STATIC_INLINE rv_csr_t __get_nonvec_entry ( void  )

Get Non-vector interrupt entry address.

This function get Non-vector interrupt address.

Returns
Non-vector interrupt handler address
Remarks
  • This function use to get non-vector interrupt entry address from 'CSR_MTVT2' if
  • CSR_MTVT2 bit0 is 1. If 'CSR_MTVT2' bit0 is 0 then get address from 'CSR_MTVEC'.
See also

Definition at line 1823 of file core_feature_eclic.h.

1824 {
1825  if (__RV_CSR_READ(CSR_MTVT2) & 0x1) {
1826  return __RV_CSR_READ(CSR_MTVT2) & (~(rv_csr_t)(0x1));
1827  } else {
1829  return (addr & ~ECLIC_MODE_MTVEC_Msk);
1830  }
1831 }

References __RV_CSR_READ, CSR_MTVEC, CSR_MTVT2, and ECLIC_MODE_MTVEC_Msk.

◆ __set_exc_entry()

__STATIC_FORCEINLINE void __set_exc_entry ( rv_csr_t  addr)

Set Exception entry address.

This function set exception handler address to 'CSR_MTVEC'.

Parameters
[in]addrException handler address
Remarks
  • This function use to set exception handler address to 'CSR_MTVEC'. Address need to be aligned to 64 bytes.
See also

Definition at line 1766 of file core_feature_eclic.h.

1767 {
1768  addr &= (rv_csr_t)(~0x3F);
1769  addr |= ECLIC_MODE_MTVEC_Msk;
1770  __RV_CSR_WRITE(CSR_MTVEC, addr);
1771 }

References __RV_CSR_WRITE, CSR_MTVEC, and ECLIC_MODE_MTVEC_Msk.

◆ __set_nonvec_entry()

__STATIC_INLINE void __set_nonvec_entry ( rv_csr_t  addr)

Set Non-vector interrupt entry address.

This function set Non-vector interrupt address.

Parameters
[in]addrNon-vector interrupt entry address
Remarks
  • This function use to set non-vector interrupt entry address to 'CSR_MTVT2' if
  • CSR_MTVT2 bit0 is 1. If 'CSR_MTVT2' bit0 is 0 then set address to 'CSR_MTVEC'
See also

Definition at line 1801 of file core_feature_eclic.h.

1802 {
1803  if (__RV_CSR_READ(CSR_MTVT2) & 0x1) {
1804  __RV_CSR_WRITE(CSR_MTVT2, addr | 0x01);
1805  } else {
1806  addr &= (rv_csr_t)(~0x3F);
1807  addr |= ECLIC_MODE_MTVEC_Msk;
1808  __RV_CSR_WRITE(CSR_MTVEC, addr);
1809  }
1810 }

References __RV_CSR_READ, __RV_CSR_WRITE, CSR_MTVEC, CSR_MTVT2, and ECLIC_MODE_MTVEC_Msk.

SysTimer_IRQn
@ SysTimer_IRQn
System Timer Interrupt.
Definition: core_feature_eclic.h:224
Reserved5_IRQn
@ Reserved5_IRQn
Internal reserved.
Definition: core_feature_eclic.h:223
CLIC_INTIE_IE_Msk
#define CLIC_INTIE_IE_Msk
CLIC INTIE: IE Mask.
Definition: core_feature_eclic.h:143
Reserved3_IRQn
@ Reserved3_IRQn
Internal reserved.
Definition: core_feature_eclic.h:221
CLIC_INTATTR_TRIG_Pos
#define CLIC_INTATTR_TRIG_Pos
CLIC INTATTR: TRIG Position.
Definition: core_feature_eclic.h:150
Reserved14_IRQn
@ Reserved14_IRQn
Internal reserved.
Definition: core_feature_eclic.h:233
CLIC_INTATTR_MODE_Msk
#define CLIC_INTATTR_MODE_Msk
CLIC INTATTA: Mode Mask.
Definition: core_feature_eclic.h:147
CSR_MTVEC
#define CSR_MTVEC
Definition: riscv_encoding.h:672
Reserved7_IRQn
@ Reserved7_IRQn
Internal reserved.
Definition: core_feature_eclic.h:226
MInvalICacheLine
__STATIC_INLINE void MInvalICacheLine(unsigned long addr)
Invalidate one I-Cache line specified by address in M-Mode.
Definition: core_feature_cache.h:651
CLIC_INTATTR_SHV_Pos
#define CLIC_INTATTR_SHV_Pos
CLIC INTATTR: SHV Position.
Definition: core_feature_eclic.h:153
Reserved6_IRQn
@ Reserved6_IRQn
Internal reserved.
Definition: core_feature_eclic.h:225
Reserved0_IRQn
@ Reserved0_IRQn
Internal reserved.
Definition: core_feature_eclic.h:217
CLIC_CLICCFG_NLBIT_Msk
#define CLIC_CLICCFG_NLBIT_Msk
CLIC CLICCFG: NLBIT Mask.
Definition: core_feature_eclic.h:125
RESTORE_IRQ_CSR_CONTEXT
#define RESTORE_IRQ_CSR_CONTEXT()
Restore necessary CSRs from variables for vector interrupt nesting.
Definition: core_feature_eclic.h:1911
Reserved8_IRQn
@ Reserved8_IRQn
Internal reserved.
Definition: core_feature_eclic.h:227
CSR_MTVT
#define CSR_MTVT
Definition: riscv_encoding.h:1002
__ECLIC_GetCtrlIRQ_S
__STATIC_FORCEINLINE uint8_t __ECLIC_GetCtrlIRQ_S(IRQn_Type IRQn)
Get ECLIC Interrupt Input Control Register value for a specific interrupt in supervisor mode.
Definition: core_feature_eclic.h:1301
CSR_STVT
#define CSR_STVT
Definition: riscv_encoding.h:657
ECLIC_MODE_MTVEC_Msk
#define ECLIC_MODE_MTVEC_Msk
ECLIC Mode mask for MTVT CSR Register.
Definition: core_feature_eclic.h:157
CLIC_INTATTR_MODE_Pos
#define CLIC_INTATTR_MODE_Pos
CLIC INTATTA: Mode Position.
Definition: core_feature_eclic.h:146
IRQn
IRQn
Definition of IRQn numbers.
Definition: core_feature_eclic.h:214
ECLIC
#define ECLIC
CLIC configuration struct.
Definition: core_feature_eclic.h:187
__RV_CSR_WRITE
#define __RV_CSR_WRITE(csr, val)
CSR operation Macro for csrw instruction.
Definition: core_feature_base.h:725
__ECLIC_SetCtrlIRQ
__STATIC_FORCEINLINE void __ECLIC_SetCtrlIRQ(IRQn_Type IRQn, uint8_t intctrl)
Modify ECLIC Interrupt Input Control Register for a specific interrupt.
Definition: core_feature_eclic.h:662
CLIC_CLICINFO_CTLBIT_Pos
#define CLIC_CLICINFO_CTLBIT_Pos
CLIC INTINFO: CLICINTCTLBITS Position.
Definition: core_feature_eclic.h:127
__FENCE_I
__STATIC_FORCEINLINE void __FENCE_I(void)
Fence.i Instruction.
Definition: core_feature_base.h:841
SOC_INT_MAX
@ SOC_INT_MAX
Number of total interrupts.
Definition: core_feature_eclic.h:244
CLIC_CLICINFO_SHD_NUM_Msk
#define CLIC_CLICINFO_SHD_NUM_Msk
CLIC CLICINFO: SHD_NUM Mask.
Definition: core_feature_eclic.h:137
SInvalICacheLine
__STATIC_INLINE void SInvalICacheLine(unsigned long addr)
Invalidate one I-Cache line specified by address in S-Mode.
Definition: core_feature_cache.h:693
CLIC_INTATTR_SHV_Msk
#define CLIC_INTATTR_SHV_Msk
CLIC INTATTR: SHV Mask.
Definition: core_feature_eclic.h:154
SAVE_IRQ_CSR_CONTEXT
#define SAVE_IRQ_CSR_CONTEXT()
Save necessary CSRs into variables for vector interrupt nesting.
Definition: core_feature_eclic.h:1888
CLIC_CLICINFO_SHD_NUM_Pos
#define CLIC_CLICINFO_SHD_NUM_Pos
CLIC CLICINFO: SHD_NUM Position.
Definition: core_feature_eclic.h:136
FirstDeviceSpecificInterrupt_IRQn
@ FirstDeviceSpecificInterrupt_IRQn
First Device Specific Interrupt.
Definition: core_feature_eclic.h:243
Reserved16_IRQn
@ Reserved16_IRQn
Internal reserved.
Definition: core_feature_eclic.h:235
Reserved9_IRQn
@ Reserved9_IRQn
Internal reserved.
Definition: core_feature_eclic.h:228
CLIC_CLICINFO_NUM_Msk
#define CLIC_CLICINFO_NUM_Msk
CLIC CLICINFO: NUM_INTERRUPT Mask.
Definition: core_feature_eclic.h:134
MFlushDCacheLine
__STATIC_INLINE void MFlushDCacheLine(unsigned long addr)
Flush one D-Cache line specified by address in M-Mode.
Definition: core_feature_cache.h:1576
__ECLIC_GetCfgNlbits
__STATIC_FORCEINLINE uint32_t __ECLIC_GetCfgNlbits(void)
Get nlbits value.
Definition: core_feature_eclic.h:363
Reserved15_IRQn
@ Reserved15_IRQn
Internal reserved.
Definition: core_feature_eclic.h:234
ECLIC_MAX_NLBITS
#define ECLIC_MAX_NLBITS
Max nlbit of the CLICINTCTLBITS.
Definition: core_feature_eclic.h:156
Reserved2_IRQn
@ Reserved2_IRQn
Internal reserved.
Definition: core_feature_eclic.h:219
CLIC_CLICCFG_NLBIT_Pos
#define CLIC_CLICCFG_NLBIT_Pos
CLIC CLICCFG: NLBIT Position.
Definition: core_feature_eclic.h:124
CSR_MNVEC
#define CSR_MNVEC
Definition: riscv_encoding.h:1017
Reserved11_IRQn
@ Reserved11_IRQn
Internal reserved.
Definition: core_feature_eclic.h:230
__RV_CSR_READ
#define __RV_CSR_READ(csr)
CSR operation Macro for csrr instruction.
Definition: core_feature_base.h:707
CLIC_INTATTR_TRIG_Msk
#define CLIC_INTATTR_TRIG_Msk
CLIC INTATTR: TRIG Mask.
Definition: core_feature_eclic.h:151
Reserved10_IRQn
@ Reserved10_IRQn
Internal reserved.
Definition: core_feature_eclic.h:229
__ECLIC_GetCtrlIRQ
__STATIC_FORCEINLINE uint8_t __ECLIC_GetCtrlIRQ(IRQn_Type IRQn)
Get ECLIC Interrupt Input Control Register value for a specific interrupt.
Definition: core_feature_eclic.h:678
SFlushDCacheLine
__STATIC_INLINE void SFlushDCacheLine(unsigned long addr)
Flush one D-Cache line specified by address in S-Mode.
Definition: core_feature_cache.h:1617
__ECLIC_SetCtrlIRQ_S
__STATIC_FORCEINLINE void __ECLIC_SetCtrlIRQ_S(IRQn_Type IRQn, uint8_t intctrl)
Modify ECLIC Interrupt Input Control Register for a specific interrupt in supervisor mode.
Definition: core_feature_eclic.h:1285
CSR_MTVT2
#define CSR_MTVT2
Definition: riscv_encoding.h:1041
Reserved4_IRQn
@ Reserved4_IRQn
Internal reserved.
Definition: core_feature_eclic.h:222
Reserved13_IRQn
@ Reserved13_IRQn
Internal reserved.
Definition: core_feature_eclic.h:232
Reserved1_IRQn
@ Reserved1_IRQn
Internal reserved.
Definition: core_feature_eclic.h:218
SysTimerSW_IRQn
@ SysTimerSW_IRQn
System Timer SW interrupt.
Definition: core_feature_eclic.h:220
__INTERRUPT
#define __INTERRUPT
Use this attribute to indicate that the specified function is an interrupt handler run in Machine Mod...
Definition: nmsis_gcc.h:187
CLIC_CLICINFO_VER_Pos
#define CLIC_CLICINFO_VER_Pos
CLIC CLICINFO: VERSION Position.
Definition: core_feature_eclic.h:130
CLIC_CLICINFO_CTLBIT_Msk
#define CLIC_CLICINFO_CTLBIT_Msk
CLIC INTINFO: CLICINTCTLBITS Mask.
Definition: core_feature_eclic.h:128
Reserved12_IRQn
@ Reserved12_IRQn
Internal reserved.
Definition: core_feature_eclic.h:231
rv_csr_t
unsigned long rv_csr_t
Type of Control and Status Register(CSR), depends on the XLEN defined in RISC-V.
Definition: core_feature_base.h:55
CLIC_INTIP_IP_Msk
#define CLIC_INTIP_IP_Msk
CLIC INTIP: IP Mask.
Definition: core_feature_eclic.h:140
CLIC_CLICINFO_NUM_Pos
#define CLIC_CLICINFO_NUM_Pos
CLIC CLICINFO: NUM_INTERRUPT Position.
Definition: core_feature_eclic.h:133
CLIC_CLICINFO_VER_Msk
#define CLIC_CLICINFO_VER_Msk
CLIC CLICINFO: VERSION Mask.
Definition: core_feature_eclic.h:131