summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoodData <[email protected]>2022-06-02 09:08:07 +0800
committersakumisu <[email protected]>2022-06-02 11:59:40 +0800
commit84a68fc04004a748496bd00389c865491ebd69e1 (patch)
tree2c956f356757357bae8f043af700b698370a1b1d
parent9248fe04cc785468397644c084ed759fb151d633 (diff)
fix endpoint buffer address set error bug.add print color define.
-rw-r--r--common/usb_util.h7
-rw-r--r--port/fsdev/usb_dc_fsdev.c3
-rw-r--r--port/fsdev/usb_fsdev_reg.h3
3 files changed, 12 insertions, 1 deletions
diff --git a/common/usb_util.h b/common/usb_util.h
index 30415de4..a3c13e48 100644
--- a/common/usb_util.h
+++ b/common/usb_util.h
@@ -275,11 +275,18 @@
* WHITE 37
*/
#define _USB_PRINTF printf
+#ifdef _USB_PRINTF_COLOR_ENABLE
#define _USB_DBG_COLOR(n) _USB_PRINTF("\033[" #n "m")
#define _USB_DBG_LOG_HDR(lvl_name, color_n) \
_USB_PRINTF("\033[" #color_n "m[" lvl_name "/" USB_DBG_TAG "] ")
#define _USB_DBG_LOG_X_END \
_USB_PRINTF("\033[0m")
+#else
+#define _USB_DBG_COLOR(n)
+#define _USB_DBG_LOG_HDR(lvl_name, color_n) \
+ _USB_PRINTF("[" lvl_name "/" USB_DBG_TAG "] ")
+#define _USB_DBG_LOG_X_END
+#endif
#define usb_dbg_log_line(lvl, color_n, fmt, ...) \
do { \
diff --git a/port/fsdev/usb_dc_fsdev.c b/port/fsdev/usb_dc_fsdev.c
index 23756acd..4ef48acc 100644
--- a/port/fsdev/usb_dc_fsdev.c
+++ b/port/fsdev/usb_dc_fsdev.c
@@ -382,8 +382,9 @@ void USBD_IRQHandler(void)
}
}
if (wIstr & USB_ISTR_RESET) {
- usbd_event_notify_handler(USBD_EVENT_RESET, NULL);
+ memset(&usb_dc_cfg, 0, sizeof(struct usb_dc_config_priv));
usb_dc_cfg.pma_offset = USB_BTABLE_SIZE;
+ usbd_event_notify_handler(USBD_EVENT_RESET, NULL);
USB->ISTR &= (uint16_t)(~USB_ISTR_RESET);
}
if (wIstr & USB_ISTR_PMAOVR) {
diff --git a/port/fsdev/usb_fsdev_reg.h b/port/fsdev/usb_fsdev_reg.h
index d1035537..c9f532ba 100644
--- a/port/fsdev/usb_fsdev_reg.h
+++ b/port/fsdev/usb_fsdev_reg.h
@@ -1112,7 +1112,10 @@ typedef struct
*/
#define BTABLE_ADDRESS 0x000U
+
+#ifndef PMA_ACCESS
#define PMA_ACCESS 2U
+#endif
/******************** Bit definition for USB_COUNTn_RX register *************/
#define USB_CNTRX_NBLK_MSK (0x1FU << 10)
#define USB_CNTRX_BLSIZE (0x1U << 15)