mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
fix naming for bio api
This commit is contained in:
parent
a4d9fc9dc7
commit
0391a6aef5
4 changed files with 16 additions and 16 deletions
|
|
@ -30,7 +30,7 @@ pub enum HalOpcode {
|
||||||
SetGpioBank = 5,
|
SetGpioBank = 5,
|
||||||
/// Return the value of a GPIO bank (blocking scalar)
|
/// Return the value of a GPIO bank (blocking scalar)
|
||||||
GetGpioBank = 6,
|
GetGpioBank = 6,
|
||||||
/// Configure BIO
|
/// Configure BIO pins
|
||||||
ConfigureBio = 17,
|
ConfigureBio = 17,
|
||||||
|
|
||||||
/// Configure UDMA clocks & events
|
/// Configure UDMA clocks & events
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ pub trait IoSetup {
|
||||||
slow_slew: Option<IoxEnable>,
|
slow_slew: Option<IoxEnable>,
|
||||||
strength: Option<IoxDriveStrength>,
|
strength: Option<IoxDriveStrength>,
|
||||||
);
|
);
|
||||||
fn set_pio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option<u8>;
|
fn set_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option<u8>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Traits for accessing GPIOs after the port has been set up.
|
/// 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 the PIO 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_pio_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> {
|
||||||
todo!("Do this when we get around to filling in the PIO drivers")
|
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 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,
|
/// 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 PIO mux register.
|
||||||
pub fn unset_pio_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> {
|
||||||
todo!("Do this when we get around to filling in the PIO drivers")
|
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");
|
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<u8> {
|
fn set_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option<u8> {
|
||||||
match xous::send_message(
|
match xous::send_message(
|
||||||
self.conn,
|
self.conn,
|
||||||
xous::Message::new_blocking_scalar(
|
xous::Message::new_blocking_scalar(
|
||||||
|
|
|
||||||
|
|
@ -333,7 +333,7 @@ pub fn setup_trng_input_pin<T: IoSetup + IoGpio>(iox: &T) -> u8 {
|
||||||
None,
|
None,
|
||||||
Some(IoxDriveStrength::Drive2mA),
|
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
|
// sentinel used by test infrastructure to assist with parsing
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ impl Iox {
|
||||||
|
|
||||||
/// Returns the PIO bit that was enabled based on the port and pin specifier given;
|
/// Returns the PIO 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_pio_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 {
|
||||||
IoxPort::PA => None,
|
IoxPort::PA => None,
|
||||||
IoxPort::PB => {
|
IoxPort::PB => {
|
||||||
|
|
@ -261,17 +261,17 @@ impl Iox {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
self.set_alternate_function(port, pin, IoxFunction::AF1);
|
self.set_alternate_function(port, pin, IoxFunction::AF1);
|
||||||
let pio_bit = 15 - pin;
|
let bio_bit = 15 - pin;
|
||||||
self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << pio_bit as u32));
|
self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << bio_bit as u32));
|
||||||
Some(pio_bit)
|
Some(bio_bit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IoxPort::PC => {
|
IoxPort::PC => {
|
||||||
if pin < 16 {
|
if pin < 16 {
|
||||||
self.set_alternate_function(port, pin, IoxFunction::AF1);
|
self.set_alternate_function(port, pin, IoxFunction::AF1);
|
||||||
let pio_bit = pin + 16;
|
let bio_bit = pin + 16;
|
||||||
self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << pio_bit as u32));
|
self.csr.wo(iox::SFR_PIOSEL, self.csr.r(iox::SFR_PIOSEL) | (1 << bio_bit as u32));
|
||||||
Some(pio_bit)
|
Some(bio_bit)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
@ -283,7 +283,7 @@ impl Iox {
|
||||||
/// Returns the PIO bit that was disabled based on the port and pin specifier given;
|
/// 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,
|
/// 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 PIO mux register.
|
||||||
pub fn unset_pio_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,
|
||||||
IoxPort::PB => {
|
IoxPort::PB => {
|
||||||
|
|
@ -377,8 +377,8 @@ impl IoSetup for Iox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_pio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option<u8> {
|
fn set_bio_bit_from_port_and_pin(&self, port: IoxPort, pin: u8) -> Option<u8> {
|
||||||
self.set_pio_bit_from_port_and_pin(port, pin)
|
self.set_bio_bit_from_port_and_pin(port, pin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue