mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-22 18:20:40 +00:00
55 lines
1.4 KiB
C
55 lines
1.4 KiB
C
|
#define PERIPHERAL_BASE 0xFE000000
|
||
|
#define CLOCKHZ 1000000
|
||
|
|
||
|
struct timer_regs {
|
||
|
volatile unsigned int control_status;
|
||
|
volatile unsigned int counter_lo;
|
||
|
volatile unsigned int counter_hi;
|
||
|
volatile unsigned int compare[4];
|
||
|
};
|
||
|
|
||
|
#define REGS_TIMER ((struct timer_regs *)(PERIPHERAL_BASE + 0x00003000))
|
||
|
|
||
|
struct arm_irq_regs_2711 {
|
||
|
volatile unsigned int irq0_pending_0;
|
||
|
volatile unsigned int irq0_pending_1;
|
||
|
volatile unsigned int irq0_pending_2;
|
||
|
volatile unsigned int res0;
|
||
|
volatile unsigned int irq0_enable_0;
|
||
|
volatile unsigned int irq0_enable_1;
|
||
|
volatile unsigned int irq0_enable_2;
|
||
|
volatile unsigned int res1;
|
||
|
volatile unsigned int irq0_disable_0;
|
||
|
volatile unsigned int irq0_disable_1;
|
||
|
volatile unsigned int irq0_disable_2;
|
||
|
};
|
||
|
|
||
|
typedef struct arm_irq_regs_2711 arm_irq_regs;
|
||
|
|
||
|
#define REGS_IRQ ((arm_irq_regs *)(PERIPHERAL_BASE + 0x0000B200))
|
||
|
|
||
|
enum vc_irqs {
|
||
|
SYS_TIMER_IRQ_0 = 1,
|
||
|
SYS_TIMER_IRQ_1 = 2,
|
||
|
SYS_TIMER_IRQ_2 = 4,
|
||
|
SYS_TIMER_IRQ_3 = 8,
|
||
|
AUX_IRQ = (1 << 29),
|
||
|
GPIO_INT_0 = (1 << 49),
|
||
|
GPIO_INT_1 = (1 << 50),
|
||
|
GPIO_INT_2 = (1 << 51),
|
||
|
GPIO_INT_3 = (1 << 52),
|
||
|
SPI_INT = (1 << 54)
|
||
|
};
|
||
|
|
||
|
// from util.S
|
||
|
void irq_init_vectors();
|
||
|
void irq_enable();
|
||
|
void irq_barrier();
|
||
|
void irq_disable();
|
||
|
void enable_interrupt_controller();
|
||
|
void disable_interrupt_controller();
|
||
|
|
||
|
void handle_timer_1();
|
||
|
void handle_timer_3();
|
||
|
void handle_spi();
|