pub struct IntId(/* private fields */);Expand description
An interrupt identifier (INTID) for the GIC.
Represents a unique interrupt ID that can be used with the GIC hardware. The GIC supports different types of interrupts based on the ID range:
- SGI (0-15): Software Generated Interrupts for inter-processor communication
- PPI (16-31): Private Peripheral Interrupts specific to each CPU core
- SPI (32-1019): Shared Peripheral Interrupts that can be routed to any CPU
- Special (1020-1023): Reserved interrupt IDs for special purposes
§Examples
use arm_gic_driver::IntId;
// Create different types of interrupt IDs
let sgi = IntId::sgi(1); // SGI #1
let ppi = IntId::ppi(2); // PPI #2 (actual ID will be 18)
let spi = IntId::spi(42); // SPI #42 (actual ID will be 74)
// Check interrupt type
assert!(sgi.is_sgi());
assert!(ppi.is_private());
assert!(!spi.is_private());Implementations§
Source§impl IntId
impl IntId
Sourcepub const unsafe fn raw(id: u32) -> Self
pub const unsafe fn raw(id: u32) -> Self
Create a new IntId from a raw interrupt ID.
§Arguments
id- The raw interrupt ID value
§Safety
The caller must ensure that id represents a valid interrupt ID
according to the GIC specification. Invalid IDs may cause undefined
behavior when used with GIC operations.
§Examples
use arm_gic_driver::IntId;
// Create from a known valid interrupt ID
let intid = unsafe { IntId::raw(32) }; // SPI #0Sourcepub const fn sgi(sgi: u32) -> Self
pub const fn sgi(sgi: u32) -> Self
Create an interrupt ID for a Software Generated Interrupt.
SGIs are used for inter-processor communication and are always private to the target CPU core.
§Arguments
sgi- SGI number (0-15)
§Panics
Panics if sgi is greater than or equal to 16.
§Examples
use arm_gic_driver::IntId;
let sgi1 = IntId::sgi(1);
assert_eq!(sgi1.to_u32(), 1);
assert!(sgi1.is_sgi());Sourcepub const fn ppi(ppi: u32) -> Self
pub const fn ppi(ppi: u32) -> Self
Create an interrupt ID for a Private Peripheral Interrupt.
PPIs are peripheral interrupts that are private to each CPU core.
The actual interrupt ID will be ppi + 16.
§Arguments
ppi- PPI number (0-15, gets mapped to interrupt IDs 16-31)
§Panics
Panics if ppi is greater than or equal to 16.
§Examples
use arm_gic_driver::IntId;
let ppi2 = IntId::ppi(2);
assert_eq!(ppi2.to_u32(), 18); // 16 + 2
assert!(ppi2.is_private());Sourcepub const fn spi(spi: u32) -> Self
pub const fn spi(spi: u32) -> Self
Create an interrupt ID for a Shared Peripheral Interrupt.
SPIs are peripheral interrupts that can be routed to any CPU core.
The actual interrupt ID will be spi + 32.
§Arguments
spi- SPI number (0-987, gets mapped to interrupt IDs 32-1019)
§Panics
Panics if spi would result in an interrupt ID >= 1020.
§Examples
use arm_gic_driver::IntId;
let spi42 = IntId::spi(42);
assert_eq!(spi42.to_u32(), 74); // 32 + 42
assert!(!spi42.is_private());Sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Check if this interrupt ID is private to a CPU core.
Private interrupts include both SGIs (0-15) and PPIs (16-31). These interrupts cannot be routed between different CPU cores.
§Returns
true if this is a private interrupt (SGI or PPI), false for SPIs.
§Examples
use arm_gic_driver::IntId;
assert!(IntId::sgi(1).is_private()); // SGI
assert!(IntId::ppi(5).is_private()); // PPI
assert!(!IntId::spi(42).is_private()); // SPISourcepub fn is_special(&self) -> bool
pub fn is_special(&self) -> bool
Check if this interrupt ID is in the special range.
Special interrupt IDs (1020-1023) are reserved for specific purposes and are not used for regular interrupt handling.
§Returns
true if this is a special interrupt ID, false otherwise.
§Examples
use arm_gic_driver::IntId;
let special = unsafe { IntId::raw(1023) };
assert!(special.is_special());
let normal = IntId::spi(10);
assert!(!normal.is_special());