mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
fix plug/unplug not ready error
This commit is contained in:
parent
5dae83d404
commit
e4d230f42e
1 changed files with 13 additions and 6 deletions
|
|
@ -2229,7 +2229,7 @@ pub struct CorigineWrapper {
|
||||||
pub hw: Arc<Mutex<CorigineUsb>>,
|
pub hw: Arc<Mutex<CorigineUsb>>,
|
||||||
/// Tuple is (type of endpoint, max packet size)
|
/// Tuple is (type of endpoint, max packet size)
|
||||||
pub ep_meta: [Option<(EpType, usize)>; CRG_EP_NUM],
|
pub ep_meta: [Option<(EpType, usize)>; CRG_EP_NUM],
|
||||||
pub ep_out_ready: Box<[AtomicBool]>,
|
pub ep_out_ready: Box<[Arc<AtomicBool>]>,
|
||||||
pub address_is_set: Arc<AtomicBool>,
|
pub address_is_set: Arc<AtomicBool>,
|
||||||
pub event: Option<CrgEvent>,
|
pub event: Option<CrgEvent>,
|
||||||
}
|
}
|
||||||
|
|
@ -2240,7 +2240,7 @@ impl CorigineWrapper {
|
||||||
hw: Arc::new(Mutex::new(obj)),
|
hw: Arc::new(Mutex::new(obj)),
|
||||||
ep_meta: [None; CRG_EP_NUM],
|
ep_meta: [None; CRG_EP_NUM],
|
||||||
ep_out_ready: (0..CRG_EP_NUM + 1)
|
ep_out_ready: (0..CRG_EP_NUM + 1)
|
||||||
.map(|_| AtomicBool::new(false))
|
.map(|_| Arc::new(AtomicBool::new(false)))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.into_boxed_slice(),
|
.into_boxed_slice(),
|
||||||
event: None,
|
event: None,
|
||||||
|
|
@ -2253,10 +2253,7 @@ impl CorigineWrapper {
|
||||||
let mut c = Self {
|
let mut c = Self {
|
||||||
hw: self.hw.clone(),
|
hw: self.hw.clone(),
|
||||||
ep_meta: [None; CRG_EP_NUM],
|
ep_meta: [None; CRG_EP_NUM],
|
||||||
ep_out_ready: (0..CRG_EP_NUM + 1)
|
ep_out_ready: self.ep_out_ready.clone(),
|
||||||
.map(|_| AtomicBool::new(false))
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.into_boxed_slice(),
|
|
||||||
event: None,
|
event: None,
|
||||||
address_is_set: self.address_is_set.clone(),
|
address_is_set: self.address_is_set.clone(),
|
||||||
};
|
};
|
||||||
|
|
@ -2599,6 +2596,16 @@ impl UsbBus for CorigineWrapper {
|
||||||
let pending_ep = self.core().pending_ep(ep_addr.index(), CRG_OUT);
|
let pending_ep = self.core().pending_ep(ep_addr.index(), CRG_OUT);
|
||||||
#[cfg(feature = "verbose-debug")]
|
#[cfg(feature = "verbose-debug")]
|
||||||
crate::println!(" ******** READ {} pending {:?}", ep_addr.index(), pending_ep);
|
crate::println!(" ******** READ {} pending {:?}", ep_addr.index(), pending_ep);
|
||||||
|
#[cfg(feature = "verbose-debug")]
|
||||||
|
{
|
||||||
|
let mut readies: usize = 0;
|
||||||
|
for (i, epr) in self.ep_out_ready.iter().enumerate() {
|
||||||
|
if epr.load(Ordering::SeqCst) {
|
||||||
|
readies |= 1 << i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
crate::println!(" readies: {:b}", readies);
|
||||||
|
}
|
||||||
let ret = if let Some(pending_ep) = pending_ep {
|
let ret = if let Some(pending_ep) = pending_ep {
|
||||||
if pending_ep as usize == ep_addr.index() {
|
if pending_ep as usize == ep_addr.index() {
|
||||||
let app_ptr =
|
let app_ptr =
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue