@@ -52,8 +52,6 @@ unsafe impl Sync for Buffers {}
52
52
/// USB device implementation.
53
53
pub struct Usbd {
54
54
periph : Mutex < USBD > ,
55
- // argument passed to `UsbDeviceBuilder.max_packet_size_0`
56
- max_packet_size_0 : u16 ,
57
55
unalloc_buffers : & ' static mut [ u8 ] ,
58
56
bufs : Buffers ,
59
57
used_in : u8 ,
@@ -82,7 +80,6 @@ impl Usbd {
82
80
pub fn new_alloc ( periph : USBD , endpoint_buffers : & ' static mut [ u8 ] ) -> UsbBusAllocator < Self > {
83
81
UsbBusAllocator :: new ( Self {
84
82
periph : Mutex :: new ( periph) ,
85
- max_packet_size_0 : 0 ,
86
83
unalloc_buffers : endpoint_buffers,
87
84
bufs : Buffers :: new ( ) ,
88
85
used_in : 0 ,
@@ -204,11 +201,6 @@ impl UsbBus for Usbd {
204
201
205
202
// Endpoint directions are allocated individually.
206
203
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
-
212
204
let buf = self . alloc_ep_buf ( ep_type, max_packet_size) ?;
213
205
214
206
if false {
@@ -440,21 +432,6 @@ impl UsbBus for Usbd {
440
432
epin[ i] . ptr . write ( |w| w. bits ( self . bufs . in_bufs [ i] as u32 ) ) ;
441
433
}
442
434
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
-
458
435
// Kick off device -> host transmission. This starts DMA, so a compiler fence is needed.
459
436
dma_start ( ) ;
460
437
regs. tasks_startepin [ i] . write ( |w| w. tasks_startepin ( ) . set_bit ( ) ) ;
0 commit comments