From f8a3084b55e3a96c38f19d503cd256dbf5eaeb3e Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 14 Nov 2024 09:35:40 +0800 Subject: [PATCH] add usb --- .cproject | 36 ++- .mxproject | 81 +++--- .settings/language.settings.xml | 4 +- .vscode/c_cpp_properties.json | 3 + .vscode/settings.json | 6 +- Core | 2 +- Drivers | 2 +- FATFS/App/fatfs.c | 54 ++++ FATFS/App/fatfs.h | 47 ++++ FATFS/Target/ffconf.h | 273 ++++++++++++++++++++ FATFS/Target/usbh_diskio.c | 267 ++++++++++++++++++++ FATFS/Target/usbh_diskio.h | 40 +++ Middlewares | 2 +- README.md | 5 + USB_HOST/App/usb_host.c | 128 ++++++++++ USB_HOST/App/usb_host.h | 90 +++++++ USB_HOST/Target/usbh_conf.c | 539 ++++++++++++++++++++++++++++++++++++++++ USB_HOST/Target/usbh_conf.h | 194 +++++++++++++++ USB_HOST/Target/usbh_platform.c | 52 ++++ USB_HOST/Target/usbh_platform.h | 42 ++++ hand_acid_mainboard.ioc | 99 ++++---- stm32halport | 2 +- uappbase/apphal/apphal.cpp | 45 +++- uappbase/apphal/apphal.hpp | 1 + usrc/service/app_core.cpp | 6 + 25 files changed, 1924 insertions(+), 96 deletions(-) create mode 100644 FATFS/App/fatfs.c create mode 100644 FATFS/App/fatfs.h create mode 100644 FATFS/Target/ffconf.h create mode 100644 FATFS/Target/usbh_diskio.c create mode 100644 FATFS/Target/usbh_diskio.h create mode 100644 USB_HOST/App/usb_host.c create mode 100644 USB_HOST/App/usb_host.h create mode 100644 USB_HOST/Target/usbh_conf.c create mode 100644 USB_HOST/Target/usbh_conf.h create mode 100644 USB_HOST/Target/usbh_platform.c create mode 100644 USB_HOST/Target/usbh_platform.h diff --git a/.cproject b/.cproject index bd325b1..96a05b0 100644 --- a/.cproject +++ b/.cproject @@ -23,7 +23,7 @@ @@ -228,7 +258,9 @@ + + diff --git a/.mxproject b/.mxproject index b912566..b30b63b 100644 --- a/.mxproject +++ b/.mxproject @@ -1,48 +1,65 @@ [PreviousLibFiles] -LibFiles=Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_can.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_bus.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_system.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_utils.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dmamux.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_iwdg.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_iwdg.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rtc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_usart.h;Middlewares\Third_Party\FreeRTOS\Source\include\croutine.h;Middlewares\Third_Party\FreeRTOS\Source\include\deprecated_definitions.h;Middlewares\Third_Party\FreeRTOS\Source\include\event_groups.h;Middlewares\Third_Party\FreeRTOS\Source\include\FreeRTOS.h;Middlewares\Third_Party\FreeRTOS\Source\include\list.h;Middlewares\Third_Party\FreeRTOS\Source\include\message_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_prototypes.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_wrappers.h;Middlewares\Third_Party\FreeRTOS\Source\include\portable.h;Middlewares\Third_Party\FreeRTOS\Source\include\projdefs.h;Middlewares\Third_Party\FreeRTOS\Source\include\queue.h;Middlewares\Third_Party\FreeRTOS\Source\include\semphr.h;Middlewares\Third_Party\FreeRTOS\Source\include\stack_macros.h;Middlewares\Third_Party\FreeRTOS\Source\include\StackMacros.h;Middlewares\Third_Party\FreeRTOS\Source\include\stream_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\task.h;Middlewares\Third_Party\FreeRTOS\Source\include\timers.h;Middlewares\Third_Party\FreeRTOS\Source\include\atomic.h;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.h;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\portmacro.h;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_iwdg.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_can.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_bus.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_system.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_utils.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dmamux.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_iwdg.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_iwdg.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rtc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_usart.h;Middlewares\Third_Party\FreeRTOS\Source\include\croutine.h;Middlewares\Third_Party\FreeRTOS\Source\include\deprecated_definitions.h;Middlewares\Third_Party\FreeRTOS\Source\include\event_groups.h;Middlewares\Third_Party\FreeRTOS\Source\include\FreeRTOS.h;Middlewares\Third_Party\FreeRTOS\Source\include\list.h;Middlewares\Third_Party\FreeRTOS\Source\include\message_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_prototypes.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_wrappers.h;Middlewares\Third_Party\FreeRTOS\Source\include\portable.h;Middlewares\Third_Party\FreeRTOS\Source\include\projdefs.h;Middlewares\Third_Party\FreeRTOS\Source\include\queue.h;Middlewares\Third_Party\FreeRTOS\Source\include\semphr.h;Middlewares\Third_Party\FreeRTOS\Source\include\stack_macros.h;Middlewares\Third_Party\FreeRTOS\Source\include\StackMacros.h;Middlewares\Third_Party\FreeRTOS\Source\include\stream_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\task.h;Middlewares\Third_Party\FreeRTOS\Source\include\timers.h;Middlewares\Third_Party\FreeRTOS\Source\include\atomic.h;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.h;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\portmacro.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f407xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Drivers\CMSIS\Include\cachel1_armv7.h;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_armclang_ltm.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv81mml.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm35p.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm55.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_cm85.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\core_starmc1.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\pac_armv81.h;Drivers\CMSIS\Include\pmu_armv8.h;Drivers\CMSIS\Include\tz_context.h; +LibFiles=Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_hcd.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_usb.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_bus.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_system.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_utils.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dmamux.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_iwdg.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_iwdg.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rtc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_usart.h;Middlewares\Third_Party\FreeRTOS\Source\include\croutine.h;Middlewares\Third_Party\FreeRTOS\Source\include\deprecated_definitions.h;Middlewares\Third_Party\FreeRTOS\Source\include\event_groups.h;Middlewares\Third_Party\FreeRTOS\Source\include\FreeRTOS.h;Middlewares\Third_Party\FreeRTOS\Source\include\list.h;Middlewares\Third_Party\FreeRTOS\Source\include\message_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_prototypes.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_wrappers.h;Middlewares\Third_Party\FreeRTOS\Source\include\portable.h;Middlewares\Third_Party\FreeRTOS\Source\include\projdefs.h;Middlewares\Third_Party\FreeRTOS\Source\include\queue.h;Middlewares\Third_Party\FreeRTOS\Source\include\semphr.h;Middlewares\Third_Party\FreeRTOS\Source\include\stack_macros.h;Middlewares\Third_Party\FreeRTOS\Source\include\StackMacros.h;Middlewares\Third_Party\FreeRTOS\Source\include\stream_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\task.h;Middlewares\Third_Party\FreeRTOS\Source\include\timers.h;Middlewares\Third_Party\FreeRTOS\Source\include\atomic.h;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.h;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\portmacro.h;Middlewares\Third_Party\FatFs\src\diskio.h;Middlewares\Third_Party\FatFs\src\ff.h;Middlewares\Third_Party\FatFs\src\ff_gen_drv.h;Middlewares\Third_Party\FatFs\src\integer.h;Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_core.h;Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_ctlreq.h;Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_def.h;Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_ioreq.h;Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_pipes.h;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Inc\usbh_msc.h;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Inc\usbh_msc_bot.h;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Inc\usbh_msc_scsi.h;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_hcd.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_usb.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_iwdg.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Middlewares\Third_Party\FatFs\src\diskio.c;Middlewares\Third_Party\FatFs\src\ff.c;Middlewares\Third_Party\FatFs\src\ff_gen_drv.c;Middlewares\Third_Party\FatFs\src\option\syscall.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_core.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_ctlreq.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_ioreq.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_pipes.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc_bot.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc_scsi.c;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_hcd.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_usb.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_bus.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rcc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_system.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_utils.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_gpio.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dma.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_dmamux.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_pwr.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_cortex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_exti.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_crc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_iwdg.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_iwdg.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rng.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_rtc.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rtc_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_spi.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_tim.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h;Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_ll_usart.h;Middlewares\Third_Party\FreeRTOS\Source\include\croutine.h;Middlewares\Third_Party\FreeRTOS\Source\include\deprecated_definitions.h;Middlewares\Third_Party\FreeRTOS\Source\include\event_groups.h;Middlewares\Third_Party\FreeRTOS\Source\include\FreeRTOS.h;Middlewares\Third_Party\FreeRTOS\Source\include\list.h;Middlewares\Third_Party\FreeRTOS\Source\include\message_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_prototypes.h;Middlewares\Third_Party\FreeRTOS\Source\include\mpu_wrappers.h;Middlewares\Third_Party\FreeRTOS\Source\include\portable.h;Middlewares\Third_Party\FreeRTOS\Source\include\projdefs.h;Middlewares\Third_Party\FreeRTOS\Source\include\queue.h;Middlewares\Third_Party\FreeRTOS\Source\include\semphr.h;Middlewares\Third_Party\FreeRTOS\Source\include\stack_macros.h;Middlewares\Third_Party\FreeRTOS\Source\include\StackMacros.h;Middlewares\Third_Party\FreeRTOS\Source\include\stream_buffer.h;Middlewares\Third_Party\FreeRTOS\Source\include\task.h;Middlewares\Third_Party\FreeRTOS\Source\include\timers.h;Middlewares\Third_Party\FreeRTOS\Source\include\atomic.h;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.h;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\portmacro.h;Middlewares\Third_Party\FatFs\src\diskio.h;Middlewares\Third_Party\FatFs\src\ff.h;Middlewares\Third_Party\FatFs\src\ff_gen_drv.h;Middlewares\Third_Party\FatFs\src\integer.h;Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_core.h;Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_ctlreq.h;Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_def.h;Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_ioreq.h;Middlewares\ST\STM32_USB_Host_Library\Core\Inc\usbh_pipes.h;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Inc\usbh_msc.h;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Inc\usbh_msc_bot.h;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Inc\usbh_msc_scsi.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f407xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Drivers\CMSIS\Include\cachel1_armv7.h;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_armclang_ltm.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv81mml.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm35p.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm55.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_cm85.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\core_starmc1.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\pac_armv81.h;Drivers\CMSIS\Include\pmu_armv8.h;Drivers\CMSIS\Include\tz_context.h; [PreviousUsedCubeIDEFiles] -SourceFiles=Core\Src\main.c;Core\Src\gpio.c;Core\Src\freertos.c;Core\Src\can.c;Core\Src\crc.c;Core\Src\dma.c;Core\Src\iwdg.c;Core\Src\rng.c;Core\Src\rtc.c;Core\Src\spi.c;Core\Src\tim.c;Core\Src\usart.c;Core\Src\stm32f4xx_it.c;Core\Src\stm32f4xx_hal_msp.c;Core\Src\stm32f4xx_hal_timebase_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_iwdg.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Core\Src\system_stm32f4xx.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_can.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_iwdg.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Core\Src\system_stm32f4xx.c;;;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c; -HeaderPath=Drivers\STM32F4xx_HAL_Driver\Inc;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy;Middlewares\Third_Party\FreeRTOS\Source\include;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F;Drivers\CMSIS\Device\ST\STM32F4xx\Include;Drivers\CMSIS\Include;Core\Inc; +SourceFiles=Core\Src\main.c;Core\Src\gpio.c;Core\Src\freertos.c;Core\Src\crc.c;Core\Src\dma.c;FATFS\Target\usbh_diskio.c;FATFS\App\fatfs.c;Core\Src\iwdg.c;Core\Src\rng.c;Core\Src\rtc.c;Core\Src\spi.c;Core\Src\tim.c;Core\Src\usart.c;USB_HOST\App\usb_host.c;USB_HOST\Target\usbh_conf.c;USB_HOST\Target\usbh_platform.c;Core\Src\stm32f4xx_it.c;Core\Src\stm32f4xx_hal_msp.c;Core\Src\stm32f4xx_hal_timebase_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_hcd.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_usb.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_iwdg.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Middlewares\Third_Party\FatFs\src\diskio.c;Middlewares\Third_Party\FatFs\src\ff.c;Middlewares\Third_Party\FatFs\src\ff_gen_drv.c;Middlewares\Third_Party\FatFs\src\option\syscall.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_core.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_ctlreq.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_ioreq.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_pipes.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc_bot.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc_scsi.c;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Core\Src\system_stm32f4xx.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_hcd.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_usb.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rcc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_flash_ramfunc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_gpio.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_dma.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_pwr_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_cortex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_exti.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_crc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_iwdg.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rng.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_rtc_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_spi.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_tim_ex.c;Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_hal_uart.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Middlewares\Third_Party\FatFs\src\diskio.c;Middlewares\Third_Party\FatFs\src\ff.c;Middlewares\Third_Party\FatFs\src\ff_gen_drv.c;Middlewares\Third_Party\FatFs\src\option\syscall.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_core.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_ctlreq.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_ioreq.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_pipes.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc_bot.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc_scsi.c;Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c;Core\Src\system_stm32f4xx.c;;;Middlewares\Third_Party\FatFs\src\diskio.c;Middlewares\Third_Party\FatFs\src\ff.c;Middlewares\Third_Party\FatFs\src\ff_gen_drv.c;Middlewares\Third_Party\FatFs\src\option\syscall.c;Middlewares\Third_Party\FreeRTOS\Source\croutine.c;Middlewares\Third_Party\FreeRTOS\Source\event_groups.c;Middlewares\Third_Party\FreeRTOS\Source\list.c;Middlewares\Third_Party\FreeRTOS\Source\queue.c;Middlewares\Third_Party\FreeRTOS\Source\stream_buffer.c;Middlewares\Third_Party\FreeRTOS\Source\tasks.c;Middlewares\Third_Party\FreeRTOS\Source\timers.c;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS\cmsis_os.c;Middlewares\Third_Party\FreeRTOS\Source\portable\MemMang\heap_4.c;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F\port.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_core.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_ctlreq.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_ioreq.c;Middlewares\ST\STM32_USB_Host_Library\Core\Src\usbh_pipes.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc_bot.c;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Src\usbh_msc_scsi.c; +HeaderPath=Drivers\STM32F4xx_HAL_Driver\Inc;Drivers\STM32F4xx_HAL_Driver\Inc\Legacy;Middlewares\Third_Party\FreeRTOS\Source\include;Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS;Middlewares\Third_Party\FreeRTOS\Source\portable\GCC\ARM_CM4F;Middlewares\Third_Party\FatFs\src;Middlewares\ST\STM32_USB_Host_Library\Core\Inc;Middlewares\ST\STM32_USB_Host_Library\Class\MSC\Inc;Drivers\CMSIS\Device\ST\STM32F4xx\Include;Drivers\CMSIS\Include;Core\Inc;FATFS\Target;FATFS\App;USB_HOST\App;USB_HOST\Target; CDefines=USE_HAL_DRIVER;STM32F407xx;USE_HAL_DRIVER;USE_HAL_DRIVER; [PreviousGenFiles] AdvancedFolderStructure=true -HeaderFileListSize=14 +HeaderFileListSize=19 HeaderFiles#0=..\Core\Inc\gpio.h HeaderFiles#1=..\Core\Inc\FreeRTOSConfig.h -HeaderFiles#2=..\Core\Inc\can.h -HeaderFiles#3=..\Core\Inc\crc.h -HeaderFiles#4=..\Core\Inc\dma.h -HeaderFiles#5=..\Core\Inc\iwdg.h -HeaderFiles#6=..\Core\Inc\rng.h -HeaderFiles#7=..\Core\Inc\rtc.h -HeaderFiles#8=..\Core\Inc\spi.h -HeaderFiles#9=..\Core\Inc\tim.h -HeaderFiles#10=..\Core\Inc\usart.h -HeaderFiles#11=..\Core\Inc\stm32f4xx_it.h -HeaderFiles#12=..\Core\Inc\stm32f4xx_hal_conf.h -HeaderFiles#13=..\Core\Inc\main.h -HeaderFolderListSize=1 +HeaderFiles#2=..\Core\Inc\crc.h +HeaderFiles#3=..\Core\Inc\dma.h +HeaderFiles#4=..\FATFS\Target\ffconf.h +HeaderFiles#5=..\FATFS\Target\usbh_diskio.h +HeaderFiles#6=..\FATFS\App\fatfs.h +HeaderFiles#7=..\Core\Inc\iwdg.h +HeaderFiles#8=..\Core\Inc\rng.h +HeaderFiles#9=..\Core\Inc\rtc.h +HeaderFiles#10=..\Core\Inc\spi.h +HeaderFiles#11=..\Core\Inc\tim.h +HeaderFiles#12=..\Core\Inc\usart.h +HeaderFiles#13=..\USB_HOST\App\usb_host.h +HeaderFiles#14=..\USB_HOST\Target\usbh_conf.h +HeaderFiles#15=..\USB_HOST\Target\usbh_platform.h +HeaderFiles#16=..\Core\Inc\stm32f4xx_it.h +HeaderFiles#17=..\Core\Inc\stm32f4xx_hal_conf.h +HeaderFiles#18=..\Core\Inc\main.h +HeaderFolderListSize=5 HeaderPath#0=..\Core\Inc +HeaderPath#1=..\FATFS\Target +HeaderPath#2=..\FATFS\App +HeaderPath#3=..\USB_HOST\App +HeaderPath#4=..\USB_HOST\Target HeaderFiles=; -SourceFileListSize=15 +SourceFileListSize=19 SourceFiles#0=..\Core\Src\gpio.c SourceFiles#1=..\Core\Src\freertos.c -SourceFiles#2=..\Core\Src\can.c -SourceFiles#3=..\Core\Src\crc.c -SourceFiles#4=..\Core\Src\dma.c -SourceFiles#5=..\Core\Src\iwdg.c -SourceFiles#6=..\Core\Src\rng.c -SourceFiles#7=..\Core\Src\rtc.c -SourceFiles#8=..\Core\Src\spi.c -SourceFiles#9=..\Core\Src\tim.c -SourceFiles#10=..\Core\Src\usart.c -SourceFiles#11=..\Core\Src\stm32f4xx_it.c -SourceFiles#12=..\Core\Src\stm32f4xx_hal_msp.c -SourceFiles#13=..\Core\Src\stm32f4xx_hal_timebase_tim.c -SourceFiles#14=..\Core\Src\main.c -SourceFolderListSize=1 +SourceFiles#2=..\Core\Src\crc.c +SourceFiles#3=..\Core\Src\dma.c +SourceFiles#4=..\FATFS\Target\usbh_diskio.c +SourceFiles#5=..\FATFS\App\fatfs.c +SourceFiles#6=..\Core\Src\iwdg.c +SourceFiles#7=..\Core\Src\rng.c +SourceFiles#8=..\Core\Src\rtc.c +SourceFiles#9=..\Core\Src\spi.c +SourceFiles#10=..\Core\Src\tim.c +SourceFiles#11=..\Core\Src\usart.c +SourceFiles#12=..\USB_HOST\App\usb_host.c +SourceFiles#13=..\USB_HOST\Target\usbh_conf.c +SourceFiles#14=..\USB_HOST\Target\usbh_platform.c +SourceFiles#15=..\Core\Src\stm32f4xx_it.c +SourceFiles#16=..\Core\Src\stm32f4xx_hal_msp.c +SourceFiles#17=..\Core\Src\stm32f4xx_hal_timebase_tim.c +SourceFiles#18=..\Core\Src\main.c +SourceFolderListSize=5 SourcePath#0=..\Core\Src +SourcePath#1=..\FATFS\Target +SourcePath#2=..\FATFS\App +SourcePath#3=..\USB_HOST\App +SourcePath#4=..\USB_HOST\Target SourceFiles=; diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 1eb30e0..adb54ce 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 1a9f159..25a42ae 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -10,6 +10,9 @@ "./Middlewares/Third_Party/FreeRTOS/Source/include", "./Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS", "./Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F", + "./Middlewares/ST/STM32_USB_Host_Library/Core/Inc/", + "USB_HOST/Target/", + "Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Inc/", "./Drivers/CMSIS/Device/ST/STM32F4xx/Include", "./Drivers/CMSIS/Include", "./usrc/", diff --git a/.vscode/settings.json b/.vscode/settings.json index d8e4856..1c6c9fd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -90,7 +90,11 @@ "xmemory": "cpp", "xstring": "cpp", "stm32f4xx_hal_rtc.h": "c", - "stm32f4xx_hal_rtc_ex.h": "c" + "stm32f4xx_hal_rtc_ex.h": "c", + "usb_otg.h": "c", + "stm32f4xx_hal_hcd.h": "c", + "usb_host.h": "c", + "usbh_core.h": "c" }, "files.autoGuessEncoding": false, "files.encoding": "gb2312" diff --git a/Core b/Core index fe78220..fd98100 160000 --- a/Core +++ b/Core @@ -1 +1 @@ -Subproject commit fe78220f807588b84f1a45712eacb4a5fded971e +Subproject commit fd9810003dcdd1c419fea3444dad1528b881822a diff --git a/Drivers b/Drivers index ec0007f..c3dadcb 160000 --- a/Drivers +++ b/Drivers @@ -1 +1 @@ -Subproject commit ec0007fadbdd5a34d2dd0f1fc86811675458f19f +Subproject commit c3dadcb8c6850dff86543647e73fb80b2b236dfa diff --git a/FATFS/App/fatfs.c b/FATFS/App/fatfs.c new file mode 100644 index 0000000..4ab4014 --- /dev/null +++ b/FATFS/App/fatfs.c @@ -0,0 +1,54 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file fatfs.c + * @brief Code for fatfs applications + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +#include "fatfs.h" + +uint8_t retUSBH; /* Return value for USBH */ +char USBHPath[4]; /* USBH logical drive path */ +FATFS USBHFatFS; /* File system object for USBH logical drive */ +FIL USBHFile; /* File object for USBH */ + +/* USER CODE BEGIN Variables */ + +/* USER CODE END Variables */ + +void MX_FATFS_Init(void) +{ + /*## FatFS: Link the USBH driver ###########################*/ + retUSBH = FATFS_LinkDriver(&USBH_Driver, USBHPath); + + /* USER CODE BEGIN Init */ + /* additional user code for init */ + /* USER CODE END Init */ +} + +/** + * @brief Gets Time from RTC + * @param None + * @retval Time in DWORD + */ +DWORD get_fattime(void) +{ + /* USER CODE BEGIN get_fattime */ + return 0; + /* USER CODE END get_fattime */ +} + +/* USER CODE BEGIN Application */ + +/* USER CODE END Application */ diff --git a/FATFS/App/fatfs.h b/FATFS/App/fatfs.h new file mode 100644 index 0000000..9cd534e --- /dev/null +++ b/FATFS/App/fatfs.h @@ -0,0 +1,47 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file fatfs.h + * @brief Header for fatfs applications + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __fatfs_H +#define __fatfs_H +#ifdef __cplusplus + extern "C" { +#endif + +#include "ff.h" +#include "ff_gen_drv.h" +#include "usbh_diskio.h" /* defines USBH_Driver as external */ + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +extern uint8_t retUSBH; /* Return value for USBH */ +extern char USBHPath[4]; /* USBH logical drive path */ +extern FATFS USBHFatFS; /* File system object for USBH logical drive */ +extern FIL USBHFile; /* File object for USBH */ + +void MX_FATFS_Init(void); + +/* USER CODE BEGIN Prototypes */ + +/* USER CODE END Prototypes */ +#ifdef __cplusplus +} +#endif +#endif /*__fatfs_H */ diff --git a/FATFS/Target/ffconf.h b/FATFS/Target/ffconf.h new file mode 100644 index 0000000..63ab990 --- /dev/null +++ b/FATFS/Target/ffconf.h @@ -0,0 +1,273 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * FatFs - Generic FAT file system module R0.12c (C)ChaN, 2017 + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +#ifndef _FFCONF +#define _FFCONF 68300 /* Revision ID */ + +/*-----------------------------------------------------------------------------/ +/ Additional user header to be used +/-----------------------------------------------------------------------------*/ +#include "main.h" +#include "stm32f4xx_hal.h" +#include "usbh_core.h" +#include "usbh_msc.h" +#include "cmsis_os.h" /* _FS_REENTRANT set to 1 and CMSIS API chosen */ +/* Handle for USB Host */ +#define hUSB_Host hUsbHostFS + +/*-----------------------------------------------------------------------------/ +/ Function Configurations +/-----------------------------------------------------------------------------*/ + +#define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */ +/* This option switches read-only configuration. (0:Read/Write or 1:Read-only) +/ Read-only configuration removes writing API functions, f_write(), f_sync(), +/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree() +/ and optional writing functions as well. */ + +#define _FS_MINIMIZE 0 /* 0 to 3 */ +/* This option defines minimization level to remove some basic API functions. +/ +/ 0: All basic functions are enabled. +/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename() +/ are removed. +/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1. +/ 3: f_lseek() function is removed in addition to 2. */ + +#define _USE_STRFUNC 2 /* 0:Disable or 1-2:Enable */ +/* This option switches string functions, f_gets(), f_putc(), f_puts() and +/ f_printf(). +/ +/ 0: Disable string functions. +/ 1: Enable without LF-CRLF conversion. +/ 2: Enable with LF-CRLF conversion. */ + +#define _USE_FIND 0 +/* This option switches filtered directory read functions, f_findfirst() and +/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */ + +#define _USE_MKFS 1 +/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */ + +#define _USE_FASTSEEK 1 +/* This option switches fast seek feature. (0:Disable or 1:Enable) */ + +#define _USE_EXPAND 0 +/* This option switches f_expand function. (0:Disable or 1:Enable) */ + +#define _USE_CHMOD 0 +/* This option switches attribute manipulation functions, f_chmod() and f_utime(). +/ (0:Disable or 1:Enable) Also _FS_READONLY needs to be 0 to enable this option. */ + +#define _USE_LABEL 0 +/* This option switches volume label functions, f_getlabel() and f_setlabel(). +/ (0:Disable or 1:Enable) */ + +#define _USE_FORWARD 0 +/* This option switches f_forward() function. (0:Disable or 1:Enable) */ + +/*-----------------------------------------------------------------------------/ +/ Locale and Namespace Configurations +/-----------------------------------------------------------------------------*/ + +#define _CODE_PAGE 936 +/* This option specifies the OEM code page to be used on the target system. +/ Incorrect setting of the code page can cause a file open failure. +/ +/ 1 - ASCII (No extended character. Non-LFN cfg. only) +/ 437 - U.S. +/ 720 - Arabic +/ 737 - Greek +/ 771 - KBL +/ 775 - Baltic +/ 850 - Latin 1 +/ 852 - Latin 2 +/ 855 - Cyrillic +/ 857 - Turkish +/ 860 - Portuguese +/ 861 - Icelandic +/ 862 - Hebrew +/ 863 - Canadian French +/ 864 - Arabic +/ 865 - Nordic +/ 866 - Russian +/ 869 - Greek 2 +/ 932 - Japanese (DBCS) +/ 936 - Simplified Chinese (DBCS) +/ 949 - Korean (DBCS) +/ 950 - Traditional Chinese (DBCS) +*/ + +#define _USE_LFN 0 /* 0 to 3 */ +#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */ +/* The _USE_LFN switches the support of long file name (LFN). +/ +/ 0: Disable support of LFN. _MAX_LFN has no effect. +/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe. +/ 2: Enable LFN with dynamic working buffer on the STACK. +/ 3: Enable LFN with dynamic working buffer on the HEAP. +/ +/ To enable the LFN, Unicode handling functions (option/unicode.c) must be added +/ to the project. The working buffer occupies (_MAX_LFN + 1) * 2 bytes and +/ additional 608 bytes at exFAT enabled. _MAX_LFN can be in range from 12 to 255. +/ It should be set 255 to support full featured LFN operations. +/ When use stack for the working buffer, take care on stack overflow. When use heap +/ memory for the working buffer, memory management functions, ff_memalloc() and +/ ff_memfree(), must be added to the project. */ + +#define _LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */ +/* This option switches character encoding on the API. (0:ANSI/OEM or 1:UTF-16) +/ To use Unicode string for the path name, enable LFN and set _LFN_UNICODE = 1. +/ This option also affects behavior of string I/O functions. */ + +#define _STRF_ENCODE 3 +/* When _LFN_UNICODE == 1, this option selects the character encoding ON THE FILE to +/ be read/written via string I/O functions, f_gets(), f_putc(), f_puts and f_printf(). +/ +/ 0: ANSI/OEM +/ 1: UTF-16LE +/ 2: UTF-16BE +/ 3: UTF-8 +/ +/ This option has no effect when _LFN_UNICODE == 0. */ + +#define _FS_RPATH 0 /* 0 to 2 */ +/* This option configures support of relative path. +/ +/ 0: Disable relative path and remove related functions. +/ 1: Enable relative path. f_chdir() and f_chdrive() are available. +/ 2: f_getcwd() function is available in addition to 1. +*/ + +/*---------------------------------------------------------------------------/ +/ Drive/Volume Configurations +/----------------------------------------------------------------------------*/ + +#define _VOLUMES 1 +/* Number of volumes (logical drives) to be used. */ + +/* USER CODE BEGIN Volumes */ +#define _STR_VOLUME_ID 0 /* 0:Use only 0-9 for drive ID, 1:Use strings for drive ID */ +#define _VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3" +/* _STR_VOLUME_ID switches string support of volume ID. +/ When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive +/ number in the path name. _VOLUME_STRS defines the drive ID strings for each +/ logical drives. Number of items must be equal to _VOLUMES. Valid characters for +/ the drive ID strings are: A-Z and 0-9. */ +/* USER CODE END Volumes */ + +#define _MULTI_PARTITION 0 /* 0:Single partition, 1:Multiple partition */ +/* This option switches support of multi-partition on a physical drive. +/ By default (0), each logical drive number is bound to the same physical drive +/ number and only an FAT volume found on the physical drive will be mounted. +/ When multi-partition is enabled (1), each logical drive number can be bound to +/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk() +/ function will be available. */ +#define _MIN_SS 512 /* 512, 1024, 2048 or 4096 */ +#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */ +/* These options configure the range of sector size to be supported. (512, 1024, +/ 2048 or 4096) Always set both 512 for most systems, all type of memory cards and +/ harddisk. But a larger value may be required for on-board flash memory and some +/ type of optical media. When _MAX_SS is larger than _MIN_SS, FatFs is configured +/ to variable sector size and GET_SECTOR_SIZE command must be implemented to the +/ disk_ioctl() function. */ + +#define _USE_TRIM 0 +/* This option switches support of ATA-TRIM. (0:Disable or 1:Enable) +/ To enable Trim function, also CTRL_TRIM command should be implemented to the +/ disk_ioctl() function. */ + +#define _FS_NOFSINFO 0 /* 0,1,2 or 3 */ +/* If you need to know correct free space on the FAT32 volume, set bit 0 of this +/ option, and f_getfree() function at first time after volume mount will force +/ a full FAT scan. Bit 1 controls the use of last allocated cluster number. +/ +/ bit0=0: Use free cluster count in the FSINFO if available. +/ bit0=1: Do not trust free cluster count in the FSINFO. +/ bit1=0: Use last allocated cluster number in the FSINFO if available. +/ bit1=1: Do not trust last allocated cluster number in the FSINFO. +*/ + +/*---------------------------------------------------------------------------/ +/ System Configurations +/----------------------------------------------------------------------------*/ + +#define _FS_TINY 0 /* 0:Normal or 1:Tiny */ +/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny) +/ At the tiny configuration, size of file object (FIL) is reduced _MAX_SS bytes. +/ Instead of private sector buffer eliminated from the file object, common sector +/ buffer in the file system object (FATFS) is used for the file data transfer. */ + +#define _FS_EXFAT 0 +/* This option switches support of exFAT file system. (0:Disable or 1:Enable) +/ When enable exFAT, also LFN needs to be enabled. (_USE_LFN >= 1) +/ Note that enabling exFAT discards C89 compatibility. */ + +#define _FS_NORTC 0 +#define _NORTC_MON 6 +#define _NORTC_MDAY 4 +#define _NORTC_YEAR 2015 +/* The option _FS_NORTC switches timestamp function. If the system does not have +/ any RTC function or valid timestamp is not needed, set _FS_NORTC = 1 to disable +/ the timestamp function. All objects modified by FatFs will have a fixed timestamp +/ defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR in local time. +/ To enable timestamp function (_FS_NORTC = 0), get_fattime() function need to be +/ added to the project to get current time form real-time clock. _NORTC_MON, +/ _NORTC_MDAY and _NORTC_YEAR have no effect. +/ These options have no effect at read-only configuration (_FS_READONLY = 1). */ + +#define _FS_LOCK 2 /* 0:Disable or >=1:Enable */ +/* The option _FS_LOCK switches file lock function to control duplicated file open +/ and illegal operation to open objects. This option must be 0 when _FS_READONLY +/ is 1. +/ +/ 0: Disable file lock function. To avoid volume corruption, application program +/ should avoid illegal open, remove and rename to the open objects. +/ >0: Enable file lock function. The value defines how many files/sub-directories +/ can be opened simultaneously under file lock control. Note that the file +/ lock control is independent of re-entrancy. */ + +#define _FS_REENTRANT 1 /* 0:Disable or 1:Enable */ + +#define _USE_MUTEX 0 /* 0:Disable or 1:Enable */ +#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */ +#define _SYNC_t osSemaphoreId +/* The option _FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs +/ module itself. Note that regardless of this option, file access to different +/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs() +/ and f_fdisk() function, are always not re-entrant. Only file/directory access +/ to the same volume is under control of this function. +/ +/ 0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect. +/ 1: Enable re-entrancy. Also user provided synchronization handlers, +/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj() +/ function, must be added to the project. Samples are available in +/ option/syscall.c. +/ +/ The _FS_TIMEOUT defines timeout period in unit of time tick. +/ The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*, +/ SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be +/ included somewhere in the scope of ff.h. */ + +/* define the ff_malloc ff_free macros as FreeRTOS pvPortMalloc and vPortFree macros */ +#if !defined(ff_malloc) && !defined(ff_free) +#define ff_malloc pvPortMalloc +#define ff_free vPortFree +#endif + +#endif /* _FFCONF */ diff --git a/FATFS/Target/usbh_diskio.c b/FATFS/Target/usbh_diskio.c new file mode 100644 index 0000000..09c9c39 --- /dev/null +++ b/FATFS/Target/usbh_diskio.c @@ -0,0 +1,267 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file usbh_diskio.c (based on usbh_diskio_template.c v2.0.2) + * @brief USB Host Disk I/O driver + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +/* USER CODE BEGIN firstSection */ +/* can be used to modify / undefine following code or add new definitions */ +/* USER CODE END firstSection */ + +/* Includes ------------------------------------------------------------------*/ +#include "ff_gen_drv.h" +#include "usbh_diskio.h" + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ + +#define USB_DEFAULT_BLOCK_SIZE 512 + +/* Private variables ---------------------------------------------------------*/ +extern USBH_HandleTypeDef hUSB_Host; + +/* Private function prototypes -----------------------------------------------*/ +DSTATUS USBH_initialize (BYTE); +DSTATUS USBH_status (BYTE); +DRESULT USBH_read (BYTE, BYTE*, DWORD, UINT); + +#if _USE_WRITE == 1 + DRESULT USBH_write (BYTE, const BYTE*, DWORD, UINT); +#endif /* _USE_WRITE == 1 */ + +#if _USE_IOCTL == 1 + DRESULT USBH_ioctl (BYTE, BYTE, void*); +#endif /* _USE_IOCTL == 1 */ + +const Diskio_drvTypeDef USBH_Driver = +{ + USBH_initialize, + USBH_status, + USBH_read, +#if _USE_WRITE == 1 + USBH_write, +#endif /* _USE_WRITE == 1 */ +#if _USE_IOCTL == 1 + USBH_ioctl, +#endif /* _USE_IOCTL == 1 */ +}; + +/* USER CODE BEGIN beforeFunctionSection */ +/* can be used to modify / undefine following code or add new code */ +/* USER CODE END beforeFunctionSection */ + +/* Private functions ---------------------------------------------------------*/ + +/** + * @brief Initializes a Drive + * @param lun : lun id + * @retval DSTATUS: Operation status + */ +DSTATUS USBH_initialize(BYTE lun) +{ + /* CAUTION : USB Host library has to be initialized in the application */ + + return RES_OK; +} + +/** + * @brief Gets Disk Status + * @param lun : lun id + * @retval DSTATUS: Operation status + */ +DSTATUS USBH_status(BYTE lun) +{ + DRESULT res = RES_ERROR; + + if(USBH_MSC_UnitIsReady(&hUSB_Host, lun)) + { + res = RES_OK; + } + else + { + res = RES_ERROR; + } + + return res; +} + +/* USER CODE BEGIN beforeReadSection */ +/* can be used to modify previous code / undefine following code / add new code */ +/* USER CODE END beforeReadSection */ + +/** + * @brief Reads Sector(s) + * @param lun : lun id + * @param *buff: Data buffer to store read data + * @param sector: Sector address (LBA) + * @param count: Number of sectors to read (1..128) + * @retval DRESULT: Operation result + */ +DRESULT USBH_read(BYTE lun, BYTE *buff, DWORD sector, UINT count) +{ + DRESULT res = RES_ERROR; + MSC_LUNTypeDef info; + + if(USBH_MSC_Read(&hUSB_Host, lun, sector, buff, count) == USBH_OK) + { + res = RES_OK; + } + else + { + USBH_MSC_GetLUNInfo(&hUSB_Host, lun, &info); + + switch (info.sense.asc) + { + case SCSI_ASC_LOGICAL_UNIT_NOT_READY: + case SCSI_ASC_MEDIUM_NOT_PRESENT: + case SCSI_ASC_NOT_READY_TO_READY_CHANGE: + USBH_ErrLog ("USB Disk is not ready!"); + res = RES_NOTRDY; + break; + + default: + res = RES_ERROR; + break; + } + } + + return res; +} + +/* USER CODE BEGIN beforeWriteSection */ +/* can be used to modify previous code / undefine following code / add new code */ +/* USER CODE END beforeWriteSection */ + +/** + * @brief Writes Sector(s) + * @param lun : lun id + * @param *buff: Data to be written + * @param sector: Sector address (LBA) + * @param count: Number of sectors to write (1..128) + * @retval DRESULT: Operation result + */ +#if _USE_WRITE == 1 +DRESULT USBH_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count) +{ + DRESULT res = RES_ERROR; + MSC_LUNTypeDef info; + + if(USBH_MSC_Write(&hUSB_Host, lun, sector, (BYTE *)buff, count) == USBH_OK) + { + res = RES_OK; + } + else + { + USBH_MSC_GetLUNInfo(&hUSB_Host, lun, &info); + + switch (info.sense.asc) + { + case SCSI_ASC_WRITE_PROTECTED: + USBH_ErrLog("USB Disk is Write protected!"); + res = RES_WRPRT; + break; + + case SCSI_ASC_LOGICAL_UNIT_NOT_READY: + case SCSI_ASC_MEDIUM_NOT_PRESENT: + case SCSI_ASC_NOT_READY_TO_READY_CHANGE: + USBH_ErrLog("USB Disk is not ready!"); + res = RES_NOTRDY; + break; + + default: + res = RES_ERROR; + break; + } + } + + return res; +} +#endif /* _USE_WRITE == 1 */ + +/* USER CODE BEGIN beforeIoctlSection */ +/* can be used to modify previous code / undefine following code / add new code */ +/* USER CODE END beforeIoctlSection */ + +/** + * @brief I/O control operation + * @param lun : lun id + * @param cmd: Control code + * @param *buff: Buffer to send/receive control data + * @retval DRESULT: Operation result + */ +#if _USE_IOCTL == 1 +DRESULT USBH_ioctl(BYTE lun, BYTE cmd, void *buff) +{ + DRESULT res = RES_ERROR; + MSC_LUNTypeDef info; + + switch (cmd) + { + /* Make sure that no pending write process */ + case CTRL_SYNC: + res = RES_OK; + break; + + /* Get number of sectors on the disk (DWORD) */ + case GET_SECTOR_COUNT : + if(USBH_MSC_GetLUNInfo(&hUSB_Host, lun, &info) == USBH_OK) + { + *(DWORD*)buff = info.capacity.block_nbr; + res = RES_OK; + } + else + { + res = RES_ERROR; + } + break; + + /* Get R/W sector size (WORD) */ + case GET_SECTOR_SIZE : + if(USBH_MSC_GetLUNInfo(&hUSB_Host, lun, &info) == USBH_OK) + { + *(DWORD*)buff = info.capacity.block_size; + res = RES_OK; + } + else + { + res = RES_ERROR; + } + break; + + /* Get erase block size in unit of sector (DWORD) */ + case GET_BLOCK_SIZE : + + if(USBH_MSC_GetLUNInfo(&hUSB_Host, lun, &info) == USBH_OK) + { + *(DWORD*)buff = info.capacity.block_size / USB_DEFAULT_BLOCK_SIZE; + res = RES_OK; + } + else + { + res = RES_ERROR; + } + break; + + default: + res = RES_PARERR; + } + + return res; +} +#endif /* _USE_IOCTL == 1 */ + +/* USER CODE BEGIN lastSection */ +/* can be used to modify / undefine previous code or add new code */ +/* USER CODE END lastSection */ diff --git a/FATFS/Target/usbh_diskio.h b/FATFS/Target/usbh_diskio.h new file mode 100644 index 0000000..57a40c0 --- /dev/null +++ b/FATFS/Target/usbh_diskio.h @@ -0,0 +1,40 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file usbh_diskio.h (based on usbh_diskio_template.h v2.0.2) + * @brief Header for usbh_diskio.c module + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USBH_DISKIO_H +#define __USBH_DISKIO_H + +/* USER CODE BEGIN firstSection */ +/* can be used to modify / undefine following code or add new definitions */ +/* USER CODE END firstSection */ + +/* Includes ------------------------------------------------------------------*/ +#include "usbh_core.h" +#include "usbh_msc.h" +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +extern const Diskio_drvTypeDef USBH_Driver; + +/* USER CODE BEGIN lastSection */ +/* can be used to modify / undefine previous code or add new definitions */ +/* USER CODE END lastSection */ + +#endif /* __USBH_DISKIO_H */ + diff --git a/Middlewares b/Middlewares index 5047b05..0aa6384 160000 --- a/Middlewares +++ b/Middlewares @@ -1 +1 @@ -Subproject commit 5047b0506d61e226ae953e58e47293d466a509be +Subproject commit 0aa6384240f5489d7c81d21823fbd8018294b07b diff --git a/README.md b/README.md index 910f0de..556ea44 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,8 @@ UI 11. 美化提示栏 ``` + +``` +量产时注意事项: + 1. 量产时,需要注意注意掉显示密码的相关日志 +``` diff --git a/USB_HOST/App/usb_host.c b/USB_HOST/App/usb_host.c new file mode 100644 index 0000000..dcbd273 --- /dev/null +++ b/USB_HOST/App/usb_host.c @@ -0,0 +1,128 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : usb_host.c + * @version : v1.0_Cube + * @brief : This file implements the USB Host + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ + +#include "usb_host.h" +#include "usbh_core.h" +#include "usbh_msc.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* USER CODE BEGIN PV */ +/* Private variables ---------------------------------------------------------*/ + +/* USER CODE END PV */ + +/* USER CODE BEGIN PFP */ +/* Private function prototypes -----------------------------------------------*/ + +/* USER CODE END PFP */ + +/* USB Host core handle declaration */ +USBH_HandleTypeDef hUsbHostFS; +ApplicationTypeDef Appli_state = APPLICATION_IDLE; + +/* + * -- Insert your variables declaration here -- + */ +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* + * user callback declaration + */ +static void USBH_UserProcess(USBH_HandleTypeDef *phost, uint8_t id); + +/* + * -- Insert your external function declaration here -- + */ +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/** + * Init USB host library, add supported class and start the library + * @retval None + */ +void MX_USB_HOST_Init(void) +{ + /* USER CODE BEGIN USB_HOST_Init_PreTreatment */ + + /* USER CODE END USB_HOST_Init_PreTreatment */ + + /* Init host Library, add supported class and start the library. */ + if (USBH_Init(&hUsbHostFS, USBH_UserProcess, HOST_FS) != USBH_OK) + { + Error_Handler(); + } + if (USBH_RegisterClass(&hUsbHostFS, USBH_MSC_CLASS) != USBH_OK) + { + Error_Handler(); + } + if (USBH_Start(&hUsbHostFS) != USBH_OK) + { + Error_Handler(); + } + /* USER CODE BEGIN USB_HOST_Init_PostTreatment */ + + /* USER CODE END USB_HOST_Init_PostTreatment */ +} + +/* + * user callback definition + */ +static void USBH_UserProcess (USBH_HandleTypeDef *phost, uint8_t id) +{ + /* USER CODE BEGIN CALL_BACK_1 */ + switch(id) + { + case HOST_USER_SELECT_CONFIGURATION: + break; + + case HOST_USER_DISCONNECTION: + Appli_state = APPLICATION_DISCONNECT; + break; + + case HOST_USER_CLASS_ACTIVE: + Appli_state = APPLICATION_READY; + break; + + case HOST_USER_CONNECTION: + Appli_state = APPLICATION_START; + break; + + default: + break; + } + /* USER CODE END CALL_BACK_1 */ +} + +/** + * @} + */ + +/** + * @} + */ + diff --git a/USB_HOST/App/usb_host.h b/USB_HOST/App/usb_host.h new file mode 100644 index 0000000..94a5cf2 --- /dev/null +++ b/USB_HOST/App/usb_host.h @@ -0,0 +1,90 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : usb_host.h + * @version : v1.0_Cube + * @brief : Header for usb_host.c file. + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USB_HOST__H__ +#define __USB_HOST__H__ + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f4xx.h" +#include "stm32f4xx_hal.h" + +/* USER CODE BEGIN INCLUDE */ + +/* USER CODE END INCLUDE */ + +/** @addtogroup USBH_OTG_DRIVER + * @{ + */ + +/** @defgroup USBH_HOST USBH_HOST + * @brief Host file for Usb otg low level driver. + * @{ + */ + +/** @defgroup USBH_HOST_Exported_Variables USBH_HOST_Exported_Variables + * @brief Public variables. + * @{ + */ + +/** + * @} + */ + +/** Status of the application. */ +typedef enum { + APPLICATION_IDLE = 0, + APPLICATION_START, + APPLICATION_READY, + APPLICATION_DISCONNECT +}ApplicationTypeDef; + +/** @defgroup USBH_HOST_Exported_FunctionsPrototype USBH_HOST_Exported_FunctionsPrototype + * @brief Declaration of public functions for Usb host. + * @{ + */ + +/* Exported functions -------------------------------------------------------*/ + +/** @brief USB Host initialization function. */ +void MX_USB_HOST_Init(void); + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USB_HOST__H__ */ + diff --git a/USB_HOST/Target/usbh_conf.c b/USB_HOST/Target/usbh_conf.c new file mode 100644 index 0000000..9b17281 --- /dev/null +++ b/USB_HOST/Target/usbh_conf.c @@ -0,0 +1,539 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : Target/usbh_conf.c + * @version : v1.0_Cube + * @brief : This file implements the board support package for the USB host library + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "usbh_core.h" +#include "usbh_platform.h" + +/* USER CODE BEGIN Includes */ + +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ + +/* USER CODE BEGIN PV */ +/* Private variables ---------------------------------------------------------*/ + +/* USER CODE END PV */ + +extern HCD_HandleTypeDef hhcd_USB_OTG_FS; +void Error_Handler(void); + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* USER CODE BEGIN PFP */ +/* Private function prototypes -----------------------------------------------*/ +USBH_StatusTypeDef USBH_Get_USB_Status(HAL_StatusTypeDef hal_status); + +/* USER CODE END PFP */ + +/* Private functions ---------------------------------------------------------*/ + +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ + +/******************************************************************************* + LL Driver Callbacks (HCD -> USB Host Library) +*******************************************************************************/ +/* MSP Init */ + +void HAL_HCD_MspInit(HCD_HandleTypeDef* hcdHandle) +{ + GPIO_InitTypeDef GPIO_InitStruct = {0}; + if(hcdHandle->Instance==USB_OTG_FS) + { + /* USER CODE BEGIN USB_OTG_FS_MspInit 0 */ + + /* USER CODE END USB_OTG_FS_MspInit 0 */ + + __HAL_RCC_GPIOA_CLK_ENABLE(); + /**USB_OTG_FS GPIO Configuration + PA11 ------> USB_OTG_FS_DM + PA12 ------> USB_OTG_FS_DP + */ + GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* Peripheral clock enable */ + __HAL_RCC_USB_OTG_FS_CLK_ENABLE(); + + /* Peripheral interrupt init */ + HAL_NVIC_SetPriority(OTG_FS_IRQn, 5, 0); + HAL_NVIC_EnableIRQ(OTG_FS_IRQn); + /* USER CODE BEGIN USB_OTG_FS_MspInit 1 */ + + /* USER CODE END USB_OTG_FS_MspInit 1 */ + } +} + +void HAL_HCD_MspDeInit(HCD_HandleTypeDef* hcdHandle) +{ + if(hcdHandle->Instance==USB_OTG_FS) + { + /* USER CODE BEGIN USB_OTG_FS_MspDeInit 0 */ + + /* USER CODE END USB_OTG_FS_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_USB_OTG_FS_CLK_DISABLE(); + + /**USB_OTG_FS GPIO Configuration + PA11 ------> USB_OTG_FS_DM + PA12 ------> USB_OTG_FS_DP + */ + HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12); + + /* Peripheral interrupt Deinit*/ + HAL_NVIC_DisableIRQ(OTG_FS_IRQn); + + /* USER CODE BEGIN USB_OTG_FS_MspDeInit 1 */ + + /* USER CODE END USB_OTG_FS_MspDeInit 1 */ + } +} + +/** + * @brief SOF callback. + * @param hhcd: HCD handle + * @retval None + */ +void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd) +{ + USBH_LL_IncTimer(hhcd->pData); +} + +/** + * @brief SOF callback. + * @param hhcd: HCD handle + * @retval None + */ +void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd) +{ + USBH_LL_Connect(hhcd->pData); +} + +/** + * @brief SOF callback. + * @param hhcd: HCD handle + * @retval None + */ +void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd) +{ + USBH_LL_Disconnect(hhcd->pData); +} + +/** + * @brief Notify URB state change callback. + * @param hhcd: HCD handle + * @param chnum: channel number + * @param urb_state: state + * @retval None + */ +void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, uint8_t chnum, HCD_URBStateTypeDef urb_state) +{ + /* To be used with OS to sync URB state with the global state machine */ +#if (USBH_USE_OS == 1) + USBH_LL_NotifyURBChange(hhcd->pData); +#endif +} +/** +* @brief Port Port Enabled callback. + * @param hhcd: HCD handle + * @retval None + */ +void HAL_HCD_PortEnabled_Callback(HCD_HandleTypeDef *hhcd) +{ + USBH_LL_PortEnabled(hhcd->pData); +} + +/** + * @brief Port Port Disabled callback. + * @param hhcd: HCD handle + * @retval None + */ +void HAL_HCD_PortDisabled_Callback(HCD_HandleTypeDef *hhcd) +{ + USBH_LL_PortDisabled(hhcd->pData); +} + +/******************************************************************************* + LL Driver Interface (USB Host Library --> HCD) +*******************************************************************************/ + +/** + * @brief Initialize the low level portion of the host driver. + * @param phost: Host handle + * @retval USBH status + */ +USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) +{ + /* Init USB_IP */ + if (phost->id == HOST_FS) { + /* Link the driver to the stack. */ + hhcd_USB_OTG_FS.pData = phost; + phost->pData = &hhcd_USB_OTG_FS; + + hhcd_USB_OTG_FS.Instance = USB_OTG_FS; + hhcd_USB_OTG_FS.Init.Host_channels = 8; + hhcd_USB_OTG_FS.Init.speed = HCD_SPEED_FULL; + hhcd_USB_OTG_FS.Init.dma_enable = DISABLE; + hhcd_USB_OTG_FS.Init.phy_itface = HCD_PHY_EMBEDDED; + hhcd_USB_OTG_FS.Init.Sof_enable = DISABLE; + if (HAL_HCD_Init(&hhcd_USB_OTG_FS) != HAL_OK) + { + Error_Handler( ); + } + + USBH_LL_SetTimer(phost, HAL_HCD_GetCurrentFrame(&hhcd_USB_OTG_FS)); + } + return USBH_OK; +} + +/** + * @brief De-Initialize the low level portion of the host driver. + * @param phost: Host handle + * @retval USBH status + */ +USBH_StatusTypeDef USBH_LL_DeInit(USBH_HandleTypeDef *phost) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBH_StatusTypeDef usb_status = USBH_OK; + + hal_status = HAL_HCD_DeInit(phost->pData); + + usb_status = USBH_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Start the low level portion of the host driver. + * @param phost: Host handle + * @retval USBH status + */ +USBH_StatusTypeDef USBH_LL_Start(USBH_HandleTypeDef *phost) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBH_StatusTypeDef usb_status = USBH_OK; + + hal_status = HAL_HCD_Start(phost->pData); + + usb_status = USBH_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Stop the low level portion of the host driver. + * @param phost: Host handle + * @retval USBH status + */ +USBH_StatusTypeDef USBH_LL_Stop(USBH_HandleTypeDef *phost) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBH_StatusTypeDef usb_status = USBH_OK; + + hal_status = HAL_HCD_Stop(phost->pData); + + usb_status = USBH_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Return the USB host speed from the low level driver. + * @param phost: Host handle + * @retval USBH speeds + */ +USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost) +{ + USBH_SpeedTypeDef speed = USBH_SPEED_FULL; + + switch (HAL_HCD_GetCurrentSpeed(phost->pData)) + { + case 0 : + speed = USBH_SPEED_HIGH; + break; + + case 1 : + speed = USBH_SPEED_FULL; + break; + + case 2 : + speed = USBH_SPEED_LOW; + break; + + default: + speed = USBH_SPEED_FULL; + break; + } + return speed; +} + +/** + * @brief Reset the Host port of the low level driver. + * @param phost: Host handle + * @retval USBH status + */ +USBH_StatusTypeDef USBH_LL_ResetPort(USBH_HandleTypeDef *phost) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBH_StatusTypeDef usb_status = USBH_OK; + + hal_status = HAL_HCD_ResetPort(phost->pData); + + usb_status = USBH_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Return the last transferred packet size. + * @param phost: Host handle + * @param pipe: Pipe index + * @retval Packet size + */ +uint32_t USBH_LL_GetLastXferSize(USBH_HandleTypeDef *phost, uint8_t pipe) +{ + return HAL_HCD_HC_GetXferCount(phost->pData, pipe); +} + +/** + * @brief Open a pipe of the low level driver. + * @param phost: Host handle + * @param pipe_num: Pipe index + * @param epnum: Endpoint number + * @param dev_address: Device USB address + * @param speed: Device Speed + * @param ep_type: Endpoint type + * @param mps: Endpoint max packet size + * @retval USBH status + */ +USBH_StatusTypeDef USBH_LL_OpenPipe(USBH_HandleTypeDef *phost, uint8_t pipe_num, uint8_t epnum, + uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBH_StatusTypeDef usb_status = USBH_OK; + + hal_status = HAL_HCD_HC_Init(phost->pData, pipe_num, epnum, + dev_address, speed, ep_type, mps); + + usb_status = USBH_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Close a pipe of the low level driver. + * @param phost: Host handle + * @param pipe: Pipe index + * @retval USBH status + */ +USBH_StatusTypeDef USBH_LL_ClosePipe(USBH_HandleTypeDef *phost, uint8_t pipe) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBH_StatusTypeDef usb_status = USBH_OK; + + hal_status = HAL_HCD_HC_Halt(phost->pData, pipe); + + usb_status = USBH_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Submit a new URB to the low level driver. + * @param phost: Host handle + * @param pipe: Pipe index + * This parameter can be a value from 1 to 15 + * @param direction : Channel number + * This parameter can be one of the these values: + * 0 : Output + * 1 : Input + * @param ep_type : Endpoint Type + * This parameter can be one of the these values: + * @arg EP_TYPE_CTRL: Control type + * @arg EP_TYPE_ISOC: Isochrounous type + * @arg EP_TYPE_BULK: Bulk type + * @arg EP_TYPE_INTR: Interrupt type + * @param token : Endpoint Type + * This parameter can be one of the these values: + * @arg 0: PID_SETUP + * @arg 1: PID_DATA + * @param pbuff : pointer to URB data + * @param length : Length of URB data + * @param do_ping : activate do ping protocol (for high speed only) + * This parameter can be one of the these values: + * 0 : do ping inactive + * 1 : do ping active + * @retval Status + */ +USBH_StatusTypeDef USBH_LL_SubmitURB(USBH_HandleTypeDef *phost, uint8_t pipe, uint8_t direction, + uint8_t ep_type, uint8_t token, uint8_t *pbuff, uint16_t length, + uint8_t do_ping) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBH_StatusTypeDef usb_status = USBH_OK; + + hal_status = HAL_HCD_HC_SubmitRequest(phost->pData, pipe, direction , + ep_type, token, pbuff, length, + do_ping); + usb_status = USBH_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Get a URB state from the low level driver. + * @param phost: Host handle + * @param pipe: Pipe index + * This parameter can be a value from 1 to 15 + * @retval URB state + * This parameter can be one of the these values: + * @arg URB_IDLE + * @arg URB_DONE + * @arg URB_NOTREADY + * @arg URB_NYET + * @arg URB_ERROR + * @arg URB_STALL + */ +USBH_URBStateTypeDef USBH_LL_GetURBState(USBH_HandleTypeDef *phost, uint8_t pipe) +{ + return (USBH_URBStateTypeDef)HAL_HCD_HC_GetURBState (phost->pData, pipe); +} + +/** + * @brief Drive VBUS. + * @param phost: Host handle + * @param state : VBUS state + * This parameter can be one of the these values: + * 0 : VBUS Inactive + * 1 : VBUS Active + * @retval Status + */ +USBH_StatusTypeDef USBH_LL_DriverVBUS(USBH_HandleTypeDef *phost, uint8_t state) +{ + if (phost->id == HOST_FS) { + MX_DriverVbusFS(state); + } + + /* USER CODE BEGIN 0 */ + + /* USER CODE END 0*/ + + HAL_Delay(200); + return USBH_OK; +} + +/** + * @brief Set toggle for a pipe. + * @param phost: Host handle + * @param pipe: Pipe index + * @param toggle: toggle (0/1) + * @retval Status + */ +USBH_StatusTypeDef USBH_LL_SetToggle(USBH_HandleTypeDef *phost, uint8_t pipe, uint8_t toggle) +{ + HCD_HandleTypeDef *pHandle; + pHandle = phost->pData; + + if(pHandle->hc[pipe].ep_is_in) + { + pHandle->hc[pipe].toggle_in = toggle; + } + else + { + pHandle->hc[pipe].toggle_out = toggle; + } + + return USBH_OK; +} + +/** + * @brief Return the current toggle of a pipe. + * @param phost: Host handle + * @param pipe: Pipe index + * @retval toggle (0/1) + */ +uint8_t USBH_LL_GetToggle(USBH_HandleTypeDef *phost, uint8_t pipe) +{ + uint8_t toggle = 0; + HCD_HandleTypeDef *pHandle; + pHandle = phost->pData; + + if(pHandle->hc[pipe].ep_is_in) + { + toggle = pHandle->hc[pipe].toggle_in; + } + else + { + toggle = pHandle->hc[pipe].toggle_out; + } + return toggle; +} + +/** + * @brief Delay routine for the USB Host Library + * @param Delay: Delay in ms + * @retval None + */ +void USBH_Delay(uint32_t Delay) +{ + HAL_Delay(Delay); +} + +/** + * @brief Returns the USB status depending on the HAL status: + * @param hal_status: HAL status + * @retval USB status + */ +USBH_StatusTypeDef USBH_Get_USB_Status(HAL_StatusTypeDef hal_status) +{ + USBH_StatusTypeDef usb_status = USBH_OK; + + switch (hal_status) + { + case HAL_OK : + usb_status = USBH_OK; + break; + case HAL_ERROR : + usb_status = USBH_FAIL; + break; + case HAL_BUSY : + usb_status = USBH_BUSY; + break; + case HAL_TIMEOUT : + usb_status = USBH_FAIL; + break; + default : + usb_status = USBH_FAIL; + break; + } + return usb_status; +} + diff --git a/USB_HOST/Target/usbh_conf.h b/USB_HOST/Target/usbh_conf.h new file mode 100644 index 0000000..60ef4a1 --- /dev/null +++ b/USB_HOST/Target/usbh_conf.h @@ -0,0 +1,194 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : Target/usbh_conf.h + * @version : v1.0_Cube + * @brief : Header for usbh_conf.c file. + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USBH_CONF__H__ +#define __USBH_CONF__H__ +#ifdef __cplusplus + extern "C" { +#endif +/* Includes ------------------------------------------------------------------*/ + +#include +#include +#include +#include "main.h" + +#include "stm32f4xx.h" +#include "stm32f4xx_hal.h" + +/* USER CODE BEGIN INCLUDE */ + +/* USER CODE END INCLUDE */ + +/** @addtogroup STM32_USB_HOST_LIBRARY + * @{ + */ + +/** @defgroup USBH_CONF + * @brief usb host low level driver configuration file + * @{ + */ + +/** @defgroup USBH_CONF_Exported_Variables USBH_CONF_Exported_Variables + * @brief Public variables. + * @{ + */ + +/** + * @} + */ + +/** @defgroup USBH_CONF_Exported_Defines USBH_CONF_Exported_Defines + * @brief Defines for configuration of the Usb host. + * @{ + */ + +/*---------- -----------*/ +#define USBH_MAX_NUM_ENDPOINTS 2U + +/*---------- -----------*/ +#define USBH_MAX_NUM_INTERFACES 2U + +/*---------- -----------*/ +#define USBH_MAX_NUM_CONFIGURATION 1U + +/*---------- -----------*/ +#define USBH_KEEP_CFG_DESCRIPTOR 1U + +/*---------- -----------*/ +#define USBH_MAX_NUM_SUPPORTED_CLASS 1U + +/*---------- -----------*/ +#define USBH_MAX_SIZE_CONFIGURATION 256U + +/*---------- -----------*/ +#define USBH_MAX_DATA_BUFFER 512U + +/*---------- -----------*/ +#define USBH_DEBUG_LEVEL 0U + +/*---------- -----------*/ +#define USBH_USE_OS 1U + +/****************************************/ +/* #define for FS and HS identification */ +#define HOST_HS 0 +#define HOST_FS 1 + +#if (USBH_USE_OS == 1) + #include "cmsis_os.h" + #define USBH_PROCESS_PRIO osPriorityNormal + #define USBH_PROCESS_STACK_SIZE ((uint16_t)512) +#endif /* (USBH_USE_OS == 1) */ + +/** + * @} + */ + +/** @defgroup USBH_CONF_Exported_Macros USBH_CONF_Exported_Macros + * @brief Aliases. + * @{ + */ + +/* Memory management macros */ + +/** Alias for memory allocation. */ +#define USBH_malloc malloc + +/** Alias for memory release. */ +#define USBH_free free + +/** Alias for memory set. */ +#define USBH_memset memset + +/** Alias for memory copy. */ +#define USBH_memcpy memcpy + +/* DEBUG macros */ + +#if (USBH_DEBUG_LEVEL > 0U) +#define USBH_UsrLog(...) do { \ + printf(__VA_ARGS__); \ + printf("\n"); \ +} while (0) +#else +#define USBH_UsrLog(...) do {} while (0) +#endif + +#if (USBH_DEBUG_LEVEL > 1U) + +#define USBH_ErrLog(...) do { \ + printf("ERROR: "); \ + printf(__VA_ARGS__); \ + printf("\n"); \ +} while (0) +#else +#define USBH_ErrLog(...) do {} while (0) +#endif + +#if (USBH_DEBUG_LEVEL > 2U) +#define USBH_DbgLog(...) do { \ + printf("DEBUG : "); \ + printf(__VA_ARGS__); \ + printf("\n"); \ +} while (0) +#else +#define USBH_DbgLog(...) do {} while (0) +#endif + +/** + * @} + */ + +/** @defgroup USBH_CONF_Exported_Types USBH_CONF_Exported_Types + * @brief Types. + * @{ + */ + +/** + * @} + */ + +/** @defgroup USBH_CONF_Exported_FunctionsPrototype USBH_CONF_Exported_FunctionsPrototype + * @brief Declaration of public functions for Usb host. + * @{ + */ + +/* Exported functions -------------------------------------------------------*/ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USBH_CONF__H__ */ + diff --git a/USB_HOST/Target/usbh_platform.c b/USB_HOST/Target/usbh_platform.c new file mode 100644 index 0000000..24e5bc8 --- /dev/null +++ b/USB_HOST/Target/usbh_platform.c @@ -0,0 +1,52 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : usbh_platform.c + + * @brief : This file implements the USB platform + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "usbh_platform.h" + +/* USER CODE BEGIN INCLUDE */ + +/* USER CODE END INCLUDE */ + +/** + * @brief Drive VBUS. + * @param state : VBUS state + * This parameter can be one of the these values: + * - 1 : VBUS Active + * - 0 : VBUS Inactive + */ +void MX_DriverVbusFS(uint8_t state) +{ + uint8_t data = state; + /* USER CODE BEGIN PREPARE_GPIO_DATA_VBUS_FS */ + if(state == 0) + { + /* Drive high Charge pump */ + data = GPIO_PIN_RESET; + } + else + { + /* Drive low Charge pump */ + data = GPIO_PIN_SET; + } + /* USER CODE END PREPARE_GPIO_DATA_VBUS_FS */ + HAL_GPIO_WritePin(GPIOA,GPIO_PIN_15,(GPIO_PinState)data); +} + diff --git a/USB_HOST/Target/usbh_platform.h b/USB_HOST/Target/usbh_platform.h new file mode 100644 index 0000000..559e13a --- /dev/null +++ b/USB_HOST/Target/usbh_platform.h @@ -0,0 +1,42 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : usbh_platform.h + * @brief : Header for usbh_platform.c file. + ****************************************************************************** + * @attention + * + * Copyright (c) 2024 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USBH_PLATFORM_H__ +#define __USBH_PLATFORM_H__ + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "usb_host.h" + +/* USER CODE BEGIN INCLUDE */ + +/* USER CODE END INCLUDE */ + +void MX_DriverVbusFS(uint8_t state); + +#ifdef __cplusplus +} +#endif + +#endif /* __USBH_PLATFORM_H__ */ + diff --git a/hand_acid_mainboard.ioc b/hand_acid_mainboard.ioc index 02badab..ea9142f 100644 --- a/hand_acid_mainboard.ioc +++ b/hand_acid_mainboard.ioc @@ -2,18 +2,6 @@ CAD.formats= CAD.pinconfig= CAD.provider= -CAN1.ABOM=ENABLE -CAN1.BS1=CAN_BS1_14TQ -CAN1.BS2=CAN_BS2_3TQ -CAN1.CalculateBaudRate=500000 -CAN1.CalculateTimeBit=2000 -CAN1.CalculateTimeQuantum=111.11111111111111 -CAN1.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS1,BS2,SJW,TTCM,ABOM,NART,RFLM -CAN1.NART=ENABLE -CAN1.Prescaler=4 -CAN1.RFLM=ENABLE -CAN1.SJW=CAN_SJW_3TQ -CAN1.TTCM=ENABLE Dma.Request0=USART3_RX Dma.Request1=USART3_TX Dma.RequestsNb=2 @@ -37,6 +25,8 @@ Dma.USART3_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE Dma.USART3_TX.1.PeriphInc=DMA_PINC_DISABLE Dma.USART3_TX.1.Priority=DMA_PRIORITY_LOW Dma.USART3_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode +FATFS.IPParameters=_CODE_PAGE +FATFS._CODE_PAGE=936 FREERTOS.FootprintOK=true FREERTOS.INCLUDE_uxTaskGetStackHighWaterMark=1 FREERTOS.IPParameters=Tasks01,FootprintOK,configUSE_NEWLIB_REENTRANT,configUSE_RECURSIVE_MUTEXES,configUSE_COUNTING_SEMAPHORES,configRECORD_STACK_HIGH_ADDRESS,configENABLE_FPU,configTOTAL_HEAP_SIZE,configMINIMAL_STACK_SIZE,INCLUDE_uxTaskGetStackHighWaterMark,configUSE_MALLOC_FAILED_HOOK,configCHECK_FOR_STACK_OVERFLOW,configUSE_TIMERS,configTIMER_TASK_PRIORITY,configUSE_TRACE_FACILITY,configGENERATE_RUN_TIME_STATS,configUSE_STATS_FORMATTING_FUNCTIONS,configUSE_IDLE_HOOK,configUSE_TICK_HOOK @@ -65,17 +55,18 @@ IWDG.Reload=500 KeepUserPlacement=false Mcu.CPN=STM32F407VET6 Mcu.Family=STM32F4 -Mcu.IP0=CAN1 -Mcu.IP1=CRC +Mcu.IP0=CRC +Mcu.IP1=DMA Mcu.IP10=SYS Mcu.IP11=TIM1 Mcu.IP12=TIM3 Mcu.IP13=TIM6 Mcu.IP14=TIM7 -Mcu.IP15=USART1 -Mcu.IP16=USART2 -Mcu.IP17=USART3 -Mcu.IP2=DMA +Mcu.IP15=USART2 +Mcu.IP16=USART3 +Mcu.IP17=USB_HOST +Mcu.IP18=USB_OTG_FS +Mcu.IP2=FATFS Mcu.IP3=FREERTOS Mcu.IP4=IWDG Mcu.IP5=NVIC @@ -83,21 +74,21 @@ Mcu.IP6=RCC Mcu.IP7=RNG Mcu.IP8=RTC Mcu.IP9=SPI1 -Mcu.IPNb=18 +Mcu.IPNb=19 Mcu.Name=STM32F407V(E-G)Tx Mcu.Package=LQFP100 Mcu.Pin0=PH0-OSC_IN Mcu.Pin1=PH1-OSC_OUT Mcu.Pin10=PB11 Mcu.Pin11=PC9 -Mcu.Pin12=PA9 -Mcu.Pin13=PA10 -Mcu.Pin14=PA11 -Mcu.Pin15=PA12 -Mcu.Pin16=PA13 -Mcu.Pin17=PA14 -Mcu.Pin18=PD3 -Mcu.Pin19=VP_CRC_VS_CRC +Mcu.Pin12=PA11 +Mcu.Pin13=PA12 +Mcu.Pin14=PA13 +Mcu.Pin15=PA14 +Mcu.Pin16=PA15 +Mcu.Pin17=PD3 +Mcu.Pin18=VP_CRC_VS_CRC +Mcu.Pin19=VP_FATFS_VS_USB Mcu.Pin2=PC0 Mcu.Pin20=VP_FREERTOS_VS_CMSIS_V1 Mcu.Pin21=VP_IWDG_VS_IWDG @@ -110,23 +101,20 @@ Mcu.Pin27=VP_TIM3_VS_ClockSourceINT Mcu.Pin28=VP_TIM6_VS_ClockSourceINT Mcu.Pin29=VP_TIM7_VS_ClockSourceINT Mcu.Pin3=PA2 +Mcu.Pin30=VP_USB_HOST_VS_USB_HOST_MSC_FS Mcu.Pin4=PA3 Mcu.Pin5=PA5 Mcu.Pin6=PA6 Mcu.Pin7=PA7 Mcu.Pin8=PC4 Mcu.Pin9=PB10 -Mcu.PinsNb=30 +Mcu.PinsNb=31 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F407VETx MxCube.Version=6.11.0 MxDb.Version=DB.6.0.110 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false -NVIC.CAN1_RX0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true -NVIC.CAN1_RX1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true -NVIC.CAN1_SCE_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true -NVIC.CAN1_TX_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.DMA1_Stream1_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true NVIC.DMA1_Stream3_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false @@ -134,6 +122,7 @@ NVIC.ForceEnableDMAVector=true NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false +NVIC.OTG_FS_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.PendSV_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:false\:false NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false\:false\:false\:false @@ -148,18 +137,16 @@ NVIC.TimeBase=TIM1_TRG_COM_TIM11_IRQn NVIC.TimeBaseIP=TIM11 NVIC.USART3_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false -PA10.Mode=Asynchronous -PA10.Signal=USART1_RX -PA11.Locked=true -PA11.Mode=CAN_Activate -PA11.Signal=CAN1_RX -PA12.Locked=true -PA12.Mode=CAN_Activate -PA12.Signal=CAN1_TX +PA11.Mode=Host_Only +PA11.Signal=USB_OTG_FS_DM +PA12.Mode=Host_Only +PA12.Signal=USB_OTG_FS_DP PA13.Mode=Serial_Wire PA13.Signal=SYS_JTMS-SWDIO PA14.Mode=Serial_Wire PA14.Signal=SYS_JTCK-SWCLK +PA15.Locked=true +PA15.Signal=GPIO_Output PA2.Locked=true PA2.Mode=Asynchronous PA2.Signal=USART2_TX @@ -172,9 +159,6 @@ PA6.Mode=Full_Duplex_Master PA6.Signal=SPI1_MISO PA7.Mode=Full_Duplex_Master PA7.Signal=SPI1_MOSI -PA9.Locked=true -PA9.Mode=Asynchronous -PA9.Signal=USART1_TX PB10.Locked=true PB10.Mode=Asynchronous PB10.Signal=USART3_TX @@ -227,7 +211,7 @@ ProjectManager.ToolChainLocation= ProjectManager.UAScriptAfterPath= ProjectManager.UAScriptBeforePath= ProjectManager.UnderRoot=true -ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_USART1_UART_Init-USART1-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_CRC_Init-CRC-false-HAL-true,7-MX_RNG_Init-RNG-false-HAL-true,8-MX_TIM7_Init-TIM7-false-HAL-true,9-MX_TIM6_Init-TIM6-false-HAL-true,10-MX_TIM1_Init-TIM1-false-HAL-true,11-MX_USART3_UART_Init-USART3-false-HAL-true,12-MX_CAN1_Init-CAN1-false-HAL-true,13-MX_SPI1_Init-SPI1-false-HAL-true,14-MX_USART2_UART_Init-USART2-false-HAL-true,15-MX_IWDG_Init-IWDG-false-HAL-true +ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_TIM3_Init-TIM3-false-HAL-true,5-MX_CRC_Init-CRC-false-HAL-true,6-MX_RNG_Init-RNG-false-HAL-true,7-MX_TIM7_Init-TIM7-false-HAL-true,8-MX_TIM6_Init-TIM6-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_USART3_UART_Init-USART3-false-HAL-true,11-MX_SPI1_Init-SPI1-false-HAL-true,12-MX_USART2_UART_Init-USART2-false-HAL-true,13-MX_IWDG_Init-IWDG-false-HAL-true,14-MX_RTC_Init-RTC-false-HAL-true,15-MX_USB_OTG_FS_HCD_Init-USB_OTG_FS-false-HAL-true RCC.48MHZClocksFreq_Value=48000000 RCC.AHBFreq_Value=144000000 RCC.APB1CLKDivider=RCC_HCLK_DIV4 @@ -244,7 +228,7 @@ RCC.HCLKFreq_Value=144000000 RCC.HSE_VALUE=8000000 RCC.HSI_VALUE=16000000 RCC.I2SClocksFreq_Value=64000000 -RCC.IPParameters=48MHZClocksFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSE_VALUE,LSI_VALUE,MCO1PinFreq_Value,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLI2SN,PLLM,PLLN,PLLQ,PLLQCLKFreq_Value,PLLSourceVirtual,RCC_MCO1Source,RCC_MCO2Source,RCC_MCODiv1,RCC_MCODiv2,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VcooutputI2S +RCC.IPParameters=48MHZClocksFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSE_VALUE,LSI_VALUE,MCO1PinFreq_Value,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLI2SN,PLLM,PLLN,PLLQ,PLLQCLKFreq_Value,RCC_MCO1Source,RCC_MCO2Source,RCC_MCODiv1,RCC_MCODiv2,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VcooutputI2S RCC.LSE_VALUE=32768 RCC.LSI_VALUE=32000 RCC.MCO1PinFreq_Value=36000000 @@ -255,7 +239,6 @@ RCC.PLLM=4 RCC.PLLN=144 RCC.PLLQ=6 RCC.PLLQCLKFreq_Value=48000000 -RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE RCC.RCC_MCO1Source=RCC_MCO1SOURCE_PLLCLK RCC.RCC_MCO2Source=RCC_MCO2SOURCE_PLLI2SCLK RCC.RCC_MCODiv1=RCC_MCODIV_4 @@ -293,16 +276,32 @@ TIM6.IPParameters=Prescaler TIM6.Prescaler=71 TIM7.IPParameters=Prescaler TIM7.Prescaler=81 -USART1.BaudRate=460800 -USART1.IPParameters=VirtualMode,BaudRate -USART1.VirtualMode=VM_ASYNC USART2.IPParameters=VirtualMode USART2.VirtualMode=VM_ASYNC USART3.BaudRate=9600 USART3.IPParameters=VirtualMode,BaudRate USART3.VirtualMode=VM_ASYNC +USB_HOST.BSP.number=1 +USB_HOST.IPParameters=VirtualModeFS,USBH_HandleTypeDef-MSC_FS +USB_HOST.USBH_HandleTypeDef-MSC_FS=hUsbHostFS +USB_HOST.VirtualModeFS=Msc +USB_HOST0.BSP.STBoard=false +USB_HOST0.BSP.api=Unknown +USB_HOST0.BSP.component= +USB_HOST0.BSP.condition=SW_VBUS_DRIVE_MSC_FS \= false +USB_HOST0.BSP.instance=PA15 +USB_HOST0.BSP.ip=GPIO +USB_HOST0.BSP.mode=Output +USB_HOST0.BSP.name=Drive_VBUS_FS +USB_HOST0.BSP.semaphore= +USB_HOST0.BSP.solution=PA15 +USB_OTG_FS.IPParameters=VirtualMode,phy_itface +USB_OTG_FS.VirtualMode=Host_Only +USB_OTG_FS.phy_itface=HCD_PHY_EMBEDDED VP_CRC_VS_CRC.Mode=CRC_Activate VP_CRC_VS_CRC.Signal=CRC_VS_CRC +VP_FATFS_VS_USB.Mode=USB +VP_FATFS_VS_USB.Signal=FATFS_VS_USB VP_FREERTOS_VS_CMSIS_V1.Mode=CMSIS_V1 VP_FREERTOS_VS_CMSIS_V1.Signal=FREERTOS_VS_CMSIS_V1 VP_IWDG_VS_IWDG.Mode=IWDG_Activate @@ -323,6 +322,8 @@ VP_TIM6_VS_ClockSourceINT.Mode=Enable_Timer VP_TIM6_VS_ClockSourceINT.Signal=TIM6_VS_ClockSourceINT VP_TIM7_VS_ClockSourceINT.Mode=Enable_Timer VP_TIM7_VS_ClockSourceINT.Signal=TIM7_VS_ClockSourceINT +VP_USB_HOST_VS_USB_HOST_MSC_FS.Mode=MSC_FS +VP_USB_HOST_VS_USB_HOST_MSC_FS.Signal=USB_HOST_VS_USB_HOST_MSC_FS board=custom rtos.0.ip=FREERTOS isbadioc=false diff --git a/stm32halport b/stm32halport index 5fe45de..e0cd077 160000 --- a/stm32halport +++ b/stm32halport @@ -1 +1 @@ -Subproject commit 5fe45de21864dd3b53b0a8683f0067fa429d15a0 +Subproject commit e0cd077ca7616f1ec6c299b13925c98d772cc970 diff --git a/uappbase/apphal/apphal.cpp b/uappbase/apphal/apphal.cpp index daccb71..24c9c1f 100644 --- a/uappbase/apphal/apphal.cpp +++ b/uappbase/apphal/apphal.cpp @@ -342,21 +342,17 @@ void AppHal::tmc_spi_init() { } void AppHal::rtc_init() { - RTC_TimeTypeDef sTime = {0}; RTC_DateTypeDef sDate = {0}; - RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC; - PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI; + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC; + PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { Error_Handler(); } __HAL_RCC_RTC_ENABLE(); - - /** Initialize RTC Only */ hrtc.Instance = RTC; @@ -389,3 +385,40 @@ void AppHal::rtc_init() { Error_Handler(); } } + +void AppHal::usb_init() { + GPIO_InitTypeDef GPIO_InitStruct = {0}; + + __HAL_RCC_GPIOA_CLK_ENABLE(); + /**USB_OTG_FS GPIO Configuration + PA11 ------> USB_OTG_FS_DM + PA12 ------> USB_OTG_FS_DP + */ + GPIO_InitStruct.Pin = GPIO_PIN_11 | GPIO_PIN_12; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + __HAL_RCC_USB_OTG_FS_CLK_ENABLE(); + + hhcd_USB_OTG_FS.Instance = USB_OTG_FS; + hhcd_USB_OTG_FS.Init.Host_channels = 8; + hhcd_USB_OTG_FS.Init.speed = HCD_SPEED_FULL; + hhcd_USB_OTG_FS.Init.dma_enable = DISABLE; + hhcd_USB_OTG_FS.Init.phy_itface = HCD_PHY_EMBEDDED; + hhcd_USB_OTG_FS.Init.Sof_enable = DISABLE; + if (HAL_HCD_Init(&hhcd_USB_OTG_FS) != HAL_OK) { + Error_Handler(); + } + +#if 0 + __HAL_RCC_USB_OTG_FS_CLK_DISABLE(); + /**USB_OTG_FS GPIO Configuration + PA11 ------> USB_OTG_FS_DM + PA12 ------> USB_OTG_FS_DP + */ + HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12); +#endif +} diff --git a/uappbase/apphal/apphal.hpp b/uappbase/apphal/apphal.hpp index b63530a..7a1f1f6 100644 --- a/uappbase/apphal/apphal.hpp +++ b/uappbase/apphal/apphal.hpp @@ -17,6 +17,7 @@ class AppHal { static void tmc_spi_init(); static void rtc_init(); + static void usb_init(); }; diff --git a/usrc/service/app_core.cpp b/usrc/service/app_core.cpp index d95135b..bbbf707 100644 --- a/usrc/service/app_core.cpp +++ b/usrc/service/app_core.cpp @@ -196,6 +196,12 @@ void AppCore::test() { osDelay(1000); } + extern void MX_USB_HOST_Init(void); + MX_USB_HOST_Init(); + while (true) { + osDelay(1000); + } + // // 配置初始化 // ConfigService::ins()->initialize();