aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/USB_CDC/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/USB_CDC/main.c')
-rw-r--r--testhal/STM32/USB_CDC/main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/testhal/STM32/USB_CDC/main.c b/testhal/STM32/USB_CDC/main.c
index 9868b00ab..49d744d5d 100644
--- a/testhal/STM32/USB_CDC/main.c
+++ b/testhal/STM32/USB_CDC/main.c
@@ -271,12 +271,14 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
case USB_EVENT_ADDRESS:
return;
case USB_EVENT_CONFIGURED:
- /* Enables the endpoints specified into the configuration.*/
- chSysLock();
+ /* Enables the endpoints specified into the configuration.
+ Note, this callback is invoked from an ISR so I-Class functions
+ must be used.*/
+ chSysLockFromIsr();
usbInitEndpointI(usbp, DATA_REQUEST_EP, &ep1config);
usbInitEndpointI(usbp, INTERRUPT_REQUEST_EP, &ep2config);
usbInitEndpointI(usbp, DATA_AVAILABLE_EP, &ep3config);
- chSysUnlock();
+ chSysUnlockFromIsr();
return;
case USB_EVENT_SUSPEND:
return;