1
0
forked from M-Labs/artiq

satman: replace forward with send for InjectionRequest

This commit is contained in:
Simon Renblad 2024-11-26 11:23:09 +08:00 committed by Sébastien Bourdeauducq
parent 46c3616a38
commit 504bb5116d
2 changed files with 18 additions and 4 deletions

View File

@ -215,7 +215,21 @@ fn process_aux_packet(_repeaters: &mut [repeater::Repeater],
drtioaux::send(0, &reply) drtioaux::send(0, &reply)
}, },
drtioaux::Packet::InjectionRequest { destination: _destination, channel, overrd, value } => { drtioaux::Packet::InjectionRequest { destination: _destination, channel, overrd, value } => {
forward!(_routing_table, _destination, *_rank, _repeaters, &packet); #[cfg(has_drtio_routing)]
{
let hop = _routing_table.0[_destination as usize][*_rank as usize];
if hop != 0 {
let repno = (hop - 1) as usize;
if repno < _repeaters.len() {
if _repeaters[repno].state != repeater::RepeaterState::Up {
return Err(drtioaux::Error::LinkDown);
}
return drtioaux::send(_repeaters[repno].auxno, &packet);
} else {
return Err(drtioaux::Error::RoutingError);
}
}
}
#[cfg(has_rtio_moninj)] #[cfg(has_rtio_moninj)]
unsafe { unsafe {
csr::rtio_moninj::inj_chan_sel_write(channel as _); csr::rtio_moninj::inj_chan_sel_write(channel as _);

View File

@ -12,7 +12,7 @@ fn rep_link_rx_up(repno: u8) -> bool {
#[cfg(has_drtio_routing)] #[cfg(has_drtio_routing)]
#[derive(Clone, Copy, PartialEq)] #[derive(Clone, Copy, PartialEq)]
enum RepeaterState { pub enum RepeaterState {
Down, Down,
SendPing { ping_count: u16 }, SendPing { ping_count: u16 },
WaitPingReply { ping_count: u16, timeout: u64 }, WaitPingReply { ping_count: u16, timeout: u64 },
@ -29,8 +29,8 @@ impl Default for RepeaterState {
#[derive(Clone, Copy, Default)] #[derive(Clone, Copy, Default)]
pub struct Repeater { pub struct Repeater {
repno: u8, repno: u8,
auxno: u8, pub auxno: u8,
state: RepeaterState pub state: RepeaterState
} }
#[cfg(has_drtio_routing)] #[cfg(has_drtio_routing)]