update(osal/freertos): update usb_osal_mq_recv and usb_osal_mq_send for isr api
This commit is contained in:
@@ -101,9 +101,13 @@ int usb_osal_mq_send(usb_osal_mq_t mq, uintptr_t addr)
|
|||||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = xQueueSendFromISR((usb_osal_mq_t)mq, &addr, &xHigherPriorityTaskWoken);
|
if (xPortInIsrContext()) {
|
||||||
if (ret == pdPASS) {
|
ret = xQueueSendFromISR((usb_osal_mq_t)mq, &addr, &xHigherPriorityTaskWoken);
|
||||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
if (ret == pdPASS) {
|
||||||
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret = xQueueSend((usb_osal_mq_t)mq, &addr, 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ret == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
return (ret == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
||||||
@@ -111,10 +115,21 @@ int usb_osal_mq_send(usb_osal_mq_t mq, uintptr_t addr)
|
|||||||
|
|
||||||
int usb_osal_mq_recv(usb_osal_mq_t mq, uintptr_t *addr, uint32_t timeout)
|
int usb_osal_mq_recv(usb_osal_mq_t mq, uintptr_t *addr, uint32_t timeout)
|
||||||
{
|
{
|
||||||
if (timeout == USB_OSAL_WAITING_FOREVER) {
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
return (xQueueReceive((usb_osal_mq_t)mq, addr, portMAX_DELAY) == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
int ret;
|
||||||
|
|
||||||
|
if (xPortInIsrContext()) {
|
||||||
|
ret = xQueueReceiveFromISR((usb_osal_mq_t)mq, addr, &xHigherPriorityTaskWoken);
|
||||||
|
if (ret == pdPASS) {
|
||||||
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
|
}
|
||||||
|
return (ret == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
||||||
} else {
|
} else {
|
||||||
return (xQueueReceive((usb_osal_mq_t)mq, addr, pdMS_TO_TICKS(timeout)) == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
if (timeout == USB_OSAL_WAITING_FOREVER) {
|
||||||
|
return (xQueueReceive((usb_osal_mq_t)mq, addr, portMAX_DELAY) == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
||||||
|
} else {
|
||||||
|
return (xQueueReceive((usb_osal_mq_t)mq, addr, pdMS_TO_TICKS(timeout)) == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,9 +118,13 @@ int usb_osal_mq_send(usb_osal_mq_t mq, uintptr_t addr)
|
|||||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = xQueueSendFromISR((usb_osal_mq_t)mq, &addr, &xHigherPriorityTaskWoken);
|
if (xPortIsInsideInterrupt()) {
|
||||||
if (ret == pdPASS) {
|
ret = xQueueSendFromISR((usb_osal_mq_t)mq, &addr, &xHigherPriorityTaskWoken);
|
||||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
if (ret == pdPASS) {
|
||||||
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret = xQueueSend((usb_osal_mq_t)mq, &addr, 0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ret == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
return (ret == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
||||||
@@ -128,10 +132,21 @@ int usb_osal_mq_send(usb_osal_mq_t mq, uintptr_t addr)
|
|||||||
|
|
||||||
int usb_osal_mq_recv(usb_osal_mq_t mq, uintptr_t *addr, uint32_t timeout)
|
int usb_osal_mq_recv(usb_osal_mq_t mq, uintptr_t *addr, uint32_t timeout)
|
||||||
{
|
{
|
||||||
if (timeout == USB_OSAL_WAITING_FOREVER) {
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
return (xQueueReceive((usb_osal_mq_t)mq, addr, portMAX_DELAY) == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
int ret;
|
||||||
|
|
||||||
|
if (xPortIsInsideInterrupt()) {
|
||||||
|
ret = xQueueReceiveFromISR((usb_osal_mq_t)mq, addr, &xHigherPriorityTaskWoken);
|
||||||
|
if (ret == pdPASS) {
|
||||||
|
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||||
|
}
|
||||||
|
return (ret == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
||||||
} else {
|
} else {
|
||||||
return (xQueueReceive((usb_osal_mq_t)mq, addr, pdMS_TO_TICKS(timeout)) == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
if (timeout == USB_OSAL_WAITING_FOREVER) {
|
||||||
|
return (xQueueReceive((usb_osal_mq_t)mq, addr, portMAX_DELAY) == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
||||||
|
} else {
|
||||||
|
return (xQueueReceive((usb_osal_mq_t)mq, addr, pdMS_TO_TICKS(timeout)) == pdPASS) ? 0 : -USB_ERR_TIMEOUT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user