* few cleanups
* libcortexa9 mutex behavior understood * io.until replaced with spinlock
This commit is contained in:
parent
ff77204d37
commit
414cfd2fa7
@ -12,27 +12,19 @@ extern crate libconfig;
|
||||
extern crate libcortex_a9;
|
||||
extern crate log_buffer;
|
||||
|
||||
|
||||
// has csr; taken from runtime main
|
||||
#[path = "../../../build/pl.rs"]
|
||||
pub mod pl;
|
||||
|
||||
pub mod drtioaux_proto;
|
||||
|
||||
pub mod drtio_routing;
|
||||
pub mod logger;
|
||||
#[cfg(has_si5324)]
|
||||
pub mod si5324;
|
||||
#[cfg(has_drtio)]
|
||||
pub mod drtioaux;
|
||||
// for now, memory map is only needed for DRTIO firmware
|
||||
#[cfg(has_drtio)]
|
||||
#[path = "../../../build/mem.rs"]
|
||||
pub mod mem;
|
||||
|
||||
pub mod drtio_routing;
|
||||
|
||||
pub mod logger;
|
||||
|
||||
#[cfg(has_si5324)]
|
||||
pub mod si5324;
|
||||
|
||||
use core::{cmp, str};
|
||||
use libboard_zynq::slcr;
|
||||
use libregister::RegisterW;
|
||||
|
@ -21,15 +21,13 @@ use void::Void;
|
||||
use embedded_hal::blocking::delay::DelayMs;
|
||||
use libconfig::Config;
|
||||
use libcortex_a9::l2c::enable_l2_cache;
|
||||
use libboard_artiq::{logger, identifier_read, init_gateware};
|
||||
use libboard_artiq::{logger, identifier_read, init_gateware, pl};
|
||||
#[cfg(has_si5324)]
|
||||
use libboard_artiq::si5324;
|
||||
|
||||
mod proto_async;
|
||||
mod comms;
|
||||
mod rpc;
|
||||
#[path = "../../../build/pl.rs"]
|
||||
mod pl;
|
||||
#[cfg(ki_impl = "csr")]
|
||||
#[path = "rtio_csr.rs"]
|
||||
mod rtio;
|
||||
|
@ -61,10 +61,10 @@ enum DeviceMessage {
|
||||
mod remote_moninj {
|
||||
use drtioaux;
|
||||
use rtio_mgt::drtio;
|
||||
use sched::{Io, Mutex};
|
||||
use libcortexa9::Mutex;
|
||||
|
||||
pub fn read_probe(io: &Io, aux_mutex: &Mutex, linkno: u8, destination: u8, channel: u16, probe: u8) -> u32 {
|
||||
let reply = drtio::aux_transact(io, aux_mutex, linkno, &drtioaux::Packet::MonitorRequest {
|
||||
pub fn read_probe( aux_mutex: &Mutex, linkno: u8, destination: u8, channel: u16, probe: u8) -> u32 {
|
||||
let reply = drtio::aux_transact(aux_mutex, linkno, &drtioaux::Packet::MonitorRequest {
|
||||
destination: destination,
|
||||
channel: channel,
|
||||
probe: probe
|
||||
@ -77,8 +77,8 @@ mod remote_moninj {
|
||||
0
|
||||
}
|
||||
|
||||
pub fn inject(io: &Io, aux_mutex: &Mutex, linkno: u8, destination: u8, channel: u16, overrd: u8, value: u8) {
|
||||
let _lock = aux_mutex.lock(io).unwrap();
|
||||
pub fn inject(aux_mutex: &Mutex, linkno: u8, destination: u8, channel: u16, overrd: u8, value: u8) {
|
||||
let _lock = aux_mutex.lock();
|
||||
drtioaux::send(linkno, &drtioaux::Packet::InjectionRequest {
|
||||
destination: destination,
|
||||
channel: channel,
|
||||
@ -87,8 +87,8 @@ mod remote_moninj {
|
||||
}).unwrap();
|
||||
}
|
||||
|
||||
pub fn read_injection_status(io: &Io, aux_mutex: &Mutex, linkno: u8, destination: u8, channel: u16, overrd: u8) -> u8 {
|
||||
let reply = drtio::aux_transact(io, aux_mutex, linkno, &drtioaux::Packet::InjectionStatusRequest {
|
||||
pub fn read_injection_status(aux_mutex: &Mutex, linkno: u8, destination: u8, channel: u16, overrd: u8) -> u8 {
|
||||
let reply = drtio::aux_transact(aux_mutex, linkno, &drtioaux::Packet::InjectionStatusRequest {
|
||||
destination: destination,
|
||||
channel: channel,
|
||||
overrd: overrd
|
||||
|
@ -50,7 +50,7 @@ pub mod drtio {
|
||||
|
||||
pub fn aux_transact(aux_mutex: &Mutex, linkno: u8, request: &drtioaux::Packet,
|
||||
timer: GlobalTimer) -> Result<drtioaux::Packet, &'static str> {
|
||||
let _lock = aux_mutex.lock().unwrap();
|
||||
let _lock = aux_mutex.lock();
|
||||
drtioaux::send(linkno, request).unwrap();
|
||||
recv_aux_timeout(io, linkno, 200, timer)
|
||||
}
|
||||
@ -83,7 +83,7 @@ pub mod drtio {
|
||||
}
|
||||
|
||||
fn sync_tsc(aux_mutex: &Mutex, linkno: u8, timer: GlobalTimer) -> Result<(), &'static str> {
|
||||
let _lock = aux_mutex.lock().unwrap();
|
||||
let _lock = aux_mutex.lock();
|
||||
|
||||
unsafe {
|
||||
(csr::DRTIO[linkno as usize].set_time_write)(1);
|
||||
@ -137,7 +137,7 @@ pub mod drtio {
|
||||
}
|
||||
|
||||
fn process_unsolicited_aux(aux_mutex: &Mutex, linkno: u8) {
|
||||
let _lock = aux_mutex.lock().unwrap();
|
||||
let _lock = aux_mutex.lock();
|
||||
match drtioaux::recv(linkno) {
|
||||
Ok(Some(packet)) => warn!("[LINK#{}] unsolicited aux packet: {:?}", linkno, packet),
|
||||
Ok(None) => (),
|
||||
@ -320,15 +320,16 @@ pub mod drtio {
|
||||
use super::*;
|
||||
|
||||
pub fn startup(_aux_mutex: &Mutex, _routing_table: &Urc<RefCell<drtio_routing::RoutingTable>>,
|
||||
_up_destinations: &Urc<RefCell<[bool; drtio_routing::DEST_COUNT]>>, timer:GlobalTimer) {}
|
||||
pub fn reset(_aux_mutex: &Mutex, timer: GlobalTimer) {}
|
||||
_up_destinations: &Urc<RefCell<[bool; drtio_routing::DEST_COUNT]>>, _timer:GlobalTimer) {}
|
||||
pub fn reset(_aux_mutex: &Mutex, _timer: GlobalTimer) {}
|
||||
}
|
||||
|
||||
// todo figure out what to do with these untils
|
||||
fn async_error_thread(io: Io) {
|
||||
fn async_error_thread() {
|
||||
loop {
|
||||
unsafe {
|
||||
io.until(|| csr::rtio_core::async_error_read() != 0).unwrap();
|
||||
// replaced io.until with spinlock
|
||||
while csr::rtio_core::async_error_read() != 0 {}
|
||||
|
||||
let errors = csr::rtio_core::async_error_read();
|
||||
if errors & 1 != 0 {
|
||||
error!("RTIO collision involving channel {}",
|
||||
|
Loading…
Reference in New Issue
Block a user