File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -296,6 +296,18 @@ pub unsafe trait Port: KernelCfg1 {
296
296
/// [an interrupt context]: crate#contexts
297
297
fn is_interrupt_context ( ) -> bool ;
298
298
299
+ /// Set the priority of the specified interrupt line.
300
+ ///
301
+ /// Precondition: CPU Lock active
302
+ ///
303
+ /// Postcondition: CPU Lock active
304
+ unsafe fn set_interrupt_line_priority (
305
+ _line : InterruptNum ,
306
+ _priority : InterruptPriority ,
307
+ ) -> Result < ( ) , SetInterruptLinePriorityError > {
308
+ Err ( SetInterruptLinePriorityError :: NotSupported )
309
+ }
310
+
299
311
/// Enable the specified interrupt line.
300
312
unsafe fn enable_interrupt_line ( _line : InterruptNum ) -> Result < ( ) , EnableInterruptLineError > {
301
313
Err ( EnableInterruptLineError :: NotSupported )
Original file line number Diff line number Diff line change @@ -329,6 +329,8 @@ define_error! {
329
329
/// [`InterruptLine::set_priority`]: super::InterruptLine::set_priority
330
330
/// [`InterruptLine::set_priority_unchecked`]: super::InterruptLine::set_priority_unchecked
331
331
pub enum SetInterruptLinePriorityError : BadContextError , BadParamError {
332
+ /// The operation is not supported by the port.
333
+ NotSupported ,
332
334
/// CPU Lock is active, or the current context is not [a task context].
333
335
///
334
336
/// [a task context]: crate#contexts
Original file line number Diff line number Diff line change @@ -97,11 +97,13 @@ impl<System: Kernel> InterruptLine<System> {
97
97
/// [unmanaged-safe]: crate::kernel::cfg::CfgInterruptHandlerBuilder::unmanaged
98
98
pub unsafe fn set_priority_unchecked (
99
99
self ,
100
- _value : InterruptPriority ,
100
+ value : InterruptPriority ,
101
101
) -> Result < ( ) , SetInterruptLinePriorityError > {
102
102
let _lock = utils:: lock_cpu :: < System > ( ) ?;
103
- // TODO: deny non-task context
104
- todo ! ( )
103
+
104
+ // Safety: (1) We are the kernel, so it's okay to call `Port`'s methods.
105
+ // (2) CPU Lock active
106
+ unsafe { System :: set_interrupt_line_priority ( self . 0 , value) }
105
107
}
106
108
107
109
/// Enable the interrupt line.
You can’t perform that action at this time.
0 commit comments