summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2022-08-11 17:25:57 +0800
committersakumisu <[email protected]>2022-08-11 17:26:10 +0800
commit9ed5f1ce6b40c79d0c56ac394e0fc84a95e320b9 (patch)
tree376d93c7d2a916198e46c81c5d5025ab811444ae
parent9f4e063646832c1d5701ea4ac044b6c298d7a4c0 (diff)
sem give use from isr
-rw-r--r--osal/usb_osal_freertos.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/osal/usb_osal_freertos.c b/osal/usb_osal_freertos.c
index 4c4e929d..8af74065 100644
--- a/osal/usb_osal_freertos.c
+++ b/osal/usb_osal_freertos.c
@@ -63,22 +63,11 @@ int usb_osal_sem_take(usb_osal_sem_t sem, uint32_t timeout)
int usb_osal_sem_give(usb_osal_sem_t sem)
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
- uint32_t intstatus = 0;
int ret;
-#ifdef __riscv
- /* Obtain the level of the currently executing interrupt. */
- __asm volatile("csrr %0, mintstatus" : "=r"(intstatus)::"memory");
-#else
- /* Obtain the number of the currently executing interrupt. */
- __asm volatile ( "mrs %0, ipsr" : "=r" ( intstatus )::"memory" );
-#endif
- if (intstatus == 0) {
- ret = xSemaphoreGive((SemaphoreHandle_t)sem);
- } else {
- ret = xSemaphoreGiveFromISR((SemaphoreHandle_t)sem, &xHigherPriorityTaskWoken);
- if (ret == pdPASS) {
- portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
- }
+
+ ret = xSemaphoreGiveFromISR((SemaphoreHandle_t)sem, &xHigherPriorityTaskWoken);
+ if (ret == pdPASS) {
+ portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
return (ret == pdPASS) ? 0 : -EINVAL;