Skip to content

Commit 4079fb6

Browse files
committed
feat(interrupt): implement InterruptLine::set_priority
1 parent d42bc04 commit 4079fb6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/constance/src/kernel/interrupt.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,18 @@ impl<System: Kernel> InterruptLine<System> {
7474
/// [a managed range]: crate::kernel::Port::MANAGED_INTERRUPT_PRIORITY_RANGE
7575
pub fn set_priority(
7676
self,
77-
_value: InterruptPriority,
77+
value: InterruptPriority,
7878
) -> Result<(), SetInterruptLinePriorityError> {
7979
let _lock = utils::lock_cpu::<System>()?;
80-
todo!()
80+
81+
// Deny unmanaged priority
82+
if !System::MANAGED_INTERRUPT_PRIORITY_RANGE.contains(&value) {
83+
return Err(SetInterruptLinePriorityError::BadParam);
84+
}
85+
86+
// Safety: (1) We are the kernel, so it's okay to call `Port`'s methods.
87+
// (2) CPU Lock active
88+
unsafe { System::set_interrupt_line_priority(self.0, value) }
8189
}
8290

8391
/// Set the priority of the interrupt line without checking if the new

0 commit comments

Comments
 (0)