A UART DAP (Debug Access Port) for Green Hills Integrity and WxWork Wind River serial consoles.
-
Configurable baud rate
-
Configurable echo: local, remote
-
Configurable line endings: lf, crlf
use uart_dap::{UartDap, Echo, LineEnding, Command, Event};
#[tokio::main]
async fn main() -> Result<()> {
let dap = UartDap::new(
"/dev/ttyS0",
115200,
Echo::Local,
LineEnding::Lf,
)?;
let (command_tx, command_rx) = mpsc::channel(1);
let (event_tx, mut event_rx) = mpsc::channel(1);
tokio::spawn(async move { dap.run(command_rx, event_tx).await? });
let command = Command::Read { addr: 0x600df00d };
command_tx.send(command).await?;
// Assumes the DUT responded with 0x5a5a5a5a
assert_eq!(
event_rx.recv().await?,
Event::Read {
addr: 0x600df00d,
data: 0x5a5a5a5a
}
);
Ok(())
}
Important
|
Care must be taken to prevent multiple tests from talking to the same ports at the same time. Limit the number of parallel tests and test threads to 1. |
cargo test -j1 -- --test-threads=1
Licensed under either of
-
Apache License, Version 2.0
-
MIT license
at your option.