parent
c4df7cd3af
commit
f6352b2688
@ -0,0 +1,18 @@
|
||||
use super::consts::KERNEL_OFFSET;
|
||||
|
||||
/// Mask all external interrupt except serial.
|
||||
pub unsafe fn init_external_interrupt() {
|
||||
const HART1_S_MODE_INTERRUPT_ENABLES: *mut u64 = (KERNEL_OFFSET + 0x0C00_2100) as *mut u64;
|
||||
const SERIAL: u64 = 4;
|
||||
HART1_S_MODE_INTERRUPT_ENABLES.write(1 << SERIAL);
|
||||
}
|
||||
|
||||
/// Claim and complete external interrupt by reading and writing to
|
||||
/// PLIC Interrupt Claim/Complete Register.
|
||||
pub unsafe fn handle_external_interrupt() {
|
||||
const HART1_S_MODE_INTERRUPT_CLAIM_COMPLETE: *mut u32 = (KERNEL_OFFSET + 0x0C20_2004) as *mut u32;
|
||||
// claim
|
||||
let source = HART1_S_MODE_INTERRUPT_CLAIM_COMPLETE.read();
|
||||
// complete
|
||||
HART1_S_MODE_INTERRUPT_CLAIM_COMPLETE.write(source);
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit 2829915ea12fba2e5fd4db2879e23311043a55b4
|
||||
Subproject commit 405ea59dd7dd2762c5883822f21d9995bea32b0c
|
Loading…
Reference in new issue