mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
expose append zero packet api and rename function to be generic
This commit is contained in:
parent
d2c534a3c8
commit
832d0205c2
1 changed files with 10 additions and 6 deletions
|
|
@ -1464,7 +1464,7 @@ impl CorigineUsb {
|
||||||
storage.copy_from_slice(hw_buf);
|
storage.copy_from_slice(hw_buf);
|
||||||
self.readout[ep_num as usize - 1] = Some(storage);
|
self.readout[ep_num as usize - 1] = Some(storage);
|
||||||
// re-enqueue the listener
|
// re-enqueue the listener
|
||||||
self.intr_xfer(
|
self.ep_xfer(
|
||||||
ep_num,
|
ep_num,
|
||||||
dir,
|
dir,
|
||||||
addr,
|
addr,
|
||||||
|
|
@ -1472,6 +1472,7 @@ impl CorigineUsb {
|
||||||
CRG_INT_TARGET,
|
CRG_INT_TARGET,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
ret = CrgEvent::Data(ep_num as u16, 0, 0);
|
ret = CrgEvent::Data(ep_num as u16, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1807,7 +1808,7 @@ impl CorigineUsb {
|
||||||
self.knock_doorbell(0);
|
self.knock_doorbell(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn intr_xfer(
|
pub fn ep_xfer(
|
||||||
&mut self,
|
&mut self,
|
||||||
ep_num: u8,
|
ep_num: u8,
|
||||||
dir: bool,
|
dir: bool,
|
||||||
|
|
@ -1816,6 +1817,7 @@ impl CorigineUsb {
|
||||||
intr_target: u32,
|
intr_target: u32,
|
||||||
no_intr: bool,
|
no_intr: bool,
|
||||||
no_knock: bool,
|
no_knock: bool,
|
||||||
|
append_zero_packet: bool,
|
||||||
) {
|
) {
|
||||||
let pei = 2 * ep_num as usize + if dir { 1 } else { 0 };
|
let pei = 2 * ep_num as usize + if dir { 1 } else { 0 };
|
||||||
let num_trb = if len != 0 {
|
let num_trb = if len != 0 {
|
||||||
|
|
@ -1828,7 +1830,7 @@ impl CorigineUsb {
|
||||||
unsafe { udc_ep.enq_pt.load(Ordering::SeqCst).as_mut().expect("couldn't deref pointer") };
|
unsafe { udc_ep.enq_pt.load(Ordering::SeqCst).as_mut().expect("couldn't deref pointer") };
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"intr_xfer() pei: {}, enq_pt: {:x}, buf_addr: {:x}, pcs: {}, len: {:x}",
|
"ep_xfer() pei: {}, enq_pt: {:x}, buf_addr: {:x}, pcs: {}, len: {:x}",
|
||||||
pei,
|
pei,
|
||||||
enq_pt as *mut TransferTrbS as usize,
|
enq_pt as *mut TransferTrbS as usize,
|
||||||
addr,
|
addr,
|
||||||
|
|
@ -1873,7 +1875,7 @@ impl CorigineUsb {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
false,
|
append_zero_packet,
|
||||||
intr_target,
|
intr_target,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -2230,7 +2232,7 @@ impl UsbBus for CorigineWrapper {
|
||||||
if dir == CRG_OUT {
|
if dir == CRG_OUT {
|
||||||
let addr = self.core().get_app_buf_ptr(index as u8, dir);
|
let addr = self.core().get_app_buf_ptr(index as u8, dir);
|
||||||
// TODO: how do we deal with bulk endpoints??
|
// TODO: how do we deal with bulk endpoints??
|
||||||
self.core().intr_xfer(
|
self.core().ep_xfer(
|
||||||
index as u8,
|
index as u8,
|
||||||
dir,
|
dir,
|
||||||
addr,
|
addr,
|
||||||
|
|
@ -2238,6 +2240,7 @@ impl UsbBus for CorigineWrapper {
|
||||||
CRG_INT_TARGET,
|
CRG_INT_TARGET,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2302,7 +2305,7 @@ impl UsbBus for CorigineWrapper {
|
||||||
let hw_buf = unsafe { core::slice::from_raw_parts_mut(addr as *mut u8, CRG_UDC_APP_BUF_LEN) };
|
let hw_buf = unsafe { core::slice::from_raw_parts_mut(addr as *mut u8, CRG_UDC_APP_BUF_LEN) };
|
||||||
assert!(buf.len() < CRG_UDC_APP_BUF_LEN, "write buffer size exceeded");
|
assert!(buf.len() < CRG_UDC_APP_BUF_LEN, "write buffer size exceeded");
|
||||||
hw_buf[..buf.len()].copy_from_slice(&buf);
|
hw_buf[..buf.len()].copy_from_slice(&buf);
|
||||||
self.core().intr_xfer(
|
self.core().ep_xfer(
|
||||||
ep_addr.index() as u8,
|
ep_addr.index() as u8,
|
||||||
CRG_IN,
|
CRG_IN,
|
||||||
addr,
|
addr,
|
||||||
|
|
@ -2310,6 +2313,7 @@ impl UsbBus for CorigineWrapper {
|
||||||
CRG_INT_TARGET,
|
CRG_INT_TARGET,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
Ok(buf.len())
|
Ok(buf.len())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue