kernel: add ddma support
parent
4f1810ab84
commit
fac563bbc0
|
@ -167,6 +167,9 @@ pub extern "C" fn dma_playback(timestamp: i64, ptr: i32) {
|
||||||
|
|
||||||
csr::cri_con::selected_write(1);
|
csr::cri_con::selected_write(1);
|
||||||
csr::rtio_dma::enable_write(1);
|
csr::rtio_dma::enable_write(1);
|
||||||
|
#[cfg(has_drtio)]
|
||||||
|
KERNEL_CHANNEL_1TO0.as_mut().unwrap().send(
|
||||||
|
Message::DmaStartRemoteRequest{ id: ptr, timestamp: timestamp });
|
||||||
while csr::rtio_dma::enable_read() != 0 {}
|
while csr::rtio_dma::enable_read() != 0 {}
|
||||||
csr::cri_con::selected_write(0);
|
csr::cri_con::selected_write(0);
|
||||||
|
|
||||||
|
@ -194,5 +197,41 @@ pub extern "C" fn dma_playback(timestamp: i64, ptr: i32) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(has_drtio)]
|
||||||
|
{
|
||||||
|
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
|
||||||
|
} => {
|
||||||
|
if timeout {
|
||||||
|
artiq_raise!(
|
||||||
|
"DMAError",
|
||||||
|
"Error running DMA on satellite device, timed out waiting for results"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if error & 1 != 0 {
|
||||||
|
artiq_raise!(
|
||||||
|
"RTIOUnderflow",
|
||||||
|
"RTIO underflow at {1} mu, channel {rtio_channel_info:0}",
|
||||||
|
channel as i64,
|
||||||
|
timestamp as i64,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if error & 2 != 0 {
|
||||||
|
artiq_raise!(
|
||||||
|
"RTIODestinationUnreachable",
|
||||||
|
"RTIO destination unreachable, output, at {1} mu, channel {rtio_channel_info:0}",
|
||||||
|
channel as i64,
|
||||||
|
timestamp as i64,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => panic!("Expected DmaAwaitRemoteReply after DmaAwaitRemoteRequest!"),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,7 @@ pub enum Message {
|
||||||
timestamp: i64
|
timestamp: i64
|
||||||
},
|
},
|
||||||
#[cfg(has_drtio)]
|
#[cfg(has_drtio)]
|
||||||
DmaAwaitRemoteRequest {
|
DmaAwaitRemoteRequest(i32),
|
||||||
id: i32
|
|
||||||
},
|
|
||||||
#[cfg(has_drtio)]
|
#[cfg(has_drtio)]
|
||||||
DmaAwaitRemoteReply {
|
DmaAwaitRemoteReply {
|
||||||
timeout: bool,
|
timeout: bool,
|
||||||
|
|
Loading…
Reference in New Issue