diff --git a/port/ch32/usb_dc_usbfs.c b/port/ch32/usb_dc_usbfs.c index af832838..78e1a2fb 100644 --- a/port/ch32/usb_dc_usbfs.c +++ b/port/ch32/usb_dc_usbfs.c @@ -106,8 +106,9 @@ int usb_dc_init(void) return 0; } -void usb_dc_deinit(void) +int usb_dc_deinit(void) { + return 0; } int usbd_set_address(const uint8_t addr) diff --git a/port/ch32/usb_dc_usbhs.c b/port/ch32/usb_dc_usbhs.c index 44cb3db0..8790d719 100644 --- a/port/ch32/usb_dc_usbhs.c +++ b/port/ch32/usb_dc_usbhs.c @@ -165,8 +165,9 @@ int usb_dc_init(void) return 0; } -void usb_dc_deinit(void) +int usb_dc_deinit(void) { + return 0; } int usbd_set_address(const uint8_t addr) diff --git a/port/fsdev/usb_dc_fsdev.c b/port/fsdev/usb_dc_fsdev.c index c6f27493..93af80cb 100644 --- a/port/fsdev/usb_dc_fsdev.c +++ b/port/fsdev/usb_dc_fsdev.c @@ -6,9 +6,7 @@ #endif #ifndef USB_BASE -/* USB device FS */ -#define USB_BASE (0x40005C00UL) /*!< USB_IP Peripheral Registers base address */ -#define USB_PMAADDR (USB_BASE + 0x400UL) /*!< USB_IP Packet Memory Area base address */ +#define USB_BASE (0x40005C00UL) /*!< USB_IP Peripheral Registers base address */ #endif #ifndef USB_NUM_BIDIR_ENDPOINTS @@ -90,7 +88,7 @@ int usb_dc_init(void) return 0; } -void usb_dc_deinit(void) +int usb_dc_deinit(void) { /* disable all interrupts and force USB reset */ USB->CNTR = (uint16_t)USB_CNTR_FRES; @@ -102,6 +100,7 @@ void usb_dc_deinit(void) USB->CNTR = (uint16_t)(USB_CNTR_FRES | USB_CNTR_PDWN); usb_dc_low_level_deinit(); + return 0; } int usbd_set_address(const uint8_t addr) diff --git a/port/mm32/usb_dc_mm32.c b/port/mm32/usb_dc_mm32.c index c783103f..76075064 100644 --- a/port/mm32/usb_dc_mm32.c +++ b/port/mm32/usb_dc_mm32.c @@ -48,9 +48,9 @@ int usb_dc_init(void) memset(&usb_dc_cfg, 0, sizeof(struct usb_dc_config_priv)); usb_dc_cfg.out_ep[0].ep_mps = USB_CTRL_EP_MPS; - usb_dc_cfg.out_ep[0].ep_type = USBD_EP_TYPE_CTRL; + usb_dc_cfg.out_ep[0].ep_type = 0x00; usb_dc_cfg.in_ep[0].ep_mps = USB_CTRL_EP_MPS; - usb_dc_cfg.in_ep[0].ep_type = USBD_EP_TYPE_CTRL; + usb_dc_cfg.in_ep[0].ep_type = 0x00; usb_dc_low_level_init(); @@ -84,9 +84,10 @@ int usb_dc_init(void) return 0; } -void usb_dc_deinit(void) +int usb_dc_deinit(void) { usb_dc_low_level_deinit(); + return 0; } int usbd_set_address(const uint8_t addr) diff --git a/port/musb/usb_dc_musb.c b/port/musb/usb_dc_musb.c index 6979eb12..abd180cc 100644 --- a/port/musb/usb_dc_musb.c +++ b/port/musb/usb_dc_musb.c @@ -1,6 +1,10 @@ #include "usbd_core.h" #include "usb_musb_reg.h" +#ifndef USBD_IRQHandler +#define USBD_IRQHandler USB_INT_Handler //use actual usb irq name instead +#endif + #ifndef USB_BASE #define USB_BASE (0x40080000UL + 0x6400) #endif @@ -9,10 +13,6 @@ #define USB_NUM_BIDIR_ENDPOINTS 8 #endif -#ifndef USBD_IRQHandler -#define USBD_IRQHandler USB_INT_Handler //use actual usb irq name instead -#endif - #define USB ((USB0_Type *)USB_BASE) #define HWREG(x) \ @@ -159,9 +159,9 @@ int usb_dc_init(void) memset(&usb_dc_cfg, 0, sizeof(struct usb_dc_config_priv)); usb_dc_cfg.out_ep[0].ep_mps = USB_CTRL_EP_MPS; - usb_dc_cfg.out_ep[0].ep_type = USBD_EP_TYPE_CTRL; + usb_dc_cfg.out_ep[0].ep_type = 0x00; usb_dc_cfg.in_ep[0].ep_mps = USB_CTRL_EP_MPS; - usb_dc_cfg.in_ep[0].ep_type = USBD_EP_TYPE_CTRL; + usb_dc_cfg.in_ep[0].ep_type = 0x00; usb_dc_cfg.fifo_size_offset = USB_CTRL_EP_MPS; usb_dc_low_level_init(); @@ -183,8 +183,9 @@ int usb_dc_init(void) return 0; } -void usb_dc_deinit(void) +int usb_dc_deinit(void) { + return 0; } int usbd_set_address(const uint8_t addr) diff --git a/port/nuvoton/usb_dc_nuvoton.c b/port/nuvoton/usb_dc_nuvoton.c index d8faadc7..6b0e3478 100644 --- a/port/nuvoton/usb_dc_nuvoton.c +++ b/port/nuvoton/usb_dc_nuvoton.c @@ -1,16 +1,20 @@ #include "usbd_core.h" #include "usb_nuvoton_reg.h" +#ifndef USBD_IRQHandler +#define USBD_IRQHandler USBD_IRQHandler +#endif + #ifndef USB_BASE #define USB_BASE (0x40000000 + 0x19000) #endif -#define USBD ((USBD_T *)USB_BASE) - #ifndef USB_NUM_BIDIR_ENDPOINTS #define USB_NUM_BIDIR_ENDPOINTS 13 #endif +#define USBD ((USBD_T *)USB_BASE) + #define USBD_ENABLE_USB() ((uint32_t)(USBD->PHYCTL |= (USBD_PHYCTL_PHYEN_Msk | USBD_PHYCTL_DPPUEN_Msk))) /*!PHYCTL &= ~USBD_PHYCTL_DPPUEN_Msk)) /*!PHYCTL |= USBD_PHYCTL_PHYEN_Msk)) /*!DCTL |= USB_OTG_DCTL_SDIS; + + return 0; } int usbd_set_address(const uint8_t addr) diff --git a/port/template/usb_dc.c b/port/template/usb_dc.c index 3c68f099..943bf926 100644 --- a/port/template/usb_dc.c +++ b/port/template/usb_dc.c @@ -42,8 +42,9 @@ int usb_dc_init(void) return 0; } -void usb_dc_deinit(void) +int usb_dc_deinit(void) { + return 0; } int usbd_set_address(const uint8_t addr) @@ -94,7 +95,6 @@ int usbd_ep_write(const uint8_t ep, const uint8_t *data, uint32_t data_len, uint } if (!data_len) { - return 0; } @@ -131,5 +131,4 @@ int usbd_ep_read(const uint8_t ep, uint8_t *data, uint32_t max_data_len, uint32_ void USBD_IRQHandler(void) { - }