Просмотр исходного кода

CPU工程更新:
1.优化了未对USB非周期循环链表做临界保护导致的枚举卡死异常问题;

helen 8 месяцев назад
Родитель
Сommit
8b4f81cf5d

+ 11 - 0
amt630hv160-freertos-beta/ArkmicroFiles/libcpu-amt630hv160/source/usb/hcd.c

@@ -51,6 +51,8 @@
 #include "core.h"
 #include "hcd.h"
 
+extern uint8_t interrupt_get_nest(void);
+
 int usb_urb_dir_in(struct urb *urb)
 {
 	return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN;
@@ -3416,6 +3418,11 @@ static void dwc2_process_non_periodic_channels(struct dwc2_hsotg *hsotg)
 	 * Process once through the active list or until no more space is
 	 * available in the request queue or the Tx FIFO
 	 */
+
+	if(interrupt_get_nest() == 0) {
+		portENTER_CRITICAL();
+	}
+
 	do {
 		tx_status = dwc2_readl(hsotg->regs + GNPTXSTS);
 		qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
@@ -3463,6 +3470,10 @@ next:
 #endif
 	} while (hsotg->non_periodic_qh_ptr != orig_qh_ptr);
 
+	if(interrupt_get_nest() == 0) {
+		portEXIT_CRITICAL();
+	}
+
 	if (!hsotg->params.host_dma) {
 		tx_status = dwc2_readl(hsotg->regs + GNPTXSTS);
 		qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>