From 035f01b2cab6d0d48670c14912eb8f46a0eef8fe Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Sat, 23 Apr 2022 16:22:13 +0800 Subject: [PATCH] add static for usb_ep0_state to avoid duplicating --- port/musb/usb_dc_musb.c | 8 +++----- port/musb/usb_hc_musb.c | 5 +---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/port/musb/usb_dc_musb.c b/port/musb/usb_dc_musb.c index 4c3439af..c4e94707 100644 --- a/port/musb/usb_dc_musb.c +++ b/port/musb/usb_dc_musb.c @@ -2,10 +2,8 @@ #include "usb_musb_reg.h" #ifdef CONFIG_USB_MUSB_SUNXI -#define SUNXI_SRAMC_BASE 0x01c00000 -#define SUNXI_USB0_BASE 0x01c13000 -#define USBC_REG_o_PHYCTL 0x0404 +#define SUNXI_USB0_BASE 0x01c13000 #ifndef USB_BASE #define USB_BASE (SUNXI_USB0_BASE) @@ -98,7 +96,7 @@ struct usb_dc_config_priv { struct usb_dc_ep_state out_ep[USB_NUM_BIDIR_ENDPOINTS]; /*!< OUT endpoint parameters */ } usb_dc_cfg; -volatile uint8_t usb_ep0_state = USB_EP0_STATE_SETUP; +static volatile uint8_t usb_ep0_state = USB_EP0_STATE_SETUP; volatile uint16_t ep0_last_size = 0; /* get current active ep */ @@ -503,7 +501,7 @@ int usbd_ep_read(const uint8_t ep, uint8_t *data, uint32_t max_data_len, uint32_ { int ret = 0; uint8_t ep_idx = USB_EP_GET_IDX(ep); - uint32_t read_count; + uint32_t read_count = 0; uint8_t old_ep_idx; old_ep_idx = USBC_GetActiveEp(); diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c index 720e166a..baa26cfc 100644 --- a/port/musb/usb_hc_musb.c +++ b/port/musb/usb_hc_musb.c @@ -3,11 +3,8 @@ #ifdef CONFIG_USB_MUSB_SUNXI -#define SUNXI_SRAMC_BASE 0x01c00000 #define SUNXI_USB0_BASE 0x01c13000 -#define USBC_REG_o_PHYCTL 0x0404 - #ifndef USB_BASE #define USB_BASE (SUNXI_USB0_BASE) #endif @@ -131,7 +128,7 @@ struct usb_musb_priv { usb_osal_mutex_t exclsem[CONIFG_USB_MUSB_EP_NUM]; /* Support mutually exclusive access */ } g_usbhost; -volatile uint8_t usb_ep0_state = USB_EP0_STATE_SETUP; +static volatile uint8_t usb_ep0_state = USB_EP0_STATE_SETUP; volatile uint8_t ep0_outlen = 0; /* get current active ep */