Skip to content

Commit 02f7e5d

Browse files
Revert "EP0: shoehorn status stage"
This reverts commit 51a2a0f.
1 parent 8a943f5 commit 02f7e5d

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

nrf-hal-common/src/usbd/mod.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ unsafe impl Sync for Buffers {}
5252
/// USB device implementation.
5353
pub struct Usbd {
5454
periph: Mutex<USBD>,
55-
// argument passed to `UsbDeviceBuilder.max_packet_size_0`
56-
max_packet_size_0: u16,
5755
unalloc_buffers: &'static mut [u8],
5856
bufs: Buffers,
5957
used_in: u8,
@@ -82,7 +80,6 @@ impl Usbd {
8280
pub fn new_alloc(periph: USBD, endpoint_buffers: &'static mut [u8]) -> UsbBusAllocator<Self> {
8381
UsbBusAllocator::new(Self {
8482
periph: Mutex::new(periph),
85-
max_packet_size_0: 0,
8683
unalloc_buffers: endpoint_buffers,
8784
bufs: Buffers::new(),
8885
used_in: 0,
@@ -204,11 +201,6 @@ impl UsbBus for Usbd {
204201

205202
// Endpoint directions are allocated individually.
206203

207-
// store user-supplied value
208-
if ep_addr.map(|addr| addr.index()) == Some(0) {
209-
self.max_packet_size_0 = max_packet_size;
210-
}
211-
212204
let buf = self.alloc_ep_buf(ep_type, max_packet_size)?;
213205

214206
if false {
@@ -440,21 +432,6 @@ impl UsbBus for Usbd {
440432
epin[i].ptr.write(|w| w.bits(self.bufs.in_bufs[i] as u32));
441433
}
442434

443-
if i == 0 {
444-
// EPIN0: a short packet (len < max_packet_size0) indicates the end of the data
445-
// stage and must be followed by us responding with an ACK token to an OUT token
446-
// sent from the host (AKA the status stage) -- `usb-device` provides no call back
447-
// for that so we'll trigger the status stage using a shortcut
448-
let is_short_packet = buf.len() < self.max_packet_size_0.into();
449-
regs.shorts.modify(|_, w| {
450-
if is_short_packet {
451-
w.ep0datadone_ep0status().set_bit()
452-
} else {
453-
w.ep0datadone_ep0status().clear_bit()
454-
}
455-
})
456-
}
457-
458435
// Kick off device -> host transmission. This starts DMA, so a compiler fence is needed.
459436
dma_start();
460437
regs.tasks_startepin[i].write(|w| w.tasks_startepin().set_bit());

0 commit comments

Comments
 (0)