mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
Turn off interrupts when working with the event queue.
This commit is contained in:
parent
6aa0146c72
commit
246c28db1a
@ -43,6 +43,8 @@
|
|||||||
#ifndef _TUSB_OSAL_NONE_H_
|
#ifndef _TUSB_OSAL_NONE_H_
|
||||||
#define _TUSB_OSAL_NONE_H_
|
#define _TUSB_OSAL_NONE_H_
|
||||||
|
|
||||||
|
#include "tusb_hal.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -135,14 +137,14 @@ static inline osal_queue_t osal_queue_create(osal_queue_def_t* qdef)
|
|||||||
|
|
||||||
static inline bool osal_queue_send(osal_queue_t const queue_hdl, void const * data, bool in_isr)
|
static inline bool osal_queue_send(osal_queue_t const queue_hdl, void const * data, bool in_isr)
|
||||||
{
|
{
|
||||||
(void) in_isr;
|
if (!in_isr) {
|
||||||
// if (!in_isr) tusb_hal_int_disable_all();
|
tusb_hal_int_disable_all();
|
||||||
|
}
|
||||||
bool rc = tu_fifo_write( (tu_fifo_t*) queue_hdl, data);
|
bool success = tu_fifo_write( (tu_fifo_t*) queue_hdl, data);
|
||||||
|
if (!in_isr) {
|
||||||
// if (!in_isr) tusb_hal_int_enable_all();
|
tusb_hal_int_enable_all();
|
||||||
|
}
|
||||||
return rc;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void osal_queue_reset(osal_queue_t const queue_hdl)
|
static inline void osal_queue_reset(osal_queue_t const queue_hdl)
|
||||||
@ -152,18 +154,11 @@ static inline void osal_queue_reset(osal_queue_t const queue_hdl)
|
|||||||
// tusb_hal_int_enable_all();
|
// tusb_hal_int_enable_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool osal_queue_receive(osal_queue_t const queue_hdl, void* data) {
|
||||||
static inline bool osal_queue_receive(osal_queue_t const queue_hdl, void* data)
|
tusb_hal_int_disable_all();
|
||||||
{
|
bool success = tu_fifo_read(queue_hdl, data);
|
||||||
// osal none return immediately without blocking
|
tusb_hal_int_enable_all();
|
||||||
// extern void tusb_hal_int_disable(uint8_t rhport);
|
return success;
|
||||||
// extern void tusb_hal_int_enable(uint8_t rhport);
|
|
||||||
|
|
||||||
// tusb_hal_int_disable(0);
|
|
||||||
bool rc = tu_fifo_read(queue_hdl, data);
|
|
||||||
// tusb_hal_int_enable(0);
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user