diff --git a/usb_config.h b/cherryusb_config_template.h similarity index 77% rename from usb_config.h rename to cherryusb_config_template.h index 074ba319..e01b709d 100644 --- a/usb_config.h +++ b/cherryusb_config_template.h @@ -6,7 +6,8 @@ #ifndef CHERRYUSB_CONFIG_H #define CHERRYUSB_CONFIG_H -/* USB common Configuration */ +/* ================ USB common Configuration ================ */ + #ifndef CONFIG_USB_DBG_LEVEL #define CONFIG_USB_DBG_LEVEL USB_DBG_INFO #endif @@ -15,23 +16,34 @@ #define CONFIG_USB_PRINTF printf #endif -//#define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) +/* attribute data into no cache ram */ +// #define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) +/* Enable print with color */ #define CONFIG_USB_PRINTF_COLOR_ENABLE -/* USB DEVICE Configuration */ -/* core */ -#ifndef CONFIG_USBDEV_REQUEST_BUFFER_LEN -#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 -#endif +/* ================ USB DEVICE Configuration ================*/ +/* core */ + +/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ +#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 +/* Setup packet log for debug */ // #define CONFIG_USBDEV_SETUP_LOG_PRINT +/* Check if the input descriptor is correct */ // #define CONFIG_USBDEV_DESC_CHECK +/* Enable test mode */ // #define CONFIG_USBDEV_TEST_MODE /* cdc class */ + // #define CONFIG_USBDEV_CDC_ACM_UART /* msc class */ + +#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE +#define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 +#endif + #ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" #endif @@ -57,15 +69,17 @@ #endif /* audio class */ + #ifndef CONFIG_USBDEV_AUDIO_VERSION #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 #endif #ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL -#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 2 +#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 #endif -/* USB HOST Configuration */ +/* ================ USB HOST Configuration ================ */ + #ifndef CONFIG_USBHOST_RHPORTS #define CONFIG_USBHOST_RHPORTS 1 #endif @@ -108,7 +122,8 @@ #define CONFIG_USBHOST_ASYNCH //#define CONFIG_USBHOST_GET_STRING_DESC -/* EHCI Configuration */ +/* ================ EHCI Configuration ================ */ + #define CONFIG_USB_EHCI_HCCR_BASE (0x20072000) #define CONFIG_USB_EHCI_HCOR_BASE (0x20072000 + 0x10) #define CONFIG_USB_EHCI_QH_NUM (10) diff --git a/demo/es32/usb_device/ES32F369x/Inc/usb_config.h b/demo/es32/usb_device/ES32F369x/Inc/usb_config.h index 8c57c91b..e01b709d 100644 --- a/demo/es32/usb_device/ES32F369x/Inc/usb_config.h +++ b/demo/es32/usb_device/ES32F369x/Inc/usb_config.h @@ -1,7 +1,13 @@ -#ifndef _USB_CONFIG_H -#define _USB_CONFIG_H +/* + * Copyright (c) 2022, sakumisu + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef CHERRYUSB_CONFIG_H +#define CHERRYUSB_CONFIG_H + +/* ================ USB common Configuration ================ */ -/* USB common Configuration */ #ifndef CONFIG_USB_DBG_LEVEL #define CONFIG_USB_DBG_LEVEL USB_DBG_INFO #endif @@ -10,22 +16,34 @@ #define CONFIG_USB_PRINTF printf #endif +/* attribute data into no cache ram */ +// #define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) +/* Enable print with color */ #define CONFIG_USB_PRINTF_COLOR_ENABLE -/* USB DEVICE Configuration */ -/* core */ -#ifndef CONFIG_USBDEV_REQUEST_BUFFER_LEN -#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 -#endif +/* ================ USB DEVICE Configuration ================*/ +/* core */ + +/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ +#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 +/* Setup packet log for debug */ // #define CONFIG_USBDEV_SETUP_LOG_PRINT +/* Check if the input descriptor is correct */ // #define CONFIG_USBDEV_DESC_CHECK +/* Enable test mode */ // #define CONFIG_USBDEV_TEST_MODE /* cdc class */ + // #define CONFIG_USBDEV_CDC_ACM_UART /* msc class */ + +#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE +#define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 +#endif + #ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" #endif @@ -51,15 +69,17 @@ #endif /* audio class */ + #ifndef CONFIG_USBDEV_AUDIO_VERSION #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 #endif #ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL -#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 2 +#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 #endif -/* USB HOST Configuration */ +/* ================ USB HOST Configuration ================ */ + #ifndef CONFIG_USBHOST_RHPORTS #define CONFIG_USBHOST_RHPORTS 1 #endif @@ -88,20 +108,6 @@ #define CONFIG_USBHOST_MSC_TIMEOUT 5000 #endif -#ifndef CONFIG_USBHOST_HPWORKQ_PRIO -#define CONFIG_USBHOST_HPWORKQ_PRIO 5 -#endif -#ifndef CONFIG_USBHOST_HPWORKQ_STACKSIZE -#define CONFIG_USBHOST_HPWORKQ_STACKSIZE 2048 -#endif - -#ifndef CONFIG_USBHOST_LPWORKQ_PRIO -#define CONFIG_USBHOST_LPWORKQ_PRIO 1 -#endif -#ifndef CONFIG_USBHOST_LPWORKQ_STACKSIZE -#define CONFIG_USBHOST_LPWORKQ_STACKSIZE 2048 -#endif - #ifndef CONFIG_USBHOST_PSC_PRIO #define CONFIG_USBHOST_PSC_PRIO 4 #endif @@ -116,13 +122,15 @@ #define CONFIG_USBHOST_ASYNCH //#define CONFIG_USBHOST_GET_STRING_DESC -/* EHCI Configuration */ +/* ================ EHCI Configuration ================ */ + #define CONFIG_USB_EHCI_HCCR_BASE (0x20072000) #define CONFIG_USB_EHCI_HCOR_BASE (0x20072000 + 0x10) #define CONFIG_USB_EHCI_QH_NUM (10) #define CONFIG_USB_EHCI_QTD_NUM (10) // #define CONFIG_USB_EHCI_INFO_ENABLE -#define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE +// #define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE // #define CONFIG_USB_EHCI_CONFIGFLAG +// #define CONFIG_USB_EHCI_PORT_POWER #endif diff --git a/demo/es32/usb_host/ES32F369x/Inc/usb_config.h b/demo/es32/usb_host/ES32F369x/Inc/usb_config.h index 39c77df6..e01b709d 100644 --- a/demo/es32/usb_host/ES32F369x/Inc/usb_config.h +++ b/demo/es32/usb_host/ES32F369x/Inc/usb_config.h @@ -1,7 +1,13 @@ -#ifndef _USB_CONFIG_H -#define _USB_CONFIG_H +/* + * Copyright (c) 2022, sakumisu + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef CHERRYUSB_CONFIG_H +#define CHERRYUSB_CONFIG_H + +/* ================ USB common Configuration ================ */ -/* USB common Configuration */ #ifndef CONFIG_USB_DBG_LEVEL #define CONFIG_USB_DBG_LEVEL USB_DBG_INFO #endif @@ -10,26 +16,34 @@ #define CONFIG_USB_PRINTF printf #endif +/* attribute data into no cache ram */ +// #define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) +/* Enable print with color */ #define CONFIG_USB_PRINTF_COLOR_ENABLE -/* USB DEVICE Configuration */ +/* ================ USB DEVICE Configuration ================*/ + /* core */ -#ifndef CONFIG_USBDEV_REQUEST_BUFFER_LEN + +/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ #define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 -#endif - -#ifndef CONFIG_USBDEV_DESC_CHECK -#define CONFIG_USBDEV_DESC_CHECK 0 -#endif - -#ifndef CONFIG_USBDEV_TEST_MODE -#define CONFIG_USBDEV_TEST_MODE 0 -#endif +/* Setup packet log for debug */ +// #define CONFIG_USBDEV_SETUP_LOG_PRINT +/* Check if the input descriptor is correct */ +// #define CONFIG_USBDEV_DESC_CHECK +/* Enable test mode */ +// #define CONFIG_USBDEV_TEST_MODE /* cdc class */ + // #define CONFIG_USBDEV_CDC_ACM_UART /* msc class */ + +#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE +#define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 +#endif + #ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" #endif @@ -55,15 +69,17 @@ #endif /* audio class */ + #ifndef CONFIG_USBDEV_AUDIO_VERSION #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 #endif #ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL -#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 2 +#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 #endif -/* USB HOST Configuration */ +/* ================ USB HOST Configuration ================ */ + #ifndef CONFIG_USBHOST_RHPORTS #define CONFIG_USBHOST_RHPORTS 1 #endif @@ -92,20 +108,6 @@ #define CONFIG_USBHOST_MSC_TIMEOUT 5000 #endif -#ifndef CONFIG_USBHOST_HPWORKQ_PRIO -#define CONFIG_USBHOST_HPWORKQ_PRIO 5 -#endif -#ifndef CONFIG_USBHOST_HPWORKQ_STACKSIZE -#define CONFIG_USBHOST_HPWORKQ_STACKSIZE 2048 -#endif - -#ifndef CONFIG_USBHOST_LPWORKQ_PRIO -#define CONFIG_USBHOST_LPWORKQ_PRIO 1 -#endif -#ifndef CONFIG_USBHOST_LPWORKQ_STACKSIZE -#define CONFIG_USBHOST_LPWORKQ_STACKSIZE 2048 -#endif - #ifndef CONFIG_USBHOST_PSC_PRIO #define CONFIG_USBHOST_PSC_PRIO 4 #endif @@ -120,13 +122,15 @@ #define CONFIG_USBHOST_ASYNCH //#define CONFIG_USBHOST_GET_STRING_DESC -/* EHCI Configuration */ +/* ================ EHCI Configuration ================ */ + #define CONFIG_USB_EHCI_HCCR_BASE (0x20072000) #define CONFIG_USB_EHCI_HCOR_BASE (0x20072000 + 0x10) #define CONFIG_USB_EHCI_QH_NUM (10) #define CONFIG_USB_EHCI_QTD_NUM (10) // #define CONFIG_USB_EHCI_INFO_ENABLE -#define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE +// #define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE // #define CONFIG_USB_EHCI_CONFIGFLAG +// #define CONFIG_USB_EHCI_PORT_POWER #endif diff --git a/demo/hpm/usb_device/src/usb_config.h b/demo/hpm/usb_device/src/usb_config.h index 796e5b0c..09c64014 100644 --- a/demo/hpm/usb_device/src/usb_config.h +++ b/demo/hpm/usb_device/src/usb_config.h @@ -1,7 +1,13 @@ -#ifndef _USB_CONFIG_H -#define _USB_CONFIG_H +/* + * Copyright (c) 2022, sakumisu + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef CHERRYUSB_CONFIG_H +#define CHERRYUSB_CONFIG_H + +/* ================ USB common Configuration ================ */ -/* USB common Configuration */ #ifndef CONFIG_USB_DBG_LEVEL #define CONFIG_USB_DBG_LEVEL USB_DBG_INFO #endif @@ -10,23 +16,34 @@ #define CONFIG_USB_PRINTF printf #endif +/* attribute data into no cache ram */ +#define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) +/* Enable print with color */ #define CONFIG_USB_PRINTF_COLOR_ENABLE -#define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) -/* USB DEVICE Configuration */ -/* core */ -#ifndef CONFIG_USBDEV_REQUEST_BUFFER_LEN -#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 -#endif +/* ================ USB DEVICE Configuration ================*/ +/* core */ + +/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ +#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 +/* Setup packet log for debug */ // #define CONFIG_USBDEV_SETUP_LOG_PRINT +/* Check if the input descriptor is correct */ // #define CONFIG_USBDEV_DESC_CHECK +/* Enable test mode */ // #define CONFIG_USBDEV_TEST_MODE /* cdc class */ + // #define CONFIG_USBDEV_CDC_ACM_UART /* msc class */ + +#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE +#define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 +#endif + #ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" #endif @@ -52,15 +69,17 @@ #endif /* audio class */ + #ifndef CONFIG_USBDEV_AUDIO_VERSION #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 #endif #ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL -#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 2 +#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 #endif -/* USB HOST Configuration */ +/* ================ USB HOST Configuration ================ */ + #ifndef CONFIG_USBHOST_RHPORTS #define CONFIG_USBHOST_RHPORTS 1 #endif @@ -89,20 +108,6 @@ #define CONFIG_USBHOST_MSC_TIMEOUT 5000 #endif -#ifndef CONFIG_USBHOST_HPWORKQ_PRIO -#define CONFIG_USBHOST_HPWORKQ_PRIO 5 -#endif -#ifndef CONFIG_USBHOST_HPWORKQ_STACKSIZE -#define CONFIG_USBHOST_HPWORKQ_STACKSIZE 2048 -#endif - -#ifndef CONFIG_USBHOST_LPWORKQ_PRIO -#define CONFIG_USBHOST_LPWORKQ_PRIO 1 -#endif -#ifndef CONFIG_USBHOST_LPWORKQ_STACKSIZE -#define CONFIG_USBHOST_LPWORKQ_STACKSIZE 2048 -#endif - #ifndef CONFIG_USBHOST_PSC_PRIO #define CONFIG_USBHOST_PSC_PRIO 4 #endif @@ -117,7 +122,8 @@ #define CONFIG_USBHOST_ASYNCH //#define CONFIG_USBHOST_GET_STRING_DESC -/* EHCI Configuration */ +/* ================ EHCI Configuration ================ */ + #define CONFIG_USB_EHCI_HCCR_BASE (0x20072000) #define CONFIG_USB_EHCI_HCOR_BASE (0x20072000 + 0x10) #define CONFIG_USB_EHCI_QH_NUM (10) diff --git a/demo/hpm/usb_host/src/usb_config.h b/demo/hpm/usb_host/src/usb_config.h index e84c395b..e01b709d 100644 --- a/demo/hpm/usb_host/src/usb_config.h +++ b/demo/hpm/usb_host/src/usb_config.h @@ -1,7 +1,13 @@ -#ifndef _USB_CONFIG_H -#define _USB_CONFIG_H +/* + * Copyright (c) 2022, sakumisu + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef CHERRYUSB_CONFIG_H +#define CHERRYUSB_CONFIG_H + +/* ================ USB common Configuration ================ */ -/* USB common Configuration */ #ifndef CONFIG_USB_DBG_LEVEL #define CONFIG_USB_DBG_LEVEL USB_DBG_INFO #endif @@ -10,23 +16,34 @@ #define CONFIG_USB_PRINTF printf #endif -//#define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) +/* attribute data into no cache ram */ +// #define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) +/* Enable print with color */ #define CONFIG_USB_PRINTF_COLOR_ENABLE -/* USB DEVICE Configuration */ -/* core */ -#ifndef CONFIG_USBDEV_REQUEST_BUFFER_LEN -#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 -#endif +/* ================ USB DEVICE Configuration ================*/ +/* core */ + +/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ +#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 +/* Setup packet log for debug */ // #define CONFIG_USBDEV_SETUP_LOG_PRINT +/* Check if the input descriptor is correct */ // #define CONFIG_USBDEV_DESC_CHECK +/* Enable test mode */ // #define CONFIG_USBDEV_TEST_MODE /* cdc class */ + // #define CONFIG_USBDEV_CDC_ACM_UART /* msc class */ + +#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE +#define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 +#endif + #ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" #endif @@ -52,15 +69,17 @@ #endif /* audio class */ + #ifndef CONFIG_USBDEV_AUDIO_VERSION #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 #endif #ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL -#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 2 +#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 #endif -/* USB HOST Configuration */ +/* ================ USB HOST Configuration ================ */ + #ifndef CONFIG_USBHOST_RHPORTS #define CONFIG_USBHOST_RHPORTS 1 #endif @@ -103,14 +122,15 @@ #define CONFIG_USBHOST_ASYNCH //#define CONFIG_USBHOST_GET_STRING_DESC -/* EHCI Configuration */ -#define CONFIG_USB_EHCI_HCCR_BASE (0xF2020000UL) -#define CONFIG_USB_EHCI_HCOR_BASE (0xF2020000UL + 0x140) +/* ================ EHCI Configuration ================ */ + +#define CONFIG_USB_EHCI_HCCR_BASE (0x20072000) +#define CONFIG_USB_EHCI_HCOR_BASE (0x20072000 + 0x10) #define CONFIG_USB_EHCI_QH_NUM (10) #define CONFIG_USB_EHCI_QTD_NUM (10) // #define CONFIG_USB_EHCI_INFO_ENABLE // #define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE // #define CONFIG_USB_EHCI_CONFIGFLAG -#define CONFIG_USB_EHCI_PORT_POWER +// #define CONFIG_USB_EHCI_PORT_POWER #endif diff --git a/demo/stm32/usb_device/stm32f103c8t6/Core/Inc/usb_config.h b/demo/stm32/usb_device/stm32f103c8t6/Core/Inc/usb_config.h index 8c57c91b..e01b709d 100644 --- a/demo/stm32/usb_device/stm32f103c8t6/Core/Inc/usb_config.h +++ b/demo/stm32/usb_device/stm32f103c8t6/Core/Inc/usb_config.h @@ -1,7 +1,13 @@ -#ifndef _USB_CONFIG_H -#define _USB_CONFIG_H +/* + * Copyright (c) 2022, sakumisu + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef CHERRYUSB_CONFIG_H +#define CHERRYUSB_CONFIG_H + +/* ================ USB common Configuration ================ */ -/* USB common Configuration */ #ifndef CONFIG_USB_DBG_LEVEL #define CONFIG_USB_DBG_LEVEL USB_DBG_INFO #endif @@ -10,22 +16,34 @@ #define CONFIG_USB_PRINTF printf #endif +/* attribute data into no cache ram */ +// #define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) +/* Enable print with color */ #define CONFIG_USB_PRINTF_COLOR_ENABLE -/* USB DEVICE Configuration */ -/* core */ -#ifndef CONFIG_USBDEV_REQUEST_BUFFER_LEN -#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 -#endif +/* ================ USB DEVICE Configuration ================*/ +/* core */ + +/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ +#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 +/* Setup packet log for debug */ // #define CONFIG_USBDEV_SETUP_LOG_PRINT +/* Check if the input descriptor is correct */ // #define CONFIG_USBDEV_DESC_CHECK +/* Enable test mode */ // #define CONFIG_USBDEV_TEST_MODE /* cdc class */ + // #define CONFIG_USBDEV_CDC_ACM_UART /* msc class */ + +#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE +#define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 +#endif + #ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" #endif @@ -51,15 +69,17 @@ #endif /* audio class */ + #ifndef CONFIG_USBDEV_AUDIO_VERSION #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 #endif #ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL -#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 2 +#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 #endif -/* USB HOST Configuration */ +/* ================ USB HOST Configuration ================ */ + #ifndef CONFIG_USBHOST_RHPORTS #define CONFIG_USBHOST_RHPORTS 1 #endif @@ -88,20 +108,6 @@ #define CONFIG_USBHOST_MSC_TIMEOUT 5000 #endif -#ifndef CONFIG_USBHOST_HPWORKQ_PRIO -#define CONFIG_USBHOST_HPWORKQ_PRIO 5 -#endif -#ifndef CONFIG_USBHOST_HPWORKQ_STACKSIZE -#define CONFIG_USBHOST_HPWORKQ_STACKSIZE 2048 -#endif - -#ifndef CONFIG_USBHOST_LPWORKQ_PRIO -#define CONFIG_USBHOST_LPWORKQ_PRIO 1 -#endif -#ifndef CONFIG_USBHOST_LPWORKQ_STACKSIZE -#define CONFIG_USBHOST_LPWORKQ_STACKSIZE 2048 -#endif - #ifndef CONFIG_USBHOST_PSC_PRIO #define CONFIG_USBHOST_PSC_PRIO 4 #endif @@ -116,13 +122,15 @@ #define CONFIG_USBHOST_ASYNCH //#define CONFIG_USBHOST_GET_STRING_DESC -/* EHCI Configuration */ +/* ================ EHCI Configuration ================ */ + #define CONFIG_USB_EHCI_HCCR_BASE (0x20072000) #define CONFIG_USB_EHCI_HCOR_BASE (0x20072000 + 0x10) #define CONFIG_USB_EHCI_QH_NUM (10) #define CONFIG_USB_EHCI_QTD_NUM (10) // #define CONFIG_USB_EHCI_INFO_ENABLE -#define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE +// #define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE // #define CONFIG_USB_EHCI_CONFIGFLAG +// #define CONFIG_USB_EHCI_PORT_POWER #endif diff --git a/demo/stm32/usb_device/stm32f429igt6/Core/Inc/usb_config.h b/demo/stm32/usb_device/stm32f429igt6/Core/Inc/usb_config.h index 8c57c91b..e01b709d 100644 --- a/demo/stm32/usb_device/stm32f429igt6/Core/Inc/usb_config.h +++ b/demo/stm32/usb_device/stm32f429igt6/Core/Inc/usb_config.h @@ -1,7 +1,13 @@ -#ifndef _USB_CONFIG_H -#define _USB_CONFIG_H +/* + * Copyright (c) 2022, sakumisu + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef CHERRYUSB_CONFIG_H +#define CHERRYUSB_CONFIG_H + +/* ================ USB common Configuration ================ */ -/* USB common Configuration */ #ifndef CONFIG_USB_DBG_LEVEL #define CONFIG_USB_DBG_LEVEL USB_DBG_INFO #endif @@ -10,22 +16,34 @@ #define CONFIG_USB_PRINTF printf #endif +/* attribute data into no cache ram */ +// #define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) +/* Enable print with color */ #define CONFIG_USB_PRINTF_COLOR_ENABLE -/* USB DEVICE Configuration */ -/* core */ -#ifndef CONFIG_USBDEV_REQUEST_BUFFER_LEN -#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 -#endif +/* ================ USB DEVICE Configuration ================*/ +/* core */ + +/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ +#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 +/* Setup packet log for debug */ // #define CONFIG_USBDEV_SETUP_LOG_PRINT +/* Check if the input descriptor is correct */ // #define CONFIG_USBDEV_DESC_CHECK +/* Enable test mode */ // #define CONFIG_USBDEV_TEST_MODE /* cdc class */ + // #define CONFIG_USBDEV_CDC_ACM_UART /* msc class */ + +#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE +#define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 +#endif + #ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" #endif @@ -51,15 +69,17 @@ #endif /* audio class */ + #ifndef CONFIG_USBDEV_AUDIO_VERSION #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 #endif #ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL -#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 2 +#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 #endif -/* USB HOST Configuration */ +/* ================ USB HOST Configuration ================ */ + #ifndef CONFIG_USBHOST_RHPORTS #define CONFIG_USBHOST_RHPORTS 1 #endif @@ -88,20 +108,6 @@ #define CONFIG_USBHOST_MSC_TIMEOUT 5000 #endif -#ifndef CONFIG_USBHOST_HPWORKQ_PRIO -#define CONFIG_USBHOST_HPWORKQ_PRIO 5 -#endif -#ifndef CONFIG_USBHOST_HPWORKQ_STACKSIZE -#define CONFIG_USBHOST_HPWORKQ_STACKSIZE 2048 -#endif - -#ifndef CONFIG_USBHOST_LPWORKQ_PRIO -#define CONFIG_USBHOST_LPWORKQ_PRIO 1 -#endif -#ifndef CONFIG_USBHOST_LPWORKQ_STACKSIZE -#define CONFIG_USBHOST_LPWORKQ_STACKSIZE 2048 -#endif - #ifndef CONFIG_USBHOST_PSC_PRIO #define CONFIG_USBHOST_PSC_PRIO 4 #endif @@ -116,13 +122,15 @@ #define CONFIG_USBHOST_ASYNCH //#define CONFIG_USBHOST_GET_STRING_DESC -/* EHCI Configuration */ +/* ================ EHCI Configuration ================ */ + #define CONFIG_USB_EHCI_HCCR_BASE (0x20072000) #define CONFIG_USB_EHCI_HCOR_BASE (0x20072000 + 0x10) #define CONFIG_USB_EHCI_QH_NUM (10) #define CONFIG_USB_EHCI_QTD_NUM (10) // #define CONFIG_USB_EHCI_INFO_ENABLE -#define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE +// #define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE // #define CONFIG_USB_EHCI_CONFIGFLAG +// #define CONFIG_USB_EHCI_PORT_POWER #endif diff --git a/demo/stm32/usb_device/stm32h743vbt6/Core/Inc/usb_config.h b/demo/stm32/usb_device/stm32h743vbt6/Core/Inc/usb_config.h index 8c57c91b..e01b709d 100644 --- a/demo/stm32/usb_device/stm32h743vbt6/Core/Inc/usb_config.h +++ b/demo/stm32/usb_device/stm32h743vbt6/Core/Inc/usb_config.h @@ -1,7 +1,13 @@ -#ifndef _USB_CONFIG_H -#define _USB_CONFIG_H +/* + * Copyright (c) 2022, sakumisu + * + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef CHERRYUSB_CONFIG_H +#define CHERRYUSB_CONFIG_H + +/* ================ USB common Configuration ================ */ -/* USB common Configuration */ #ifndef CONFIG_USB_DBG_LEVEL #define CONFIG_USB_DBG_LEVEL USB_DBG_INFO #endif @@ -10,22 +16,34 @@ #define CONFIG_USB_PRINTF printf #endif +/* attribute data into no cache ram */ +// #define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) +/* Enable print with color */ #define CONFIG_USB_PRINTF_COLOR_ENABLE -/* USB DEVICE Configuration */ -/* core */ -#ifndef CONFIG_USBDEV_REQUEST_BUFFER_LEN -#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 -#endif +/* ================ USB DEVICE Configuration ================*/ +/* core */ + +/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ +#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 +/* Setup packet log for debug */ // #define CONFIG_USBDEV_SETUP_LOG_PRINT +/* Check if the input descriptor is correct */ // #define CONFIG_USBDEV_DESC_CHECK +/* Enable test mode */ // #define CONFIG_USBDEV_TEST_MODE /* cdc class */ + // #define CONFIG_USBDEV_CDC_ACM_UART /* msc class */ + +#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE +#define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 +#endif + #ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" #endif @@ -51,15 +69,17 @@ #endif /* audio class */ + #ifndef CONFIG_USBDEV_AUDIO_VERSION #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 #endif #ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL -#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 2 +#define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 #endif -/* USB HOST Configuration */ +/* ================ USB HOST Configuration ================ */ + #ifndef CONFIG_USBHOST_RHPORTS #define CONFIG_USBHOST_RHPORTS 1 #endif @@ -88,20 +108,6 @@ #define CONFIG_USBHOST_MSC_TIMEOUT 5000 #endif -#ifndef CONFIG_USBHOST_HPWORKQ_PRIO -#define CONFIG_USBHOST_HPWORKQ_PRIO 5 -#endif -#ifndef CONFIG_USBHOST_HPWORKQ_STACKSIZE -#define CONFIG_USBHOST_HPWORKQ_STACKSIZE 2048 -#endif - -#ifndef CONFIG_USBHOST_LPWORKQ_PRIO -#define CONFIG_USBHOST_LPWORKQ_PRIO 1 -#endif -#ifndef CONFIG_USBHOST_LPWORKQ_STACKSIZE -#define CONFIG_USBHOST_LPWORKQ_STACKSIZE 2048 -#endif - #ifndef CONFIG_USBHOST_PSC_PRIO #define CONFIG_USBHOST_PSC_PRIO 4 #endif @@ -116,13 +122,15 @@ #define CONFIG_USBHOST_ASYNCH //#define CONFIG_USBHOST_GET_STRING_DESC -/* EHCI Configuration */ +/* ================ EHCI Configuration ================ */ + #define CONFIG_USB_EHCI_HCCR_BASE (0x20072000) #define CONFIG_USB_EHCI_HCOR_BASE (0x20072000 + 0x10) #define CONFIG_USB_EHCI_QH_NUM (10) #define CONFIG_USB_EHCI_QTD_NUM (10) // #define CONFIG_USB_EHCI_INFO_ENABLE -#define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE +// #define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE // #define CONFIG_USB_EHCI_CONFIGFLAG +// #define CONFIG_USB_EHCI_PORT_POWER #endif