forked from M-Labs/nac3
rtio_mgt: use mutex's async_lock
This commit is contained in:
parent
596edb480c
commit
7a8f96dbd9
|
@ -52,7 +52,7 @@ pub mod drtio {
|
||||||
if !link_rx_up(linkno).await {
|
if !link_rx_up(linkno).await {
|
||||||
return Err("link went down");
|
return Err("link went down");
|
||||||
}
|
}
|
||||||
let _lock = aux_mutex.lock();
|
let _lock = aux_mutex.async_lock().await;
|
||||||
drtioaux_async::send(linkno, request).await.unwrap();
|
drtioaux_async::send(linkno, request).await.unwrap();
|
||||||
recv_aux_timeout(linkno, 200, timer).await
|
recv_aux_timeout(linkno, 200, timer).await
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ pub mod drtio {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn sync_tsc(aux_mutex: &Rc<Mutex<bool>>, linkno: u8, timer: GlobalTimer) -> Result<(), &'static str> {
|
async fn sync_tsc(aux_mutex: &Rc<Mutex<bool>>, linkno: u8, timer: GlobalTimer) -> Result<(), &'static str> {
|
||||||
let _lock = aux_mutex.lock();
|
let _lock = aux_mutex.async_lock().await;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
(csr::DRTIO[linkno as usize].set_time_write)(1);
|
(csr::DRTIO[linkno as usize].set_time_write)(1);
|
||||||
|
@ -145,7 +145,7 @@ pub mod drtio {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn process_unsolicited_aux(aux_mutex: &Rc<Mutex<bool>>, linkno: u8) {
|
async fn process_unsolicited_aux(aux_mutex: &Rc<Mutex<bool>>, linkno: u8) {
|
||||||
let _lock = aux_mutex.lock();
|
let _lock = aux_mutex.async_lock().await;
|
||||||
match drtioaux_async::recv(linkno).await {
|
match drtioaux_async::recv(linkno).await {
|
||||||
Ok(Some(packet)) => warn!("[LINK#{}] unsolicited aux packet: {:?}", linkno, packet),
|
Ok(Some(packet)) => warn!("[LINK#{}] unsolicited aux packet: {:?}", linkno, packet),
|
||||||
Ok(None) => (),
|
Ok(None) => (),
|
||||||
|
|
Loading…
Reference in New Issue