allow toggling SED spread with flash config key
This commit is contained in:
parent
d0615bf965
commit
23857eef63
@ -560,7 +560,10 @@ class GenericSatellite(SoCCore):
|
||||
self.submodules.local_io = SyncRTIO(
|
||||
self.rtio_tsc, self.rtio_channels, lane_count=description["sed_lanes"]
|
||||
)
|
||||
self.comb += self.drtiosat.async_errors.eq(self.local_io.async_errors)
|
||||
self.comb += [
|
||||
self.drtiosat.async_errors.eq(self.local_io.async_errors),
|
||||
self.local_io.sed_spread_enable.eq(self.drtiosat.sed_spread_enable.storage)
|
||||
]
|
||||
|
||||
self.submodules.cri_con = rtio.CRIInterconnectShared(
|
||||
[self.drtiosat.cri, self.rtio_dma.cri, self.rtio.cri],
|
||||
|
@ -487,6 +487,10 @@ class _SatelliteBase(SoCCore):
|
||||
self.csr_devices.append("rtio_dma")
|
||||
|
||||
self.submodules.local_io = SyncRTIO(self.rtio_tsc, rtio_channels)
|
||||
self.comb += [
|
||||
self.drtiosat.async_errors.eq(self.local_io.async_errors),
|
||||
self.local_io.sed_spread_enable.eq(self.drtiosat.sed_spread_enable.storage)
|
||||
]
|
||||
self.submodules.cri_con = rtio.CRIInterconnectShared(
|
||||
[self.drtiosat.cri, self.rtio_dma.cri, self.rtio.cri],
|
||||
[self.local_io.cri] + self.drtio_cri,
|
||||
|
@ -771,7 +771,7 @@ pub fn main(timer: GlobalTimer, cfg: Config) {
|
||||
#[cfg(has_drtio_routing)]
|
||||
drtio_routing::interconnect_disable_all();
|
||||
|
||||
rtio_mgt::startup(&aux_mutex, &drtio_routing_table, &up_destinations, timer);
|
||||
rtio_mgt::startup(&aux_mutex, &drtio_routing_table, &up_destinations, &cfg, timer);
|
||||
ksupport::setup_device_map(&cfg);
|
||||
|
||||
analyzer::start(&aux_mutex, &drtio_routing_table, &up_destinations, timer);
|
||||
|
@ -3,7 +3,9 @@ use core::cell::RefCell;
|
||||
|
||||
use libboard_artiq::{drtio_routing, drtio_routing::RoutingTable, pl::csr};
|
||||
use libboard_zynq::timer::GlobalTimer;
|
||||
use libconfig::Config;
|
||||
use libcortex_a9::mutex::Mutex;
|
||||
use log::{info, warn};
|
||||
|
||||
#[cfg(has_drtio)]
|
||||
pub mod drtio {
|
||||
@ -898,12 +900,36 @@ pub mod drtio {
|
||||
pub fn reset(_aux_mutex: Rc<Mutex<bool>>, _routing_table: &RoutingTable, mut _timer: GlobalTimer) {}
|
||||
}
|
||||
|
||||
fn toggle_sed_spread(val: u8) {
|
||||
unsafe {
|
||||
csr::rtio_core::sed_spread_enable_write(val);
|
||||
}
|
||||
}
|
||||
|
||||
fn setup_sed_spread(cfg: &Config) {
|
||||
if let Ok(spread_enable) = cfg.read_str("sed_spread_enable") {
|
||||
match spread_enable.as_ref() {
|
||||
"1" => toggle_sed_spread(1),
|
||||
"0" => toggle_sed_spread(0),
|
||||
_ => {
|
||||
warn!("sed_spread_enable value not supported (only 1, 0 allowed), disabling by default");
|
||||
toggle_sed_spread(0)
|
||||
}
|
||||
};
|
||||
} else {
|
||||
info!("SED spreading disabled by default");
|
||||
toggle_sed_spread(0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn startup(
|
||||
aux_mutex: &Rc<Mutex<bool>>,
|
||||
routing_table: &Rc<RefCell<RoutingTable>>,
|
||||
up_destinations: &Rc<RefCell<[bool; drtio_routing::DEST_COUNT]>>,
|
||||
cfg: &Config,
|
||||
timer: GlobalTimer,
|
||||
) {
|
||||
setup_sed_spread(cfg);
|
||||
drtio::startup(aux_mutex, routing_table, up_destinations, timer);
|
||||
unsafe {
|
||||
csr::rtio_core::reset_phy_write(1);
|
||||
|
@ -12,6 +12,7 @@ extern crate io;
|
||||
extern crate ksupport;
|
||||
extern crate libboard_artiq;
|
||||
extern crate libboard_zynq;
|
||||
extern crate libconfig;
|
||||
extern crate libcortex_a9;
|
||||
extern crate libregister;
|
||||
extern crate libsupport_zynq;
|
||||
@ -38,6 +39,7 @@ use libboard_artiq::{drtio_routing, drtioaux,
|
||||
#[cfg(feature = "target_kasli_soc")]
|
||||
use libboard_zynq::error_led::ErrorLED;
|
||||
use libboard_zynq::{i2c::I2c, print, println, time::Milliseconds, timer::GlobalTimer};
|
||||
use libconfig::Config;
|
||||
use libcortex_a9::{l2c::enable_l2_cache, regs::MPIDR};
|
||||
use libregister::RegisterR;
|
||||
use libsupport_zynq::{exception_vectors, ram};
|
||||
@ -81,6 +83,12 @@ fn drtiosat_tsc_loaded() -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
fn toggle_sed_spread(val: u8) {
|
||||
unsafe {
|
||||
csr::drtiosat::sed_spread_enable_write(val);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(has_drtio_routing)]
|
||||
macro_rules! forward {
|
||||
($routing_table:expr, $destination:expr, $rank:expr, $repeaters:expr, $packet:expr, $timer:expr) => {{
|
||||
@ -920,6 +928,28 @@ pub extern "C" fn main_core0() -> i32 {
|
||||
#[cfg(has_si549)]
|
||||
si549::helper_setup(&mut timer, &SI549_SETTINGS).expect("cannot initialize helper Si549");
|
||||
|
||||
let cfg = match Config::new() {
|
||||
Ok(cfg) => cfg,
|
||||
Err(err) => {
|
||||
warn!("config initialization failed: {}", err);
|
||||
Config::new_dummy()
|
||||
}
|
||||
};
|
||||
|
||||
if let Ok(spread_enable) = cfg.read_str("sed_spread_enable") {
|
||||
match spread_enable.as_ref() {
|
||||
"1" => toggle_sed_spread(1),
|
||||
"0" => toggle_sed_spread(0),
|
||||
_ => {
|
||||
warn!("sed_spread_enable value not supported (only 1, 0 allowed), disabling by default");
|
||||
toggle_sed_spread(0)
|
||||
}
|
||||
};
|
||||
} else {
|
||||
info!("SED spreading disabled by default");
|
||||
toggle_sed_spread(0);
|
||||
}
|
||||
|
||||
#[cfg(has_drtio_routing)]
|
||||
let mut repeaters = [repeater::Repeater::default(); csr::DRTIOREP.len()];
|
||||
#[cfg(not(has_drtio_routing))]
|
||||
|
Loading…
Reference in New Issue
Block a user