mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-04 04:27:34 +00:00
uart Rx in loader now seems to work.
This commit is contained in:
parent
a0e464bcee
commit
f12ddb09cb
1 changed files with 11 additions and 5 deletions
|
|
@ -100,6 +100,10 @@ pub fn early_init() {
|
|||
// tx as output
|
||||
iox.set_gpio_dir(IoxPort::PA, 4, IoxDir::Output);
|
||||
|
||||
// This is necessary because an input has to be "high" on an alternate mux for it to work... :-/
|
||||
iox.set_gpio_dir(IoxPort::PD, 13, IoxDir::Input);
|
||||
iox.set_gpio_pullup(IoxPort::PD, 13, IoxEnable::Enable);
|
||||
|
||||
// Set up the UDMA_UART block to the correct baud rate and enable status
|
||||
let mut udma_global = udma::GlobalConfig::new(utra::udma_ctrl::HW_UDMA_CTRL_BASE as *mut u32);
|
||||
udma_global.clock_on(udma::PeriphId::Uart0);
|
||||
|
|
@ -122,7 +126,9 @@ pub fn early_init() {
|
|||
udma::Uart::new(utra::udma_uart_0::HW_UDMA_UART_0_BASE, baudrate, freq)
|
||||
};
|
||||
|
||||
// Board bringup: send characters to confirm the UART is configured & ready to go for the logging crate!
|
||||
// Board bring-up: send characters to confirm the UART is configured & ready to go for the logging crate!
|
||||
// The "boot gutter" also has a role to pause the system in "real mode" before VM is mapped in Xous
|
||||
// makes things a little bit cleaner for JTAG ops, it seems.
|
||||
#[cfg(feature = "board-bringup")]
|
||||
{
|
||||
let tx_buf = unsafe {
|
||||
|
|
@ -133,17 +139,17 @@ pub fn early_init() {
|
|||
// safety: it's safe only because we are manually tracking the allocations in IFRAM0. Yuck!
|
||||
core::slice::from_raw_parts_mut((utralib::HW_IFRAM0_MEM + 256) as *mut u8, 1)
|
||||
};
|
||||
const BANNER: &'static str = "\n\rHit any key to continue boot...\r";
|
||||
const BANNER: &'static str = "\n\rHit any key to continue boot...\r\n";
|
||||
tx_buf[..BANNER.len()].copy_from_slice(BANNER.as_bytes());
|
||||
udma_uart.write(&tx_buf[0..BANNER.len()]);
|
||||
|
||||
// receive characters
|
||||
for _ in 0..16 {
|
||||
// receive characters -- print them back. just to prove that this works.
|
||||
for _ in 0..4 {
|
||||
udma_uart.read(rx_buf);
|
||||
tx_buf[0] = rx_buf[0];
|
||||
const DBG_MSG: &'static str = "Got: ";
|
||||
tx_buf[..DBG_MSG.len()].copy_from_slice(DBG_MSG.as_bytes());
|
||||
udma_uart.write(&tx_buf[0..DBG_MSG.len()]);
|
||||
tx_buf[0] = rx_buf[0];
|
||||
udma_uart.write(&tx_buf[0..1]);
|
||||
tx_buf[0] = '\n' as u32 as u8;
|
||||
tx_buf[1] = '\r' as u32 as u8;
|
||||
|
|
|
|||
Loading…
Reference in a new issue