forked from M-Labs/artiq
1
0
Fork 0

runtime: fix DMA recording after now-pinning

This commit is contained in:
Sebastien Bourdeauducq 2018-11-10 14:14:55 +08:00
parent 1f7858b80b
commit 84a6b3d09b
1 changed files with 6 additions and 4 deletions

View File

@ -20,6 +20,8 @@ use dyld::Library;
use board_artiq::{mailbox, rpc_queue}; use board_artiq::{mailbox, rpc_queue};
use proto_artiq::{kernel_proto, rpc_proto}; use proto_artiq::{kernel_proto, rpc_proto};
use kernel_proto::*; use kernel_proto::*;
#[cfg(has_rtio_dma)]
use board_misoc::csr;
fn send(request: &Message) { fn send(request: &Message) {
unsafe { mailbox::send(request as *const _ as usize) } unsafe { mailbox::send(request as *const _ as usize) }
@ -335,8 +337,9 @@ unsafe fn dma_record_output_prepare(timestamp: i64, target: i32,
} }
#[unwind(aborts)] #[unwind(aborts)]
extern fn dma_record_output(timestamp: i64, target: i32, word: i32) { extern fn dma_record_output(target: i32, word: i32) {
unsafe { unsafe {
let timestamp = *(csr::rtio::NOW_HI_ADDR as *const i64);
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,
@ -348,10 +351,11 @@ extern fn dma_record_output(timestamp: i64, target: i32, word: i32) {
} }
#[unwind(aborts)] #[unwind(aborts)]
extern fn dma_record_output_wide(timestamp: i64, target: i32, words: CSlice<i32>) { 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_HI_ADDR as *const i64);
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(&[
@ -404,8 +408,6 @@ extern fn dma_playback(timestamp: i64, ptr: i32) {
assert!(ptr % 64 == 0); assert!(ptr % 64 == 0);
unsafe { unsafe {
use board_misoc::csr;
csr::rtio_dma::base_address_write(ptr as u64); csr::rtio_dma::base_address_write(ptr as u64);
csr::rtio_dma::time_offset_write(timestamp as u64); csr::rtio_dma::time_offset_write(timestamp as u64);