port and add comment for gccfg with gd/at/st

This commit is contained in:
sakumisu 2023-11-27 20:30:12 +08:00
parent b14976dd56
commit c90f273e24
4 changed files with 66 additions and 2 deletions

View File

@ -14,7 +14,7 @@
## AT32
- AT32F415xx
- AT32F402xx、AT32F405xx、AT32F415xx、AT32F423xx、AT32F425xx、AT32F435xx、AT32F437xx
## GD32

30
port/dwc2/usb_glue_at.c Normal file
View File

@ -0,0 +1,30 @@
#include "usb_config.h"
#include "stdint.h"
#include "usb_dwc2_reg.h"
/* you can find this config in function: usb_global_init, file:at32fxxx_usb.c, for example:
*
* usbx->gccfg_bit.pwrdown = TRUE;
* usbx->gccfg_bit.avalidsesen = TRUE;
* usbx->gccfg_bit.bvalidsesen = TRUE;
*
*/
uint32_t usbd_get_dwc2_gccfg_conf(void)
{
#ifdef CONFIG_USB_HS
return (1 << 16);
#else
// return ((1 << 16) | (1 << 18) | (1 << 19));
return (1 << 16);
#endif
}
uint32_t usbh_get_dwc2_gccfg_conf(void)
{
#ifdef CONFIG_USB_DWC2_ULPI_PHY
return (1 << 16);
#else
return (1 << 16);
#endif
}

27
port/dwc2/usb_glue_gd.c Normal file
View File

@ -0,0 +1,27 @@
#include "usb_config.h"
#include "stdint.h"
#include "usb_dwc2_reg.h"
/* you can find this config in function:usb_core_init, file:drv_usb_core.c, for example:
*
* usb_regs->gr->GCCFG |= GCCFG_PWRON | GCCFG_VBUSACEN | GCCFG_VBUSBCEN;
*
*/
uint32_t usbd_get_dwc2_gccfg_conf(void)
{
#ifdef CONFIG_USB_HS
return 0;
#else
return ((1 << 16) | (1 << 18) | (1 << 19));
#endif
}
uint32_t usbh_get_dwc2_gccfg_conf(void)
{
#ifdef CONFIG_USB_DWC2_ULPI_PHY
return 0;
#else
return ((1 << 16) | (1 << 18) | (1 << 19));
#endif
}

View File

@ -2,7 +2,14 @@
#include "stdint.h"
#include "usb_dwc2_reg.h"
/* st different chips maybe have a little difference in this register, you should check this */
/* you can find this config in function: USB_DevInit, file:stm32xxx_ll_usb.c, for example:
*
* USBx->GCCFG |= USB_OTG_GCCFG_PWRDWN;
* USBx->GCCFG |= USB_OTG_GCCFG_NOVBUSSENS;
* USBx->GCCFG &= ~USB_OTG_GCCFG_VBUSBSEN;
* USBx->GCCFG &= ~USB_OTG_GCCFG_VBUSASEN;
*
*/
uint32_t usbd_get_dwc2_gccfg_conf(void)
{