added usb event to not wait for the next frame (#1733)

This commit is contained in:
Bernd Herzog
2024-01-07 14:09:22 +01:00
committed by GitHub
parent 23e6295dd2
commit 9d22711368
4 changed files with 22 additions and 2 deletions

View File

@@ -23,10 +23,20 @@
#include "usb_serial_endpoints.h"
#include "usb_serial_event.hpp"
uint32_t EVT_MASK_USB = EVENT_MASK(8);
extern void usb0_isr(void);
static Thread* thread_usb_event = NULL;
CH_IRQ_HANDLER(USB0_IRQHandler) {
CH_IRQ_PROLOGUE();
usb0_isr();
chSysLockFromIsr();
chEvtSignalI(thread_usb_event, EVT_MASK_USB);
chSysUnlockFromIsr();
CH_IRQ_EPILOGUE();
}
@@ -46,6 +56,7 @@ uint32_t __strex(uint32_t val, volatile uint32_t* addr) {
void nvic_enable_irq(uint8_t irqn) {
NVIC_ISER(irqn / 32) = (1 << (irqn % 32));
thread_usb_event = chThdSelf();
}
void usb_configuration_changed(usb_device_t* const device) {