# Conflicts: # kernel/src/arch/aarch64/memory.rs # kernel/src/arch/aarch64/paging.rs # kernel/src/process/context.rsmaster
commit
9b0b0064d0
@ -1,11 +1,28 @@
|
|||||||
use crate::arch::interrupt::TrapFrame;
|
use crate::arch::interrupt::TrapFrame;
|
||||||
use bcm2837::timer::Timer;
|
use bcm2837::interrupt::Controller;
|
||||||
use bcm2837::interrupt::{Controller, Interrupt};
|
use log::*;
|
||||||
|
|
||||||
pub fn handle_irq(tf: &mut TrapFrame) {
|
pub use bcm2837::interrupt::Interrupt;
|
||||||
let controller = Timer::new();
|
|
||||||
|
static IRQ_HANDLERS: &'static [Option<fn()>; 64] = &[None; 64];
|
||||||
|
|
||||||
|
pub fn handle_irq(_tf: &mut TrapFrame) {
|
||||||
|
let controller = bcm2837::timer::Timer::new();
|
||||||
if controller.is_pending() {
|
if controller.is_pending() {
|
||||||
super::timer::set_next();
|
super::timer::set_next();
|
||||||
crate::trap::timer();
|
crate::trap::timer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for int in Controller::new().pending_interrupts() {
|
||||||
|
if let Some(handler) = IRQ_HANDLERS[int] {
|
||||||
|
handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn register_irq(int: Interrupt, handler: fn()) {
|
||||||
|
unsafe {
|
||||||
|
*(&IRQ_HANDLERS[int as usize] as *const _ as *mut Option<fn()>) = Some(handler);
|
||||||
|
}
|
||||||
|
Controller::new().enable(int);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
/// ARM64 drivers
|
||||||
|
|
||||||
|
use once::*;
|
||||||
|
|
||||||
|
use super::board;
|
||||||
|
|
||||||
|
/// Initialize ARM64 common drivers
|
||||||
|
pub fn init() {
|
||||||
|
assert_has_not_been_called!();
|
||||||
|
|
||||||
|
board::init_driver();
|
||||||
|
}
|
Loading…
Reference in new issue