diff options
| author | hathach <[email protected]> | 2020-05-20 13:38:41 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2020-05-20 13:38:41 +0700 |
| commit | 4e8d414bc666d4636efd29e1c9feffd622d055c5 (patch) | |
| tree | 74203937e5438e4e6f4540a27086f418f98caaad /src/osal/osal_none.h | |
| parent | 76bf96bcb0c12ba241ee4ecc175afb257e550d19 (diff) | |
added osal_queue_empty() API
ported for osal none/freertos/mynewt
Diffstat (limited to 'src/osal/osal_none.h')
| -rw-r--r-- | src/osal/osal_none.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/osal/osal_none.h b/src/osal/osal_none.h index b27e628a9..c9b762915 100644 --- a/src/osal/osal_none.h +++ b/src/osal/osal_none.h @@ -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,7 +176,6 @@ 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) { _osal_q_lock(qhdl); @@ -203,6 +202,15 @@ 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 const qhdl) +{ + _osal_q_lock(qhdl); + bool is_empty = tu_fifo_empty(&qhdl->ff); + _osal_q_unlock(qhdl); + + return is_empty; +} + #ifdef __cplusplus } #endif |
