|
|
@@ -142,7 +142,7 @@ typedef osal_queue_def_t* osal_queue_t;
|
|
|
}\
|
|
|
}
|
|
|
|
|
|
-// lock queue by disable usb isr
|
|
|
+// lock queue by disable USB interrupt
|
|
|
static inline void _osal_q_lock(osal_queue_t qhdl)
|
|
|
{
|
|
|
(void) qhdl;
|
|
|
@@ -176,8 +176,7 @@ static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef)
|
|
|
return (osal_queue_t) qdef;
|
|
|
}
|
|
|
|
|
|
-// non blocking
|
|
|
-static inline bool osal_queue_receive(osal_queue_t const qhdl, void* data)
|
|
|
+static inline bool osal_queue_receive(osal_queue_t qhdl, void* data)
|
|
|
{
|
|
|
_osal_q_lock(qhdl);
|
|
|
bool success = tu_fifo_read(&qhdl->ff, data);
|
|
|
@@ -186,7 +185,7 @@ static inline bool osal_queue_receive(osal_queue_t const qhdl, void* data)
|
|
|
return success;
|
|
|
}
|
|
|
|
|
|
-static inline bool osal_queue_send(osal_queue_t const qhdl, void const * data, bool in_isr)
|
|
|
+static inline bool osal_queue_send(osal_queue_t qhdl, void const * data, bool in_isr)
|
|
|
{
|
|
|
if (!in_isr) {
|
|
|
_osal_q_lock(qhdl);
|
|
|
@@ -203,6 +202,13 @@ static inline bool osal_queue_send(osal_queue_t const qhdl, void const * data, b
|
|
|
return success;
|
|
|
}
|
|
|
|
|
|
+static inline bool osal_queue_empty(osal_queue_t qhdl)
|
|
|
+{
|
|
|
+ // Skip queue lock/unlock since this function is primarily called
|
|
|
+ // with interrupt disabled before going into low power mode
|
|
|
+ return tu_fifo_empty(&qhdl->ff);
|
|
|
+}
|
|
|
+
|
|
|
#ifdef __cplusplus
|
|
|
}
|
|
|
#endif
|