From 0391a6aef57cd0818c2ff69021f12586262e61a0 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 14 Sep 2025 02:09:40 +0800 Subject: [PATCH] fix naming for bio api --- libs/cramium-api/src/api.rs | 2 +- libs/cramium-api/src/iox.rs | 8 ++++---- libs/cramium-hal/src/board/baosec.rs | 2 +- libs/cramium-hal/src/iox.rs | 20 ++++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libs/cramium-api/src/api.rs b/libs/cramium-api/src/api.rs index 7947be76c..1d7e17bad 100644 --- a/libs/cramium-api/src/api.rs +++ b/libs/cramium-api/src/api.rs @@ -30,7 +30,7 @@ pub enum HalOpcode { SetGpioBank = 5, /// Return the value of a GPIO bank (blocking scalar) GetGpioBank = 6, - /// Configure BIO + /// Configure BIO pins ConfigureBio = 17, /// Configure UDMA clocks & events diff --git a/libs/cramium-api/src/iox.rs b/libs/cramium-api/src/iox.rs index 4c1659abb..4fd24affa 100644 --- a/libs/cramium-api/src/iox.rs +++ b/libs/cramium-api/src/iox.rs @@ -82,7 +82,7 @@ pub trait IoSetup { slow_slew: Option, strength: Option, ); - fn set_pio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option; + fn set_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option; } /// Traits for accessing GPIOs after the port has been set up. @@ -230,14 +230,14 @@ impl IoxHal { /// Returns the PIO bit that was enabled based on the port and pin specifier given; /// returns `None` if the proposed mapping is invalid. - pub fn set_pio_bit_from_port_and_pin(&self, _port: IoxPort, _pin: u8) -> Option { + pub fn set_bio_bit_from_port_and_pin(&self, _port: IoxPort, _pin: u8) -> Option { todo!("Do this when we get around to filling in the PIO drivers") } /// Returns the PIO bit that was disabled based on the port and pin specifier given; /// returns `None` if the proposed mapping is invalid. Does not change the AF mapping, /// simply disables the bit in the PIO mux register. - pub fn unset_pio_bit_from_port_and_pin(&self, _port: IoxPort, _pin: u8) -> Option { + pub fn unset_bio_bit_from_port_and_pin(&self, _port: IoxPort, _pin: u8) -> Option { todo!("Do this when we get around to filling in the PIO drivers") } } @@ -261,7 +261,7 @@ impl IoSetup for IoxHal { buf.lend(self.conn, HalOpcode::ConfigureIox as u32).expect("Couldn't set up IO"); } - fn set_pio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option { + fn set_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option { match xous::send_message( self.conn, xous::Message::new_blocking_scalar( diff --git a/libs/cramium-hal/src/board/baosec.rs b/libs/cramium-hal/src/board/baosec.rs index def8e9dc2..7b5da37a3 100644 --- a/libs/cramium-hal/src/board/baosec.rs +++ b/libs/cramium-hal/src/board/baosec.rs @@ -333,7 +333,7 @@ pub fn setup_trng_input_pin(iox: &T) -> u8 { None, Some(IoxDriveStrength::Drive2mA), ); - iox.set_pio_bit_from_port_and_pin(port, pin).expect("Couldn't allocate TRNG input pin") + iox.set_bio_bit_from_port_and_pin(port, pin).expect("Couldn't allocate TRNG input pin") } // sentinel used by test infrastructure to assist with parsing diff --git a/libs/cramium-hal/src/iox.rs b/libs/cramium-hal/src/iox.rs index a3153cc6e..f58131cb4 100644 --- a/libs/cramium-hal/src/iox.rs +++ b/libs/cramium-hal/src/iox.rs @@ -253,7 +253,7 @@ impl Iox { /// Returns the PIO bit that was enabled based on the port and pin specifier given; /// returns `None` if the proposed mapping is invalid. - pub fn set_pio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option { + pub fn set_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option { match port { IoxPort::PA => None, IoxPort::PB => { @@ -261,17 +261,17 @@ impl Iox { None } else { self.set_alternate_function(port, pin, IoxFunction::AF1); - let pio_bit = 15 - pin; - self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << pio_bit as u32)); - Some(pio_bit) + let bio_bit = 15 - pin; + self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << bio_bit as u32)); + Some(bio_bit) } } IoxPort::PC => { if pin < 16 { self.set_alternate_function(port, pin, IoxFunction::AF1); - let pio_bit = pin + 16; - self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << pio_bit as u32)); - Some(pio_bit) + let bio_bit = pin + 16; + self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << bio_bit as u32)); + Some(bio_bit) } else { None } @@ -283,7 +283,7 @@ impl Iox { /// Returns the PIO bit that was disabled based on the port and pin specifier given; /// returns `None` if the proposed mapping is invalid. Does not change the AF mapping, /// simply disables the bit in the PIO mux register. - pub fn unset_pio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option { + pub fn unset_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option { match port { IoxPort::PA => None, IoxPort::PB => { @@ -377,8 +377,8 @@ impl IoSetup for Iox { } } - fn set_pio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option { - self.set_pio_bit_from_port_and_pin(port, pin) + fn set_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option { + self.set_bio_bit_from_port_and_pin(port, pin) } }