From 7d8268adf233bd297a5bcbf08b96a591e97bd75d Mon Sep 17 00:00:00 2001 From: mwojcik Date: Wed, 28 Feb 2024 14:15:50 +0800 Subject: [PATCH] moninj: hold aux mutex for inject for extra time this should prevent gateware errors on satellites --- src/runtime/src/moninj.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/runtime/src/moninj.rs b/src/runtime/src/moninj.rs index 5b13606..a6b9bbe 100644 --- a/src/runtime/src/moninj.rs +++ b/src/runtime/src/moninj.rs @@ -61,6 +61,7 @@ mod remote_moninj { use libboard_artiq::drtioaux_async; use crate::rtio_mgt::drtio; use log::error; + use libasync::delay; pub async fn read_probe(aux_mutex: &Rc>, timer: GlobalTimer, linkno: u8, destination: u8, channel: i32, probe: i8) -> i64 { let reply = drtio::aux_transact(aux_mutex, linkno, &drtioaux_async::Packet::MonitorRequest { @@ -77,7 +78,7 @@ mod remote_moninj { 0 } - pub async fn inject(aux_mutex: &Rc>, _timer: GlobalTimer, linkno: u8, destination: u8, channel: i32, overrd: i8, value: i8) { + pub async fn inject(aux_mutex: &Rc>, timer: GlobalTimer, linkno: u8, destination: u8, channel: i32, overrd: i8, value: i8) { let _lock = aux_mutex.lock(); drtioaux_async::send(linkno, &drtioaux_async::Packet::InjectionRequest { destination: destination, @@ -85,6 +86,9 @@ mod remote_moninj { overrd: overrd as _, value: value as _ }).await.unwrap(); + // give time for the satellite to process the request before releasing mutex + let mut countdown = timer.countdown(); + delay(&mut countdown, Milliseconds(10)).await; } pub async fn read_injection_status(aux_mutex: &Rc>, timer: GlobalTimer, linkno: u8, destination: u8, channel: i32, overrd: i8) -> i8 {