add irq_status_bits() trait and enum for selecting Irq bank

multiple IRQs related to the UDMA will eventually get mapped into
the global IRQ handler for UDMA. Create an enum type that will
help us differentiate this and add a trait that returns the raw bits
for a given IRQ type.

Probably a fancier wrapper should be made to interptet the IRQ
bits but unfortunately there isn't a uniform pattern to the IRQ
mappings, it's pretty much whatever fit into the IRQ space based
on the underlying function. At the moment not even sure if this
is the right register to be chasing, so we'll use this for probing
that aspect and then get fancy later, maybe.
This commit is contained in:
bunnie 2025-06-07 02:42:25 +08:00
parent cfe9b3c845
commit c24bb3a450

View file

@ -233,6 +233,11 @@ pub enum EventChannel {
Channel3 = 24,
}
#[derive(Debug, Copy, Clone, num_derive::FromPrimitive)]
pub enum IrqBank {
I2c,
}
/// Use a trait that will allow us to share code between both `std` and `no-std` implementations
pub trait UdmaGlobalConfig {
fn clock(&self, peripheral: PeriphId, enable: bool);
@ -243,4 +248,5 @@ pub trait UdmaGlobalConfig {
to_channel: EventChannel,
);
fn reset(&self, peripheral: PeriphId);
fn irq_status_bits(&self, bank: IrqBank) -> u32;
}