cleanup typos

This commit is contained in:
bunnie 2025-10-28 18:00:38 +08:00
parent c159ddd214
commit 52198821b0
3 changed files with 15 additions and 15 deletions

View file

@ -7,7 +7,7 @@ const DABAO_PINMASK: u32 = 0b0001_1111_1000_1111_0111_1000_0011_1110; // 0x1F8F7
pub fn dabao_selftest() { pub fn dabao_selftest() {
let mut bio_ss = BioSharedState::new(); let mut bio_ss = BioSharedState::new();
let iox = bao1x_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32); let iox = bao1x_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
iox.set_ports_from_pio_bitmask(DABAO_PINMASK); iox.set_ports_from_bio_bitmask(DABAO_PINMASK);
bio_ss.init(); bio_ss.init();
bio_ss.load_code(db_pin_test_code(), 0, BioCore::Core0); bio_ss.load_code(db_pin_test_code(), 0, BioCore::Core0);
bio_ss.bio.wo(utra::bio_bdma::SFR_QDIV0, 0x1_0001); bio_ss.bio.wo(utra::bio_bdma::SFR_QDIV0, 0x1_0001);
@ -34,7 +34,7 @@ pub fn dabao_selftest() {
} }
crate::println!("Done; pin state reverted"); crate::println!("Done; pin state reverted");
crate::usb::flush(); crate::usb::flush();
iox.set_ports_from_pio_bitmask(0x0); iox.set_ports_from_bio_bitmask(0x0);
} }
#[rustfmt::skip] #[rustfmt::skip]

View file

@ -304,7 +304,7 @@ impl Repl {
// map the BIO ports to GPIO pins // map the BIO ports to GPIO pins
// let iox = bao1x_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32); // let iox = bao1x_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
// iox.set_ports_from_pio_bitmask(0xFFFF_FFFF); // iox.set_ports_from_bio_bitmask(0xFFFF_FFFF);
crate::println!("Resetting block"); crate::println!("Resetting block");
let mut bio_ss = BioSharedState::new(); let mut bio_ss = BioSharedState::new();
@ -414,7 +414,7 @@ impl Repl {
// Initialize BIO and IOX once, as they are common to all subcommands. // Initialize BIO and IOX once, as they are common to all subcommands.
let mut bio_ss = BioSharedState::new(); let mut bio_ss = BioSharedState::new();
let iox = bao1x_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32); let iox = bao1x_hal::iox::Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
iox.set_ports_from_pio_bitmask(0xFFFF_FFFF); iox.set_ports_from_bio_bitmask(0xFFFF_FFFF);
match subcommand { match subcommand {
"set" => { "set" => {

View file

@ -180,18 +180,18 @@ impl Iox {
} }
} }
/// This function takes a 32-bit bitmask, corresponding to PIO 31 through 0, where /// This function takes a 32-bit bitmask, corresponding to BIO 31 through 0, where
/// a `1` indicates to map that PIO to a GPIO. /// a `1` indicates to map that BIO to a GPIO.
/// ///
/// This function will automatically remap the AF and PIO settings for the PIO pins /// This function will automatically remap the AF and BIO settings for the BIO pins
/// specified in the bitmask, corresponding to the PIO GPIO pin number. If a `0` is /// specified in the bitmask, corresponding to the BIO GPIO pin number. If a `0` is
/// present in a bit position, it will turn off the PIO mux, but not change the AF setting. /// present in a bit position, it will turn off the BIO mux, but not change the AF setting.
/// ///
/// Returns: a 32-entry array which records which GPIO bank and pin number was affected /// Returns: a 32-entry array which records which GPIO bank and pin number was affected
/// by the mapping request. The index of the array corresponds to the bit position in /// by the mapping request. The index of the array corresponds to the bit position in
/// the bitmask. You may use this to pass as arguments to further functions /// the bitmask. You may use this to pass as arguments to further functions
/// that do things like control slew rate or apply pull-ups. /// that do things like control slew rate or apply pull-ups.
pub fn set_ports_from_pio_bitmask(&self, enable_bitmask: u32) -> [Option<(IoxPort, u8)>; 32] { pub fn set_ports_from_bio_bitmask(&self, enable_bitmask: u32) -> [Option<(IoxPort, u8)>; 32] {
let mut mapping: [Option<(IoxPort, u8)>; 32] = [None; 32]; let mut mapping: [Option<(IoxPort, u8)>; 32] = [None; 32];
for i in 0..32 { for i in 0..32 {
@ -238,20 +238,20 @@ impl Iox {
if let Some((port, pin)) = map { if let Some((port, pin)) = map {
// AF1 must be selected // AF1 must be selected
self.set_alternate_function(port, pin, IoxFunction::AF1); self.set_alternate_function(port, pin, IoxFunction::AF1);
// then the PIO register must have its bit flipped to 1 // then the BIO register must have its bit flipped to 1
self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << i)); self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << i));
mapping[i] = Some((port, pin)); mapping[i] = Some((port, pin));
} }
} else { } else {
mapping[i] = None; mapping[i] = None;
// ensure that the PIO register bit is not set // ensure that the BIO register bit is not set
self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) & !(1 << i)); self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) & !(1 << i));
} }
} }
mapping mapping
} }
/// Returns the PIO bit that was enabled based on the port and pin specifier given; /// Returns the BIO bit that was enabled based on the port and pin specifier given;
/// returns `None` if the proposed mapping is invalid. /// returns `None` if the proposed mapping is invalid.
pub fn set_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option<u8> { pub fn set_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option<u8> {
match port { match port {
@ -280,9 +280,9 @@ impl Iox {
} }
} }
/// Returns the PIO bit that was disabled based on the port and pin specifier given; /// Returns the BIO 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, /// returns `None` if the proposed mapping is invalid. Does not change the AF mapping,
/// simply disables the bit in the PIO mux register. /// simply disables the bit in the BIO mux register.
pub fn unset_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option<u8> { pub fn unset_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option<u8> {
match port { match port {
IoxPort::PA => None, IoxPort::PA => None,