summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-02-11 22:54:57 +0700
committerGitHub <[email protected]>2025-02-11 22:54:57 +0700
commit5afcfb7522c4fd8b50512cfb277d8a3ccdbc5453 (patch)
treee860b06abf72d90698b7fef2d5559a2372735cf3 /src
parentbb48e6acc8c20253a98003b0b6621075aecacce2 (diff)
parent3560ed3d986426b22837e86f2d1648174db02428 (diff)
Merge pull request #2989 from hathach/rtos-house-keeping
Rtos house keeping
Diffstat (limited to 'src')
-rw-r--r--src/osal/osal_none.h24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/osal/osal_none.h b/src/osal/osal_none.h
index c93f7a86c..40e9bb83a 100644
--- a/src/osal/osal_none.h
+++ b/src/osal/osal_none.h
@@ -137,18 +137,6 @@ typedef osal_queue_def_t* osal_queue_t;
.ff = TU_FIFO_INIT(_name##_buf, _depth, _type, false) \
}
-// lock queue by disable USB interrupt
-TU_ATTR_ALWAYS_INLINE static inline void _osal_q_lock(osal_queue_t qhdl) {
- // disable dcd/hcd interrupt
- qhdl->interrupt_set(false);
-}
-
-// unlock queue
-TU_ATTR_ALWAYS_INLINE static inline void _osal_q_unlock(osal_queue_t qhdl) {
- // enable dcd/hcd interrupt
- qhdl->interrupt_set(true);
-}
-
TU_ATTR_ALWAYS_INLINE static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef) {
tu_fifo_clear(&qdef->ff);
return (osal_queue_t) qdef;
@@ -162,22 +150,22 @@ TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_delete(osal_queue_t qhdl) {
TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_receive(osal_queue_t qhdl, void* data, uint32_t msec) {
(void) msec; // not used, always behave as msec = 0
- _osal_q_lock(qhdl);
- bool success = tu_fifo_read(&qhdl->ff, data);
- _osal_q_unlock(qhdl);
+ qhdl->interrupt_set(false);
+ const bool success = tu_fifo_read(&qhdl->ff, data);
+ qhdl->interrupt_set(true);
return success;
}
TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_send(osal_queue_t qhdl, void const* data, bool in_isr) {
if (!in_isr) {
- _osal_q_lock(qhdl);
+ qhdl->interrupt_set(false);
}
- bool success = tu_fifo_write(&qhdl->ff, data);
+ const bool success = tu_fifo_write(&qhdl->ff, data);
if (!in_isr) {
- _osal_q_unlock(qhdl);
+ qhdl->interrupt_set(true);
}
return success;