@@ -341,69 +341,6 @@ impl<B: UsbBus> UsbClass<B> for SimpleStereoOutput<'_, B> {
341
341
}
342
342
343
343
fn poll ( & mut self ) {
344
- // The synopsys crate (and usb-device above that) doesn't support
345
- // reporting incomplete isochronous IN transfers. We've got to trap them
346
- // ourselves and follow the procedure from the reference manual to reset
347
- // the endpoint. Once that's done, we can immediately re-attempt to
348
- // transmit.
349
- //
350
- // Tokens Interrupts Action
351
- //
352
- // SOF
353
- // ...
354
- // IN 1
355
- // EP1 TXFE
356
- // ...
357
- // EOPF &
358
- // IISOIXFR Disable & reset endpoint;
359
- // Fill EP1 TX FIFO (write to endpoint)
360
- // ...
361
- // SOF
362
- // ...
363
- // IN Core transmits from TX FIFO
364
- // XFRC Fill EP1 TX FIFO (write to endpoint)
365
- // ...
366
- // SOF
367
- // ...
368
- // IN Core transmits from TX FIFO
369
- // XFRC Fill EP1 TX FIFO (write to endpoint)
370
- // ...
371
- //
372
- let otg_device = unsafe { & * pac:: OTG_FS_DEVICE :: ptr ( ) } ;
373
- let otg_global = unsafe { & * pac:: OTG_FS_GLOBAL :: ptr ( ) } ;
374
- if otg_global. gintsts . read ( ) . iisoixfr ( ) . bit_is_set ( ) {
375
- defmt:: warn!( "GINTSTS: {:b}" , otg_global. gintsts. read( ) . bits( ) ) ;
376
- defmt:: warn!( "DIEPINT0: {:b}" , otg_device. diepint0. read( ) . bits( ) ) ;
377
- defmt:: warn!( "DIEPINT1: {:b}" , otg_device. diepint1. read( ) . bits( ) ) ;
378
- otg_global. gintsts . write ( |w| w. iisoixfr ( ) . set_bit ( ) ) ;
379
-
380
- // TODO OTG FS DIEPINTx is meant to have NAK at bit 13
381
- //if otg_device.diepint1.read().nak().bit_is_set() {
382
- if otg_device. diepint1 . read ( ) . bits ( ) . bitand ( 1 << 13 ) > 0 {
383
- // Set the endpoint to NAK mode
384
- otg_device. diepctl1 . modify ( |_, w| w. snak ( ) . set_bit ( ) ) ;
385
- while otg_device. diepint1 . read ( ) . inepne ( ) . bit_is_clear ( ) { }
386
-
387
- // Disable the endpoint
388
- otg_device. diepctl1 . modify ( |_, w| w
389
- . snak ( ) . set_bit ( )
390
- . epdis ( ) . set_bit ( )
391
- ) ;
392
- while otg_device. diepint1 . read ( ) . epdisd ( ) . bit_is_clear ( ) { }
393
- otg_device. diepint1 . modify ( |_, w| w. epdisd ( ) . set_bit ( ) ) ;
394
- assert ! ( otg_device. diepctl1. read( ) . epena( ) . bit_is_clear( ) ) ;
395
- assert ! ( otg_device. diepctl1. read( ) . epdis( ) . bit_is_clear( ) ) ;
396
-
397
- // Flush the TX FIFO
398
- otg_global. grstctl . modify ( |_, w| unsafe {
399
- w. txfflsh ( ) . set_bit ( ) . txfnum ( ) . bits ( 0x01 )
400
- } ) ;
401
- while otg_global. grstctl . read ( ) . txfflsh ( ) . bit_is_set ( ) { }
402
-
403
- // We're ready to retry sending the feedback packet again
404
- self . audio_feedback_needed = true ;
405
- }
406
- }
407
344
}
408
345
409
346
fn control_out ( & mut self , xfer : ControlOut < B > ) {
@@ -456,9 +393,9 @@ impl<B: UsbBus> UsbClass<B> for SimpleStereoOutput<'_, B> {
456
393
self . mute = xfer. data ( ) [ 0 ] != 0 ;
457
394
return xfer. accept ( ) . unwrap ( ) ;
458
395
} else if cs_request. control_selector == FU_VOLUME_CONTROL {
459
- defmt:: info!( "usb audio :: Set Volume = {:?}" , xfer. data( ) ) ;
460
396
let data = xfer. data ( ) ;
461
397
self . volume = i16:: from_le_bytes ( [ data[ 0 ] , data[ 1 ] ] ) ;
398
+ defmt:: info!( "usb audio :: Set Volume = {:?}" , self . volume) ;
462
399
return xfer. accept ( ) . unwrap ( ) ;
463
400
}
464
401
}
0 commit comments