diff options
| author | hathach <[email protected]> | 2024-11-27 00:01:37 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2024-11-27 00:01:37 +0700 |
| commit | 123f1affb734e1bbec65708a6a721e199598e73f (patch) | |
| tree | b855200afa6b3dce7633f0b62bdc973d11170034 /src | |
| parent | 67e92e6688e609098270ba249f15a8dc7f051cbf (diff) | |
update device_info example to work with p4 dcache
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/tusb_mcu.h | 13 | ||||
| -rw-r--r-- | src/host/usbh.c | 110 | ||||
| -rw-r--r-- | src/tusb_option.h | 12 |
3 files changed, 71 insertions, 64 deletions
diff --git a/src/common/tusb_mcu.h b/src/common/tusb_mcu.h index 22d652913..e74e8b780 100644 --- a/src/common/tusb_mcu.h +++ b/src/common/tusb_mcu.h @@ -364,15 +364,14 @@ #define TUP_DCD_ENDPOINT_MAX 16 // FS 7 ep, HS 16 ep #define CFG_TUSB_OS_INC_PATH_DEFAULT freertos/ - #define CFG_TUSB_MEM_DCACHE_LINE_SIZE_DEFAULT 64 - - #if defined(CFG_TUD_DWC2_DMA_ENABLE) && CFG_TUD_DWC2_DMA_ENABLE == 1 - #define CFG_TUD_MEM_DCACHE_ENABLE_DEFAULT 1 - #endif - #define CFG_TUH_DWC2_DMA_ENABLE_DEFAULT 0 - #define CFG_TUH_MEM_DCACHE_ENABLE_DEFAULT 0 + // #define CFG_TUH_DWC2_DMA_ENABLE_DEFAULT 1 + // #define CFG_TUD_DWC2_SLAVE_ENABLE_DEFAULT 0 + // Enable host/device dcache if DMA is enabled + #define CFG_TUD_MEM_DCACHE_ENABLE_DEFAULT CFG_TUD_DWC2_DMA_ENABLE + #define CFG_TUH_MEM_DCACHE_ENABLE_DEFAULT CFG_TUH_DWC2_DMA_ENABLE + #define CFG_TUSB_MEM_DCACHE_LINE_SIZE_DEFAULT 64 #elif TU_CHECK_MCU(OPT_MCU_ESP32, OPT_MCU_ESP32C2, OPT_MCU_ESP32C3, OPT_MCU_ESP32C6, OPT_MCU_ESP32H2) #if (CFG_TUD_ENABLED || !(defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421)) diff --git a/src/host/usbh.c b/src/host/usbh.c index 4364efcf6..73753a713 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -152,65 +152,65 @@ typedef struct { #endif static usbh_class_driver_t const usbh_class_drivers[] = { - #if CFG_TUH_CDC - { - .name = DRIVER_NAME("CDC"), - .init = cdch_init, - .deinit = cdch_deinit, - .open = cdch_open, - .set_config = cdch_set_config, - .xfer_cb = cdch_xfer_cb, - .close = cdch_close - }, - #endif + #if CFG_TUH_CDC + { + .name = DRIVER_NAME("CDC"), + .init = cdch_init, + .deinit = cdch_deinit, + .open = cdch_open, + .set_config = cdch_set_config, + .xfer_cb = cdch_xfer_cb, + .close = cdch_close + }, + #endif - #if CFG_TUH_MSC - { - .name = DRIVER_NAME("MSC"), - .init = msch_init, - .deinit = msch_deinit, - .open = msch_open, - .set_config = msch_set_config, - .xfer_cb = msch_xfer_cb, - .close = msch_close - }, - #endif + #if CFG_TUH_MSC + { + .name = DRIVER_NAME("MSC"), + .init = msch_init, + .deinit = msch_deinit, + .open = msch_open, + .set_config = msch_set_config, + .xfer_cb = msch_xfer_cb, + .close = msch_close + }, + #endif - #if CFG_TUH_HID - { - .name = DRIVER_NAME("HID"), - .init = hidh_init, - .deinit = hidh_deinit, - .open = hidh_open, - .set_config = hidh_set_config, - .xfer_cb = hidh_xfer_cb, - .close = hidh_close - }, - #endif + #if CFG_TUH_HID + { + .name = DRIVER_NAME("HID"), + .init = hidh_init, + .deinit = hidh_deinit, + .open = hidh_open, + .set_config = hidh_set_config, + .xfer_cb = hidh_xfer_cb, + .close = hidh_close + }, + #endif - #if CFG_TUH_HUB - { - .name = DRIVER_NAME("HUB"), - .init = hub_init, - .deinit = hub_deinit, - .open = hub_open, - .set_config = hub_set_config, - .xfer_cb = hub_xfer_cb, - .close = hub_close - }, - #endif + #if CFG_TUH_HUB + { + .name = DRIVER_NAME("HUB"), + .init = hub_init, + .deinit = hub_deinit, + .open = hub_open, + .set_config = hub_set_config, + .xfer_cb = hub_xfer_cb, + .close = hub_close + }, + #endif - #if CFG_TUH_VENDOR - { - .name = DRIVER_NAME("VENDOR"), - .init = cush_init, - .deinit = cush_deinit, - .open = cush_open, - .set_config = cush_set_config, - .xfer_cb = cush_isr, - .close = cush_close - } - #endif + #if CFG_TUH_VENDOR + { + .name = DRIVER_NAME("VENDOR"), + .init = cush_init, + .deinit = cush_deinit, + .open = cush_open, + .set_config = cush_set_config, + .xfer_cb = cush_isr, + .close = cush_close + } + #endif }; enum { BUILTIN_DRIVER_COUNT = TU_ARRAY_SIZE(usbh_class_drivers) }; diff --git a/src/tusb_option.h b/src/tusb_option.h index d8b9feb16..989fb5032 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -249,12 +249,20 @@ //--------------------------------------------------------------------+ #ifndef CFG_TUD_DWC2_SLAVE_ENABLE - #define CFG_TUD_DWC2_SLAVE_ENABLE 1 + #ifndef CFG_TUD_DWC2_SLAVE_ENABLE_DEFAULT + #define CFG_TUD_DWC2_SLAVE_ENABLE_DEFAULT 1 + #endif + + #define CFG_TUD_DWC2_SLAVE_ENABLE CFG_TUD_DWC2_SLAVE_ENABLE_DEFAULT #endif // Enable DWC2 DMA for device #ifndef CFG_TUD_DWC2_DMA_ENABLE - #define CFG_TUD_DWC2_DMA_ENABLE 0 + #ifndef CFG_TUD_DWC2_DMA_ENABLE_DEFAULT + #define CFG_TUD_DWC2_DMA_ENABLE_DEFAULT 0 + #endif + + #define CFG_TUD_DWC2_DMA_ENABLE CFG_TUD_DWC2_DMA_ENABLE_DEFAULT #endif // Enable DWC2 Slave mode for host |
