From ad8fcb8b86bd1627b300cc8e1088e5c1ee3a6a11 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 3 Nov 2017 15:56:13 +0000 Subject: [PATCH] runtime: has_rtio -> has_rtio_core. has_rtio is the cfg for the kernel CPU, has_rtio_core is the one for the comms CPU. Also remove a few useless #[cfg]s. --- artiq/firmware/runtime/kern_hwreq.rs | 14 +++++++------- artiq/firmware/runtime/lib.rs | 4 ++-- artiq/firmware/runtime/session.rs | 18 +++++++----------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/artiq/firmware/runtime/kern_hwreq.rs b/artiq/firmware/runtime/kern_hwreq.rs index 76436f3fe..245fdaeab 100644 --- a/artiq/firmware/runtime/kern_hwreq.rs +++ b/artiq/firmware/runtime/kern_hwreq.rs @@ -2,7 +2,7 @@ use std::io; use kernel_proto as kern; use sched::Io; use session::{kern_acknowledge, kern_send}; -#[cfg(has_rtio)] +#[cfg(has_rtio_core)] use rtio_mgt; #[cfg(has_drtio)] @@ -318,35 +318,35 @@ mod spi { pub fn process_kern_hwreq(io: &Io, request: &kern::Message) -> io::Result { match request { - #[cfg(has_rtio)] + #[cfg(has_rtio_core)] &kern::RtioInitRequest => { info!("resetting RTIO"); rtio_mgt::init_core(); kern_acknowledge() } - #[cfg(has_rtio)] + #[cfg(has_rtio_core)] &kern::DrtioChannelStateRequest { channel } => { let (fifo_space, last_timestamp) = rtio_mgt::drtio_dbg::get_channel_state(channel); kern_send(io, &kern::DrtioChannelStateReply { fifo_space: fifo_space, last_timestamp: last_timestamp }) } - #[cfg(has_rtio)] + #[cfg(has_rtio_core)] &kern::DrtioResetChannelStateRequest { channel } => { rtio_mgt::drtio_dbg::reset_channel_state(channel); kern_acknowledge() } - #[cfg(has_rtio)] + #[cfg(has_rtio_core)] &kern::DrtioGetFifoSpaceRequest { channel } => { rtio_mgt::drtio_dbg::get_fifo_space(channel); kern_acknowledge() } - #[cfg(has_rtio)] + #[cfg(has_rtio_core)] &kern::DrtioPacketCountRequest { linkno } => { let (tx_cnt, rx_cnt) = rtio_mgt::drtio_dbg::get_packet_counts(linkno); kern_send(io, &kern::DrtioPacketCountReply { tx_cnt: tx_cnt, rx_cnt: rx_cnt }) } - #[cfg(has_rtio)] + #[cfg(has_rtio_core)] &kern::DrtioFifoSpaceReqCountRequest { linkno } => { let cnt = rtio_mgt::drtio_dbg::get_fifo_space_req_count(linkno); kern_send(io, &kern::DrtioFifoSpaceReqCountReply { cnt: cnt }) diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index efdf987fc..d66687f3a 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -37,7 +37,7 @@ macro_rules! borrow_mut { mod config; mod ethmac; -#[cfg(has_rtio)] +#[cfg(has_rtio_core)] mod rtio_mgt; mod urc; @@ -124,7 +124,7 @@ fn startup() { let mut scheduler = sched::Scheduler::new(); let io = scheduler.io(); - #[cfg(has_rtio)] + #[cfg(has_rtio_core)] rtio_mgt::startup(&io); io.spawn(4096, mgmt::thread); io.spawn(16384, session::thread); diff --git a/artiq/firmware/runtime/session.rs b/artiq/firmware/runtime/session.rs index a9e8578eb..263933765 100644 --- a/artiq/firmware/runtime/session.rs +++ b/artiq/firmware/runtime/session.rs @@ -10,11 +10,10 @@ use sched::{ThreadHandle, Io}; use sched::{TcpListener, TcpStream}; use board; use {config, mailbox, rpc_queue, kernel}; -#[cfg(has_rtio)] +#[cfg(has_rtio_core)] use rtio_mgt; use rtio_dma::Manager as DmaManager; use cache::Cache; -#[cfg(has_rtio)] use kern_hwreq; use rpc_proto as rpc; @@ -272,7 +271,7 @@ fn process_host_message(io: &Io, unexpected!("attempted to switch RTIO clock while a kernel was running") } - #[cfg(has_rtio)] + #[cfg(has_rtio_core)] { if rtio_mgt::crg::switch_clock(clk) { host_write(stream, host::Reply::ClockSwitchCompleted) @@ -281,7 +280,7 @@ fn process_host_message(io: &Io, } } - #[cfg(not(has_rtio))] + #[cfg(not(has_rtio_core))] host_write(stream, host::Reply::ClockSwitchFailed) } @@ -376,11 +375,8 @@ fn process_kern_message(io: &Io, mut stream: Option<&mut TcpStream>, kern_recv_dotrace(request); - #[cfg(has_rtio)] - { - if kern_hwreq::process_kern_hwreq(io, request)? { - return Ok(false) - } + if kern_hwreq::process_kern_hwreq(io, request)? { + return Ok(false) } match request { @@ -556,7 +552,7 @@ fn host_kernel_worker(io: &Io, return Err(io_error("watchdog expired")) } - #[cfg(has_rtio)] + #[cfg(has_rtio_core)] { if !rtio_mgt::crg::check() { host_write(stream, host::Reply::ClockFailure)?; @@ -601,7 +597,7 @@ fn flash_kernel_worker(io: &Io, return Err(io_error("watchdog expired")) } - #[cfg(has_rtio)] + #[cfg(has_rtio_core)] { if !rtio_mgt::crg::check() { return Err(io_error("RTIO clock failure"))