Skip to content

Commit 5914e48

Browse files
committed
feat(kernel): provide default impl for Port::{enable, disable}_interrupt_line returning NotSupported
1 parent 29edeeb commit 5914e48

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

src/constance/src/kernel.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,14 @@ pub unsafe trait Port: KernelCfg1 {
297297
fn is_interrupt_context() -> bool;
298298

299299
/// Enable the specified interrupt line.
300-
unsafe fn enable_interrupt_line(line: InterruptNum) -> Result<(), EnableInterruptLineError>;
300+
unsafe fn enable_interrupt_line(_line: InterruptNum) -> Result<(), EnableInterruptLineError> {
301+
Err(EnableInterruptLineError::NotSupported)
302+
}
301303

302304
/// Disable the specified interrupt line.
303-
unsafe fn disable_interrupt_line(line: InterruptNum) -> Result<(), EnableInterruptLineError>;
305+
unsafe fn disable_interrupt_line(_line: InterruptNum) -> Result<(), EnableInterruptLineError> {
306+
Err(EnableInterruptLineError::NotSupported)
307+
}
304308
}
305309

306310
/// Methods intended to be called by a port.

src/constance_port_std/src/lib.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -307,20 +307,6 @@ impl State {
307307
pub fn is_interrupt_context(&self) -> bool {
308308
false
309309
}
310-
311-
pub fn enable_interrupt_line(
312-
&self,
313-
_line: InterruptNum,
314-
) -> Result<(), EnableInterruptLineError> {
315-
todo!()
316-
}
317-
318-
pub fn disable_interrupt_line(
319-
&self,
320-
_line: InterruptNum,
321-
) -> Result<(), EnableInterruptLineError> {
322-
todo!()
323-
}
324310
}
325311

326312
#[macro_export]
@@ -366,14 +352,6 @@ macro_rules! use_port {
366352
fn is_interrupt_context() -> bool {
367353
PORT_STATE.is_interrupt_context()
368354
}
369-
370-
unsafe fn enable_interrupt_line(line: $crate::InterruptNum) -> Result<(), $crate::EnableInterruptLineError> {
371-
PORT_STATE.enable_interrupt_line(line)
372-
}
373-
374-
unsafe fn disable_interrupt_line(line: $crate::InterruptNum) -> Result<(), $crate::EnableInterruptLineError> {
375-
PORT_STATE.disable_interrupt_line(line)
376-
}
377355
}
378356

379357
fn main() {

0 commit comments

Comments
 (0)