forked from M-Labs/artiq
1
0
Fork 0

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.
This commit is contained in:
whitequark 2017-11-03 15:56:13 +00:00
parent 2404a0d8c8
commit ad8fcb8b86
3 changed files with 16 additions and 20 deletions

View File

@ -2,7 +2,7 @@ use std::io;
use kernel_proto as kern; use kernel_proto as kern;
use sched::Io; use sched::Io;
use session::{kern_acknowledge, kern_send}; use session::{kern_acknowledge, kern_send};
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
use rtio_mgt; use rtio_mgt;
#[cfg(has_drtio)] #[cfg(has_drtio)]
@ -318,35 +318,35 @@ mod spi {
pub fn process_kern_hwreq(io: &Io, request: &kern::Message) -> io::Result<bool> { pub fn process_kern_hwreq(io: &Io, request: &kern::Message) -> io::Result<bool> {
match request { match request {
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
&kern::RtioInitRequest => { &kern::RtioInitRequest => {
info!("resetting RTIO"); info!("resetting RTIO");
rtio_mgt::init_core(); rtio_mgt::init_core();
kern_acknowledge() kern_acknowledge()
} }
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
&kern::DrtioChannelStateRequest { channel } => { &kern::DrtioChannelStateRequest { channel } => {
let (fifo_space, last_timestamp) = rtio_mgt::drtio_dbg::get_channel_state(channel); let (fifo_space, last_timestamp) = rtio_mgt::drtio_dbg::get_channel_state(channel);
kern_send(io, &kern::DrtioChannelStateReply { fifo_space: fifo_space, kern_send(io, &kern::DrtioChannelStateReply { fifo_space: fifo_space,
last_timestamp: last_timestamp }) last_timestamp: last_timestamp })
} }
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
&kern::DrtioResetChannelStateRequest { channel } => { &kern::DrtioResetChannelStateRequest { channel } => {
rtio_mgt::drtio_dbg::reset_channel_state(channel); rtio_mgt::drtio_dbg::reset_channel_state(channel);
kern_acknowledge() kern_acknowledge()
} }
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
&kern::DrtioGetFifoSpaceRequest { channel } => { &kern::DrtioGetFifoSpaceRequest { channel } => {
rtio_mgt::drtio_dbg::get_fifo_space(channel); rtio_mgt::drtio_dbg::get_fifo_space(channel);
kern_acknowledge() kern_acknowledge()
} }
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
&kern::DrtioPacketCountRequest { linkno } => { &kern::DrtioPacketCountRequest { linkno } => {
let (tx_cnt, rx_cnt) = rtio_mgt::drtio_dbg::get_packet_counts(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 }) kern_send(io, &kern::DrtioPacketCountReply { tx_cnt: tx_cnt, rx_cnt: rx_cnt })
} }
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
&kern::DrtioFifoSpaceReqCountRequest { linkno } => { &kern::DrtioFifoSpaceReqCountRequest { linkno } => {
let cnt = rtio_mgt::drtio_dbg::get_fifo_space_req_count(linkno); let cnt = rtio_mgt::drtio_dbg::get_fifo_space_req_count(linkno);
kern_send(io, &kern::DrtioFifoSpaceReqCountReply { cnt: cnt }) kern_send(io, &kern::DrtioFifoSpaceReqCountReply { cnt: cnt })

View File

@ -37,7 +37,7 @@ macro_rules! borrow_mut {
mod config; mod config;
mod ethmac; mod ethmac;
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
mod rtio_mgt; mod rtio_mgt;
mod urc; mod urc;
@ -124,7 +124,7 @@ fn startup() {
let mut scheduler = sched::Scheduler::new(); let mut scheduler = sched::Scheduler::new();
let io = scheduler.io(); let io = scheduler.io();
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
rtio_mgt::startup(&io); rtio_mgt::startup(&io);
io.spawn(4096, mgmt::thread); io.spawn(4096, mgmt::thread);
io.spawn(16384, session::thread); io.spawn(16384, session::thread);

View File

@ -10,11 +10,10 @@ use sched::{ThreadHandle, Io};
use sched::{TcpListener, TcpStream}; use sched::{TcpListener, TcpStream};
use board; use board;
use {config, mailbox, rpc_queue, kernel}; use {config, mailbox, rpc_queue, kernel};
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
use rtio_mgt; use rtio_mgt;
use rtio_dma::Manager as DmaManager; use rtio_dma::Manager as DmaManager;
use cache::Cache; use cache::Cache;
#[cfg(has_rtio)]
use kern_hwreq; use kern_hwreq;
use rpc_proto as rpc; 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") 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) { if rtio_mgt::crg::switch_clock(clk) {
host_write(stream, host::Reply::ClockSwitchCompleted) 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) 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); 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 { match request {
@ -556,7 +552,7 @@ fn host_kernel_worker(io: &Io,
return Err(io_error("watchdog expired")) return Err(io_error("watchdog expired"))
} }
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
{ {
if !rtio_mgt::crg::check() { if !rtio_mgt::crg::check() {
host_write(stream, host::Reply::ClockFailure)?; host_write(stream, host::Reply::ClockFailure)?;
@ -601,7 +597,7 @@ fn flash_kernel_worker(io: &Io,
return Err(io_error("watchdog expired")) return Err(io_error("watchdog expired"))
} }
#[cfg(has_rtio)] #[cfg(has_rtio_core)]
{ {
if !rtio_mgt::crg::check() { if !rtio_mgt::crg::check() {
return Err(io_error("RTIO clock failure")) return Err(io_error("RTIO clock failure"))