mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fix bugs in baremetal udma API
This commit is contained in:
parent
be8c78a0db
commit
528abf3b9f
1 changed files with 23 additions and 5 deletions
|
|
@ -393,6 +393,7 @@ impl Udma for Uart {
|
||||||
}
|
}
|
||||||
/// The sum of UART_TX_BUF_SIZE + UART_RX_BUF_SIZE should be 4096.
|
/// The sum of UART_TX_BUF_SIZE + UART_RX_BUF_SIZE should be 4096.
|
||||||
const UART_TX_BUF_SIZE: usize = 2048;
|
const UART_TX_BUF_SIZE: usize = 2048;
|
||||||
|
const UART_RX_BUF_START: usize = UART_TX_BUF_SIZE;
|
||||||
const UART_RX_BUF_SIZE: usize = 2048;
|
const UART_RX_BUF_SIZE: usize = 2048;
|
||||||
impl Uart {
|
impl Uart {
|
||||||
/// Configures for N81
|
/// Configures for N81
|
||||||
|
|
@ -530,9 +531,16 @@ impl Uart {
|
||||||
writelen += chunk.len();
|
writelen += chunk.len();
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
unsafe {
|
{
|
||||||
self.udma_enqueue(Bank::Tx, chunk, CFG_EN | CFG_SIZE_8);
|
self.ifram.as_slice_mut()[..chunk.len()].copy_from_slice(chunk);
|
||||||
writelen += chunk.len();
|
unsafe {
|
||||||
|
self.udma_enqueue(
|
||||||
|
Bank::Tx,
|
||||||
|
&self.ifram.as_phys_slice::<u8>()[..chunk.len()],
|
||||||
|
CFG_EN | CFG_SIZE_8,
|
||||||
|
);
|
||||||
|
writelen += chunk.len();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.wait_tx_done();
|
self.wait_tx_done();
|
||||||
|
|
@ -546,7 +554,7 @@ impl Uart {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.udma_enqueue(
|
self.udma_enqueue(
|
||||||
Bank::Rx,
|
Bank::Rx,
|
||||||
&self.ifram.as_phys_slice::<u8>()[UART_TX_BUF_SIZE..UART_TX_BUF_SIZE + chunk.len()],
|
&self.ifram.as_phys_slice::<u8>()[UART_RX_BUF_START..UART_RX_BUF_START + chunk.len()],
|
||||||
CFG_EN | CFG_SIZE_8,
|
CFG_EN | CFG_SIZE_8,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -554,11 +562,21 @@ impl Uart {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.udma_enqueue(
|
self.udma_enqueue(
|
||||||
Bank::Rx,
|
Bank::Rx,
|
||||||
&chunk[UART_TX_BUF_SIZE..UART_TX_BUF_SIZE + chunk.len()],
|
&self.ifram.as_phys_slice::<u8>()[UART_RX_BUF_START..UART_RX_BUF_START + chunk.len()],
|
||||||
CFG_EN | CFG_SIZE_8,
|
CFG_EN | CFG_SIZE_8,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
self.wait_rx_done();
|
self.wait_rx_done();
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
chunk.copy_from_slice(
|
||||||
|
&self.ifram.as_slice::<u8>()[UART_RX_BUF_START..UART_RX_BUF_START + chunk.len()],
|
||||||
|
);
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
unsafe {
|
||||||
|
chunk.copy_from_slice(
|
||||||
|
&self.ifram.as_phys_slice::<u8>()[UART_RX_BUF_START..UART_RX_BUF_START + chunk.len()],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue