SquidgeOS/src/kernel/plic.h

23 lines
756 B
C
Raw Normal View History

#ifndef PLIC_H
#define PLIC_H
2026-02-10 03:01:50 +00:00
#define PLIC_BASE 0x0c000000UL
// Priorities: 4 bytes per IRQ (IRQ 0 is reserved/null)
#define PLIC_PRIORITY(irq) ((volatile uint32_t *)(PLIC_BASE + (irq) * 4))
// Enables: Each Hart has a 0x80 byte stride for its enable bits
// For Hart 0 Machine Mode: 0x0c002000
#define PLIC_ENABLE(hart) ((volatile uint32_t *)(PLIC_BASE + 0x2000 + (hart) * 0x80))
// Threshold and Claim/Complete: Each Hart has a 0x1000 byte stride
// For Hart 0 Machine Mode: 0x0c200000 and 0x0c200004
#define PLIC_THRESHOLD(hart) ((volatile uint32_t *)(PLIC_BASE + 0x200000 + (hart) * 0x1000))
#define PLIC_CLAIM(hart) ((volatile uint32_t *)(PLIC_BASE + 0x200004 + (hart) * 0x1000))
#define UART_IRQ 10
2026-05-01 23:14:44 +01:00
#define TIMER_IRQ 5
void plic_init();
#endif