summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2024-03-29 08:11:25 +0800
committersakumisu <[email protected]>2024-03-29 08:11:56 +0800
commita21947ff221bd133017204aa599de8aaf3ea65b1 (patch)
tree05caa18b713998ad707f5c55bc6bd5363da7eab7
parent078e21066cd7ff683846a069888360babc506b6a (diff)
fix timer start in isr
-rw-r--r--osal/usb_osal_freertos.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/osal/usb_osal_freertos.c b/osal/usb_osal_freertos.c
index e536ff14..14118570 100644
--- a/osal/usb_osal_freertos.c
+++ b/osal/usb_osal_freertos.c
@@ -153,7 +153,17 @@ void usb_osal_timer_delete(struct usb_osal_timer *timer)
void usb_osal_timer_start(struct usb_osal_timer *timer)
{
- xTimerStart(timer->timer, 0);
+ BaseType_t xHigherPriorityTaskWoken = pdFALSE;
+ int ret;
+
+ if (xPortIsInsideInterrupt()) {
+ ret = xTimerStartFromISR(timer->timer, &xHigherPriorityTaskWoken);
+ if (ret == pdPASS) {
+ portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
+ }
+ } else {
+ xTimerStart(timer->timer, 0);
+ }
}
void usb_osal_timer_stop(struct usb_osal_timer *timer)