NMSIS-Core  Version 1.4.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_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_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_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 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_FORCEINLINE void __ECLIC_SetLevelIRQ (IRQn_Type IRQn, uint8_t lvl_abs)
 Set ECLIC Interrupt level of a specific interrupt. More...
 
__STATIC_FORCEINLINE uint8_t __ECLIC_GetLevelIRQ (IRQn_Type IRQn)
 Get ECLIC Interrupt level of a specific interrupt. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetPriorityIRQ (IRQn_Type IRQn, uint8_t pri)
 Get ECLIC Interrupt priority of a specific interrupt. More...
 
__STATIC_FORCEINLINE uint8_t __ECLIC_GetPriorityIRQ (IRQn_Type IRQn)
 Get ECLIC Interrupt priority of a specific interrupt. More...
 
__STATIC_FORCEINLINE 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_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_FORCEINLINE void __ECLIC_SetLevelIRQ_S (IRQn_Type IRQn, uint8_t lvl_abs)
 Set ECLIC Interrupt level of a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE uint8_t __ECLIC_GetLevelIRQ_S (IRQn_Type IRQn)
 Get ECLIC Interrupt level of a specific interrupt. More...
 
__STATIC_FORCEINLINE void __ECLIC_SetPriorityIRQ_S (IRQn_Type IRQn, uint8_t pri)
 Set ECLIC Interrupt priority of a specific interrupt in supervisor mode. More...
 
__STATIC_FORCEINLINE 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_FORCEINLINE 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_FORCEINLINE void __set_nonvec_entry (rv_csr_t addr)
 Set Non-vector interrupt entry address. More...
 
__STATIC_FORCEINLINE 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 254 of file core_feature_eclic.h.

◆ ECLIC_DisableIRQ

#define ECLIC_DisableIRQ   __ECLIC_DisableIRQ

Definition at line 251 of file core_feature_eclic.h.

◆ ECLIC_DisableIRQ_S

#define ECLIC_DisableIRQ_S   __ECLIC_DisableIRQ_S

Definition at line 283 of file core_feature_eclic.h.

◆ ECLIC_EnableIRQ

#define ECLIC_EnableIRQ   __ECLIC_EnableIRQ

Definition at line 249 of file core_feature_eclic.h.

◆ ECLIC_EnableIRQ_S

#define ECLIC_EnableIRQ_S   __ECLIC_EnableIRQ_S

Definition at line 281 of file core_feature_eclic.h.

◆ ECLIC_GetCfgNlbits

#define ECLIC_GetCfgNlbits   __ECLIC_GetCfgNlbits

Definition at line 243 of file core_feature_eclic.h.

◆ ECLIC_GetCtrlIRQ

#define ECLIC_GetCtrlIRQ   __ECLIC_GetCtrlIRQ

Definition at line 260 of file core_feature_eclic.h.

◆ ECLIC_GetCtrlIRQ_S

#define ECLIC_GetCtrlIRQ_S   __ECLIC_GetCtrlIRQ_S

Definition at line 276 of file core_feature_eclic.h.

◆ ECLIC_GetEnableIRQ

#define ECLIC_GetEnableIRQ   __ECLIC_GetEnableIRQ

Definition at line 250 of file core_feature_eclic.h.

◆ ECLIC_GetEnableIRQ_S

#define ECLIC_GetEnableIRQ_S   __ECLIC_GetEnableIRQ_S

Definition at line 282 of file core_feature_eclic.h.

◆ ECLIC_GetInfoCtlbits

#define ECLIC_GetInfoCtlbits   __ECLIC_GetInfoCtlbits

Definition at line 245 of file core_feature_eclic.h.

◆ ECLIC_GetInfoNum

#define ECLIC_GetInfoNum   __ECLIC_GetInfoNum

Definition at line 246 of file core_feature_eclic.h.

◆ ECLIC_GetInfoVer

#define ECLIC_GetInfoVer   __ECLIC_GetInfoVer

Definition at line 244 of file core_feature_eclic.h.

◆ ECLIC_GetLevelIRQ

#define ECLIC_GetLevelIRQ   __ECLIC_GetLevelIRQ

Definition at line 262 of file core_feature_eclic.h.

◆ ECLIC_GetLevelIRQ_S

#define ECLIC_GetLevelIRQ_S   __ECLIC_GetLevelIRQ_S

Definition at line 278 of file core_feature_eclic.h.

◆ ECLIC_GetMth

#define ECLIC_GetMth   __ECLIC_GetMth

Definition at line 248 of file core_feature_eclic.h.

◆ ECLIC_GetPendingIRQ

#define ECLIC_GetPendingIRQ   __ECLIC_GetPendingIRQ

Definition at line 253 of file core_feature_eclic.h.

◆ ECLIC_GetPriorityIRQ

#define ECLIC_GetPriorityIRQ   __ECLIC_GetPriorityIRQ

Definition at line 264 of file core_feature_eclic.h.

◆ ECLIC_GetPriorityIRQ_S

#define ECLIC_GetPriorityIRQ_S   __ECLIC_GetPriorityIRQ_S

Definition at line 280 of file core_feature_eclic.h.

◆ ECLIC_GetShvIRQ

#define ECLIC_GetShvIRQ   __ECLIC_GetShvIRQ

Definition at line 258 of file core_feature_eclic.h.

◆ ECLIC_GetShvIRQ_S

#define ECLIC_GetShvIRQ_S   __ECLIC_GetShvIRQ_S

Definition at line 274 of file core_feature_eclic.h.

◆ ECLIC_GetSth

#define ECLIC_GetSth   __ECLIC_GetSth

Definition at line 270 of file core_feature_eclic.h.

◆ ECLIC_GetTrigIRQ

#define ECLIC_GetTrigIRQ   __ECLIC_GetTrigIRQ

Definition at line 256 of file core_feature_eclic.h.

◆ ECLIC_GetTrigIRQ_S

#define ECLIC_GetTrigIRQ_S   __ECLIC_GetTrigIRQ_S

Definition at line 272 of file core_feature_eclic.h.

◆ ECLIC_GetVector

#define ECLIC_GetVector   __ECLIC_GetVector

Definition at line 295 of file core_feature_eclic.h.

◆ ECLIC_GetVector_S

#define ECLIC_GetVector_S   __ECLIC_GetVector_S

Definition at line 299 of file core_feature_eclic.h.

◆ ECLIC_SetCfgNlbits

#define ECLIC_SetCfgNlbits   __ECLIC_SetCfgNlbits

Definition at line 242 of file core_feature_eclic.h.

◆ ECLIC_SetCtrlIRQ

#define ECLIC_SetCtrlIRQ   __ECLIC_SetCtrlIRQ

Definition at line 259 of file core_feature_eclic.h.

◆ ECLIC_SetCtrlIRQ_S

#define ECLIC_SetCtrlIRQ_S   __ECLIC_SetCtrlIRQ_S

Definition at line 275 of file core_feature_eclic.h.

◆ ECLIC_SetLevelIRQ

#define ECLIC_SetLevelIRQ   __ECLIC_SetLevelIRQ

Definition at line 261 of file core_feature_eclic.h.

◆ ECLIC_SetLevelIRQ_S

#define ECLIC_SetLevelIRQ_S   __ECLIC_SetLevelIRQ_S

Definition at line 277 of file core_feature_eclic.h.

◆ ECLIC_SetModeIRQ

#define ECLIC_SetModeIRQ   __ECLIC_SetModeIRQ

Definition at line 268 of file core_feature_eclic.h.

◆ ECLIC_SetMth

#define ECLIC_SetMth   __ECLIC_SetMth

Definition at line 247 of file core_feature_eclic.h.

◆ ECLIC_SetPendingIRQ

#define ECLIC_SetPendingIRQ   __ECLIC_SetPendingIRQ

Definition at line 252 of file core_feature_eclic.h.

◆ ECLIC_SetPriorityIRQ

#define ECLIC_SetPriorityIRQ   __ECLIC_SetPriorityIRQ

Definition at line 263 of file core_feature_eclic.h.

◆ ECLIC_SetPriorityIRQ_S

#define ECLIC_SetPriorityIRQ_S   __ECLIC_SetPriorityIRQ_S

Definition at line 279 of file core_feature_eclic.h.

◆ ECLIC_SetShvIRQ

#define ECLIC_SetShvIRQ   __ECLIC_SetShvIRQ

Definition at line 257 of file core_feature_eclic.h.

◆ ECLIC_SetShvIRQ_S

#define ECLIC_SetShvIRQ_S   __ECLIC_SetShvIRQ_S

Definition at line 273 of file core_feature_eclic.h.

◆ ECLIC_SetSth

#define ECLIC_SetSth   __ECLIC_SetSth

Definition at line 269 of file core_feature_eclic.h.

◆ ECLIC_SetTrigIRQ

#define ECLIC_SetTrigIRQ   __ECLIC_SetTrigIRQ

Definition at line 255 of file core_feature_eclic.h.

◆ ECLIC_SetTrigIRQ_S

#define ECLIC_SetTrigIRQ_S   __ECLIC_SetTrigIRQ_S

Definition at line 271 of file core_feature_eclic.h.

◆ ECLIC_SetVector

#define ECLIC_SetVector   __ECLIC_SetVector

Definition at line 294 of file core_feature_eclic.h.

◆ ECLIC_SetVector_S

#define ECLIC_SetVector_S   __ECLIC_SetVector_S

Definition at line 298 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 1366 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 1373 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 1344 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 1351 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 202 of file core_feature_eclic.h.

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

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

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

457 {
458  ECLIC->CTRL[IRQn].INTIE &= ~CLIC_INTIE_IE_Msk;
459 }
#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 1155 of file core_feature_eclic.h.

1156 {
1157  ECLIC->SCTRL[IRQn].INTIE &= ~CLIC_INTIE_IE_Msk;
1158 }

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

423 {
424  ECLIC->CTRL[IRQn].INTIE |= CLIC_INTIE_IE_Msk;
425 }

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

1122 {
1123  ECLIC->SCTRL[IRQn].INTIE |= CLIC_INTIE_IE_Msk;
1124 }

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

332 {
333  return ((uint32_t)((ECLIC->CFG & CLIC_CLICCFG_NLBIT_Msk) >> CLIC_CLICCFG_NLBIT_Pos));
334 }
#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 623 of file core_feature_eclic.h.

624 {
625  return (ECLIC->CTRL[IRQn].INTCTRL);
626 }

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

981 {
982  return (ECLIC->SCTRL[IRQn].INTCTRL);
983 }

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

442 {
443  return ((uint32_t) (ECLIC->CTRL[IRQn].INTIE) & CLIC_INTIE_IE_Msk);
444 }

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

1141 {
1142  return ((uint8_t) (ECLIC->SCTRL[IRQn].INTIE) & CLIC_INTIE_IE_Msk);
1143 }

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 treated as hardwired to 1.
See also

Definition at line 364 of file core_feature_eclic.h.

365 {
366  return ((uint32_t)((ECLIC->INFO & CLIC_CLICINFO_CTLBIT_Msk) >> CLIC_CLICINFO_CTLBIT_Pos));
367 }
#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 380 of file core_feature_eclic.h.

381 {
382  return ((uint32_t)((ECLIC->INFO & CLIC_CLICINFO_NUM_Msk) >> CLIC_CLICINFO_NUM_Pos));
383 }
#define CLIC_CLICINFO_NUM_Pos
CLIC CLICINFO: NUM Position.
#define CLIC_CLICINFO_NUM_Msk
CLIC CLICINFO: NUM Mask.

References CLIC_CLICINFO_NUM_Msk, CLIC_CLICINFO_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 347 of file core_feature_eclic.h.

348 {
349  return ((uint32_t)((ECLIC->INFO & CLIC_CLICINFO_VER_Msk) >> CLIC_CLICINFO_VER_Pos));
350 }
#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_FORCEINLINE 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 677 of file core_feature_eclic.h.

678 {
679  uint8_t nlbits = __ECLIC_GetCfgNlbits();
680  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
681 
682  if (nlbits == 0) {
683  return 0;
684  }
685 
686  if (nlbits > intctlbits) {
687  nlbits = intctlbits;
688  }
689  uint8_t intctrl = __ECLIC_GetCtrlIRQ(IRQn);
690  uint8_t lvl_abs = intctrl >> (ECLIC_MAX_NLBITS - nlbits);
691  return lvl_abs;
692 }
#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_FORCEINLINE 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 1035 of file core_feature_eclic.h.

1036 {
1037  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1038  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1039 
1040  if (nlbits == 0) {
1041  return 0;
1042  }
1043 
1044  if (nlbits > intctlbits) {
1045  nlbits = intctlbits;
1046  }
1047  uint8_t intctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1048  uint8_t lvl_abs = intctrl >> (ECLIC_MAX_NLBITS - nlbits);
1049  return lvl_abs;
1050 }
__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 406 of file core_feature_eclic.h.

407 {
408  return (ECLIC->MTH);
409 }

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

476 {
477  return ((uint32_t)(ECLIC->CTRL[IRQn].INTIP) & CLIC_INTIP_IP_Msk);
478 }

References CLIC_INTIP_IP_Msk, and ECLIC.

◆ __ECLIC_GetPriorityIRQ()

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

739 {
740  uint8_t nlbits = __ECLIC_GetCfgNlbits();
741  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
742  if (nlbits < intctlbits) {
743  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ(IRQn);
744  uint8_t pri = cur_ctrl << nlbits;
745  pri = pri >> nlbits;
746  pri = pri >> (ECLIC_MAX_NLBITS - intctlbits);
747  return pri;
748  } else {
749  return 0;
750  }
751 }

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

◆ __ECLIC_GetPriorityIRQ_S()

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

1097 {
1098  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1099  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1100  if (nlbits < intctlbits) {
1101  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1102  uint8_t pri = cur_ctrl << nlbits;
1103  pri = pri >> nlbits;
1104  pri = pri >> (ECLIC_MAX_NLBITS - intctlbits);
1105  return pri;
1106  } else {
1107  return 0;
1108  }
1109 }

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

592 {
593  return ((uint32_t)(((ECLIC->CTRL[IRQn].INTATTR) & CLIC_INTATTR_SHV_Msk) >> CLIC_INTATTR_SHV_Pos));
594 }
#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 948 of file core_feature_eclic.h.

949 {
950  return ((uint8_t)(((ECLIC->SCTRL[IRQn].INTATTR) & CLIC_INTATTR_SHV_Msk) >> CLIC_INTATTR_SHV_Pos));
951 }

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

865 {
866  return (ECLIC->STH);
867 }

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

553 {
554  return ((uint32_t)(((ECLIC->CTRL[IRQn].INTATTR) & CLIC_INTATTR_TRIG_Msk) >> CLIC_INTATTR_TRIG_Pos));
555 }
#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 908 of file core_feature_eclic.h.

909 {
910  return ((uint8_t)(((ECLIC->SCTRL[IRQn].INTATTR) & CLIC_INTATTR_TRIG_Msk) >> CLIC_INTATTR_TRIG_Pos));
911 }

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

802 {
803 #if __RISCV_XLEN == 32
804  return (*(uint32_t *)(__RV_CSR_READ(CSR_MTVT) + IRQn * 4));
805 #elif __RISCV_XLEN == 64
806  return (*(uint64_t *)(__RV_CSR_READ(CSR_MTVT) + IRQn * 8));
807 #else // TODO Need cover for XLEN=128 case in future
808  return (*(uint64_t *)(__RV_CSR_READ(CSR_MTVT) + IRQn * 8));
809 #endif
810 }
#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 1208 of file core_feature_eclic.h.

1209 {
1210 #if __RISCV_XLEN == 32
1211  return (*(uint32_t *)(__RV_CSR_READ(CSR_STVT) + IRQn * 4));
1212 #elif __RISCV_XLEN == 64
1213  return (*(uint64_t *)(__RV_CSR_READ(CSR_STVT) + IRQn * 8));
1214 #else // TODO Need cover for XLEN=128 case in future
1215  return (*(uint64_t *)(__RV_CSR_READ(CSR_STVT) + IRQn * 8));
1216 #endif
1217 }
#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 313 of file core_feature_eclic.h.

314 {
315  uint8_t temp = ECLIC->CFG;
316 
317  ECLIC->CFG = (temp & ~CLIC_CLICCFG_NLBIT_Msk) | \
318  ((uint8_t)((nlbits << CLIC_CLICCFG_NLBIT_Pos) & CLIC_CLICCFG_NLBIT_Msk));
319 }

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

608 {
609  ECLIC->CTRL[IRQn].INTCTRL = intctrl;
610 }

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

965 {
966  ECLIC->SCTRL[IRQn].INTCTRL = intctrl;
967 }

References ECLIC.

Referenced by __ECLIC_SetLevelIRQ_S(), and __ECLIC_SetPriorityIRQ_S().

◆ __ECLIC_SetLevelIRQ()

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

644 {
645  uint8_t nlbits = __ECLIC_GetCfgNlbits();
646  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
647 
648  if (nlbits == 0) {
649  return;
650  }
651 
652  if (nlbits > intctlbits) {
653  nlbits = intctlbits;
654  }
655  uint8_t maxlvl = ((1UL << nlbits) - 1);
656  if (lvl_abs > maxlvl) {
657  lvl_abs = maxlvl;
658  }
659  uint8_t lvl = lvl_abs << (ECLIC_MAX_NLBITS - nlbits);
660  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ(IRQn);
661  cur_ctrl = cur_ctrl << nlbits;
662  cur_ctrl = cur_ctrl >> nlbits;
663  __ECLIC_SetCtrlIRQ(IRQn, (cur_ctrl | lvl));
664 }
__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_FORCEINLINE 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 1000 of file core_feature_eclic.h.

1001 {
1002  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1003  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1004 
1005  if (nlbits == 0) {
1006  return;
1007  }
1008 
1009  if (nlbits > intctlbits) {
1010  nlbits = intctlbits;
1011  }
1012  uint8_t maxlvl = ((1UL << nlbits) - 1);
1013  if (lvl_abs > maxlvl) {
1014  lvl_abs = maxlvl;
1015  }
1016  uint8_t lvl = lvl_abs << (ECLIC_MAX_NLBITS - nlbits);
1017  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1018  cur_ctrl = cur_ctrl << nlbits;
1019  cur_ctrl = cur_ctrl >> nlbits;
1020  __ECLIC_SetCtrlIRQ_S(IRQn, (cur_ctrl | lvl));
1021 }
__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 TEE 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 827 of file core_feature_eclic.h.

828 {
829  /*
830  * only 1 or 3 can be assigned to mode in one step.the default value of mode is 3,
831  * which can't be clear to 0 firstly, then OR it to 1
832  */
833  ECLIC->CTRL[IRQn].INTATTR = (uint8_t)(mode << CLIC_INTATTR_MODE_Pos) + \
834  (ECLIC->SCTRL[IRQn].INTATTR & (~CLIC_INTATTR_MODE_Msk));
835 }
#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.

Parameters
[in]mthInterrupt Level Threshold.
See also

Definition at line 393 of file core_feature_eclic.h.

394 {
395  ECLIC->MTH = mth;
396 }

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

492 {
493  ECLIC->CTRL[IRQn].INTIP |= CLIC_INTIP_IP_Msk;
494 }

References CLIC_INTIP_IP_Msk, and ECLIC.

◆ __ECLIC_SetPriorityIRQ()

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

709 {
710  uint8_t nlbits = __ECLIC_GetCfgNlbits();
711  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
712  if (nlbits < intctlbits) {
713  uint8_t maxpri = ((1UL << (intctlbits - nlbits)) - 1);
714  if (pri > maxpri) {
715  pri = maxpri;
716  }
717  pri = pri << (ECLIC_MAX_NLBITS - intctlbits);
718  uint8_t mask = ((uint8_t)(-1)) >> intctlbits;
719  pri = pri | mask;
720  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ(IRQn);
721  cur_ctrl = cur_ctrl >> (ECLIC_MAX_NLBITS - nlbits);
722  cur_ctrl = cur_ctrl << (ECLIC_MAX_NLBITS - nlbits);
723  __ECLIC_SetCtrlIRQ(IRQn, (cur_ctrl | pri));
724  }
725 }

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

◆ __ECLIC_SetPriorityIRQ_S()

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

1067 {
1068  uint8_t nlbits = __ECLIC_GetCfgNlbits();
1069  uint8_t intctlbits = (uint8_t)__ECLIC_INTCTLBITS;
1070  if (nlbits < intctlbits) {
1071  uint8_t maxpri = ((1UL << (intctlbits - nlbits)) - 1);
1072  if (pri > maxpri) {
1073  pri = maxpri;
1074  }
1075  pri = pri << (ECLIC_MAX_NLBITS - intctlbits);
1076  uint8_t mask = ((uint8_t)(-1)) >> intctlbits;
1077  pri = pri | mask;
1078  uint8_t cur_ctrl = __ECLIC_GetCtrlIRQ_S(IRQn);
1079  cur_ctrl = cur_ctrl >> (ECLIC_MAX_NLBITS - nlbits);
1080  cur_ctrl = cur_ctrl << (ECLIC_MAX_NLBITS - nlbits);
1081  __ECLIC_SetCtrlIRQ_S(IRQn, (cur_ctrl | pri));
1082  }
1083 }

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

571 {
572  uint8_t temp = ECLIC->CTRL[IRQn].INTATTR;
573 
574  ECLIC->CTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_SHV_Msk) | \
575  ((uint8_t)(shv << CLIC_INTATTR_SHV_Pos));
576 }

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

928 {
929  uint8_t temp = ECLIC->SCTRL[IRQn].INTATTR;
930 
931  ECLIC->SCTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_SHV_Msk) | \
932  ((uint8_t)(shv << CLIC_INTATTR_SHV_Pos));
933 }

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.
See also

Definition at line 848 of file core_feature_eclic.h.

849 {
850  ECLIC->STH = sth;
851 }

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

530 {
531  uint8_t temp = ECLIC->CTRL[IRQn].INTATTR;
532 
533  ECLIC->CTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_TRIG_Msk) | \
534  ((uint8_t)(trig << CLIC_INTATTR_TRIG_Pos));
535 }

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

886 {
887  uint8_t temp = ECLIC->SCTRL[IRQn].INTATTR;
888 
889  ECLIC->SCTRL[IRQn].INTATTR = (temp & ~CLIC_INTATTR_TRIG_Msk) | \
890  ((uint8_t)(trig << CLIC_INTATTR_TRIG_Pos));
891 }

References CLIC_INTATTR_TRIG_Msk, CLIC_INTATTR_TRIG_Pos, and ECLIC.

◆ __ECLIC_SetVector()

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

770 {
771  volatile unsigned long vec_base;
772  vec_base = ((unsigned long)__RV_CSR_READ(CSR_MTVT));
773  vec_base += ((unsigned long)IRQn) * sizeof(unsigned long);
774  (* (unsigned long *) vec_base) = vector;
775 #if (defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1))
776 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
777  MFlushDCacheLine((unsigned long)vec_base);
778 #endif
779 #endif
780 #if (defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1))
781 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
782  MInvalICacheLine((unsigned long)vec_base);
783 #else
784  __FENCE_I();
785 #endif
786 #endif
787 }
__STATIC_FORCEINLINE void __FENCE_I(void)
Fence.i Instruction.
__STATIC_FORCEINLINE void MFlushDCacheLine(unsigned long addr)
Flush one D-Cache line specified by address in M-Mode.
__STATIC_FORCEINLINE 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_FORCEINLINE 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 1176 of file core_feature_eclic.h.

1177 {
1178  volatile unsigned long vec_base;
1179  vec_base = ((unsigned long)__RV_CSR_READ(CSR_STVT));
1180  vec_base += ((unsigned long)IRQn) * sizeof(unsigned long);
1181  (* (unsigned long *) vec_base) = vector;
1182 #if (defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1))
1183 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
1184  SFlushDCacheLine((unsigned long)vec_base);
1185 #endif
1186 #endif
1187 #if (defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1))
1188 #if (defined(__CCM_PRESENT) && (__CCM_PRESENT == 1))
1189  SInvalICacheLine((unsigned long)vec_base);
1190 #else
1191  __FENCE_I();
1192 #endif
1193 #endif
1194 }
__STATIC_FORCEINLINE void SFlushDCacheLine(unsigned long addr)
Flush one D-Cache line specified by address in S-Mode.
__STATIC_FORCEINLINE 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 1250 of file core_feature_eclic.h.

1251 {
1252  unsigned long addr = __RV_CSR_READ(CSR_MTVEC);
1253  return (addr & ~ECLIC_MODE_MTVEC_Msk);
1254 }
#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 1309 of file core_feature_eclic.h.

1310 {
1311  return __RV_CSR_READ(CSR_MNVEC);
1312 }
#define CSR_MNVEC

References __RV_CSR_READ, and CSR_MNVEC.

◆ __get_nonvec_entry()

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

1290 {
1291  if (__RV_CSR_READ(CSR_MTVT2) & 0x1) {
1292  return __RV_CSR_READ(CSR_MTVT2) & (~(rv_csr_t)(0x1));
1293  } else {
1295  return (addr & ~ECLIC_MODE_MTVEC_Msk);
1296  }
1297 }
#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 1232 of file core_feature_eclic.h.

1233 {
1234  addr &= (rv_csr_t)(~0x3F);
1235  addr |= ECLIC_MODE_MTVEC_Msk;
1236  __RV_CSR_WRITE(CSR_MTVEC, addr);
1237 }
#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_FORCEINLINE 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 1267 of file core_feature_eclic.h.

1268 {
1269  if (__RV_CSR_READ(CSR_MTVT2) & 0x1) {
1270  __RV_CSR_WRITE(CSR_MTVT2, addr | 0x01);
1271  } else {
1272  addr &= (rv_csr_t)(~0x3F);
1273  addr |= ECLIC_MODE_MTVEC_Msk;
1274  __RV_CSR_WRITE(CSR_MTVEC, addr);
1275  }
1276 }

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