dma: call rtio module to get time cursor position

More portable across RTIO implementations.
This commit is contained in:
Sebastien Bourdeauducq 2020-08-04 13:14:00 +08:00
parent 7f4ccc9ded
commit c9bac028bf

View File

@ -197,7 +197,7 @@ unsafe fn dma_record_output_prepare(timestamp: i64, target: i32,
pub extern fn dma_record_output(target: i32, word: i32) { pub extern fn dma_record_output(target: i32, word: i32) {
unsafe { unsafe {
let timestamp = csr::rtio::now_read() as i64; let timestamp = rtio::now_mu();
let data = dma_record_output_prepare(timestamp, target, 1); let data = dma_record_output_prepare(timestamp, target, 1);
data.copy_from_slice(&[ data.copy_from_slice(&[
(word >> 0) as u8, (word >> 0) as u8,
@ -212,7 +212,7 @@ pub extern fn dma_record_output_wide(target: i32, words: CSlice<i32>) {
assert!(words.len() <= 16); // enforce the hardware limit assert!(words.len() <= 16); // enforce the hardware limit
unsafe { unsafe {
let timestamp = csr::rtio::now_read() as i64; let timestamp = rtio::now_mu();
let mut data = dma_record_output_prepare(timestamp, target, words.len()); let mut data = dma_record_output_prepare(timestamp, target, words.len());
for word in words.as_ref().iter() { for word in words.as_ref().iter() {
data[..4].copy_from_slice(&[ data[..4].copy_from_slice(&[