From fa3550a30fa75348f82551fe0977c774a3e4c669 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 3 Jan 2025 04:04:45 +0800 Subject: [PATCH] add trait for setting IRQ on GPIO --- libs/cramium-hal/src/iox.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/cramium-hal/src/iox.rs b/libs/cramium-hal/src/iox.rs index 964a59e96..0f681a966 100644 --- a/libs/cramium-hal/src/iox.rs +++ b/libs/cramium-hal/src/iox.rs @@ -101,6 +101,14 @@ pub trait IoGpio { fn set_gpio_pin_dir(&self, port: IoxPort, pin: u8, dir: IoxDir); } +pub trait IoIrq { + /// This hooks a given port/pin to generate a message to the server specified + /// with `server` and the opcode number `usize` when an IRQ is detected on the port/pin. + /// The active state of the IRQ is defined by `active`; the transition edge from inactive + /// to active is when the event is generated. + fn set_irq_pin(&self, port: IoxPort, pin: u8, active: IoxValue, server: &str, opcode: usize); +} + pub struct Iox { pub csr: SharedCsr, }