Sapphire SoC DS Sapphire SoC UG Sapphire HP SoC DS Sapphire HP SoC UG RISC-V Embedded IDE UG Board Support Package
Loading...
Searching...
No Matches

Overview

Function definitions for IRQ driver.

Functions

void irq_enable (void)
 Enable Global Interrupts.
void irq_disable (void)
 Disable Global Interrupts.
void irq_setType (cpu_irq_t enable)
 Enable specific CPU interrupt sources.
void irq_clearType (cpu_irq_t disable)
 Disable specific CPU interrupt sources.
void irq_registerExt (u32 gateway, irq_handler_t handler)
 Register a handler for an External Interrupt (PLIC).
void irq_setTrapVector (void(*trap_vector)(void))
 Set the Machine Trap Vector (mtvec).

Function Documentation

◆ irq_clearType()

void irq_clearType ( cpu_irq_t disable)

#include <irq.h>

Disable specific CPU interrupt sources.

Clears the corresponding bit in the mie CSR.

Parameters
disableBitmask of interrupts to disable.
disableBitmask of interrupts to disable.

Definition at line 85 of file irq.c.

◆ irq_disable()

void irq_disable ( void )

#include <irq.h>

Disable Global Interrupts.

Clears the Machine Interrupt Enable (MIE) bit in the mstatus CSR.

Note
This is often used to create critical sections.

Disable Global Interrupts.

Clears the MIE bit in the mstatus CSR.

Definition at line 66 of file irq.c.

◆ irq_enable()

void irq_enable ( void )

#include <irq.h>

Enable Global Interrupts.

Sets the Machine Interrupt Enable (MIE) bit in the mstatus CSR. This acts as the master switch for all interrupts.

Enable Global Interrupts.

Sets the MIE bit in the mstatus CSR.

Definition at line 56 of file irq.c.

◆ irq_registerExt()

void irq_registerExt ( u32 gateway,
irq_handler_t handler )

#include <irq.h>

Register a handler for an External Interrupt (PLIC).

Writes the function pointer to the software vector table.

Parameters
gatewayThe PLIC Interrupt ID (Source ID) to register.
handlerPointer to the ISR function.

Register a handler for an External Interrupt (PLIC).

Parameters
gatewayThe PLIC ID (Gateway ID) to register (0-63).
handlerFunction pointer to the ISR.
Note
This function is used for PLIC (External) interrupts only.

Definition at line 29 of file irq.c.

◆ irq_setTrapVector()

void irq_setTrapVector ( void(* trap_vector )(void))

#include <irq.h>

Set the Machine Trap Vector (mtvec).

Configures the address the CPU jumps to when an exception or interrupt occurs.

Parameters
trap_vectorFunction pointer to the assembly trap entry point.
Note
usually set to trap_entry defined in trap.S.
Parameters
trap_vectorFunction pointer to the trap entry assembly code.
Note
Writes to the mtvec CSR. Ensure the address is aligned (usually 4-byte).

Definition at line 46 of file irq.c.

◆ irq_setType()

void irq_setType ( cpu_irq_t enable)

#include <irq.h>

Enable specific CPU interrupt sources.

Sets the corresponding bit in the mie (Machine Interrupt Enable) CSR.

Parameters
enableBitmask of interrupts to enable (e.g., IRQ_TIMER | IRQ_EXTERNAL).
enableBitmask of interrupts to enable (e.g., IRQ_TIMER | IRQ_EXTERNAL).

Definition at line 76 of file irq.c.