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

This commit is contained in:
wangqiang 2025-06-04 11:27:22 +08:00 committed by Rbb666
parent 8525e08709
commit 39dca869b4
1 changed files with 3 additions and 3 deletions

View File

@ -176,10 +176,10 @@
/* @} */
/*! @brief rt-thread port alloc */
#include <rtthread.h>
#define USB_OSA_SR_ALLOC(...)
#define USB_OSA_SR_ALLOC(...) rt_base_t level
/*! @brief rt-thread port enter critical */
#define USB_OSA_ENTER_CRITICAL rt_enter_critical
#define USB_OSA_ENTER_CRITICAL() level = rt_hw_interrupt_disable()
/*! @brief rt-thread port exit critical */
#define USB_OSA_EXIT_CRITICAL rt_exit_critical
#define USB_OSA_EXIT_CRITICAL() rt_hw_interrupt_enable(level)
#endif /* _USB_DEVICE_CONFIG_H_ */