@@ -13,13 +13,13 @@ use crate::pac::{PLIC, Interrupt};
13
13
/// Extension trait for PLIC interrupt controller peripheral
14
14
pub trait PlicExt {
15
15
/// Interrupt wrapper type
16
- type Interrupt ;
16
+ type Interrupt : Nr ;
17
17
/// Is this M-Mode interrupt enabled on given hart?
18
18
fn is_enabled ( hart_id : usize , interrupt : Self :: Interrupt ) -> bool ;
19
19
/// 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 ) ;
21
21
/// 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 ) ;
23
23
/// Get global priority for one interrupt
24
24
fn get_priority ( interrupt : Self :: Interrupt ) -> Priority ;
25
25
/// Globally set priority for one interrupt
@@ -45,15 +45,13 @@ impl PlicExt for PLIC {
45
45
. read ( ) . bits ( ) & 1 << ( irq_number % 32 ) != 0
46
46
}
47
47
}
48
- fn enable ( hart_id : usize , interrupt : Interrupt ) {
48
+ unsafe fn unmask ( hart_id : usize , interrupt : Interrupt ) {
49
49
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 ) ) ) ;
55
53
}
56
- fn disable ( hart_id : usize , interrupt : Interrupt ) {
54
+ fn mask ( hart_id : usize , interrupt : Interrupt ) {
57
55
let irq_number = interrupt. into_bits ( ) as usize ;
58
56
unsafe {
59
57
( * PLIC :: ptr ( ) ) . target_enables [ hart_id] . enable [ irq_number / 32 ]
0 commit comments