File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ impl<USB: UsbPeripheral> UsbBus<USB> {
108108 }
109109 }
110110
111- fn deconfigure_all ( & self , cs : & CriticalSection ) {
111+ fn deconfigure_all ( & self , cs : & CriticalSection , core_id : u32 ) {
112112 let regs = self . regs . borrow ( cs) ;
113113
114114 // disable interrupts
@@ -122,7 +122,7 @@ impl<USB: UsbPeripheral> UsbBus<USB> {
122122
123123 for ep in & self . allocator . endpoints_out {
124124 if let Some ( ep) = ep {
125- ep. deconfigure ( cs) ;
125+ ep. deconfigure ( cs, core_id ) ;
126126 }
127127 }
128128 }
@@ -586,7 +586,7 @@ impl<USB: UsbPeripheral> usb_device::bus::UsbBus for UsbBus<USB> {
586586 if reset != 0 {
587587 write_reg ! ( otg_global, regs. global( ) , GINTSTS , USBRST : 1 ) ;
588588
589- self . deconfigure_all ( cs) ;
589+ self . deconfigure_all ( cs, core_id ) ;
590590
591591 // Flush RX
592592 modify_reg ! ( otg_global, regs. global( ) , GRSTCTL , RXFFLSH : 1 ) ;
Original file line number Diff line number Diff line change @@ -189,15 +189,18 @@ impl EndpointOut {
189189 }
190190 }
191191
192- pub fn deconfigure ( & self , _cs : & CriticalSection ) {
192+ pub fn deconfigure ( & self , _cs : & CriticalSection , core_id : u32 ) {
193193 let regs = self . usb . endpoint_out ( self . index ( ) as usize ) ;
194194
195- // deactivating endpoint
196- modify_reg ! ( endpoint_out, regs, DOEPCTL , USBAEP : 0 ) ;
195+ // GD32VF103 doesn't support endpoint deactivation after reset, so skip this.
196+ if core_id > 0x0000_1000 {
197+ // deactivating endpoint
198+ modify_reg ! ( endpoint_out, regs, DOEPCTL , USBAEP : 0 ) ;
197199
198- // disabling endpoint
199- if read_reg ! ( endpoint_out, regs, DOEPCTL , EPENA ) != 0 && self . index ( ) != 0 {
200- modify_reg ! ( endpoint_out, regs, DOEPCTL , EPDIS : 1 )
200+ // disabling endpoint
201+ if read_reg ! ( endpoint_out, regs, DOEPCTL , EPENA ) != 0 && self . index ( ) != 0 {
202+ modify_reg ! ( endpoint_out, regs, DOEPCTL , EPDIS : 1 )
203+ }
201204 }
202205
203206 // clean EP interrupts
You can’t perform that action at this time.
0 commit comments