comms: implement ddma message support
parent
fac563bbc0
commit
71db828e4f
|
@ -323,7 +323,9 @@ async fn handle_run_kernel(
|
|||
.await;
|
||||
}
|
||||
kernel::Message::DmaPutRequest(recorder) => {
|
||||
rtio_dma::put_record(recorder);
|
||||
let _id = rtio_dma::put_record(recorder);
|
||||
#[cfg(has_drtio)]
|
||||
rtio_dma::remote_dma::upload_traces(aux_mutex, routing_table, timer, _id).await;
|
||||
}
|
||||
kernel::Message::DmaEraseRequest(name) => {
|
||||
// prevent possible OOM when we have large DMA record replacement.
|
||||
|
@ -338,6 +340,33 @@ async fn handle_run_kernel(
|
|||
.await;
|
||||
}
|
||||
#[cfg(has_drtio)]
|
||||
kernel::Message::DmaStartRemoteRequest { id, timestamp } => {
|
||||
rtio_dma::remote_dma::playback(aux_mutex, routing_table, timer, id as u32, timestamp as u64).await;
|
||||
}
|
||||
#[cfg(has_drtio)]
|
||||
kernel::Message::DmaAwaitRemoteRequest(id) => {
|
||||
let result = rtio_dma::remote_dma::await_done(id as u32, Some(10_000), timer).await;
|
||||
let reply = match result {
|
||||
Ok(rtio_dma::remote_dma::RemoteState::PlaybackEnded {
|
||||
error,
|
||||
channel,
|
||||
timestamp
|
||||
}) => kernel::Message::DmaAwaitRemoteReply {
|
||||
timeout: false,
|
||||
error: error,
|
||||
channel: channel,
|
||||
timestamp: timestamp
|
||||
},
|
||||
_ => kernel::Message::DmaAwaitRemoteReply {
|
||||
timeout: true,
|
||||
error: 0,
|
||||
channel: 0,
|
||||
timestamp: 0
|
||||
}
|
||||
};
|
||||
control.borrow_mut().tx.async_send(reply).await;
|
||||
}
|
||||
#[cfg(has_drtio)]
|
||||
kernel::Message::UpDestinationsRequest(destination) => {
|
||||
let result = _up_destinations.borrow()[destination as usize];
|
||||
control
|
||||
|
|
|
@ -202,9 +202,7 @@ pub extern "C" fn dma_playback(timestamp: i64, ptr: i32) {
|
|||
KERNEL_CHANNEL_1TO0.as_mut().unwrap().send(
|
||||
Message::DmaAwaitRemoteRequest(ptr));
|
||||
match KERNEL_CHANNEL_0TO1.as_mut().unwrap().recv() {
|
||||
Message::DmaAwaitRemoteReply {
|
||||
timeout: timeout, error: error, channel: channel, timestamp: timestamp
|
||||
} => {
|
||||
Message::DmaAwaitRemoteReply { timeout, error, channel, timestamp } => {
|
||||
if timeout {
|
||||
artiq_raise!(
|
||||
"DMAError",
|
||||
|
|
Loading…
Reference in New Issue