3232#include  "semphr.h" 
3333#include  "queue.h" 
3434#include  "task.h" 
35+ #include  "tusb_option.h" 
3536
3637#ifdef  __cplusplus 
3738extern  "C"  {
@@ -58,7 +59,19 @@ static inline osal_semaphore_t osal_semaphore_create(osal_semaphore_def_t* semde
5859
5960static  inline  bool  osal_semaphore_post (osal_semaphore_t  sem_hdl , bool  in_isr )
6061{
61-  return  in_isr  ? xSemaphoreGiveFromISR (sem_hdl , NULL ) : xSemaphoreGive (sem_hdl );
62+  if (!in_isr ){
63+  return  xSemaphoreGive (sem_hdl ) !=  0 ;
64+  }
65+  BaseType_t  xHigherPriorityTaskWoken ;
66+  BaseType_t  res  =  xSemaphoreGiveFromISR (sem_hdl , & xHigherPriorityTaskWoken );
67+ #if  CFG_TUSB_MCU  ==  OPT_MCU_ESP32S2 
68+  if  (xHigherPriorityTaskWoken ) {
69+  portYIELD_FROM_ISR ();
70+  }
71+ #else 
72+  portYIELD_FROM_ISR (xHigherPriorityTaskWoken );
73+ #endif 
74+  return  res  !=  0 ;
6275}
6376
6477static  inline  bool  osal_semaphore_wait  (osal_semaphore_t  sem_hdl , uint32_t  msec )
@@ -125,7 +138,19 @@ static inline bool osal_queue_receive(osal_queue_t qhdl, void* data)
125138
126139static  inline  bool  osal_queue_send (osal_queue_t  qhdl , void  const  *  data , bool  in_isr )
127140{
128-  return  in_isr  ? xQueueSendToBackFromISR (qhdl , data , NULL ) : xQueueSendToBack (qhdl , data , OSAL_TIMEOUT_WAIT_FOREVER );
141+  if (!in_isr ){
142+  return  xQueueSendToBack (qhdl , data , OSAL_TIMEOUT_WAIT_FOREVER ) !=  0 ;
143+  }
144+  BaseType_t  xHigherPriorityTaskWoken ;
145+  BaseType_t  res  =  xQueueSendToBackFromISR (qhdl , data , & xHigherPriorityTaskWoken );
146+ #if  CFG_TUSB_MCU  ==  OPT_MCU_ESP32S2 
147+  if  (xHigherPriorityTaskWoken ) {
148+  portYIELD_FROM_ISR ();
149+  }
150+ #else 
151+  portYIELD_FROM_ISR (xHigherPriorityTaskWoken );
152+ #endif 
153+  return  res  !=  0 ;
129154}
130155
131156static  inline  bool  osal_queue_empty (osal_queue_t  qhdl )
0 commit comments