diff options
| author | hathach <[email protected]> | 2018-05-17 13:49:38 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-05-17 13:49:38 +0700 |
| commit | 013bd621f5f16fabc1acfd4fb896d98af41fe152 (patch) | |
| tree | de49938405b51a8cb1bd43c809867061ccd26852 /tinyusb | |
| parent | b253291314a8859a2ef4f6f1622bedba93887ecf (diff) | |
add osal_queue_send_isr/osal_semaphore_post_isr for better support freeRTOS
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/device/usbd.c | 8 | ||||
| -rw-r--r-- | tinyusb/osal/osal_none.h | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index 2df7d49c6..fb968b3c0 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -523,7 +523,7 @@ void dcd_bus_event(uint8_t rhport, usbd_bus_event_type_t bus_event) .rhport = rhport,
.event_id = USBD_EVENTID_SOF,
};
- osal_queue_send(_usbd_q, &task_event);
+ osal_queue_send_isr(_usbd_q, &task_event);
}
break;
@@ -549,7 +549,7 @@ void dcd_setup_received(uint8_t rhport, uint8_t const* p_request) };
memcpy(&task_event.setup_received, p_request, sizeof(tusb_control_request_t));
- osal_queue_send(_usbd_q, &task_event);
+ osal_queue_send_isr(_usbd_q, &task_event);
}
void dcd_xfer_complete(uint8_t rhport, uint8_t ep_addr, uint32_t xferred_bytes, bool succeeded)
@@ -561,7 +561,7 @@ void dcd_xfer_complete(uint8_t rhport, uint8_t ep_addr, uint32_t xferred_bytes, (void) succeeded;
// only signal data stage, skip status (zero byte)
- if (xferred_bytes) osal_semaphore_post( _usbd_ctrl_sem );
+ if (xferred_bytes) osal_semaphore_post_isr( _usbd_ctrl_sem );
}else
{
usbd_task_event_t task_event =
@@ -574,7 +574,7 @@ void dcd_xfer_complete(uint8_t rhport, uint8_t ep_addr, uint32_t xferred_bytes, task_event.xfer_done.ep_addr = ep_addr;
task_event.xfer_done.xferred_byte = xferred_bytes;
- osal_queue_send(_usbd_q, &task_event);
+ osal_queue_send_isr(_usbd_q, &task_event);
}
TU_ASSERT(succeeded, );
diff --git a/tinyusb/osal/osal_none.h b/tinyusb/osal/osal_none.h index b79816130..bea90093c 100644 --- a/tinyusb/osal/osal_none.h +++ b/tinyusb/osal/osal_none.h @@ -146,7 +146,7 @@ static inline osal_queue_t osal_queue_create(uint32_t depth, uint32_t item_size) }
-static inline bool osal_queue_send(osal_queue_t const queue_hdl, void const * data)
+static inline bool osal_queue_send_isr(osal_queue_t const queue_hdl, void const * data)
{
return fifo_write( (fifo_t*) queue_hdl, data);
}
@@ -197,6 +197,8 @@ static inline osal_semaphore_t osal_semaphore_create(uint32_t max_count, uint32_ return sem_data;
}
+#define osal_semaphore_post_isr osal_semaphore_post
+
static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl)
{
if (sem_hdl->count < sem_hdl->max_count ) sem_hdl->count++;
|
