mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
change DUART ports to accommodate jtag breakout
This commit is contained in:
parent
73c834d067
commit
c407db877e
2 changed files with 13 additions and 11 deletions
|
|
@ -11,7 +11,7 @@ use utralib::*;
|
||||||
|
|
||||||
#[repr(C, align(16))]
|
#[repr(C, align(16))]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct ChannelControl {
|
pub struct ChannelControl {
|
||||||
pub src_end_ptr: u32,
|
pub src_end_ptr: u32,
|
||||||
pub dst_end_ptr: u32,
|
pub dst_end_ptr: u32,
|
||||||
pub control: u32,
|
pub control: u32,
|
||||||
|
|
@ -20,7 +20,7 @@ struct ChannelControl {
|
||||||
|
|
||||||
#[repr(C, align(256))]
|
#[repr(C, align(256))]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct ControlChannels {
|
pub struct ControlChannels {
|
||||||
pub channels: [ChannelControl; 8],
|
pub channels: [ChannelControl; 8],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,25 +99,27 @@ pub fn early_init() {
|
||||||
// Set up the IO mux to map UART_A0:
|
// Set up the IO mux to map UART_A0:
|
||||||
// UART_RX_A[0] = PA3
|
// UART_RX_A[0] = PA3
|
||||||
// UART_TX_A[0] = PA4
|
// UART_TX_A[0] = PA4
|
||||||
|
// UART_RX_A[1] = PD13
|
||||||
|
// UART_RX_A[1] = PD14
|
||||||
let mut iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
|
let mut iox = Iox::new(utra::iox::HW_IOX_BASE as *mut u32);
|
||||||
iox.set_alternate_function(IoxPort::PA, 3, IoxFunction::AF1);
|
iox.set_alternate_function(IoxPort::PD, 13, IoxFunction::AF1);
|
||||||
iox.set_alternate_function(IoxPort::PA, 4, IoxFunction::AF1);
|
iox.set_alternate_function(IoxPort::PD, 14, IoxFunction::AF1);
|
||||||
// rx as input, with pull-up
|
// rx as input, with pull-up
|
||||||
iox.set_gpio_dir(IoxPort::PA, 3, IoxDir::Input);
|
iox.set_gpio_dir(IoxPort::PD, 13, IoxDir::Input);
|
||||||
iox.set_gpio_pullup(IoxPort::PA, 3, IoxEnable::Enable);
|
iox.set_gpio_pullup(IoxPort::PD, 13, IoxEnable::Enable);
|
||||||
// tx as output
|
// tx as output
|
||||||
iox.set_gpio_dir(IoxPort::PA, 4, IoxDir::Output);
|
iox.set_gpio_dir(IoxPort::PD, 14, IoxDir::Output);
|
||||||
|
|
||||||
// Set up the UDMA_UART block to the correct baud rate and enable status
|
// 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);
|
let mut udma_global = udma::GlobalConfig::new(utra::udma_ctrl::HW_UDMA_CTRL_BASE as *mut u32);
|
||||||
udma_global.clock_on(udma::PeriphId::Uart0);
|
udma_global.clock_on(udma::PeriphId::Uart1);
|
||||||
udma_global.map_event(
|
udma_global.map_event(
|
||||||
udma::PeriphId::Uart0,
|
udma::PeriphId::Uart1,
|
||||||
udma::PeriphEventType::Uart(udma::EventUartOffset::Rx),
|
udma::PeriphEventType::Uart(udma::EventUartOffset::Rx),
|
||||||
udma::EventChannel::Channel0,
|
udma::EventChannel::Channel0,
|
||||||
);
|
);
|
||||||
udma_global.map_event(
|
udma_global.map_event(
|
||||||
udma::PeriphId::Uart0,
|
udma::PeriphId::Uart1,
|
||||||
udma::PeriphEventType::Uart(udma::EventUartOffset::Tx),
|
udma::PeriphEventType::Uart(udma::EventUartOffset::Tx),
|
||||||
udma::EventChannel::Channel1,
|
udma::EventChannel::Channel1,
|
||||||
);
|
);
|
||||||
|
|
@ -131,7 +133,7 @@ pub fn early_init() {
|
||||||
let uart_buf_addr = UART_IFRAM_ADDR;
|
let uart_buf_addr = UART_IFRAM_ADDR;
|
||||||
let mut udma_uart = unsafe {
|
let mut udma_uart = unsafe {
|
||||||
// safety: this is safe to call, because we set up clock and events prior to calling new.
|
// safety: this is safe to call, because we set up clock and events prior to calling new.
|
||||||
udma::Uart::get_handle(utra::udma_uart_0::HW_UDMA_UART_0_BASE, uart_buf_addr, uart_buf_addr)
|
udma::Uart::get_handle(utra::udma_uart_1::HW_UDMA_UART_1_BASE, uart_buf_addr, uart_buf_addr)
|
||||||
};
|
};
|
||||||
udma_uart.set_baud(baudrate, freq);
|
udma_uart.set_baud(baudrate, freq);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue