summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2022-03-11 21:08:41 +0800
committersakumisu <[email protected]>2022-03-11 21:08:41 +0800
commit1afc89657239dfaea00f9281f8a37242630a6f2f (patch)
treecae46738ed61194d66e5f6c59b0c64af9b18ea35
parentc0ccbd281d3250bd9ec02a1218b960d2623dd8f0 (diff)
fix usb_dc_deinit return type
-rw-r--r--port/ch32/usb_dc_usbfs.c3
-rw-r--r--port/ch32/usb_dc_usbhs.c3
-rw-r--r--port/fsdev/usb_dc_fsdev.c7
-rw-r--r--port/mm32/usb_dc_mm32.c7
-rw-r--r--port/musb/usb_dc_musb.c15
-rw-r--r--port/nuvoton/usb_dc_nuvoton.c11
-rw-r--r--port/synopsys/usb_dc_synopsys.c30
-rw-r--r--port/template/usb_dc.c5
8 files changed, 42 insertions, 39 deletions
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))) /*!<Enable USB \hideinitializer */
#define USBD_DISABLE_USB() ((uint32_t)(USBD->PHYCTL &= ~USBD_PHYCTL_DPPUEN_Msk)) /*!<Disable USB \hideinitializer */
#define USBD_ENABLE_PHY() ((uint32_t)(USBD->PHYCTL |= USBD_PHYCTL_PHYEN_Msk)) /*!<Enable PHY \hideinitializer */
@@ -95,8 +99,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/synopsys/usb_dc_synopsys.c b/port/synopsys/usb_dc_synopsys.c
index 4c5e8955..25f08e6b 100644
--- a/port/synopsys/usb_dc_synopsys.c
+++ b/port/synopsys/usb_dc_synopsys.c
@@ -1,22 +1,15 @@
#include "usbd_core.h"
#include "usb_synopsys_reg.h"
-/*!< USB registers base address */
-#define USB_OTG_HS_PERIPH_BASE 0x40040000UL
-#ifndef STM32H7
-#define USB_OTG_FS_PERIPH_BASE 0x50000000UL
-#else
-#define USB_OTG_FS_PERIPH_BASE 0x40080000UL
-#endif
-
-#define USB_OTG_FS ((USB_OTG_GlobalTypeDef *)USB_OTG_FS_PERIPH_BASE)
-#define USB_OTG_HS ((USB_OTG_GlobalTypeDef *)USB_OTG_HS_PERIPH_BASE)
-
#if defined(CONFIG_USB_HS) || defined(CONFIG_USB_HS_IN_FULL)
#ifndef USBD_IRQHandler
#define USBD_IRQHandler OTG_HS_IRQHandler
#endif
+#ifndef USB_BASE
+#define USB_BASE (0x40040000UL)
+#endif
+
#ifndef USB_NUM_BIDIR_ENDPOINTS
#define USB_NUM_BIDIR_ENDPOINTS 6 /* define with minimum value*/
#endif
@@ -30,6 +23,10 @@
#define USBD_IRQHandler OTG_FS_IRQHandler
#endif
+#ifndef USB_BASE
+#define USB_BASE (0x50000000UL)
+#endif
+
#ifndef USB_NUM_BIDIR_ENDPOINTS
#define USB_NUM_BIDIR_ENDPOINTS 4 /* define with minimum value*/
#endif
@@ -124,11 +121,8 @@ int usb_dc_init(void)
memset(&usb_dc_cfg, 0, sizeof(struct usb_dc_config_priv));
-#if defined(CONFIG_USB_HS) || defined(CONFIG_USB_HS_IN_FULL)
- usb_dc_cfg.Instance = USB_OTG_HS;
-#else
- usb_dc_cfg.Instance = USB_OTG_FS;
-#endif
+ usb_dc_cfg.Instance = (USB_OTG_GlobalTypeDef *)USB_BASE;
+
USB_OTG_GlobalTypeDef *USBx = usb_dc_cfg.Instance;
usb_dc_low_level_init();
@@ -285,7 +279,7 @@ int usb_dc_init(void)
return 0;
}
-void usb_dc_deinit(void)
+int usb_dc_deinit(void)
{
USB_OTG_GlobalTypeDef *USBx = usb_dc_cfg.Instance;
uint32_t USBx_BASE = (uint32_t)USBx;
@@ -307,6 +301,8 @@ void usb_dc_deinit(void)
usb_flush_rxfifo(USBx);
USBx_DEVICE->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)
{
-
}