NMSIS-Core  Version 1.5.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_Type {
  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 259 of file core_feature_eclic.h.

◆ ECLIC_ClearPendingIRQ_S

#define ECLIC_ClearPendingIRQ_S   __ECLIC_ClearPendingIRQ_S

Definition at line 286 of file core_feature_eclic.h.

◆ ECLIC_DisableIRQ

#define ECLIC_DisableIRQ   __ECLIC_DisableIRQ

Definition at line 256 of file core_feature_eclic.h.

◆ ECLIC_DisableIRQ_S

#define ECLIC_DisableIRQ_S   __ECLIC_DisableIRQ_S

Definition at line 299 of file core_feature_eclic.h.

◆ ECLIC_EnableIRQ

#define ECLIC_EnableIRQ   __ECLIC_EnableIRQ

Definition at line 254 of file core_feature_eclic.h.

◆ ECLIC_EnableIRQ_S

#define ECLIC_EnableIRQ_S   __ECLIC_EnableIRQ_S

Definition at line 297 of file core_feature_eclic.h.

◆ ECLIC_GetCfgNlbits

#define ECLIC_GetCfgNlbits   __ECLIC_GetCfgNlbits

Definition at line 247 of file core_feature_eclic.h.

◆ ECLIC_GetCtrlIRQ

#define ECLIC_GetCtrlIRQ   __ECLIC_GetCtrlIRQ

Definition at line 265 of file core_feature_eclic.h.

◆ ECLIC_GetCtrlIRQ_S

#define ECLIC_GetCtrlIRQ_S   __ECLIC_GetCtrlIRQ_S

Definition at line 292 of file core_feature_eclic.h.

◆ ECLIC_GetEnableIRQ

#define ECLIC_GetEnableIRQ   __ECLIC_GetEnableIRQ

Definition at line 255 of file core_feature_eclic.h.

◆ ECLIC_GetEnableIRQ_S

#define ECLIC_GetEnableIRQ_S   __ECLIC_GetEnableIRQ_S

Definition at line 298 of file core_feature_eclic.h.

◆ ECLIC_GetInfoCtlbits

#define ECLIC_GetInfoCtlbits   __ECLIC_GetInfoCtlbits

Definition at line 249 of file core_feature_eclic.h.

◆ ECLIC_GetInfoNum

#define ECLIC_GetInfoNum   __ECLIC_GetInfoNum

Definition at line 250 of file core_feature_eclic.h.

◆ ECLIC_GetInfoShadowNum

#define ECLIC_GetInfoShadowNum   __ECLIC_GetInfoShadowNum

Definition at line 251 of file core_feature_eclic.h.

◆ ECLIC_GetInfoVer

#define ECLIC_GetInfoVer   __ECLIC_GetInfoVer

Definition at line 248 of file core_feature_eclic.h.

◆ ECLIC_GetLevelIRQ

#define ECLIC_GetLevelIRQ   __ECLIC_GetLevelIRQ

Definition at line 267 of file core_feature_eclic.h.

◆ ECLIC_GetLevelIRQ_S

#define ECLIC_GetLevelIRQ_S   __ECLIC_GetLevelIRQ_S

Definition at line 294 of file core_feature_eclic.h.

◆ ECLIC_GetMth

#define ECLIC_GetMth   __ECLIC_GetMth

Definition at line 253 of file core_feature_eclic.h.

◆ ECLIC_GetPendingIRQ

#define ECLIC_GetPendingIRQ   __ECLIC_GetPendingIRQ

Definition at line 258 of file core_feature_eclic.h.

◆ ECLIC_GetPendingIRQ_S

#define ECLIC_GetPendingIRQ_S   __ECLIC_GetPendingIRQ_S

Definition at line 285 of file core_feature_eclic.h.

◆ ECLIC_GetPriorityIRQ

#define ECLIC_GetPriorityIRQ   __ECLIC_GetPriorityIRQ

Definition at line 269 of file core_feature_eclic.h.

◆ ECLIC_GetPriorityIRQ_S

#define ECLIC_GetPriorityIRQ_S   __ECLIC_GetPriorityIRQ_S

Definition at line 296 of file core_feature_eclic.h.

◆ ECLIC_GetShvIRQ

#define ECLIC_GetShvIRQ   __ECLIC_GetShvIRQ

Definition at line 263 of file core_feature_eclic.h.

◆ ECLIC_GetShvIRQ_S

#define ECLIC_GetShvIRQ_S   __ECLIC_GetShvIRQ_S

Definition at line 290 of file core_feature_eclic.h.

◆ ECLIC_GetSth

#define ECLIC_GetSth   __ECLIC_GetSth

Definition at line 283 of file core_feature_eclic.h.

◆ ECLIC_GetTrigIRQ

#define ECLIC_GetTrigIRQ   __ECLIC_GetTrigIRQ

Definition at line 261 of file core_feature_eclic.h.

◆ ECLIC_GetTrigIRQ_S

#define ECLIC_GetTrigIRQ_S   __ECLIC_GetTrigIRQ_S

Definition at line 288 of file core_feature_eclic.h.

◆ ECLIC_GetVector

#define ECLIC_GetVector   __ECLIC_GetVector

Definition at line 319 of file core_feature_eclic.h.

◆ ECLIC_GetVector_S

#define ECLIC_GetVector_S   __ECLIC_GetVector_S

Definition at line 323 of file core_feature_eclic.h.

◆ ECLIC_SetCfgNlbits

#define ECLIC_SetCfgNlbits   __ECLIC_SetCfgNlbits

Definition at line 246 of file core_feature_eclic.h.

◆ ECLIC_SetCtrlIRQ

#define ECLIC_SetCtrlIRQ   __ECLIC_SetCtrlIRQ

Definition at line 264 of file core_feature_eclic.h.

◆ ECLIC_SetCtrlIRQ_S

#define ECLIC_SetCtrlIRQ_S   __ECLIC_SetCtrlIRQ_S

Definition at line 291 of file core_feature_eclic.h.

◆ ECLIC_SetLevelIRQ

#define ECLIC_SetLevelIRQ   __ECLIC_SetLevelIRQ

Definition at line 266 of file core_feature_eclic.h.

◆ ECLIC_SetLevelIRQ_S

#define ECLIC_SetLevelIRQ_S   __ECLIC_SetLevelIRQ_S

Definition at line 293 of file core_feature_eclic.h.

◆ ECLIC_SetModeIRQ

#define ECLIC_SetModeIRQ   __ECLIC_SetModeIRQ

Definition at line 281 of file core_feature_eclic.h.

◆ ECLIC_SetMth

#define ECLIC_SetMth   __ECLIC_SetMth

Definition at line 252 of file core_feature_eclic.h.

◆ ECLIC_SetPendingIRQ

#define ECLIC_SetPendingIRQ   __ECLIC_SetPendingIRQ

Definition at line 257 of file core_feature_eclic.h.

◆ ECLIC_SetPendingIRQ_S

#define ECLIC_SetPendingIRQ_S   __ECLIC_SetPendingIRQ_S

Definition at line 284 of file core_feature_eclic.h.

◆ ECLIC_SetPriorityIRQ

#define ECLIC_SetPriorityIRQ   __ECLIC_SetPriorityIRQ

Definition at line 268 of file core_feature_eclic.h.

◆ ECLIC_SetPriorityIRQ_S

#define ECLIC_SetPriorityIRQ_S   __ECLIC_SetPriorityIRQ_S

Definition at line 295 of file core_feature_eclic.h.

◆ ECLIC_SetShvIRQ

#define ECLIC_SetShvIRQ   __ECLIC_SetShvIRQ

Definition at line 262 of file core_feature_eclic.h.

◆ ECLIC_SetShvIRQ_S

#define ECLIC_SetShvIRQ_S   __ECLIC_SetShvIRQ_S

Definition at line 289 of file core_feature_eclic.h.

◆ ECLIC_SetSth

#define ECLIC_SetSth   __ECLIC_SetSth

Definition at line 282 of file core_feature_eclic.h.

◆ ECLIC_SetTrigIRQ

#define ECLIC_SetTrigIRQ   __ECLIC_SetTrigIRQ

Definition at line 260 of file core_feature_eclic.h.

◆ ECLIC_SetTrigIRQ_S

#define ECLIC_SetTrigIRQ_S   __ECLIC_SetTrigIRQ_S

Definition at line 287 of file core_feature_eclic.h.

◆ ECLIC_SetVector

#define ECLIC_SetVector   __ECLIC_SetVector

Definition at line 318 of file core_feature_eclic.h.

◆ ECLIC_SetVector_S

#define ECLIC_SetVector_S   __ECLIC_SetVector_S

Definition at line 322 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 1903 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 1910 of file core_feature_eclic.h.

◆ RESTORE_SSUBM_VAR

#define RESTORE_SSUBM_VAR ( )

Definition at line 1847 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
    }
    #define __INTERRUPT
    Use this attribute to indicate that the specified function is an interrupt handler run in Machine Mod...
    Definition: nmsis_gcc.h:187
    #define SAVE_IRQ_CSR_CONTEXT()
    Save necessary CSRs into variables for vector interrupt nesting.
    #define RESTORE_IRQ_CSR_CONTEXT()
    Restore necessary CSRs from variables for vector interrupt nesting.

Definition at line 1880 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 1887 of file core_feature_eclic.h.

◆ SAVE_SSUBM_VAR

#define SAVE_SSUBM_VAR ( )

Definition at line 1846 of file core_feature_eclic.h.

Enumeration Type Documentation

◆ IRQn_Type

enum IRQn_Type

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 206 of file core_feature_eclic.h.

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

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 555 of file core_feature_eclic.h.

556 {
557  ECLIC->CTRL[IRQn].INTIP &= ~CLIC_INTIP_IP_Msk;
558 }
#define ECLIC
CLIC configuration struct.
#define CLIC_INTIP_IP_Msk
CLIC INTIP: IP Mask.

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 1177 of file core_feature_eclic.h.

1178 {
1179  ECLIC->SCTRL[IRQn].INTIP &= ~CLIC_INTIP_IP_Msk;
1180 }

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 503 of file core_feature_eclic.h.

504 {
505  ECLIC->CTRL[IRQn].INTIE &= ~CLIC_INTIE_IE_Msk;
506 }
#define CLIC_INTIE_IE_Msk
CLIC INTIE: IE Mask.

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 1468 of file core_feature_eclic.h.

1469 {
1470  ECLIC->SCTRL[IRQn].INTIE &= ~CLIC_INTIE_IE_Msk;
1471 }

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 469 of file core_feature_eclic.h.

470 {
471  ECLIC->CTRL[IRQn].INTIE |= CLIC_INTIE_IE_Msk;
472 }

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 1434 of file core_feature_eclic.h.

1435 {
1436  ECLIC->SCTRL[IRQn].INTIE |= CLIC_INTIE_IE_Msk;
1437 }

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 355 of file core_feature_eclic.h.

356 {
357  return ((uint32_t)((ECLIC->CFG & CLIC_CLICCFG_NLBIT_Msk) >> CLIC_CLICCFG_NLBIT_Pos));
358 }
#define CLIC_CLICCFG_NLBIT_Pos
CLIC CLICCFG: NLBIT Position.
#define CLIC_CLICCFG_NLBIT_Msk
CLIC CLICCFG: NLBIT Mask.

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 670 of file core_feature_eclic.h.

671 {
672  return (ECLIC->CTRL[IRQn].INTCTRL);
673 }

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 1293 of file core_feature_eclic.h.

1294 {
1295  return (ECLIC->SCTRL[IRQn].INTCTRL);
1296 }

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 488 of file core_feature_eclic.h.

489 {
490  return ((uint32_t) (ECLIC->CTRL[IRQn].INTIE) & CLIC_INTIE_IE_Msk);
491 }

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 1453 of file core_feature_eclic.h.

1454 {
1455  return ((uint8_t) (ECLIC->SCTRL[IRQn].INTIE) & CLIC_INTIE_IE_Msk);
1456 }

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 388 of file core_feature_eclic.h.

389 {
390  return ((uint32_t)((ECLIC->INFO & CLIC_CLICINFO_CTLBIT_Msk) >> CLIC_CLICINFO_CTLBIT_Pos));
391 }
#define CLIC_CLICINFO_CTLBIT_Msk
CLIC INTINFO: CLICINTCTLBITS Mask.
#define CLIC_CLICINFO_CTLBIT_Pos
CLIC INTINFO: CLICINTCTLBITS Position.

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 404 of file core_feature_eclic.h.

405 {
406  return ((uint32_t)((ECLIC->INFO & CLIC_CLICINFO_NUM_Msk) >> CLIC_CLICINFO_NUM_Pos));
407 }
#define CLIC_CLICINFO_NUM_Pos
CLIC CLICINFO: NUM_INTERRUPT Position.
#define CLIC_CLICINFO_NUM_Msk
CLIC CLICINFO: NUM_INTERRUPT Mask.

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 424 of file core_feature_eclic.h.

425 {
426  return ((uint32_t)((ECLIC->INFO & (CLIC_CLICINFO_SHD_NUM_Msk)) >> CLIC_CLICINFO_SHD_NUM_Pos));
427 }
#define CLIC_CLICINFO_SHD_NUM_Msk
CLIC CLICINFO: SHD_NUM Mask.
#define CLIC_CLICINFO_SHD_NUM_Pos
CLIC CLICINFO: SHD_NUM Position.

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 371 of file core_feature_eclic.h.

372 {
373  return ((uint32_t)((ECLIC->INFO & CLIC_CLICINFO_VER_Msk) >> CLIC_CLICINFO_VER_Pos));
374 }
#define CLIC_CLICINFO_VER_Msk
CLIC CLICINFO: VERSION Mask.
#define CLIC_CLICINFO_VER_Pos
CLIC CLICINFO: VERSION Position.

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 724 of file core_feature_eclic.h.

725 {
726  uint8_t nlbits = __ECLIC_GetCfgNlbits();
727  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
728 
729  if (nlbits == 0) {
730  return 0;
731  }
732 
733  if (nlbits > intctlbits) {
734  nlbits = intctlbits;
735  }
736  uint8_t intctrl = __ECLIC_GetCtrlIRQ(IRQn);
737  uint8_t lvl_abs = intctrl >> (ECLIC_MAX_NLBITS - nlbits);
738  return lvl_abs;
739 }
#define ECLIC_MAX_NLBITS
Max nlbit of the CLICINTCTLBITS.
__STATIC_FORCEINLINE uint8_t __ECLIC_GetCtrlIRQ(IRQn_Type IRQn)
Get ECLIC Interrupt Input Control Register value for a specific interrupt.
__STATIC_FORCEINLINE uint32_t __ECLIC_GetCfgNlbits(void)
Get nlbits value.

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 1348 of file core_feature_eclic.h.

1349 {
1350  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1351  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1352 
1353  if (nlbits == 0) {
1354  return 0;
1355  }
1356 
1357  if (nlbits > intctlbits) {
1358  nlbits = intctlbits;
1359  }
1360  uint8_t intctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1361  uint8_t lvl_abs = intctrl >> (ECLIC_MAX_NLBITS - nlbits);
1362  return lvl_abs;
1363 }
__STATIC_FORCEINLINE uint8_t __ECLIC_GetCtrlIRQ_S(IRQn_Type IRQn)
Get ECLIC Interrupt Input Control Register value for a specific interrupt in supervisor mode.

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 453 of file core_feature_eclic.h.

454 {
455  return (ECLIC->MTH);
456 }

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 522 of file core_feature_eclic.h.

523 {
524  return ((uint32_t)(ECLIC->CTRL[IRQn].INTIP) & CLIC_INTIP_IP_Msk);
525 }

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 1160 of file core_feature_eclic.h.

1161 {
1162  return ((uint32_t)(ECLIC->SCTRL[IRQn].INTIP) & CLIC_INTIP_IP_Msk);
1163 }

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 785 of file core_feature_eclic.h.

786 {
787  uint8_t nlbits = __ECLIC_GetCfgNlbits();
788  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
789  if (nlbits < intctlbits) {
790  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ(IRQn);
791  uint8_t pri = cur_ctrl << nlbits;
792  pri = pri >> nlbits;
793  pri = pri >> (ECLIC_MAX_NLBITS - intctlbits);
794  return pri;
795  } else {
796  return 0;
797  }
798 }

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 1409 of file core_feature_eclic.h.

1410 {
1411  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1412  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1413  if (nlbits < intctlbits) {
1414  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1415  uint8_t pri = cur_ctrl << nlbits;
1416  pri = pri >> nlbits;
1417  pri = pri >> (ECLIC_MAX_NLBITS - intctlbits);
1418  return pri;
1419  } else {
1420  return 0;
1421  }
1422 }

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 638 of file core_feature_eclic.h.

639 {
640  return ((uint32_t)(((ECLIC->CTRL[IRQn].INTATTR) & CLIC_INTATTR_SHV_Msk) >> CLIC_INTATTR_SHV_Pos));
641 }
#define CLIC_INTATTR_SHV_Msk
CLIC INTATTR: SHV Mask.
#define CLIC_INTATTR_SHV_Pos
CLIC INTATTR: SHV Position.

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 1261 of file core_feature_eclic.h.

1262 {
1263  return ((uint8_t)(((ECLIC->SCTRL[IRQn].INTATTR) & CLIC_INTATTR_SHV_Msk) >> CLIC_INTATTR_SHV_Pos));
1264 }

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 1125 of file core_feature_eclic.h.

1126 {
1127  return (ECLIC->STH);
1128 }

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 599 of file core_feature_eclic.h.

600 {
601  return ((uint32_t)(((ECLIC->CTRL[IRQn].INTATTR) & CLIC_INTATTR_TRIG_Msk) >> CLIC_INTATTR_TRIG_Pos));
602 }
#define CLIC_INTATTR_TRIG_Msk
CLIC INTATTR: TRIG Mask.
#define CLIC_INTATTR_TRIG_Pos
CLIC INTATTR: TRIG Position.

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 1221 of file core_feature_eclic.h.

1222 {
1223  return ((uint8_t)(((ECLIC->SCTRL[IRQn].INTATTR) & CLIC_INTATTR_TRIG_Msk) >> CLIC_INTATTR_TRIG_Pos));
1224 }

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 1060 of file core_feature_eclic.h.

1061 {
1062 #if __RISCV_XLEN == 32
1063  return (*(uint32_t *)(__RV_CSR_READ(CSR_MTVT) + IRQn * 4));
1064 #elif __RISCV_XLEN == 64
1065  return (*(uint64_t *)(__RV_CSR_READ(CSR_MTVT) + IRQn * 8));
1066 #else // TODO Need cover for XLEN=128 case in future
1067  return (*(uint64_t *)(__RV_CSR_READ(CSR_MTVT) + IRQn * 8));
1068 #endif
1069 }
#define __RV_CSR_READ(csr)
CSR operation Macro for csrr instruction.
#define CSR_MTVT

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 1521 of file core_feature_eclic.h.

1522 {
1523 #if __RISCV_XLEN == 32
1524  return (*(uint32_t *)(__RV_CSR_READ(CSR_STVT) + IRQn * 4));
1525 #elif __RISCV_XLEN == 64
1526  return (*(uint64_t *)(__RV_CSR_READ(CSR_STVT) + IRQn * 8));
1527 #else // TODO Need cover for XLEN=128 case in future
1528  return (*(uint64_t *)(__RV_CSR_READ(CSR_STVT) + IRQn * 8));
1529 #endif
1530 }
#define CSR_STVT

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 337 of file core_feature_eclic.h.

338 {
339  uint8_t temp = ECLIC->CFG;
340 
341  ECLIC->CFG = (temp & ~CLIC_CLICCFG_NLBIT_Msk) | \
342  ((uint8_t)((nlbits << CLIC_CLICCFG_NLBIT_Pos) & CLIC_CLICCFG_NLBIT_Msk));
343 }

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 654 of file core_feature_eclic.h.

655 {
656  ECLIC->CTRL[IRQn].INTCTRL = intctrl;
657 }

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 1277 of file core_feature_eclic.h.

1278 {
1279  ECLIC->SCTRL[IRQn].INTCTRL = intctrl;
1280 }

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 690 of file core_feature_eclic.h.

691 {
692  uint8_t nlbits = __ECLIC_GetCfgNlbits();
693  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
694 
695  if (nlbits == 0) {
696  return;
697  }
698 
699  if (nlbits > intctlbits) {
700  nlbits = intctlbits;
701  }
702  uint8_t maxlvl = ((1UL << nlbits) - 1);
703  if (lvl_abs > maxlvl) {
704  lvl_abs = maxlvl;
705  }
706  uint8_t lvl = lvl_abs << (ECLIC_MAX_NLBITS - nlbits);
707  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ(IRQn);
708  cur_ctrl = cur_ctrl << nlbits;
709  cur_ctrl = cur_ctrl >> nlbits;
710  __ECLIC_SetCtrlIRQ(IRQn, (cur_ctrl | lvl));
711 }
__STATIC_FORCEINLINE void __ECLIC_SetCtrlIRQ(IRQn_Type IRQn, uint8_t intctrl)
Modify ECLIC Interrupt Input Control Register for a specific interrupt.

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 1313 of file core_feature_eclic.h.

1314 {
1315  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1316  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1317 
1318  if (nlbits == 0) {
1319  return;
1320  }
1321 
1322  if (nlbits > intctlbits) {
1323  nlbits = intctlbits;
1324  }
1325  uint8_t maxlvl = ((1UL << nlbits) - 1);
1326  if (lvl_abs > maxlvl) {
1327  lvl_abs = maxlvl;
1328  }
1329  uint8_t lvl = lvl_abs << (ECLIC_MAX_NLBITS - nlbits);
1330  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1331  cur_ctrl = cur_ctrl << nlbits;
1332  cur_ctrl = cur_ctrl >> nlbits;
1333  __ECLIC_SetCtrlIRQ_S(IRQn, (cur_ctrl | lvl));
1334 }
__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.

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 1086 of file core_feature_eclic.h.

1087 {
1088  /*
1089  * only 1 or 3 can be assigned to mode in one step.the default value of mode is 3,
1090  * which can't be clear to 0 firstly, then OR it to 1
1091  */
1092  ECLIC->CTRL[IRQn].INTATTR = (uint8_t)(mode << CLIC_INTATTR_MODE_Pos) + \
1093  (ECLIC->SCTRL[IRQn].INTATTR & (~CLIC_INTATTR_MODE_Msk));
1094 }
#define CLIC_INTATTR_MODE_Msk
CLIC INTATTA: Mode Mask.
#define CLIC_INTATTR_MODE_Pos
CLIC INTATTA: Mode Position.

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 440 of file core_feature_eclic.h.

441 {
442  ECLIC->MTH = mth;
443 }

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 538 of file core_feature_eclic.h.

539 {
540  ECLIC->CTRL[IRQn].INTIP |= CLIC_INTIP_IP_Msk;
541 }

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 1141 of file core_feature_eclic.h.

1142 {
1143  ECLIC->SCTRL[IRQn].INTIP |= CLIC_INTIP_IP_Msk;
1144 }

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 755 of file core_feature_eclic.h.

756 {
757  uint8_t nlbits = __ECLIC_GetCfgNlbits();
758  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
759  if (nlbits < intctlbits) {
760  uint8_t maxpri = ((1UL << (intctlbits - nlbits)) - 1);
761  if (pri > maxpri) {
762  pri = maxpri;
763  }
764  pri = pri << (ECLIC_MAX_NLBITS - intctlbits);
765  uint8_t mask = ((uint8_t)(-1)) >> intctlbits;
766  pri = pri | mask;
767  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ(IRQn);
768  cur_ctrl = cur_ctrl >> (ECLIC_MAX_NLBITS - nlbits);
769  cur_ctrl = cur_ctrl << (ECLIC_MAX_NLBITS - nlbits);
770  __ECLIC_SetCtrlIRQ(IRQn, (cur_ctrl | pri));
771  }
772 }

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 1379 of file core_feature_eclic.h.

1380 {
1381  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1382  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1383  if (nlbits < intctlbits) {
1384  uint8_t maxpri = ((1UL << (intctlbits - nlbits)) - 1);
1385  if (pri > maxpri) {
1386  pri = maxpri;
1387  }
1388  pri = pri << (ECLIC_MAX_NLBITS - intctlbits);
1389  uint8_t mask = ((uint8_t)(-1)) >> intctlbits;
1390  pri = pri | mask;
1391  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1392  cur_ctrl = cur_ctrl >> (ECLIC_MAX_NLBITS - nlbits);
1393  cur_ctrl = cur_ctrl << (ECLIC_MAX_NLBITS - nlbits);
1394  __ECLIC_SetCtrlIRQ_S(IRQn, (cur_ctrl | pri));
1395  }
1396 }

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 617 of file core_feature_eclic.h.

618 {
619  uint8_t temp = ECLIC->CTRL[IRQn].INTATTR;
620 
621  ECLIC->CTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_SHV_Msk) | \
622  ((uint8_t)(shv << CLIC_INTATTR_SHV_Pos));
623 }

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 1240 of file core_feature_eclic.h.

1241 {
1242  uint8_t temp = ECLIC->SCTRL[IRQn].INTATTR;
1243 
1244  ECLIC->SCTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_SHV_Msk) | \
1245  ((uint8_t)(shv << CLIC_INTATTR_SHV_Pos));
1246 }

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 1109 of file core_feature_eclic.h.

1110 {
1111  ECLIC->STH = sth;
1112 }

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 576 of file core_feature_eclic.h.

577 {
578  uint8_t temp = ECLIC->CTRL[IRQn].INTATTR;
579 
580  ECLIC->CTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_TRIG_Msk) | \
581  ((uint8_t)(trig << CLIC_INTATTR_TRIG_Pos));
582 }

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 1198 of file core_feature_eclic.h.

1199 {
1200  uint8_t temp = ECLIC->SCTRL[IRQn].INTATTR;
1201 
1202  ECLIC->SCTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_TRIG_Msk) | \
1203  ((uint8_t)(trig << CLIC_INTATTR_TRIG_Pos));
1204 }

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 1028 of file core_feature_eclic.h.

1029 {
1030  unsigned long vec_base;
1031  vec_base = ((unsigned long)__RV_CSR_READ(CSR_MTVT));
1032  vec_base += ((unsigned long)IRQn) * sizeof(unsigned long);
1033  (* (unsigned long *) vec_base) = vector;
1034 #if (defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1))
1035 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
1036  MFlushDCacheLine((unsigned long)vec_base);
1037 #endif
1038 #endif
1039 #if (defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1))
1040 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
1041  MInvalICacheLine((unsigned long)vec_base);
1042 #else
1043  __FENCE_I();
1044 #endif
1045 #endif
1046 }
__STATIC_FORCEINLINE void __FENCE_I(void)
Fence.i Instruction.
__STATIC_INLINE void MFlushDCacheLine(unsigned long addr)
Flush one D-Cache line specified by address in M-Mode.
__STATIC_INLINE void MInvalICacheLine(unsigned long addr)
Invalidate one I-Cache line specified by address in M-Mode.

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 1489 of file core_feature_eclic.h.

1490 {
1491  volatile unsigned long vec_base;
1492  vec_base = ((unsigned long)__RV_CSR_READ(CSR_STVT));
1493  vec_base += ((unsigned long)IRQn) * sizeof(unsigned long);
1494  (* (unsigned long *) vec_base) = vector;
1495 #if (defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1))
1496 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
1497  SFlushDCacheLine((unsigned long)vec_base);
1498 #endif
1499 #endif
1500 #if (defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1))
1501 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
1502  SInvalICacheLine((unsigned long)vec_base);
1503 #else
1504  __FENCE_I();
1505 #endif
1506 #endif
1507 }
__STATIC_INLINE void SFlushDCacheLine(unsigned long addr)
Flush one D-Cache line specified by address in S-Mode.
__STATIC_INLINE void SInvalICacheLine(unsigned long addr)
Invalidate one I-Cache line specified by address in S-Mode.

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 1776 of file core_feature_eclic.h.

1777 {
1778  unsigned long addr = __RV_CSR_READ(CSR_MTVEC);
1779  return (addr & ~ECLIC_MODE_MTVEC_Msk);
1780 }
#define CSR_MTVEC
#define ECLIC_MODE_MTVEC_Msk
ECLIC Mode mask for MTVT CSR Register.

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 1835 of file core_feature_eclic.h.

1836 {
1837  return __RV_CSR_READ(CSR_MNVEC);
1838 }
#define CSR_MNVEC

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 1815 of file core_feature_eclic.h.

1816 {
1817  if (__RV_CSR_READ(CSR_MTVT2) & 0x1) {
1818  return __RV_CSR_READ(CSR_MTVT2) & (~(rv_csr_t)(0x1));
1819  } else {
1821  return (addr & ~ECLIC_MODE_MTVEC_Msk);
1822  }
1823 }
#define CSR_MTVT2
unsigned long rv_csr_t
Type of Control and Status Register(CSR), depends on the XLEN defined in RISC-V.

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 1758 of file core_feature_eclic.h.

1759 {
1760  addr &= (rv_csr_t)(~0x3F);
1761  addr |= ECLIC_MODE_MTVEC_Msk;
1762  __RV_CSR_WRITE(CSR_MTVEC, addr);
1763 }
#define __RV_CSR_WRITE(csr, val)
CSR operation Macro for csrw instruction.

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 1793 of file core_feature_eclic.h.

1794 {
1795  if (__RV_CSR_READ(CSR_MTVT2) & 0x1) {
1796  __RV_CSR_WRITE(CSR_MTVT2, addr | 0x01);
1797  } else {
1798  addr &= (rv_csr_t)(~0x3F);
1799  addr |= ECLIC_MODE_MTVEC_Msk;
1800  __RV_CSR_WRITE(CSR_MTVEC, addr);
1801  }
1802 }

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