Skip to content

Commit 39dca86

Browse files
xfwangqiangRbb666
authored andcommitted
修复了USB通信概率性挂掉的问题。原因是USB_OSA_ENTER_CRITICAL等宏使用的是禁止调度的函数,无法保护中断与任务的临界资源,修改为禁止中断可以解决这个问题
1 parent 8525e08 commit 39dca86

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bsp/nxp/imx/imxrt/libraries/drivers/usb/include/usb_device_config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@
176176
/* @} */
177177
/*! @brief rt-thread port alloc */
178178
#include <rtthread.h>
179-
#define USB_OSA_SR_ALLOC(...)
179+
#define USB_OSA_SR_ALLOC(...) rt_base_t level
180180
/*! @brief rt-thread port enter critical */
181-
#define USB_OSA_ENTER_CRITICAL rt_enter_critical
181+
#define USB_OSA_ENTER_CRITICAL() level = rt_hw_interrupt_disable()
182182
/*! @brief rt-thread port exit critical */
183-
#define USB_OSA_EXIT_CRITICAL rt_exit_critical
183+
#define USB_OSA_EXIT_CRITICAL() rt_hw_interrupt_enable(level)
184184

185185
#endif /* _USB_DEVICE_CONFIG_H_ */

0 commit comments

Comments
 (0)