File tree 2 files changed +12
-9
lines changed
2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ impl<USB: UsbPeripheral> UsbBus<USB> {
111
111
}
112
112
}
113
113
114
- fn deconfigure_all ( & self , cs : CriticalSection < ' _ > ) {
114
+ fn deconfigure_all ( & self , cs : & CriticalSection < ' _ > , core_id : u32 ) {
115
115
let regs = self . regs . borrow ( cs) ;
116
116
117
117
// disable interrupts
@@ -125,7 +125,7 @@ impl<USB: UsbPeripheral> UsbBus<USB> {
125
125
126
126
for ep in & self . allocator . endpoints_out {
127
127
if let Some ( ep) = ep {
128
- ep. deconfigure ( cs) ;
128
+ ep. deconfigure ( cs, core_id ) ;
129
129
}
130
130
}
131
131
}
@@ -605,7 +605,7 @@ impl<USB: UsbPeripheral> usb_device::bus::UsbBus for UsbBus<USB> {
605
605
if reset != 0 {
606
606
write_reg ! ( otg_global, regs. global( ) , GINTSTS , USBRST : 1 ) ;
607
607
608
- self . deconfigure_all ( cs) ;
608
+ self . deconfigure_all ( cs, core_id ) ;
609
609
610
610
// Flush RX
611
611
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 {
189
189
}
190
190
}
191
191
192
- pub fn deconfigure ( & self , _cs : CriticalSection < ' _ > ) {
192
+ pub fn deconfigure ( & self , _cs : & CriticalSection < ' _ > , core_id : u32 ) {
193
193
let regs = self . usb . endpoint_out ( self . index ( ) as usize ) ;
194
194
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 ) ;
197
199
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
+ }
201
204
}
202
205
203
206
// clean EP interrupts
You can’t perform that action at this time.
0 commit comments