fix usb_dc_deinit return type
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user