1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #18759 from gschorcht/drivers/usbdev_synopsys_dwc2_fixes

drivers/usbdev_synopsys_dwc2: small fixes
This commit is contained in:
benpicco 2022-10-18 02:31:23 +02:00 committed by GitHub
commit a98a706112
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 24 deletions

View File

@ -26,7 +26,7 @@ config CPU_FAM_ESP32S2
select MODULE_PS if MODULE_SHELL
select MODULE_PTHREAD if MODULE_CPP
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC
select MODULE_USBDEV_SYNOPSYS_DWC2 if HAS_PERIPH_USBDEV && MODULE_PERIPH_USBDEV
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV
imply MODULE_NEWLIB_NANO
config CPU_FAM

View File

@ -33,7 +33,7 @@ config CPU_FAM_ESP32S3
select MODULE_PS if MODULE_SHELL
select MODULE_PTHREAD if MODULE_CPP
select MODULE_RTT_RTC if HAS_PERIPH_RTT && MODULE_PERIPH_RTC
select MODULE_USBDEV_SYNOPSYS_DWC2 if HAS_PERIPH_USBDEV && MODULE_PERIPH_USBDEV
select MODULE_USBDEV_SYNOPSYS_DWC2 if MODULE_PERIPH_USBDEV
imply MODULE_NEWLIB_NANO
config CPU_FAM

View File

@ -160,7 +160,6 @@ endif
ifneq (,$(filter periph_usbdev,$(USEMODULE)))
USEMODULE += esp_idf_usb
USEMODULE += usbdev_synopsys_dwc2
USEMODULE += ztimer_msec
endif
ifneq (,$(filter shell,$(USEMODULE)))

View File

@ -264,9 +264,7 @@ extern "C" {
/**
* @brief Total size of the FIFO
*/
#ifndef DWC2_USB_OTG_FS_TOTAL_FIFO_SIZE
#define DWC2_USB_OTG_FS_TOTAL_FIFO_SIZE (1024U)
#endif
/**
* @brief Buffers have to be word aligned for DMA

View File

@ -265,9 +265,7 @@ extern "C" {
/**
* @brief Total size of the FIFO
*/
#ifndef DWC2_USB_OTG_FS_TOTAL_FIFO_SIZE
#define DWC2_USB_OTG_FS_TOTAL_FIFO_SIZE (1024U)
#endif
/**
* @brief Buffers have to be word aligned for DMA

View File

@ -81,7 +81,7 @@ extern "C" {
/**
* @brief USB OTG FS FIFO reception buffer space in 32-bit words
*
* Used as shared FIFO for reception of all OUT transfers
* Used as shared FIFO for reception of all OUT transfers from the host
*
* @note The application might have to increase this when dealing with large
* isochronous transfers
@ -99,6 +99,38 @@ extern "C" {
#define DWC2_USB_OTG_HS_RX_FIFO_SIZE (512U)
#endif
/**
* @brief USB OTG FS FIFO total size
*
* Some device families (F7 and L4) forgot to define the FS device FIFO size
* in their vendor headers. This define sets it to the value from the
* reference manual.
*/
#ifndef USB_OTG_FS_TOTAL_FIFO_SIZE
#define USB_OTG_FS_TOTAL_FIFO_SIZE (1280U)
#endif
/**
* @brief USB OTG FS FIFO total size
*
* Some device families (F7 and L4) forgot to define the HS device FIFO size
* in their vendor headers. This define sets it to the value from the
* reference manual.
*/
#ifndef USB_OTG_HS_TOTAL_FIFO_SIZE
#define USB_OTG_HS_TOTAL_FIFO_SIZE (4096U)
#endif
/**
* @brief USB OTG FS FIFO total size
*/
#define DWC2_USB_OTG_FS_TOTAL_FIFO_SIZE USB_OTG_FS_TOTAL_FIFO_SIZE
/**
* @brief USB OTG HS FIFO total size
*/
#define DWC2_USB_OTG_HS_TOTAL_FIFO_SIZE USB_OTG_HS_TOTAL_FIFO_SIZE
/**
* @brief Use the built-in DMA controller of the HS peripheral when possible
*/

View File

@ -209,6 +209,7 @@ endif
ifneq (,$(filter usbdev_synopsys_dwc2,$(USEMODULE)))
FEATURES_REQUIRED += periph_usbdev
USEMODULE += ztimer_msec
endif
ifneq (,$(filter vcnl40%0,$(USEMODULE)))

View File

@ -93,20 +93,6 @@
#define DWC2_PKTSTS_SETUP_COMP 0x04 /**< Rx fifo setup complete */
#define DWC2_PKTSTS_SETUP_UPDT 0x06 /**< Rx fifo setup update */
/* Some device families (F7 and L4) forgot to define the FS device FIFO size *
* in their vendor headers. This define sets it to the value from the *
* reference manual */
#ifndef USB_OTG_FS_TOTAL_FIFO_SIZE
#define USB_OTG_FS_TOTAL_FIFO_SIZE (1280U)
#endif
/* Some device families (F7 and L4) forgot to define the HS device FIFO size *
* in their vendor headers. This define sets it to the value from the *
* reference manual */
#ifndef USB_OTG_HS_TOTAL_FIFO_SIZE
#define USB_OTG_HS_TOTAL_FIFO_SIZE (4096U)
#endif
/* minimum depth of an individual transmit FIFO */
#define DWC2_USB_OTG_FIFO_MIN_WORD_SIZE (16U)
/* Offset for OUT endpoints in a shared IN/OUT endpoint bit flag register */
@ -472,14 +458,14 @@ static size_t _total_fifo_size(const dwc2_usb_otg_fshs_config_t *conf)
{
if (conf->type == DWC2_USB_OTG_FS) {
#ifdef DWC2_USB_OTG_FS_ENABLED
return USB_OTG_FS_TOTAL_FIFO_SIZE;
return DWC2_USB_OTG_FS_TOTAL_FIFO_SIZE;
#else
return 0;
#endif /* DWC2_USB_OTG_FS_ENABLED */
}
else {
#ifdef DWC2_USB_OTG_HS_ENABLED
return USB_OTG_HS_TOTAL_FIFO_SIZE;
return DWC2_USB_OTG_HS_TOTAL_FIFO_SIZE;
#else
return 0;
#endif /* DWC2_USB_OTG_HS_ENABLED */