diff options
Diffstat (limited to 'src/osal/osal_none.h')
| -rw-r--r-- | src/osal/osal_none.h | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/osal/osal_none.h b/src/osal/osal_none.h index 241234671..17a802ed8 100644 --- a/src/osal/osal_none.h +++ b/src/osal/osal_none.h @@ -24,10 +24,6 @@ * This file is part of the TinyUSB stack.
*/
-/** \ingroup group_osal
- * \defgroup Group_OSNone None OS
- * @{ */
-
#ifndef _TUSB_OSAL_NONE_H_
#define _TUSB_OSAL_NONE_H_
@@ -69,11 +65,6 @@ static inline bool osal_semaphore_post(osal_semaphore_t sem_hdl, bool in_isr) return true;
}
-static inline void osal_semaphore_reset(osal_semaphore_t sem_hdl)
-{
- sem_hdl->count = 0;
-}
-
// TODO blocking for now
static inline bool osal_semaphore_wait (osal_semaphore_t sem_hdl, uint32_t msec)
{
@@ -85,6 +76,11 @@ static inline bool osal_semaphore_wait (osal_semaphore_t sem_hdl, uint32_t msec) return true;
}
+static inline void osal_semaphore_reset(osal_semaphore_t sem_hdl)
+{
+ sem_hdl->count = 0;
+}
+
//--------------------------------------------------------------------+
// MUTEX API
// Within tinyusb, mutex is never used in ISR context
@@ -98,8 +94,8 @@ static inline osal_mutex_t osal_mutex_create(osal_mutex_def_t* mdef) return mdef;
}
-#define osal_mutex_unlock(_mutex_hdl) osal_semaphore_post(_mutex_hdl, false)
#define osal_mutex_lock osal_semaphore_wait
+#define osal_mutex_unlock(_mutex_hdl) osal_semaphore_post(_mutex_hdl, false)
//--------------------------------------------------------------------+
// QUEUE API
@@ -168,6 +164,16 @@ 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);
+ bool success = tu_fifo_read(&qhdl->ff, data);
+ _osal_q_unlock(qhdl);
+
+ return success;
+}
+
static inline bool osal_queue_send(osal_queue_t const qhdl, void const * data, bool in_isr)
{
if (!in_isr) {
@@ -190,20 +196,8 @@ static inline void osal_queue_reset(osal_queue_t const qhdl) // tusb_hal_int_enable_all();
}
-// non blocking
-static inline bool osal_queue_receive(osal_queue_t const qhdl, void* data)
-{
- _osal_q_lock(qhdl);
- bool success = tu_fifo_read(&qhdl->ff, data);
- _osal_q_unlock(qhdl);
-
- return success;
-}
-
#ifdef __cplusplus
}
#endif
#endif /* _TUSB_OSAL_NONE_H_ */
-
-/** @} */
|
