@@ -13,13 +13,13 @@ use crate::pac::{PLIC, Interrupt};
1313/// Extension trait for PLIC interrupt controller peripheral
1414pub trait PlicExt {
1515 /// Interrupt wrapper type
16- type Interrupt ;
16+ type Interrupt : Nr ;
1717 /// Is this M-Mode interrupt enabled on given hart?
1818 fn is_enabled ( hart_id : usize , interrupt : Self :: Interrupt ) -> bool ;
1919 /// Enable an interrupt for a given hart
20- fn enable ( hart_id : usize , interrupt : Self :: Interrupt ) ;
20+ unsafe fn unmask ( hart_id : usize , interrupt : Self :: Interrupt ) ;
2121 /// Disable an interrupt for a given hart
22- fn disable ( hart_id : usize , interrupt : Self :: Interrupt ) ;
22+ fn mask ( hart_id : usize , interrupt : Self :: Interrupt ) ;
2323 /// Get global priority for one interrupt
2424 fn get_priority ( interrupt : Self :: Interrupt ) -> Priority ;
2525 /// Globally set priority for one interrupt
@@ -45,15 +45,13 @@ impl PlicExt for PLIC {
4545 . read ( ) . bits ( ) & 1 << ( irq_number % 32 ) != 0
4646 }
4747 }
48- fn enable ( hart_id : usize , interrupt : Interrupt ) {
48+ unsafe fn unmask ( hart_id : usize , interrupt : Interrupt ) {
4949 let irq_number = interrupt. into_bits ( ) as usize ;
50- unsafe {
51- ( * PLIC :: ptr ( ) ) . target_enables [ hart_id] . enable [ irq_number / 32 ]
52- . modify ( |r, w|
53- w. bits ( r. bits ( ) | 1 << ( irq_number % 32 ) ) ) ;
54- }
50+ ( * PLIC :: ptr ( ) ) . target_enables [ hart_id] . enable [ irq_number / 32 ]
51+ . modify ( |r, w|
52+ w. bits ( r. bits ( ) | 1 << ( irq_number % 32 ) ) ) ;
5553 }
56- fn disable ( hart_id : usize , interrupt : Interrupt ) {
54+ fn mask ( hart_id : usize , interrupt : Interrupt ) {
5755 let irq_number = interrupt. into_bits ( ) as usize ;
5856 unsafe {
5957 ( * PLIC :: ptr ( ) ) . target_enables [ hart_id] . enable [ irq_number / 32 ]
0 commit comments