From f05796ba1385214e026bc2ed040cf63c16e1b37a Mon Sep 17 00:00:00 2001 From: Frank Voorburg Date: Mon, 12 Jun 2023 16:51:11 +0000 Subject: [PATCH] Refs #1229. Added support for firmware updates via USB to the Olimexino-STM32F3 demo programs. git-svn-id: https://svn.code.sf.net/p/openblt/code/trunk@1063 5dc33758-31d5-4daf-9ae8-b24bf3d40d73 --- .../Boot/.cproject | 7 +- .../Boot/.mxproject | 4 +- .../Boot/App/blt_conf.h | 13 + .../Boot/App/hooks.c | 59 + .../Boot/Boot.ioc | 25 +- .../Boot/Core/Inc/main.h | 1 + .../Boot/Core/Inc/stm32f3xx_hal_conf.h | 2 +- .../Boot/Core/Src/main.c | 36 + .../Boot/Core/Src/stm32f3xx_hal_msp.c | 65 + .../Boot/Debug/openblt_olimexino_stm32f3.srec | 2074 ++++++++++++----- .../Inc/stm32f3xx_hal_pcd.h | 989 ++++++++ .../Inc/stm32f3xx_hal_pcd_ex.h | 81 + .../Inc/stm32f3xx_ll_usb.h | 251 ++ .../Src/stm32f3xx_hal_pcd.c | 2064 ++++++++++++++++ .../Src/stm32f3xx_hal_pcd_ex.c | 186 ++ .../Src/stm32f3xx_ll_usb.c | 884 +++++++ .../Core/Inc/usbd_core.h | 161 ++ .../Core/Inc/usbd_ctlreq.h | 105 + .../Core/Inc/usbd_def.h | 348 +++ .../Core/Inc/usbd_ioreq.h | 119 + .../Core/Src/usbd_core.c | 611 +++++ .../Core/Src/usbd_ctlreq.c | 918 ++++++++ .../Core/Src/usbd_ioreq.c | 216 ++ .../Boot/USB_DEVICE/App/usbd_bulk.c | 400 ++++ .../Boot/USB_DEVICE/App/usbd_bulk.h | 120 + .../Boot/USB_DEVICE/App/usbd_desc.c | 424 ++++ .../Boot/USB_DEVICE/App/usbd_desc.h | 174 ++ .../Boot/USB_DEVICE/Target/usbd_conf.c | 611 +++++ .../Boot/USB_DEVICE/Target/usbd_conf.h | 198 ++ 29 files changed, 10518 insertions(+), 628 deletions(-) create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pcd.h create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pcd_ex.h create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_ll_usb.h create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd.c create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd_ex.c create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_ll_usb.c create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_core.h create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_def.h create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_core.c create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_bulk.c create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_bulk.h create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_desc.c create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_desc.h create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/Target/usbd_conf.c create mode 100644 Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/Target/usbd_conf.h diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/.cproject b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/.cproject index ab740700d..af3ca0064 100644 --- a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/.cproject +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/.cproject @@ -50,6 +50,9 @@ + + + @@ -79,9 +82,11 @@ + - + + diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/.mxproject b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/.mxproject index 8402c7b74..250cbc2bf 100644 --- a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/.mxproject +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/.mxproject @@ -1,8 +1,8 @@ [PreviousLibFiles] -LibFiles=Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_gpio.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_system.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_can.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_bus.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_cortex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_rcc.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_crs.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_utils.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_utils.c;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_exti.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_exti.c;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_pwr.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_dma.h;Drivers\STM32F3xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_def.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_rcc.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_rcc_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_gpio.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_gpio_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_dma_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_dma.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_cortex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pwr.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pwr_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_flash.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_flash_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_i2c.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_i2c_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_exti.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_usart.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_can.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_dma.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_cortex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_exti.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_usart.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_dma.c;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_gpio.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_system.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_can.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_bus.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_cortex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_rcc.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_crs.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_utils.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_utils.c;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_exti.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_exti.c;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_pwr.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_dma.h;Drivers\STM32F3xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_def.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_rcc.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_rcc_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_gpio.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_gpio_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_dma_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_dma.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_cortex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pwr.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pwr_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_flash.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_flash_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_i2c.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_i2c_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_exti.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_usart.h;Drivers\CMSIS\Device\ST\STM32F3xx\Include\stm32f303xc.h;Drivers\CMSIS\Device\ST\STM32F3xx\Include\stm32f3xx.h;Drivers\CMSIS\Device\ST\STM32F3xx\Include\system_stm32f3xx.h;Drivers\CMSIS\Device\ST\STM32F3xx\Source\Templates\system_stm32f3xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.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_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_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h; +LibFiles=Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_gpio.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_system.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_can.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_bus.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_cortex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_rcc.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_crs.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_utils.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_utils.c;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_exti.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_exti.c;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_pwr.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_dma.h;Drivers\STM32F3xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_def.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_rcc.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_rcc_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_gpio.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_gpio_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_dma_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_dma.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_cortex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pwr.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pwr_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_flash.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_flash_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_i2c.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_i2c_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_exti.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_usart.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pcd.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pcd_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_usb.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_usb.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_can.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_dma.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_cortex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_exti.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_usart.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_dma.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pcd.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pcd_ex.c;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_gpio.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_system.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_can.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_bus.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_cortex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_rcc.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_crs.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_utils.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_utils.c;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_exti.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_exti.c;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_pwr.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_dma.h;Drivers\STM32F3xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_def.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_rcc.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_rcc_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_gpio.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_gpio_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_dma_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_dma.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_cortex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pwr.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pwr_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_flash.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_flash_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_i2c.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_i2c_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_exti.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_usart.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pcd.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_hal_pcd_ex.h;Drivers\STM32F3xx_HAL_Driver\Inc\stm32f3xx_ll_usb.h;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_usb.c;Drivers\CMSIS\Device\ST\STM32F3xx\Include\stm32f303xc.h;Drivers\CMSIS\Device\ST\STM32F3xx\Include\stm32f3xx.h;Drivers\CMSIS\Device\ST\STM32F3xx\Include\system_stm32f3xx.h;Drivers\CMSIS\Device\ST\STM32F3xx\Source\Templates\system_stm32f3xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.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_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_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h; [PreviousUsedCubeIDEFiles] -SourceFiles=Core\Src\main.c;Core\Src\stm32f3xx_it.c;Core\Src\stm32f3xx_hal_msp.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_utils.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_exti.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_can.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_dma.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_cortex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_exti.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_usart.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_dma.c;Drivers\CMSIS\Device\ST\STM32F3xx\Source\Templates\system_stm32f3xx.c;Core\Src\system_stm32f3xx.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_utils.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_exti.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_can.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_dma.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_cortex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_exti.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_usart.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_dma.c;Drivers\CMSIS\Device\ST\STM32F3xx\Source\Templates\system_stm32f3xx.c;Core\Src\system_stm32f3xx.c;;; +SourceFiles=Core\Src\main.c;Core\Src\stm32f3xx_it.c;Core\Src\stm32f3xx_hal_msp.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_utils.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_exti.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_usb.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_can.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_dma.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_cortex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_exti.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_usart.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_dma.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pcd.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pcd_ex.c;Drivers\CMSIS\Device\ST\STM32F3xx\Source\Templates\system_stm32f3xx.c;Core\Src\system_stm32f3xx.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_utils.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_exti.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_usb.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_can.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_rcc_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_gpio.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_dma.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_cortex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pwr_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_flash_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_i2c_ex.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_exti.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_usart.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_ll_dma.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pcd.c;Drivers\STM32F3xx_HAL_Driver\Src\stm32f3xx_hal_pcd_ex.c;Drivers\CMSIS\Device\ST\STM32F3xx\Source\Templates\system_stm32f3xx.c;Core\Src\system_stm32f3xx.c;;; HeaderPath=Drivers\STM32F3xx_HAL_Driver\Inc;Drivers\STM32F3xx_HAL_Driver\Inc\Legacy;Drivers\CMSIS\Device\ST\STM32F3xx\Include;Drivers\CMSIS\Include;Core\Inc; CDefines=USE_FULL_LL_DRIVER;USE_HAL_DRIVER;STM32F303xC;USE_FULL_LL_DRIVER;USE_HAL_DRIVER;USE_HAL_DRIVER; diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/App/blt_conf.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/App/blt_conf.h index 797e2c744..d3314a561 100644 --- a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/App/blt_conf.h +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/App/blt_conf.h @@ -103,6 +103,19 @@ /** \brief Select the desired UART peripheral as a zero based index. */ #define BOOT_COM_RS232_CHANNEL_INDEX (2) +/* The USB communication interface is selected by setting the BOOT_COM_USB_ENABLE + * configurable to 1. The maximum amount of data bytes in a message for data transmission + * and reception is set through BOOT_COM_USB_TX_MAX_DATA and BOOT_COM_USB_RX_MAX_DATA, + * respectively. + * + */ +/** \brief Enable/disable USB transport layer. */ +#define BOOT_COM_USB_ENABLE (1) +/** \brief Configure number of bytes in the target->host data packet. */ +#define BOOT_COM_USB_TX_MAX_DATA (63) +/** \brief Configure number of bytes in the host->target data packet. */ +#define BOOT_COM_USB_RX_MAX_DATA (63) + /**************************************************************************************** * B A C K D O O R E N T R Y C O N F I G U R A T I O N diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/App/hooks.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/App/hooks.c index 41b8dc449..bf19902ef 100644 --- a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/App/hooks.c +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/App/hooks.c @@ -66,6 +66,65 @@ blt_bool CpuUserProgramStartHook(void) #endif /* BOOT_CPU_USER_PROGRAM_START_HOOK > 0 */ +/**************************************************************************************** +* U S B C O M M U N I C A T I O N I N T E R F A C E H O O K F U N C T I O N S +****************************************************************************************/ + +#if (BOOT_COM_USB_ENABLE > 0) +/************************************************************************************//** +** \brief Callback that gets called whenever the USB device should be connected +** to the USB bus. +** \details The connect to the USB bus, a pull-up resistor on the USB D+ line needs to +** be activated. The DISC (PC12) GPIO controls the gate of a P-MOSFET, which +** in turn controls the enabling/disabling of the pull-up resistor on the +** USB D+ line. When DISC is low (default), the Vgs is 0 - Vcc. With a +** negative Vgs, the P-MOSFET is on and the pull-up enabled. When DISC is +** high the P-MOSFET is off, disabling the pull-up. +** \param connect BLT_TRUE to connect and BLT_FALSE to disconnect. +** \return none. +** +****************************************************************************************/ +void UsbConnectHook(blt_bool connect) +{ + /* determine if the USB should be connected or disconnected */ + if (connect == BLT_TRUE) + { + /* the GPIO has a pull-up so to connect to the USB bus the pin needs to go low */ + LL_GPIO_ResetOutputPin(GPIOC, LL_GPIO_PIN_12); + } + else + { + /* the GPIO has a pull-up so to disconnect to the USB bus the pin needs to go high */ + LL_GPIO_SetOutputPin(GPIOC, LL_GPIO_PIN_12); + } +} /*** end of UsbConnect ***/ + + +/************************************************************************************//** +** \brief Callback that gets called whenever the USB host requests the device +** to enter a low power mode. +** \return none. +** +****************************************************************************************/ +void UsbEnterLowPowerModeHook(void) +{ + /* support to enter a low power mode can be implemented here */ +} /*** end of UsbEnterLowPowerMode ***/ + + +/************************************************************************************//** +** \brief Callback that gets called whenever the USB host requests the device to +** exit low power mode. +** \return none. +** +****************************************************************************************/ +void UsbLeaveLowPowerModeHook(void) +{ + /* support to leave a low power mode can be implemented here */ +} /*** end of UsbLeaveLowPowerMode ***/ +#endif /* BOOT_COM_USB_ENABLE > 0 */ + + /**************************************************************************************** * W A T C H D O G D R I V E R H O O K F U N C T I O N S ****************************************************************************************/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Boot.ioc b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Boot.ioc index 33ebc8c1f..908f55ea5 100644 --- a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Boot.ioc +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Boot.ioc @@ -18,19 +18,22 @@ Mcu.IP0=CAN Mcu.IP1=NVIC Mcu.IP2=RCC Mcu.IP3=USART3 -Mcu.IPNb=4 +Mcu.IP4=USB +Mcu.IPNb=5 Mcu.Name=STM32F303R(B-C)Tx Mcu.Package=LQFP64 Mcu.Pin0=PF0-OSC_IN Mcu.Pin1=PF1-OSC_OUT +Mcu.Pin10=PB9 Mcu.Pin2=PA0 Mcu.Pin3=PA5 Mcu.Pin4=PB10 Mcu.Pin5=PB11 -Mcu.Pin6=PC12 -Mcu.Pin7=PB8 -Mcu.Pin8=PB9 -Mcu.PinsNb=9 +Mcu.Pin6=PA11 +Mcu.Pin7=PA12 +Mcu.Pin8=PC12 +Mcu.Pin9=PB8 +Mcu.PinsNb=11 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F303RCTx @@ -51,6 +54,10 @@ PA0.GPIOParameters=GPIO_PuPd PA0.GPIO_PuPd=GPIO_PULLUP PA0.Locked=true PA0.Signal=GPIO_Input +PA11.Mode=Device +PA11.Signal=USB_DM +PA12.Mode=Device +PA12.Signal=USB_DP PA5.Locked=true PA5.Signal=GPIO_Output PB10.Locked=true @@ -100,7 +107,7 @@ ProjectManager.StackSize=0x1000 ProjectManager.TargetToolchain=STM32CubeIDE ProjectManager.ToolChainLocation= ProjectManager.UnderRoot=true -ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-LL-false,2-MX_GPIO_Init-GPIO-false-LL-true,3-MX_CAN_Init-CAN-true-HAL-false,4-MX_USART3_UART_Init-USART3-false-LL-true +ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-LL-false,2-MX_GPIO_Init-GPIO-false-LL-true,3-MX_CAN_Init-CAN-true-HAL-false,4-MX_USART3_UART_Init-USART3-false-LL-true,5-MX_USB_PCD_Init-USB-true-HAL-false RCC.ADC12outputFreq_Value=72000000 RCC.ADC34outputFreq_Value=72000000 RCC.AHBFreq_Value=72000000 @@ -120,14 +127,14 @@ RCC.HSI_VALUE=8000000 RCC.I2C1Freq_Value=8000000 RCC.I2C2Freq_Value=8000000 RCC.I2SClocksFreq_Value=72000000 -RCC.IPParameters=ADC12outputFreq_Value,ADC34outputFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSEPLLFreq_Value,HSE_VALUE,HSIPLLFreq_Value,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2SClocksFreq_Value,LSE_VALUE,LSI_VALUE,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PLLSourceVirtual,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,SYSCLKSourceVirtual,TIM1Freq_Value,TIM2Freq_Value,TIM8Freq_Value,UART4Freq_Value,UART5Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USBFreq_Value,VCOOutput2Freq_Value +RCC.IPParameters=ADC12outputFreq_Value,ADC34outputFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSEPLLFreq_Value,HSE_VALUE,HSIPLLFreq_Value,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2SClocksFreq_Value,LSE_VALUE,LSI_VALUE,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,PLLMUL,PRESCALERUSB,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,SYSCLKSourceVirtual,TIM1Freq_Value,TIM2Freq_Value,TIM8Freq_Value,UART4Freq_Value,UART5Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USBFreq_Value,VCOOutput2Freq_Value RCC.LSE_VALUE=32768 RCC.LSI_VALUE=40000 RCC.MCOFreq_Value=72000000 RCC.PLLCLKFreq_Value=72000000 RCC.PLLMCOFreq_Value=36000000 RCC.PLLMUL=RCC_PLL_MUL9 -RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE +RCC.PRESCALERUSB=RCC_USBCLKSOURCE_PLL_DIV1_5 RCC.RTCFreq_Value=40000 RCC.RTCHSEDivFreq_Value=250000 RCC.SYSCLKFreq_VALUE=72000000 @@ -140,7 +147,7 @@ RCC.UART5Freq_Value=36000000 RCC.USART1Freq_Value=72000000 RCC.USART2Freq_Value=36000000 RCC.USART3Freq_Value=36000000 -RCC.USBFreq_Value=72000000 +RCC.USBFreq_Value=48000000 RCC.VCOOutput2Freq_Value=8000000 USART3.BaudRate=57600 USART3.IPParameters=VirtualMode-Asynchronous,BaudRate diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Inc/main.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Inc/main.h index 3c54e5717..b07cca5ad 100644 --- a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Inc/main.h +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Inc/main.h @@ -62,6 +62,7 @@ extern "C" { /* Exported functions prototypes ---------------------------------------------*/ void Error_Handler(void); void MX_CAN_Init(void); +void MX_USB_PCD_Init(void); /* USER CODE BEGIN EFP */ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Inc/stm32f3xx_hal_conf.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Inc/stm32f3xx_hal_conf.h index 3a0d870a2..c3472ea4d 100644 --- a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Inc/stm32f3xx_hal_conf.h +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Inc/stm32f3xx_hal_conf.h @@ -64,7 +64,7 @@ /*#define HAL_SMARTCARD_MODULE_ENABLED */ /*#define HAL_SMBUS_MODULE_ENABLED */ /*#define HAL_WWDG_MODULE_ENABLED */ -/*#define HAL_PCD_MODULE_ENABLED */ +#define HAL_PCD_MODULE_ENABLED #define HAL_GPIO_MODULE_ENABLED #define HAL_EXTI_MODULE_ENABLED /* #define HAL_CAN_LEGACY_MODULE_ENABLED */ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Src/main.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Src/main.c index b7e2d7f32..ce36861cc 100644 --- a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Src/main.c +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Src/main.c @@ -41,6 +41,8 @@ /* Private variables ---------------------------------------------------------*/ CAN_HandleTypeDef hcan; +PCD_HandleTypeDef hpcd_USB_FS; + /* USER CODE BEGIN PV */ /* USER CODE END PV */ @@ -148,6 +150,7 @@ void SystemClock_Config(void) Error_Handler(); } LL_RCC_SetUSARTClockSource(LL_RCC_USART3_CLKSOURCE_PCLK1); + LL_RCC_SetUSBClockSource(LL_RCC_USB_CLKSOURCE_PLL_DIV_1_5); } /** @@ -243,6 +246,39 @@ static void MX_USART3_UART_Init(void) } +/** + * @brief USB Initialization Function + * @param None + * @retval None + */ +void MX_USB_PCD_Init(void) +{ + + /* USER CODE BEGIN USB_Init 0 */ + /* Note that this function is generated but not actually used. The bootloader handles + * the USB initialization. + */ + /* USER CODE END USB_Init 0 */ + + /* USER CODE BEGIN USB_Init 1 */ + + /* USER CODE END USB_Init 1 */ + hpcd_USB_FS.Instance = USB; + hpcd_USB_FS.Init.dev_endpoints = 8; + hpcd_USB_FS.Init.speed = PCD_SPEED_FULL; + hpcd_USB_FS.Init.phy_itface = PCD_PHY_EMBEDDED; + hpcd_USB_FS.Init.low_power_enable = DISABLE; + hpcd_USB_FS.Init.battery_charging_enable = DISABLE; + if (HAL_PCD_Init(&hpcd_USB_FS) != HAL_OK) + { + Error_Handler(); + } + /* USER CODE BEGIN USB_Init 2 */ + + /* USER CODE END USB_Init 2 */ + +} + /** * @brief GPIO Initialization Function * @param None diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Src/stm32f3xx_hal_msp.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Src/stm32f3xx_hal_msp.c index 7f24f7ec3..3d59d38af 100644 --- a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Src/stm32f3xx_hal_msp.c +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Core/Src/stm32f3xx_hal_msp.c @@ -141,6 +141,71 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan) } +/** +* @brief PCD MSP Initialization +* This function configures the hardware resources used in this example +* @param hpcd: PCD handle pointer +* @retval None +*/ +void HAL_PCD_MspInit(PCD_HandleTypeDef* hpcd) +{ + GPIO_InitTypeDef GPIO_InitStruct = {0}; + if(hpcd->Instance==USB) + { + /* USER CODE BEGIN USB_MspInit 0 */ + + /* USER CODE END USB_MspInit 0 */ + + __HAL_RCC_GPIOA_CLK_ENABLE(); + /**USB GPIO Configuration + PA11 ------> USB_DM + PA12 ------> USB_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_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF14_USB; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* Peripheral clock enable */ + __HAL_RCC_USB_CLK_ENABLE(); + /* USER CODE BEGIN USB_MspInit 1 */ + + /* USER CODE END USB_MspInit 1 */ + } + +} + +/** +* @brief PCD MSP De-Initialization +* This function freeze the hardware resources used in this example +* @param hpcd: PCD handle pointer +* @retval None +*/ +void HAL_PCD_MspDeInit(PCD_HandleTypeDef* hpcd) +{ + if(hpcd->Instance==USB) + { + /* USER CODE BEGIN USB_MspDeInit 0 */ + + /* USER CODE END USB_MspDeInit 0 */ + /* Peripheral clock disable */ + __HAL_RCC_USB_CLK_DISABLE(); + + /**USB GPIO Configuration + PA11 ------> USB_DM + PA12 ------> USB_DP + */ + HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12); + + /* USER CODE BEGIN USB_MspDeInit 1 */ + + /* USER CODE END USB_MspDeInit 1 */ + } + +} + /* USER CODE BEGIN 1 */ /** * De-Initializes the Global MSP. diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Debug/openblt_olimexino_stm32f3.srec b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Debug/openblt_olimexino_stm32f3.srec index fc218317f..78a33f3d3 100644 --- a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Debug/openblt_olimexino_stm32f3.srec +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Debug/openblt_olimexino_stm32f3.srec @@ -1,619 +1,1463 @@ S02100006F70656E626C745F6F6C696D6578696E6F5F73746D333266332E737265632B -S3150800000000A000200D060008E1050008E305000829 -S31508000010E5050008E7050008E905000800000000F6 -S31508000020000000000000000000000000EB050008CA -S31508000030ED05000800000000EF050008F1050008BE -S315080000405D0600085D0600085D0600085D060008F6 -S315080000505D0600085D0600085D0600085D060008E6 -S315080000605D0600085D0600085D0600085D060008D6 -S315080000705D0600085D0600085D0600085D060008C6 -S315080000805D0600085D0600085D0600085D060008B6 -S315080000905D0600085D0600085D0600085D060008A6 -S315080000A05D0600085D0600085D0600085D06000896 -S315080000B05D0600085D0600085D0600085D06000886 -S315080000C05D0600085D0600085D0600085D06000876 -S315080000D05D0600085D0600085D0600085D06000866 -S315080000E05D0600085D0600085D0600085D06000856 -S315080000F05D0600085D0600085D0600085D06000846 -S315080001000000000000000000000000005D06000876 -S315080001105D0600085D0600085D0600085D06000825 -S315080001205D0600085D0600085D0600085D06000815 -S315080001305D0600085D0600080000000000000000DB -S315080001405D0600085D0600085D0600080000000060 +S3150800000000A00020CD060008A1060008A3060008E7 +S31508000010A5060008A7060008A906000800000000B3 +S31508000020000000000000000000000000AB06000809 +S31508000030AD06000800000000AF060008B10600087B +S315080000401D0700081D0700081D0700081D070008F2 +S315080000501D0700081D0700081D0700081D070008E2 +S315080000601D0700081D0700081D0700081D070008D2 +S315080000701D0700081D0700081D0700081D070008C2 +S315080000801D0700081D0700081D0700081D070008B2 +S315080000901D0700081D0700081D0700081D070008A2 +S315080000A01D0700081D0700081D0700081D07000892 +S315080000B01D0700081D0700081D0700081D07000882 +S315080000C01D0700081D0700081D0700081D07000872 +S315080000D01D0700081D0700081D0700081D07000862 +S315080000E01D0700081D0700081D0700081D07000852 +S315080000F01D0700081D0700081D0700081D07000842 +S315080001000000000000000000000000001D070008B5 +S315080001101D0700081D0700081D0700081D07000821 +S315080001201D0700081D0700081D0700081D07000811 +S315080001301D0700081D070008000000000000000059 +S315080001401D0700081D0700081D070008000000001D S315080001500000000000000000000000000000000091 -S3150800016000000000000000005D0600085D060008AB -S315080001705D06000800000000000000000000000006 -S30D08000180000000005D060008FE +S3150800016000000000000000001D0700081D07000829 +S315080001701D07000800000000000000000000000045 +S30D08000180000000001D0700083D S3150800018810B5054C237833B9044B13B10448AFF3BB -S3150800019800800123237010BD100000200000000015 -S315080001A87825000808B5034B1BB103490348AFF384 -S315080001B8008008BD0000000014000020782500080B -S315080001C808B501F0D3FE08BD08B501F0DDFE08BD87 +S3150800019800800123237010BDC8000020000000005D +S315080001A8D058000808B5034B1BB103490348AFF3F9 +S315080001B8008008BD00000000CC000020D0580008C8 +S315080001C808B504F027FE08BD08B504F031FE08BDD9 S315080001D808B54FF090431B6913F0010F01D10020B1 -S315080001E808BD00F039F80120FAE708B5642000F0E0 -S315080001F805F808BD08B500F007F808BD014B1880D2 -S31508000208704700BF2C00002008B501F061FE0F4BAF -S315080002181B68984210D30E4B1B7873B90C4B0122F6 -S315080002281A704FF0904320229A6101F051FE094B4B -S315080002381B880344054A136008BD054B00221A703B -S315080002484FF0904320229A62EFE700BF3000002063 -S315080002582E0000202C0000204FF0904320229A629E -S31508000268704700002DE9F0438BB0002404940594E8 -S315080002780694079408940994264B5A6942F480020E -S315080002885A615A6902F480020392039A5A6942F437 -S3150800029800325A615A6902F400320292029A5A697D -S315080002A842F480225A615A6902F480220192019A1C -S315080002B85A6942F400225A615B6903F400230093E1 -S315080002C8009B4FF090464FF02009C6F82890124F29 -S315080002D84FF48058C7F8188001250495089504A98D -S315080002E8304600F09DFFCDF81090059506940794C2 -S315080002F8089404A9304600F093FFCDF810800595B8 -S3150800030806940794089404A9384600F089FF0BB0A8 -S31508000318BDE8F083001002400008004810B590B008 -S31508000328002409940A940B940C940D940E940F9433 -S31508000338039404940594069407940894224BDA695E -S3150800034842F48022DA61DA6902F480220292029A79 -S315080003585A6942F480225A615B6903F4802301933F -S31508000368019B4FF4406303930223049303230593E5 -S315080003780723089303A9154800F052FF4FF4614371 -S3150800038809930A940B940C940C230D930E940F94CA -S3150800039809A90F4801F092F90E4A52E8003F23F4DA -S315080003A8806342E800310029F6D1094B5A6822F4DD -S315080003B890425A609A6822F02A029A601A6842F0AD -S315080003C801021A6010B010BD00100240000400486F -S315080003D8004800400848004072B6FEE708B52A4AB1 -S315080003E8136823F0070343F002031360264B1B68C0 -S315080003F803F00703022BF9D1244A136843F4803320 -S315080004081360224B1B6813F4003FFAD01F4B5A6837 -S3150800041822F4741242F4E8125A60DA6A22F00F02D9 -S31508000428DA621A6842F080721A60184B1B6813F071 -S31508000438007FFAD0154B5A6822F0F0025A605A68BB -S3150800044822F4E06242F480625A605A6822F46052E2 -S315080004585A605A6822F0030242F002025A600B4BAD -S315080004685B6803F00C03082BF9D1094801F09AF9DF -S315080004780F2000F003F928B9044A136B23F4402324 -S31508000488136308BDFFF7A8FF0020024000100240CA -S3150800049800A24A0408B500F017F9FFF79FFFFFF70F -S315080004A8E1FEFFF73BFFFFF78BFEFFF78DFEFCE744 -S315080004B882B00A4B9A6942F001029A619A6902F077 -S315080004C801020092009ADA6942F08052DA61DB6921 -S315080004D803F080530193019B02B070470010024055 -S315080004E800B589B0002303930493059306930793ED -S315080004F80268144B9A4202D009B05DF804FB03F56A -S31508000508D633DA6942F00072DA61DA6902F0007203 -S315080005180192019A5A6942F480225A615B6903F486 -S3150800052880230293029B4FF4407303930223049398 -S31508000538032306930923079303A9034800F01AFD22 -S31508000548DAE700BF006400400004004830B589B007 -S3150800055800230293039304930593069307931B4C6E -S31508000568636943F400236361636903F40023019311 -S31508000578019B17484FF48053836102930123039321 -S3150800058802A900F04DFE00F0F5FE4FF09045202335 -S31508000598AB62104800F0D2FD284600F0CFFDE369AB -S315080005A823F48023E361636923F480236361636921 -S315080005B823F400336361E36923F08053E361A36995 -S315080005C823F00103A36109B030BD00BF0010024043 -S315080005D80008004800040048FEE7FEE7FEE7FEE7D5 -S315080005E8FEE770477047704708B500F07FF808BD02 -S315080005F8034AD2F8883043F47003C2F88830704743 -S3150800060800ED00E0DFF834D0FFF7F2FF0C480D499B -S315080006180D4A002302E0D458C4500433C4188C4247 -S31508000628F9D30A4A0A4C002301E013600432A242AD -S31508000638FBD301F079FFFFF72DFFFEE700A00020A6 -S31508000648000000201000002058260008100000208E -S3150800065830060020FEE7000010B5074B4FF0FF32C2 -S315080006681A6100241C61DA60DC609A629C62FFF7F2 -S315080006786DFF204610BD00BF0010024010B50446A5 -S315080006880E4B18784FF47A73B3FBF0F30C4A1068DC -S31508000698B0FBF3F000F014FB68B90F2C01D9012060 -S315080006A80AE0002221464FF0FF3000F0D1FA054B48 -S315080006B81C60002000E0012010BD00BF04000020D7 -S315080006C8000000200800002008B5074A136843F010 -S315080006D810031360032000F0A9FA0F20FFF7CEFFD6 -S315080006E8FFF7E6FE002008BD00200240034A11680D -S315080006F8034B1B780B441360704700BF3400002077 -S3150800070804000020002800F0A18038B5044690F8B7 -S315080007182030D3B12268136843F00103136001F04F -S31508000728DFFB054623685A6812F0010F10D101F05D -S31508000738D7FB401B0A28F5D9636A43F4003363627A -S31508000748052384F82030012038BDFFF7C9FEE1E704 -S315080007581A6822F002021A6001F0C2FB05462368ED -S315080007685A6812F0020F0DD001F0BAFB401B0A288E -S31508000778F5D9636A43F400336362052384F82030A5 -S315080007880120E1E7227E012A3DD01A6822F080027C -S315080007981A60637E012B3BD02268136823F0400356 -S315080007A81360A37E012B39D02268136823F020032F -S315080007B81360E37E012B37D02268136843F01003D1 -S315080007C81360237F012B35D02268136823F00803AA -S315080007D81360637F012B33D02268136823F0040360 -S315080007E81360A368E26813432269134362691343D3 -S315080007F86268013A21681343CB61002060620123CD -S3150800080884F82030A0E71A6842F080021A60C0E728 -S315080008182268136843F040031360C2E72268136826 -S3150800082843F020031360C4E72268136823F0100313 -S315080008381360C6E72268136843F008031360C8E71D -S315080008482268136843F004031360CAE70120704757 -S31508000858026890F82030013BDBB2012B05D9436AC0 -S3150800086843F4802343620120704730B4D2F800323B -S3150800087843F00103C2F800324B6903F01F03012055 -S3150800088800FA03F3D2F81C026FEA030C20EA030005 -S31508000898C2F81C02C869B0B9D2F80C020CEA000002 -S315080008A8C2F80C028C884869CD6844EA0544483081 -S315080008B842F830400C8848698D6844EA054448304F -S315080008C802EBC0004460C86901281BD0886980BB50 -S315080008D8D2F804020CEA0000C2F80402086970BBE0 -S315080008E8D2F814020CEA0000C2F81402096A0129AF -S315080008F82BD0D2F8003223F00103C2F800320020C8 -S3150800090830BC7047D2F80C021843C2F80C028C881F -S3150800091848690D6844EA0544483042F830408C89ED -S3150800092848698D6844EA0544483002EBC0004460CB -S31508000938CCE7D2F804021843C2F80402CEE7D2F884 -S3150800094814021843C2F81402D0E7D2F81C120B4353 -S31508000958C2F81C32CDE770B5044690F82050EDB2BF -S31508000968012D06D0436A43F400234362012528462D -S3150800097870BD022380F820300268136823F001034B -S31508000988136001F0ADFA064623685B6813F0010F99 -S315080009980CD001F0A5FA831B0A2BF5D9636A43F430 -S315080009A800336362052384F82030E0E70025656292 -S315080009B8DDE730B590F820C00468A4680CF1FF3C60 -S315080009C85FFA8CFCBCF1010F62D814F0E05F59D0CD -S315080009D8C4F3016C012404FA0CF41C608B68002B20 -S315080009E83DD10D68CB68046843EA45550CF11803F0 -S315080009F81B01E55003680C690CF1180E03EB0E137E -S31508000A085C600B7D012B35D0D17993791B0443EAB9 -S31508000A180163517943EA012314790168234301EBF9 -S31508000A280C11C1F88C31D17893781B0443EA016319 -S31508000A38517843EA0123117802680B4302EB0C123A -S31508000A48C2F8883102680CF1180C4FEA0C1C52F8E7 -S31508000A580C3043F0010342F80C3000201DE04C68C6 -S31508000A6843EAC403CC6823430CF118042401056837 -S31508000A782B51BFE7036803EB0E13596841F48071DD -S31508000A885960C1E7436A43F400134362012004E04E -S31508000A98436A43F480234362012030BD90F820302E -S31508000AA8013BDBB2012B01D90020704703689B681C -S31508000AB803EA8163B3EB816F01D0012070470020F8 -S31508000AC8704790F820C00CF1FF3C5FFA8CFCBCF12B -S31508000AD8010F00F2A58030B451B90468E46814F02F -S31508000AE8030F10D1436A43F40013436201207EE0E2 -S31508000AF80468246914F0030F05D1436A43F4001304 -S31508000B084362012073E0056801F11B0424012C598E -S31508000B1804F004049460002C6BD1056801F11B04E9 -S31508000B2824012C59640D1460046801F11B0C4FEA62 -S31508000B380C1C54F80C4004F00204D4600468A4445D -S31508000B48DCF8045015F0080F5BD008241461056812 -S31508000B5801F11B0C05EB0C156D68C5F307259561A6 -S31508000B68046804EB0C146468240C5461026802EBEC -S31508000B780112D2F8B8211A70026802EB0112D2F8EB -S31508000B88B821C2F307225A70026802EB0112D2F89A -S31508000B98B821C2F307429A70026802EB0112D2F82A -S31508000BA8B821120EDA70026802EB0112D2F8BC21DB -S31508000BB81A71026802EB0112D2F8BC21C2F30722A5 -S31508000BC85A71026802EB0112D2F8BC21C2F3074235 -S31508000BD89A71026802EB0112D2F8BC21120EDA7178 -S31508000BE8C1B90268D36843F02003D360002030BC3B -S31508000BF87047056801F11B0424012C59E408546060 -S31508000C0892E701F11B0504EB0514646804F00F0468 -S31508000C1814619CE70268136943F020031361E5E74A -S31508000C28436A43F48023436201207047074AD3681E -S31508000C3823F4E0631B041B0C000200F4E060034382 -S31508000C4843F0BF6343F40033D360704700ED00E018 -S31508000C5800B5194BDB68C3F30223C3F1070CBCF1D3 -S31508000C68040F28BF4FF0040C03F1040EBEF1060F5B -S31508000C7818D9033B4FF0FF3E0EFA0CFC21EA0C018B -S31508000C8899400EFA03F322EA0303194300280BDBFB -S31508000C980901C9B200F1604000F5614080F8001307 -S31508000CA85DF804FB0023E5E700F00F000901C9B267 -S31508000CB8024B1954F4E700BF00ED00E014ED00E01C -S31508000CC80138B0F1807F0BD24FF0E0235861054A0E -S31508000CD8F02182F823100020986107221A617047CC -S31508000CE80120704700ED00E0044B0022DA61044A4F -S31508000CF8136943F001031361018070473800002027 -S31508000D08002002400C4BDB6813F0100305D00B4A91 -S31508000D18D36943F00203D3611023074AD26812F055 -S31508000D28040F06D00549CA6942F00102CA6143F0B0 -S31508000D380403014AD36070470020024038000020A7 -S31508000D480A4B1B6913F0800F0BD0084B084A5A60E8 -S31508000D5802F188325A601B6913F0800F03D100200C -S31508000D687047002070470120704700BF00200240E6 -S31508000D7823016745034A136943F08003136100207A -S31508000D88704700BF0020024038B5044601F0A8F8AD -S31508000D980546144BDB6813F0010F0AD0B4F1FF3F80 -S31508000DA8F7D024B101F09CF8401BA042F1D90320E2 -S31508000DB812E00C4BDB6813F0200F02D0094B2022F7 -S31508000DC8DA60084BDB6813F0100F06D1054BDB68B1 -S31508000DD813F0040F01D1002038BDFFF793FF012057 -S31508000DE8FAE700BF002002402DE9F8431E46244BC7 -S31508000DF81B7E012B41D004460F469046204B012204 -S31508000E081A764CF25030FFF7BFFF034678BB012C21 -S31508000E1808D0022C03D04FF004091C4607E04FF00F -S31508000E280209FAE74FF00109F7E70134E4B24C453D -S31508000E381DD22101C1F12002A1F1200328FA01F1EE -S31508000E4806FA02F2114326FA03F3194389B207EBA5 -S31508000E584400FFF749FF4CF25030FFF795FF094B5E -S31508000E681D6925F001051D6103460028DDD0044AE1 -S31508000E78002111761846BDE8F8830223FAE700BF71 -S31508000E883800002000200240064B0022DA61064B93 -S31508000E981A6942F004021A611A6942F040021A6194 -S31508000EA8704700BF3800002000200240064B002289 -S31508000EB8DA61064B1A6942F002021A6158611A6920 -S31508000EC842F040021A6170473800002000200240AC -S31508000ED8264B1B7E012B45D070B505460E46234B7F -S31508000EE801221A760368934220D04CF25030FFF755 -S31508000EF84BFF88BB4FF0FF3333606C680121AA6843 -S31508000F086B6803EBC223A34227D92046FFF7CEFF17 -S31508000F184CF25030FFF738FF154A136923F00203DD -S31508000F2813610146B0B904F50064E8E74CF250309D -S31508000F38FFF72AFF08B101210FE0FFF7A5FF4CF2DA -S31508000F485030FFF721FF0146094A136923F00403C5 -S31508000F58136102E0346000E00121044B00221A768E -S31508000F68084670BD02210846704700BF38000020B1 -S31508000F7800200240F0B583B0002362E085685E0071 -S31508000F880324B44025EA0405CC68B4402C4384609D -S31508000F98446824EA0C0C4C68C4F300149C4044EAE0 -S31508000FA80C0444605EE0DD08083550F8256003F057 -S31508000FB807044FEA840C0F2404FA0CF426EA040EF4 -S31508000FC80C6904FA0CF444EA0E0440F8254060E07B -S31508000FD8042400E0002404FA0EF42C430CF1020C55 -S31508000FE8524D45F82C40524CA568D44325EA0206CA -S31508000FF84F6817F4801F01D042EA05064C4DAE60CB -S31508001008ED6804EA05064F6817F4001F01D042EA9E -S315080010180506474DEE606D6804EA05064F6817F43D -S31508001028003F01D042EA0506414D6E602D682C4006 -S315080010384E6816F4803F01D042EA05043C4A14601B -S3150800104801330A6832FA03F46ED04FF0010C0CFA31 -S3150800105803FC1CEA0202F3D04C6804F00304013CC2 -S31508001068012C8BD94C6804F00304032C0CD0C468F3 -S315080010785D004FF0030C0CFA05FC24EA0C0C8C688E -S31508001088AC4044EA0C04C4604C6804F00304022C1F -S3150800109889D004684FEA430E4FF0030C0CFA0EFC8D -S315080010A824EA0C0C4C6804F0030404FA0EF444EA27 -S315080010B80C0404604C6814F4403FC1D01D4CA56963 -S315080010C845F00105A561A46904F001040194019C91 -S315080010D84FEA930C0CF10205144C54F8255003F00A -S315080010E803044FEA840E0F2404FA0EF425EA0405CD -S315080010F8B0F1904F3FF46EAF0F4CA0420ED004F5F6 -S315080011088064A0420CD004F58064A0420AD004F595 -S315080011188064A0423FF45CAF05245CE701245AE7E3 -S31508001128022458E7032456E703B0F0BD000001403F -S31508001138000401400010024000040048B0F1904F36 -S3150800114810D0314B984218D0304B984223D0304BA8 -S3150800115898422ED02F4B984239D02F4B984244D0DC -S31508001168012070472D4B9A6A42F400329A629A6AAD -S3150800117822F400329A620020704703F1784303F597 -S3150800118803339A6A42F480229A629A6A22F480227F -S315080011989A620020704703F1784303F502339A6A86 -S315080011A842F400229A629A6A22F400229A6200207D -S315080011B8704703F1784303F501339A6A42F48012BB -S315080011C89A629A6A22F480129A620020704703F19A -S315080011D8784303F500339A6A42F400129A629A6AC7 -S315080011E822F400129A620020704703F1784303F547 -S315080011F8FE339A6A42F480029A629A6A22F4800254 -S315080012089A620020704700BF00040048000800489A -S31508001218000C00480010004800140048001002405E -S315080012280B6893FAA3F3B3FA83FC57E08D688268D0 -S3150800123893FAA3F4B4FA84F464004FF0030E0EFA92 -S3150800124804F422EA040293FAA3F4B4FA84F46400D0 -S3150800125805FA04F4224382600C68CD68426822EADB -S31508001268040205FB04F42243426045E093FAA3F21C -S31508001278B2FA82F2072A15D84D69026A93FAA3F4D4 -S31508001288B4FA84F4A4000F2606FA04F422EA04023F -S3150800129893FAA3F4B4FA84F4A40005FA04F42243EE -S315080012A8026241E04C69456A1A0A92FAA2FEBEFA37 -S315080012B88EFE4FEA8E0E0F2606FA0EFE25EA0E0554 -S315080012C892FAA2F2B2FA82F2920004FA02F22A43D7 -S315080012D8426229E0002070BD0CF1010C0B6833FA54 -S315080012E80CF244D0012202FA0CF21340F4D070B57D -S315080012F84A68013A012A99D9C26893FAA3F4B4FA52 -S3150800130884F46400032505FA04F422EA040293FA2D -S31508001318A3F4B4FA84F464000D6905FA04F42243C4 -S31508001328C2604A68022AA1D04A68046893FAA3FEEA -S31508001338BEFA8EFE4FEA4E0E032505FA0EFE24EA7D -S315080013480E0E93FAA3F3B3FA83F35B0002FA03F3D8 -S315080013584EEA030303600CF1010C0B6833FA0CF22E -S31508001368B8D0012202FA0CF21340F4D0C0E70020E4 -S315080013787047000082B0224A136843F001031360DD -S315080013881F4B1B6813F0020FFAD01D4A136823F087 -S31508001398F80343F0800313604FF0FF330193019974 -S315080013A8184B0B400193019B5360154B5B6813F070 -S315080013B80C0FFAD1124A13680193019B23F0847320 -S315080013C823F480330193019B13600D4B1B6813F0BC -S315080013D8007FFAD10A4B1A6822F480221A60002084 -S315080013E85860D86218634FF41F020192019A9A60EE -S315080013F898605A6A42F080725A6202B0704700BF13 -S31508001408001002400CC0FFF8034B5B68C3F30313D4 -S31508001418024AD35CD840704700100240902500085D -S31508001428034B5B68C3F30223024AD35CD840704770 -S3150800143800100240A0250008034B5B68C3F3C223CB -S31508001448024AD35CD840704700100240A02500081D -S315080014580E4B5B6803F48033ABB90D4B0B4AD06A65 -S3150800146800F00F000130B3FBF0F0536803F4701373 -S315080014784FF4701292FAA2F2B2FA82F2D340023309 -S3150800148803FB00F07047034BE8E700BF0010024073 -S3150800149800093D0000127A0008B5054B5B6803F0A1 -S315080014A80C03082B01D0034808BDFFF7D1FFFBE75B -S315080014B80010024000127A0010B50446FFF7ECFF48 -S315080014C82060FFF7A1FF6060FFF7AAFFA0606068C9 -S315080014D8FFF7B2FFE06010BD10B5044628BB414BC4 -S315080014E81B6B03228240134043EA0063022B14D085 -S315080014F8032B0BD0012B06D0FFF7CEFFFFF784FF8F -S31508001508FFF79AFF12E0FFF7C7FF0FE0354B186899 -S3150800151810F002000AD0344808E0324B186A10F076 -S31508001528020003D04FF4004000E00020102C02D03F -S31508001538122C2BD010BD2B4B1B6B0322A240134039 -S3150800154843EA0463294A934218D002F58032934243 -S315080015580DD0A2F50032934206D0FFF79DFFFFF79C -S3150800156853FFFFF75DFFE3E7FFF796FFE0E71D4B3D -S315080015781B6813F0020FDBD01B48D9E7194B1B6A07 -S3150800158813F0020FD4D04FF40040D1E7154B1B6B6C -S315080015980322A240134043EA0464154B9C4218D020 -S315080015A803F580239C420DD0A3F500239C4206D060 -S315080015B8FFF772FFFFF728FFFFF732FFBAE7FFF7D3 -S315080015C86BFFB7E7074B1B6813F0020FB2D0064844 -S315080015D8B0E7044B1B6A13F0020FABD04FF4004078 -S315080015E8A8E700BF0010024000127A0000000210A7 -S315080015F80000081210B50446B0F5401F04D00020B4 -S31508001608B4F5400F29D010BD284B1B6B034043EA9D -S315080016181023274A934218D002F5801293420DD018 -S31508001628A2F50012934206D0FFF736FFFFF7ECFE45 -S31508001638FFF7F6FEE4E7FFF72FFFE1E71B4B18680D -S3150800164810F00200DCD01B48DAE7184B186A10F0CD -S315080016580200D5D04FF40040D2E7144B1B6B234049 -S3150800166843EA1424144B9C4218D003F580039C4281 -S315080016780DD0A3F500039C4206D0FFF70DFFFFF730 -S31508001688C3FEFFF7CDFEBEE7FFF706FFBBE7074B2E -S315080016981B6813F0020FB6D00648B4E7034B1B6A5B -S315080016A813F0020FAFD04FF40040ACE70010024029 -S315080016B80030200000127A0000C0800038B50368A0 -S315080016C813F0010F5FD104460D46036823F4164349 -S315080016D823F00C034A68C9680A4329690A43A969B1 -S315080016E80A4313430360AB68426822F44052134323 -S315080016F843606B69826822F4407213438360244B03 -S3150800170898420DD0234B984212D0234B984213D0B7 -S31508001718224B984214D0224B984216D0012033E027 -S315080017280020FFF7D9FE80B32B689BB901202BE070 -S315080017381020FFF7D1FEF6E71220FFF7CDFEF2E7F5 -S315080017484FF44010FFF756FFEDE74FF44000FFF758 -S3150800175851FFE8E7AA69B2F5004F07D000EB530036 -S31508001768B0FBF3F39BB2E36000200DE05A0802EBE6 -S315080017784000B0FBF3F34FF6F0721A40C3F3420386 -S315080017881343E360F0E7012038BD0120FCE700BFFA -S31508001798003801400044004000480040004C004022 -S315080017A800500040014B1860704700BF0000002039 -S315080017B872B6704762B670472DE9F04184B00446A0 -S315080017C80D46174698466846FFF776FE0299174B60 -S315080017D8A3FB01318909002301E00133DBB2112B90 -S315080017E81FD8134A12F8130002EB4302527800EB8B -S315080017F8020C0CFB044CB1FBFCFE0CFB1E16002E5F -S31508001808EBD11FFA8EFCA5F800C00CF1FF3C1FFAB5 -S315080018188CFCBCF5806FE0D2387088F8002001206F -S3150800182800E0002004B0BDE8F08100BFD34D621087 -S31508001838E425000870B58CB00023ADF82E308DF875 -S315080018482D308DF82C300BAB0DF12D020DF12E0134 -S315080018584FF4FA70FFF7B0FF002835D01D4C1E4B21 -S315080018682360002525766576A5760126E67625770A -S315080018786577A560E5609DF82D30013B1B0423615B -S315080018889DF82C30013B1B056361BDF82E3063605B -S315080018982046FEF737FF0695079508964CF6E04367 -S315080018A8019302954FF6E073039304230493059571 -S315080018B809960E230A9301A92046FEF7C9FF204672 -S315080018C8FFF749F80CB070BDAF21044800F00CFBCF -S315080018D8C4E700BF5800002000640040A825000897 -S315080018E810B588B0024640F2E173029300230493C8 -S315080018F80593069101AB02A90B48FFF75AF808B1F8 -S3150800190808B010BD00F0E4FA00F13204019906485F -S31508001918FFF7C4F80028F3D000F0C2FB00F0D8FAA5 -S31508001928A042F3D9ECE700BF5800002010B588B0EC -S3150800193803460C4601AA00210848FFF7C2F850B921 -S31508001948019A40F267639A4206D1039B23B9059B1D -S315080019582370012000E0002008B010BD58000020C0 -S3150800196808B5FFF725FF08BD10B500F0C5F900B999 -S3150800197810BDFEF72DFC0028FAD000F049FBFEF74B -S315080019886BFE00F07DFA00F0BBF920F0604020F00D -S315080019987F00044B986000F0B3F94468FFF70AFF24 -S315080019A8A047E5E700ED00E070B50D46044606E0F9 -S315080019B815F8013B04F8013B00F072FB3246531E4A -S315080019C89EB2002AF4D170BD08B5C1F3080353B90D -S315080019D803688B4209D040F8041B4FF40072FFF7DE -S315080019E8E3FF012008BD0020FCE70120FAE72DE9FE -S315080019F8F0410746FFF7A4F900247F2C15D83E685E -S31508001A0806EB840807EB84035D6800F049FB2A4661 -S31508001A18002341460220FFF7E7F9804640B956F801 -S31508001A282430AB4206D10134E7E74FF0010801E05C -S31508001A384FF00008FFF79EF94046BDE8F081000020 -S31508001A4838B50D460C4B984211D004460B4B9942B3 -S31508001A5807D1094C29462046FFF7B6FF48B1204664 -S31508001A6838BDFFF7C4FF0028F4D10024F7E7044C73 -S31508001A78F0E70024F3E700BF84020020008000088E -S31508001A88800000202DE9F04106460C4617461D46FB -S31508001A9821F4FF7828F001080368B3F1FF3F07D05F -S31508001AA8336843450AD13168641A3444043414E067 -S31508001AB84146FFF789FF0028F2D11FE04146304624 -S31508001AC8FFF7BEFF06460028EDD1002016E017F8F6 -S31508001AD8013B04F8013B013D0FD000F0E1FA311D46 -S31508001AE8611AB1F5007FF2D308F500713046FFF7A1 -S31508001AF8A7FF064620B1041DE9E70120BDE8F081E5 -S31508001B080020FBE74FF0FF33024A1360024A1360CE -S31508001B18704700BF80000020840200200B4601F1B0 -S31508001B28FF3C1249091A8C4519D81149884218D315 -S31508001B3810B5191801390D4CA14214D820F4FF71B3 -S31508001B4821F001010A4CA14204D001460948FFF7D1 -S31508001B5899FF10BD01460848FFF794FFF9E70020EA -S31508001B687047002070470020F3E700BFFFFF03080F -S31508001B7800800008800000208402002030B585B067 -S31508001B88002303934A1E1F4B1B1A9A4231D820F486 -S31508001B98FF6323F007031C4A93422ED30A18013A17 -S31508001BA8184CA2422BD8C01A0844C0F3CF25C0F354 -S31508001BB80A0008B10135ADB2002400940193012347 -S31508001BC80293FFF7BDF8A5420DD900F069FA03A9F3 -S31508001BD86846FFF77DF950B9019B03F50063019341 -S31508001BE80134A4B2EFE70124FFF7C4F802E00024A1 -S31508001BF8FAE70024204605B030BD0024FAE7002499 -S31508001C08F8E700BFFFFF03080080000800B583B0A7 -S31508001C1800230193134B1B68B3F1FF3F20D0114AE9 -S31508001C285368019391680B440193D1680B44019357 -S31508001C3811690B44019351690B44019391690B444B -S31508001C480193D26913440193DB430193013301934A -S31508001C5801AA04210448FFF761FF03B05DF804FBF5 -S31508001C680120FAE784020020888100080A4B1A68CE -S31508001C78596811449A681144DA6811441A69114472 -S31508001C885A6911449A690A44D3F88831D34201D06B -S31508001C9800207047012070470080000808B50C4BE3 -S31508001CA81B68B3F1FF3F06D10A4B1B68B3F1FF3F28 -S31508001CB807D1012008BD0648FFF799FE0028F3D189 -S31508001CC8F8E70448FFF793FE0028F3D00120F1E768 -S31508001CD88402002080000020004870470080000821 -S31508001CE808B5FFF70FFF08BD08B5FFF717FF08BDCA -S31508001CF808B5FFF743FF08BD08B5FFF7B7FF08BDE6 -S31508001D0808B5FFF7E9FF08BD08B5FFF77FFF00B973 -S31508001D1808BDFFF7C3FFFBE7054BDB6913F0200F88 -S31508001D2804D0034B9B8C0370012070470020704732 -S31508001D380048004010B5094B188500F0C9F800F1AD -S31508001D480A04064BDB6913F0800F05D100F0A8F9E1 -S31508001D5800F0BEF8A042F4D910BD00BF0048004004 -S31508001D6810B588B00C4C236823F0010323604FF4A0 -S31508001D786143019300230293039304930C2205926B -S31508001D880693079301A92046FFF798FC236843F0B2 -S31508001D980103236008B010BD0048004070B5064628 -S31508001DA80D46812904D82846FFF7C4FF00240BE00E -S31508001DB86F21074800F098F8F5E700F071F9305DEB -S31508001DC8FFF7B8FF0134A4B2ABB2A342F5D870BD89 -S31508001DD80826000870B5254B1C78BCB92448FFF7B7 -S31508001DE89BFF012801D0204670BD214B1B78013B7B -S31508001DF8DBB2802BF7D800F06BF81E4B18601E4B29 -S31508001E0800221A70194B01221A70ECE706460D468D -S31508001E18194B1B78013316481844FFF77DFF04460B -S31508001E28012815D1144B1A780132D2B21A70104B00 -S31508001E381B789A4201D00024D5E710493046FFF7A7 -S31508001E48B3FD0A4B00221A700B4B1B782B70CAE796 -S31508001E5800F03EF8074B1B68C833984203D900249C -S31508001E68024B1C70BFE70024BDE700BF0A05002027 -S31508001E78880400200C0500200B0500208904002092 -S31508001E884FF0E02300221A615A619A6170470000F0 -S31508001E9808B5FFF7F5FF4FF0E023044A5A61002218 -S31508001EA89A6105211961024B1A6008BD3F1901009C -S31508001EB8100500204FF0E0231B6913F4803F03D078 -S31508001EC8024A136801331360704700BF10050020E3 -S31508001ED808B5FFF7EFFF014B186808BD1005002085 -S31508001EE808B5FFF7F5FF08BD08B500F0D9F8FCE70F -S31508001EF808B500F0CBF8012803D00B4B1B78012B4B -S31508001F0800D008BDFFF7E4FF084B1B68084A1268AB -S31508001F18134403F5FA739842F3D3034B00221A7055 -S31508001F28FFF722FDEDE700BF18050020140500207D -S31508001F381C05002008B5054B1B78012B00D008BDE9 -S31508001F48FFF7C6FF024B1860F9E700BF180500201F -S31508001F581C05002008B5044B01221A70FFF7EAFF92 -S31508001F68FFF7C6FF08BD00BF1805002008B5FFF72C -S31508001F78F7FC00F091F8FFF78BFFFFF7B1FE00F0CA -S31508001F880DF8FFF7E7FF08BD08B500F089F8FFF771 -S31508001F9891FF00F013F8FFF7ABFF08BD10B500F086 -S31508001FA82FFAFFF747FC044C01232370FFF7D8FEE6 -S31508001FB80023237010BD00BF0C00002000B583B0B5 -S31508001FC80DF107011048FFF7B1FC012809D00DF1FA -S31508001FD807010D48FFF7FEFE01280BD003B05DF890 -S31508001FE804FB0A4B01221A709DF80710064800F0F0 -S31508001FF829FAECE7054B00221A709DF807100248E3 -S3150800200800F020FAEAE700BF200500200C000020AF -S315080020187047000038B504460D46094B1B78012B56 -S3150800202805D0074B1B7833B100F004FA38BDC9B29E -S31508002038FFF756FCF5E7E9B22046FFF7AFFEF3E7E8 -S315080020480C000020074B1B78022B07D0032B07D060 -S31508002058012B01D08120704708207047002070475F -S31508002068002070470C000020074B1B78022B07D06E -S31508002078032B07D0012B01D0812070470820704711 -S3150800208800207047002070470C00002008B500F0B3 -S31508002098C9F900B1012008BD08B5FEF7A6F808BDBC -S315080020A808B5FEF7A7F808BD024B002283F8822078 -S315080020B8704700BFA4050020034BFE221A7058700B -S315080020C80222A3F886207047A405002003784278E0 -S315080020D843EA0223827843EA0243C07843EA006067 -S315080020E870470870C0F307234B70C0F307438B701B -S315080020F8000EC8707047000010B5064C002384F817 -S315080021088130FFF7D1FFFF2323700123A4F8863017 -S3150800211810BD00BFA4050020074BFF221A70002235 -S315080021285A7093F882109970DA701A715A710622E1 -S31508002138A3F88620704700BFA405002008B500202C -S31508002148FFF7BAFF08BD000010B5094CFF23237036 -S31508002158084BC4F8883000236370A370E370211D08 -S315080021680720FFF7BEFF0823A4F8863010BD00BF76 -S31508002178A40500204826000810B5064CFF2323703E -S315080021880430FFF7A3FFC4F888000123A4F88630B3 -S3150800219810BD00BFA405002008B53120FFF78CFF45 -S315080021A808BD000038B5084CFF2323700025657064 -S315080021B8A570FFF747FFE07025716571A5710723BC -S315080021C8A4F8863038BD00BFA405002038B5FFF747 -S315080021D86BFF0F4C012584F88150FF2323700023D9 -S315080021E8637010226270A370FFF72CFFE070FFF788 -S315080021F83BFF2071FFF738FFC0F307206071A57110 -S31508002208E5710823A4F88630FFF76AFD38BD00BFD4 -S31508002218A405002038B50446FFF714FF62789042F3 -S3150800222812D90B4DD5F88810681CFFF7BDFBFF239C -S315080022382B706278D5F888301344C5F888306378E7 -S315080022480133A5F8863038BD2220FFF735FFFAE7AF -S31508002258A405002038B50446FFF7F4FE63789842CB -S3150800226817D9201DFFF732FF01460C4DC5F888001F -S315080022786278681CFFF798FBFF232B706278D5F8FD -S3150800228888301344C5F8883063780133A5F8863052 -S3150800229838BD2220FFF710FFFAE700BFA405002083 -S315080022A8F8B505461746002406E015F8013B1C4410 -S315080022B8E4B2FFF7F5FE31464E1E0029F5D13C601B -S315080022C80120F8BD30B583B0002501950B4CFF23D6 -S315080022D823700430FFF7FAFE014601AAD4F88800ED -S315080022E8FFF7DEFF6070211D0198FFF7FAFEA5705B -S315080022F8E5700823A4F8863003B030BDA40500208D -S3150800230838B504460E4BD3F88850FFF79BFE621C77 -S31508002318411E2846FFF7E8FC70B1094CFF232370D5 -S31508002328FFF790FE0138D4F888300344C4F888309B -S315080023380123A4F8863038BD3120FFF7BDFEFAE739 -S31508002348A405002010B50446FFF77CFE013863781B -S31508002358984216DD134BFF221A700122A3F886202D -S31508002368617891B1A21C0F4BD3F88800FFF7BCFC23 -S3150800237898B161780B4AD2F888300B44C2F888308D -S3150800238810BD2220FFF798FEFAE7FFF7BDFC0028E4 -S31508002398F6D13120FFF790FEF2E73120FFF78CFEE1 -S315080023A8EEE700BFA405002010B50B4BD3F888400C -S315080023B80430FFF78BFE01462046FFF799FC30B13B -S315080023C8054BFF221A700122A3F8862010BD31207A -S315080023D8FFF772FEFAE700BFA405002008B5FFF765 -S315080023E8C3FA034BFF221A700122A3F8862008BDF8 -S315080023F8A405002008B589B2FFF70CFE08BD000041 -S31508002408074B002283F88120C3F8882083F88420A4 -S31508002418A3F8862083F8832083F88220704700BFB4 -S31508002428A4050020024B93F8810000B101207047EB -S31508002438A4050020024B002283F88420704700BFB9 -S31508002448A405002008B50378FF2B24D0354A92F84E -S315080024588120012A2BD1C93B352B53D8DFE803F055 -S315080024684052524F52524C43494652525252525275 -S315080024785252525252525252525252525252525226 -S3150800248852525252525252525252312B282E5252AC -S31508002498523452373A3DFFF799FE224B93F8843067 -S315080024A8012B33D01F4BB3F98610002932DC08BD3F -S315080024B8FFF7B0FEF1E7FFF7CDFEEEE7FFF75CFEA4 -S315080024C8EBE7FFF7FFFEE8E7FFF73EFEE5E7FFF76E -S315080024D835FEE2E7FFF720FEDFE7FFF70DFEDCE74C -S315080024E8FFF70EFFD9E7FFF72DFFD6E7FFF75AFEE6 -S315080024F8D3E7FFF759FFD0E7FFF770FFCDE7FFF7F8 -S315080025084BFECAE72020FFF7D7FDC6E71020FFF7DE -S31508002518D3FDC7E71846012380F88430FFF76AFF1A -S31508002528C5E700BFA405002070B50D4D0D4C641B0A -S31508002538A4100026A64209D10B4D0C4C00F018F839 -S31508002548641BA4100026A64205D170BD55F8043BA5 -S3150800255898470136EEE755F8043B98470136F2E7FF -S315080025685026000850260008502600085426000859 -S31508002578F8B500BFF8BC08BC9E467047F8B500BF5A -S30D08002588F8BC08BC9E4670472A -S315080025900000000000000000010203040607080905 -S315080025A00000000001020304433A2F576F726B2F95 -S315080025B0736F6674776172652F4F70656E424C54FF -S315080025C02F5461726765742F536F757263652F4157 -S315080025D0524D434D345F53544D333246332F636166 -S315080025E06E2E6300050206020603070308030903A5 -S315080025F009040A040B040C040C050D050E050F0549 -S315080026000F06100610071008433A2F576F726B2FE4 -S31508002610736F6674776172652F4F70656E424C549E -S315080026202F5461726765742F536F757263652F41F6 -S31508002630524D434D345F53544D333246332F7273E4 -S315080026403233322E630000004F70656E424C5400E0 -S30908002650AD010008C2 -S3090800265489010008E2 -S3150800265800127A00010000001000000004000000C3 -S7050800060DDF +S315080001E808BD00F04BF80120FAE70000012804D002 +S315080001F8044B4FF480529A617047024B4FF4805271 +S315080002089A627047000800487047704708B5642026 +S3150800021800F006F808BD08B500F008F808BD0000A3 +S31508000228014B1880704700BFE400002008B504F0A9 +S31508000238ADFB0F4B1B68984210D30E4B1B7873B94E +S315080002480C4B01221A704FF0904320229A6104F051 +S315080002589DFB094B1B880344054A136008BD054BDB +S3150800026800221A704FF0904320229A62EFE700BFE7 +S31508000278E8000020E6000020E40000204FF0904344 +S3150800028820229A62704700002DE9F0438BB00024BB +S31508000298049405940694079408940994264B5A6975 +S315080002A842F480025A615A6902F480020392039A58 +S315080002B85A6942F400325A615A6902F400320292C3 +S315080002C8029A5A6942F480225A615A6902F48022CB +S315080002D80192019A5A6942F400225A615B6903F449 +S315080002E800230093009B4FF090464FF02009C6F86C +S315080002F82890124F4FF48058C7F81880012504959E +S31508000308089504A9304602F077F8CDF810900595B7 +S3150800031806940794089404A9304602F06DF8CDF8B7 +S315080003281080059506940794089404A9384602F09F +S3150800033863F80BB0BDE8F0830010024000080048D7 +S3150800034810B590B0002409940A940B940C940D9453 +S315080003580E940F94039404940594069407940894A9 +S31508000368224BDA6942F48022DA61DA6902F48022D9 +S315080003780292029A5A6942F480225A615B6903F426 +S3150800038880230193019B4FF440630393022304934C +S31508000398032305930723089303A9154802F02CF8A5 +S315080003A84FF4614309930A940B940C940C230D9308 +S315080003B80E940F9409A90F4802F06CFA0E4A52E8EF +S315080003C8003F23F4806342E800310029F6D1094B3F +S315080003D85A6822F490425A609A6822F02A029A6069 +S315080003E81A6842F001021A6010B010BD00100240E7 +S315080003F800040048004800400848004072B6FEE776 +S3150800040808B52C4A136823F0070343F00203136060 +S31508000418284B1B6803F00703022BF9D1264A1368F1 +S3150800042843F480331360244B1B6813F4003FFAD057 +S31508000438214B5A6822F4741242F4E8125A60DA6AAE +S3150800044822F00F02DA621A6842F080721A601A4BB2 +S315080004581B6813F0007FFAD0174B5A6822F0F0028F +S315080004685A605A6822F4E06242F480625A605A680E +S3150800047822F460525A605A6822F0030242F00202D5 +S315080004885A600D4B5B6803F00C03082BF9D10B482F +S3150800049803F00EFA0F2000F051F948B9064B1A6B0B +S315080004A822F440221A635A6822F480025A6008BD68 +S315080004B8FFF7A4FF002002400010024000A24A04E9 +S315080004C808B500F061F9FFF79BFFFFF7DDFEFFF7B8 +S315080004D837FFFFF775FEFFF777FEFCE782B00A4B92 +S315080004E89A6942F001029A619A6902F00102009239 +S315080004F8009ADA6942F08052DA61DB6903F08053C0 +S315080005080193019B02B070470010024000B589B0FC +S315080005180023039304930593069307930268144BE1 +S315080005289A4202D009B05DF804FB03F5D633DA69B6 +S3150800053842F00072DA61DA6902F000720192019AF1 +S315080005485A6942F480225A615B6903F4802302934C +S31508000558029B4FF4407303930223049303230693E1 +S315080005680923079303A9034800F064FDDAE700BFE7 +S31508000578006400400004004810B588B000230393BF +S3150800058804930593069307930268134B9A4201D07E +S3150800059808B010BD114C636943F40033636163699D +S315080005A803F400330193019B4FF4C05303930223CA +S315080005B80493032306930E23079303A94FF0904049 +S315080005C800F038FDE36943F40003E361E36903F4E3 +S315080005D800030293029BDBE7005C00400010024020 +S315080005E808B50268074B9A4200D008BD064AD3697F +S315080005F823F40003D3614FF4C0514FF0904000F044 +S31508000608FDFDF2E7005C00400010024030B589B0F5 +S3150800061800230293039304930593069307931B4CAD +S31508000628636943F400236361636903F40023019350 +S31508000638019B17484FF48053836102930123039360 +S3150800064802A901F0D9FE01F081FF4FF09045202359 +S31508000658AB62104801F05EFE284601F05BFEE369CE +S3150800066823F48023E361636923F480236361636960 +S3150800067823F400336361E36923F08053E361A369D4 +S3150800068823F00103A36109B030BD00BF0010024082 +S315080006980008004800040048FEE7FEE7FEE7FEE714 +S315080006A8FEE770477047704708B500F07FF808BD41 +S315080006B8034AD2F8883043F47003C2F88830704782 +S315080006C800ED00E0DFF834D0FFF7F2FF0C480D49DB +S315080006D80D4A002302E0D458C4500433C4188C4287 +S315080006E8F9D30A4A0A4C002301E013600432A242ED +S315080006F8FBD305F0C5F8FFF7E3FEFEE700A00020E8 +S3150800070800000020C4000020545A0008C800002031 +S3150800071824100020FEE7000010B5074B4FF0FF3203 +S315080007281A6100241C61DA60DC609A629C62FFF731 +S315080007386DFF204610BD00BF0010024010B50446E4 +S315080007480E4B18784FF47A73B3FBF0F30C4A10681B +S31508000758B0FBF3F000F014FB68B90F2C01D901209F +S315080007680AE0002221464FF0FF3000F0D1FA054B87 +S315080007781C60002000E0012010BD00BF0400002016 +S31508000788000000200800002008B5074A136843F04F +S3150800079810031360032000F0A9FA0F20FFF7CEFF15 +S315080007A8FFF79CFE002008BD00200240034A116896 +S315080007B8034B1B780B441360704700BFD80300200F +S315080007C804000020002800F0A18038B5044690F8F7 +S315080007D82030D3B12268136843F00103136004F08C +S315080007E8DDF8054623685A6812F0010F10D104F09F +S315080007F8D5F8401B0A28F5D9636A43F400336362BF +S31508000808052384F82030012038BDFFF77FFEE1E78D +S315080008181A6822F002021A6004F0C0F8054623682E +S315080008285A6812F0020F0DD004F0B8F8401B0A28CF +S31508000838F5D9636A43F400336362052384F82030E4 +S315080008480120E1E7227E012A3DD01A6822F08002BB +S315080008581A60637E012B3BD02268136823F0400395 +S315080008681360A37E012B39D02268136823F020036E +S315080008781360E37E012B37D02268136843F0100310 +S315080008881360237F012B35D02268136823F00803E9 +S315080008981360637F012B33D02268136823F004039F +S315080008A81360A368E2681343226913436269134312 +S315080008B86268013A21681343CB610020606201230C +S315080008C884F82030A0E71A6842F080021A60C0E768 +S315080008D82268136843F040031360C2E72268136866 +S315080008E843F020031360C4E72268136823F0100353 +S315080008F81360C6E72268136843F008031360C8E75D +S315080009082268136843F004031360CAE70120704796 +S31508000918026890F82030013BDBB2012B05D9436AFF +S3150800092843F4802343620120704730B4D2F800327A +S3150800093843F00103C2F800324B6903F01F03012094 +S3150800094800FA03F3D2F81C026FEA030C20EA030044 +S31508000958C2F81C02C869B0B9D2F80C020CEA000041 +S31508000968C2F80C028C884869CD6844EA05444830C0 +S3150800097842F830400C8848698D6844EA054448308E +S3150800098802EBC0004460C86901281BD0886980BB8F +S31508000998D2F804020CEA0000C2F80402086970BB1F +S315080009A8D2F814020CEA0000C2F81402096A0129EE +S315080009B82BD0D2F8003223F00103C2F80032002007 +S315080009C830BC7047D2F80C021843C2F80C028C885F +S315080009D848690D6844EA0544483042F830408C892D +S315080009E848698D6844EA0544483002EBC00044600B +S315080009F8CCE7D2F804021843C2F80402CEE7D2F8C4 +S31508000A0814021843C2F81402D0E7D2F81C120B4392 +S31508000A18C2F81C32CDE770B5044690F82050EDB2FE +S31508000A28012D06D0436A43F400234362012528466C +S31508000A3870BD022380F820300268136823F001038A +S31508000A48136003F0ABFF064623685B6813F0010FD3 +S31508000A580CD003F0A3FF831B0A2BF5D9636A43F46A +S31508000A6800336362052384F82030E0E700256562D1 +S31508000A78DDE730B590F820C00468A4680CF1FF3C9F +S31508000A885FFA8CFCBCF1010F62D814F0E05F59D00C +S31508000A98C4F3016C012404FA0CF41C608B68002B5F +S31508000AA83DD10D68CB68046843EA45550CF118032F +S31508000AB81B01E55003680C690CF1180E03EB0E13BD +S31508000AC85C600B7D012B35D0D17993791B0443EAF9 +S31508000AD80163517943EA012314790168234301EB39 +S31508000AE80C11C1F88C31D17893781B0443EA016359 +S31508000AF8517843EA0123117802680B4302EB0C127A +S31508000B08C2F8883102680CF1180C4FEA0C1C52F826 +S31508000B180C3043F0010342F80C3000201DE04C6805 +S31508000B2843EAC403CC6823430CF118042401056876 +S31508000B382B51BFE7036803EB0E13596841F480711C +S31508000B485960C1E7436A43F400134362012004E08D +S31508000B58436A43F480234362012030BD90F820306D +S31508000B68013BDBB2012B01D90020704703689B685B +S31508000B7803EA8163B3EB816F01D001207047002037 +S31508000B88704790F820C00CF1FF3C5FFA8CFCBCF16A +S31508000B98010F00F2A58030B451B90468E46814F06E +S31508000BA8030F10D1436A43F40013436201207EE021 +S31508000BB80468246914F0030F05D1436A43F4001343 +S31508000BC84362012073E0056801F11B0424012C59CE +S31508000BD804F004049460002C6BD1056801F11B0429 +S31508000BE824012C59640D1460046801F11B0C4FEAA2 +S31508000BF80C1C54F80C4004F00204D4600468A4449D +S31508000C08DCF8045015F0080F5BD008241461056851 +S31508000C1801F11B0C05EB0C156D68C5F307259561E5 +S31508000C28046804EB0C146468240C5461026802EB2B +S31508000C380112D2F8B8211A70026802EB0112D2F82A +S31508000C48B821C2F307225A70026802EB0112D2F8D9 +S31508000C58B821C2F307429A70026802EB0112D2F869 +S31508000C68B821120EDA70026802EB0112D2F8BC211A +S31508000C781A71026802EB0112D2F8BC21C2F30722E4 +S31508000C885A71026802EB0112D2F8BC21C2F3074274 +S31508000C989A71026802EB0112D2F8BC21120EDA71B7 +S31508000CA8C1B90268D36843F02003D360002030BC7A +S31508000CB87047056801F11B0424012C59E40854609F +S31508000CC892E701F11B0504EB0514646804F00F04A8 +S31508000CD814619CE70268136943F020031361E5E78A +S31508000CE8436A43F48023436201207047074AD3685E +S31508000CF823F4E0631B041B0C000200F4E0600343C2 +S31508000D0843F0BF6343F40033D360704700ED00E057 +S31508000D1800B5194BDB68C3F30223C3F1070CBCF112 +S31508000D28040F28BF4FF0040C03F1040EBEF1060F9A +S31508000D3818D9033B4FF0FF3E0EFA0CFC21EA0C01CA +S31508000D4899400EFA03F322EA0303194300280BDB3A +S31508000D580901C9B200F1604000F5614080F8001346 +S31508000D685DF804FB0023E5E700F00F000901C9B2A6 +S31508000D78024B1954F4E700BF00ED00E014ED00E05B +S31508000D880138B0F1807F0BD24FF0E0235861054A4D +S31508000D98F02182F823100020986107221A6170470B +S31508000DA80120704700ED00E0044B0022DA61044A8E +S31508000DB8136943F00103136101807047E0030020BB +S31508000DC8002002400C4BDB6813F0100305D00B4AD1 +S31508000DD8D36943F00203D3611023074AD26812F095 +S31508000DE8040F06D00549CA6942F00102CA6143F0F0 +S31508000DF80403014AD360704700200240E00300203C +S31508000E080A4B1B6913F0800F0BD0084B084A5A6027 +S31508000E1802F188325A601B6913F0800F03D100204B +S31508000E287047002070470120704700BF0020024025 +S31508000E3823016745034A136943F0800313610020B9 +S31508000E48704700BF0020024038B5044603F0A6FDE7 +S31508000E580546144BDB6813F0010F0AD0B4F1FF3FBF +S31508000E68F7D024B103F09AFD401BA042F1D903201C +S31508000E7812E00C4BDB6813F0200F02D0094B202236 +S31508000E88DA60084BDB6813F0100F06D1054BDB68F0 +S31508000E9813F0040F01D1002038BDFFF793FF012096 +S31508000EA8FAE700BF002002402DE9F8431E46244B06 +S31508000EB81B7E012B41D004460F469046204B012243 +S31508000EC81A764CF25030FFF7BFFF034678BB012C61 +S31508000ED808D0022C03D04FF004091C4607E04FF04F +S31508000EE80209FAE74FF00109F7E70134E4B24C457D +S31508000EF81DD22101C1F12002A1F1200328FA01F12E +S31508000F0806FA02F2114326FA03F3194389B207EBE4 +S31508000F184400FFF749FF4CF25030FFF795FF094B9D +S31508000F281D6925F001051D6103460028DDD0044A20 +S31508000F38002111761846BDE8F8830223FAE700BFB0 +S31508000F48E003002000200240064B0022DA61064B27 +S31508000F581A6942F004021A611A6942F040021A61D3 +S31508000F68704700BFE003002000200240064B00221D +S31508000F78DA61064B1A6942F002021A6158611A695F +S31508000F8842F040021A617047E00300200020024040 +S31508000F98264B1B7E012B45D070B505460E46234BBE +S31508000FA801221A760368934220D04CF25030FFF794 +S31508000FB84BFF88BB4FF0FF3333606C680121AA6882 +S31508000FC86B6803EBC223A34227D92046FFF7CEFF57 +S31508000FD84CF25030FFF738FF154A136923F002031D +S31508000FE813610146B0B904F50064E8E74CF25030DD +S31508000FF8FFF72AFF08B101210FE0FFF7A5FF4CF21A +S315080010085030FFF721FF0146094A136923F0040304 +S31508001018136102E0346000E00121044B00221A76CD +S31508001028084670BD02210846704700BFE003002045 +S3150800103800200240F0B583B0002362E085685E00B0 +S315080010480324B44025EA0405CC68B4402C438460DC +S31508001058446824EA0C0C4C68C4F300149C4044EA1F +S315080010680C0444605EE0DD08083550F8256003F096 +S3150800107807044FEA840C0F2404FA0CF426EA040E33 +S315080010880C6904FA0CF444EA0E0440F8254060E0BA +S31508001098042400E0002404FA0EF42C430CF1020C94 +S315080010A8524D45F82C40524CA568D44325EA020609 +S315080010B84F6817F4801F01D042EA05064C4DAE600A +S315080010C8ED6804EA05064F6817F4001F01D042EADE +S315080010D80506474DEE606D6804EA05064F6817F47D +S315080010E8003F01D042EA0506414D6E602D682C4046 +S315080010F84E6816F4803F01D042EA05043C4A14605B +S3150800110801330A6832FA03F46ED04FF0010C0CFA70 +S3150800111803FC1CEA0202F3D04C6804F00304013C01 +S31508001128012C8BD94C6804F00304032C0CD0C46832 +S315080011385D004FF0030C0CFA05FC24EA0C0C8C68CD +S31508001148AC4044EA0C04C4604C6804F00304022C5E +S3150800115889D004684FEA430E4FF0030C0CFA0EFCCC +S3150800116824EA0C0C4C6804F0030404FA0EF444EA66 +S315080011780C0404604C6814F4403FC1D01D4CA569A2 +S3150800118845F00105A561A46904F001040194019CD0 +S315080011984FEA930C0CF10205144C54F8255003F049 +S315080011A803044FEA840E0F2404FA0EF425EA04050C +S315080011B8B0F1904F3FF46EAF0F4CA0420ED004F535 +S315080011C88064A0420CD004F58064A0420AD004F5D5 +S315080011D88064A0423FF45CAF05245CE701245AE723 +S315080011E8022458E7032456E703B0F0BD000001407F +S315080011F8000401400010024000040048002331FAA8 +S3150800120803F27AD0F0B52EE0042500E0002505FAA9 +S315080012180CFCA44555D004685D004FF0030C0CFA85 +S3150800122805FC24EA0C0404604FEAD30E0EF1080EF6 +S3150800123850F82E4003F00705AE000F25B54024EAFE +S31508001248050440F82E40C46824EA0C04C4604468BF +S3150800125824EA02024260826822EA0C0282600133AA +S3150800126831FA03F248D001229A4012EA0107F6D069 +S315080012784FEA930E0EF10205204C54F8254003F068 +S31508001288030C4FEA8C0C0F2505FA0CF63440B0F11E +S31508001298904FBBD01A4DA8420DD005F58065A842D7 +S315080012A80BD005F58065A84209D005F58065A842E2 +S315080012B8AAD00525ABE70125A9E70225A7E703254F +S315080012C8A5E7104C256825EA07052560656825EA17 +S315080012D807056560E56825EA0705E560A56825EA5E +S315080012E80707A760054F0EF1020457F8245025EAA8 +S315080012F8060547F824508EE7F0BD70470000014000 +S31508001308000400480004014038B512F4804F45D05F +S315080013180468B4F8503091F800C04FEACC0E1EFAAB +S3150800132883F3023304EB4303B3F80044C4F3090414 +S315080013388B69A34228D31B1B8B618B697BB905680C +S3150800134835F82C309BB223F4804323F0700383F4DA +S31508001358005343F4004343F0800325F82C3012F079 +S31508001368400F0ED002680D7832F825309BB223F468 +S31508001378E04323F0700343F4004343F0C00322F824 +S31508001388253024B9204638BD00238B61D5E7234686 +S315080013980A894969006802F072FAF3E70468B4F83A +S315080013A8503091F800C04FEACC0E1EFA83F3063384 +S315080013B804EB4303B3F80044C4F309048B69A34256 +S315080013C82FD31B1B8B618B697BB9056835F82C30C5 +S315080013D89BB223F4804323F0700383F4005343F449 +S315080013E8004343F0800325F82C3012F0400F0FD144 +S315080013F8026891F800C032F82C309BB223F4E04317 +S3150800140823F0700343F4004343F0C00322F82C305A +S31508001418002CB7D023464A894969006802F02FFA92 +S31508001428B0E700238B61CEE7002860D030B587B0D7 +S31508001438044690F8A9323BB1032384F8A9322068F8 +S3150800144801F0A5FA00231BE080F8A832FFF794F804 +S31508001458F2E75A1C02EB820104EBC101012048702D +S3150800146802EB820104F8313004EBC1000021C17097 +S3150800147803EB830004EBC0008163C1630164D3B244 +S3150800148860688342E5D3002316E003EB830204EB86 +S31508001498C202002182F8691182F8683182F86B1154 +S315080014A8C2F87811C2F87C1103EB830204EBC20276 +S315080014B8C2F880110133DBB29842E6D8A4465CF834 +S315080014C8105BEE46BCE80F00AEE80F00DCF800300B +S315080014D8CEF80030231D0ECB284601F062FA00200C +S315080014E884F82400012384F8A93207B030BD012006 +S315080014F8704738B590B10446032380F8A9320068C6 +S3150800150801F0A8FD054610B10125284638BD204634 +S31508001518FFF766F8002384F8A932F6E70125F4E709 +S3150800152838B590F8A832012B11D00446012580F861 +S31508001538A852006801F022FA2946204604F094F9D0 +S31508001548206801F098FD002084F8A80238BD02201A +S31508001558FCE790F8A832012B12D010B504460123EF +S3150800156880F8A832006801F012FA0021204604F033 +S315080015787BF9206801F081FD002084F8A80210BDD7 +S315080015880220704770B505460C46164612F0400FFD +S3150800159800F00E810268B2F850300978C80010FACF +S315080015A883F3023302EB4303B3F80024C2F30902B8 +S315080015B8A36993424ED99B1AA361A369002B66D1E6 +S315080015C86378002B49D12A68B2F8503012FA83F3A7 +S315080015D803EB0111B1F80434C3F30903A1F8043481 +S315080015E8B1F804346FEA43436FEA53439BB2A1F850 +S315080015F8043429686278002A3CD1B1F8503011FAC7 +S3150800160883F3227803EB0213B3F80C24C2F3090216 +S31508001618A3F80C24B3F80C246FEA42426FEA524244 +S3150800162892B2A3F80C242178284604F023F816F475 +S31508001638804F41D02A68217832F821309BB223F4AA +S31508001648E04323F0700343F4404343F0800322F851 +S31508001658213031E00023A361AFE7012BC9D12A68FD +S31508001668B2F8503012FA83F303EB01110023A1F8FC +S315080016780434BEE7012AD6D1B1F8503011FA83F3FB +S31508001688217803EB01130022A3F80C24CBE716F400 +S31508001698804F0DD0286830F821309BB223F4E043F8 +S315080016A823F0700343F4404343F0800320F82130C5 +S315080016B894F82430012B12D02A68217832F8213080 +S315080016C89BB223F4E04323F0400383F0300343F44A +S315080016D8004343F0800322F82130002070BD636977 +S315080016E813446361E3691344E361216A23699942F0 +S315080016F824D3C91A21626278002A44D12968B1F824 +S31508001708502011FA82F2217802EB0112B2F8041479 +S31508001718C1F30901A2F804143E2B1BD9580913F082 +S315080017281F0F00D10138B2F8041489B2800280B2BA +S31508001738014341F40041A2F8041426E021B9002324 +S3150800174884F824301346D6E7002384F82430236225 +S315080017580B46D0E74BB9B2F804146FEA41416FEA71 +S31508001768514189B2A2F804140FE0590813F0010F81 +S3150800177800D00131B2F8040480B2890289B2014363 +S31508001788A2F8041401E0012A06D09BB222896169ED +S31508001798286801F078FC8FE72968B1F8502011FA13 +S315080017A882F2217802EB011299B2A2F80414ECE746 +S315080017B80268B2F850300978C80010FA83F306337D +S315080017C802EB4303B3F80024C2F30902A369934260 +S315080017D84FD39B1AA361A369002B67D16378002BA3 +S315080017E84AD12A68B2F8503012FA83F303EB01118A +S315080017F8B1F80434C3F30903A1F80434B1F804347E +S315080018086FEA43436FEA53439BB2A1F80434296845 +S315080018186278002A3DD1B1F8503011FA83F322785C +S3150800182803EB0213B3F80C24C2F30902A3F80C2439 +S31508001838B3F80C246FEA42426FEA524292B2A3F80E +S315080018480C242178284603F015FF16F4804F7FF4F8 +S3150800185833AF2A68217832F821309BB223F4E04363 +S3150800186823F0700343F4404343F0800322F8213001 +S3150800187822E70023A361AEE7012BC8D12A68B2F88C +S31508001888503012FA83F303EB01110023A1F804344C +S31508001898BDE7012AD5D1B1F8503011FA83F321787A +S315080018A803EB01130022A3F80C24CAE716F4804FA9 +S315080018B80DD1286830F821309BB223F4E04323F091 +S315080018C8700343F4404343F0800320F8213094F82A +S315080018D82430012B7FF4F0AE636913446361E3692E +S315080018E81344E361216A2369994224D3C91A2162F8 +S315080018F829686278002A43D1B1F8502011FA82F291 +S31508001908217802EB0112B2F80C14C1F30901A2F806 +S315080019180C143E2B1BD9580913F01F0F00D1013898 +S31508001928B2F80C1489B2800280B2014341F400412E +S31508001938A2F80C1426E021B9002384F824301346AB +S31508001948D6E70023236284F824300B46D0E74BB940 +S31508001958B2F80C146FEA41416FEA514189B2A2F80C +S315080019680C140FE0590813F0010F00D00131B2F832 +S315080019780C0480B2890289B20143A2F80C1401E06A +S31508001988012A06D09BB262896169286801F07BFB47 +S3150800199892E6B1F8502011FA82F2217802EB011288 +S315080019A899B2A2F80C14EDE72DE9F0410546286826 +S315080019B8B0F8443013F4004F00F08E82B0F8444073 +S315080019C8A3B214F00F0440F0E28013F0100F6BD0A6 +S315080019D803889AB213F4006F40F09D8012F4004F02 +S315080019E8E5D0038823F070031B051B0D43F080031D +S315080019F803802868B0F8503095F86821D20012FAA2 +S31508001A0883F3063300EB4303B3F80034C3F309033F +S31508001A18C5F884318BB1D5F87C1171B1B5F86E214A +S31508001A2801F02DFFD5F88421D5F87C311344C5F883 +S31508001A387C310021284603F011FE2A68138899B2DA +S31508001A4813F4006FB3D101F44051B1F5405FAED03D +S31508001A58B2F8503012FA83F2B2F80C34C3F3090319 +S31508001A68A2F80C34D5F878313E2B77D9590913F0F2 +S31508001A781F0F00D10139B2F80C349BB2890289B21A +S31508001A880B4343F40043A2F80C342A6813889BB224 +S31508001A9823F4804323F0700383F4405343F400434C +S31508001AA843F08003138082E703889BB223F4E1435B +S31508001AB823F070036FEA43436FEA53439BB20380EC +S31508001AC82A68B2F8503095F82810C90011FA83F335 +S31508001AD8023302EB4303B3F80034C3F309036B6418 +S31508001AE8EA6B1344EB630021284603F0C3FD95F817 +S31508001AF82430002B3FF45BAF2B6C002B7FF457AFD9 +S31508001B0895F824302A6843F08003A2F84C3000235D +S31508001B1885F824304BE7B0F8503095F86821D2009C +S31508001B2812FA83F3063300EB4303B3F80034C3F31E +S31508001B380903C5F88431B5F86E2105F52C7101F04D +S31508001B489EFE2A68138823F070031B051B0D43F0B5 +S31508001B5880031380284603F079FD28E74BB9B2F8C5 +S31508001B680C346FEA43436FEA53439BB2A2F80C342A +S31508001B788BE7590813F0010F00D00131B2F80C347D +S31508001B8898B28B029BB20343A2F80C347DE730F86F +S31508001B9824309EB213F4004F4CD116F0800F3FF450 +S31508001BA806AF621C02EB820105EBC101286830F812 +S31508001BB824309BB223F4E14323F070036FEA4343CE +S31508001BC86FEA53439BB220F82430CB78012B00F0F8 +S31508001BD8F28016F4807F40F07A812868B0F8503091 +S31508001BE8621C02EB820215F83260F20012FA83F3DD +S31508001BF8023300EB4303B3F80034C3F3090304EBD9 +S31508001C08840205EBC202126C9A4240F24C8104EB3C +S31508001C18840705EBC707D21A3A6404EB840205EB76 +S31508001C28C202126C002A40F045813146284603F064 +S31508001C3821FDBCE630F8243023F070031B051B0D84 +S31508001C4843F0800320F8243004EB8401C90001F529 +S31508001C58B47105EB010804EB840305EBC30393F899 +S31508001C687431002B42D12868B0F8503004EB84024E +S31508001C7805EBC20292F86821D20012FA83F30633FA +S31508001C8800EB4303B3F80074C7F3090717BB04EB63 +S31508001C98840305EBC303D3F884213A44C3F88421A3 +S31508001CA8D3F87C213A44C3F87C21D3F880313BB178 +S31508001CB804EB840305EBC303D3F878319F4275D246 +S31508001CC804EB840305EBC30393F86811284603F06D +S31508001CD8C5FC62E704EB840105EBC1013B46B1F894 +S31508001CE86E21D1F87C1101F0CAFDD0E704EB840314 +S31508001CF805EBC30393F86B31022B35D0296804EB3F +S31508001D08840205EBC20292F8680131F820309BB2CA +S31508001D1823F4E04323F0700343F4004343F0C0037D +S31508001D2821F82030286892F8683130F8232012F410 +S31508001D38804F20D0B0F85020DB0013FA82F3023324 +S31508001D4800EB4303B3F80074C7F30907002F9ED0C6 +S31508001D5804EB840105EBC1013B46B1F87021D1F8C3 +S31508001D687C1101F08CFD92E7324641462846FFF77A +S31508001D78CBFA07468BE7B0F85020DB0013FA82F354 +S31508001D88063300EB4303B3F80074C7F30907002FBB +S31508001D983FF47DAF04EB840105EBC1013B46B1F87E +S31508001DA87221D1F87C1101F06AFD70E7414628686E +S31508001DB801F07EF9F1E604EB840305EBC303002280 +S31508001DC81A6493F83430FBB116F0400F37D04B78C5 +S31508001DD81BBB2A68B2F8503012FA83F3621C02EB6E +S31508001DE8820215F8322003EB0213B3F80424C2F36F +S31508001DF80902A3F80424B3F804246FEA42426FEAF6 +S31508001E08524292B2A3F80424013404EB840415F868 +S31508001E183410284603F02EFCC9E5012BF4D12A68AC +S31508001E28B2F8503012FA83F3621C02EB820215F8F4 +S31508001E38322003EB02130022A3F80424E4E72A68F5 +S31508001E48631C03EB830305EBC3035B78D3B9B2F8CA +S31508001E58503012FA83F3621C02EB820215F832201C +S31508001E6803EB0213B3F80C24C2F30902A3F80C24F3 +S31508001E78B3F80C246FEA42426FEA524292B2A3F8C8 +S31508001E880C24C1E7012BBFD1B2F8503012FA83F3FC +S31508001E98621C02EB820215F8322003EB02130022B9 +S31508001EA8A3F80C24B0E704EB840205EBC20200276A +S31508001EB81764B2E604EB840205EBC202D66B1E442D +S31508001EC8D663546C2344536401F0F2F86FE532463E +S31508001ED82846FFF757FB6AE50020BDE8F08190F829 +S31508001EE8A832012B0DD010B50446012180F8A81296 +S31508001EF803F0BAFC206801F0BEF8002084F8A802AE +S31508001F0810BD0220704790F8A832012B0ED010B5E4 +S31508001F180446012380F8A832002103F0A5FC2068AE +S31508001F2801F0ABF8002084F8A80210BD022070471B +S31508001F3890F8A832012B0DD010B50446012380F875 +S31508001F48A83280F82410006801F08FF8002084F879 +S31508001F58A80210BD0220704710B50446006801F0B3 +S31508001F688EF810F4004F1ED110F4806F1FD110F4AC +S31508001F78804F2DD110F4005F34D110F4805F3BD127 +S31508001F8810F4006F57D110F4007F71D110F4807FD8 +S31508001F9827D02268B2F844309BB223F480739BB2E8 +S31508001FA8A2F844301DE02046FFF7FEFC19E0226837 +S31508001FB8B2F844309BB223F480639BB2A2F844304B +S31508001FC8204603F069FB00212046FFF7B1FF08E029 +S31508001FD82268B2F844309BB223F480439BB2A2F835 +S31508001FE8443010BD2268B2F844309BB223F400533B +S31508001FF89BB2A2F84430F4E72268B2F840309BB2A4 +S3150800200823F004039BB2A2F840302268B2F84030A5 +S315080020189BB223F008039BB2A2F84030204603F08F +S3150800202863FB2268B2F844309BB223F480539BB210 +S31508002038A2F84430D5E72268B2F840309BB243F09C +S315080020480803A2F840302268B2F844309BB223F459 +S3150800205800639BB2A2F844302268B2F840309BB2BB +S3150800206843F00403A2F84030204603F02BFBB8E7F8 +S315080020782268B2F844309BB223F400739BB2A2F8E4 +S315080020884430204603F001FBABE710B50446084682 +S3150800209811F0800F25D101F0070C0CEB8C01C90053 +S315080020A801F5B47E04EB0E010CEB8C0C04EBCC0C9E +S315080020B84FF0000E8CF869E100F0070008700A6115 +S315080020C8CB70022B1AD094F8A832012B19D0012309 +S315080020D884F8A832206800F075FC002084F8A80265 +S315080020E810BD01F0070C0CF1010C0CEB8C0104EB8C +S315080020F8C1014FF0010E81F801E0DDE700230B71FD +S31508002108E1E70220ECE710B504460B4611F0800F0C +S315080021181FD101F0070202EB8201C90001F5B4716B +S31508002128014402EB820200EBC202002082F8690130 +S3150800213803F007030B7094F8A832012B13D0012378 +S3150800214884F8A832206800F024FE002084F8A80243 +S3150800215810BD01F00702013202EB820100EBC10152 +S3150800216801204870E4E70220F2E710B501F0070CF1 +S315080021780CEB8C01C90001F5B4710CEB8C0E00EB65 +S31508002188CE0ECEF87C21CEF880310024CEF88441D4 +S315080021988EF869418EF868C10144006800F088FF26 +S315080021A8204610BD01F0070101EB810100EBC101D2 +S315080021B8D1F88401704738B501F0070404F1010C19 +S315080021C80CEB8C0104EB840E00EBCE0ECEF83C200B +S315080021D8CEF8403001228EF84C20CEF8483000253B +S315080021E8CEF8445000EBC1035A7000F8314019463E +S315080021F8006800F05DFF284638BD0B4601F0070267 +S3150800220841688A422AD810B5044613F0800F1DD1B2 +S3150800221803EB8301C90001F5B471014403EB830399 +S3150800222800EBC303002083F8690101238B700A7049 +S3150800223894F8A832012B13D0012384F8A832206811 +S3150800224800F092FE002084F8A80210BD531C03EB88 +S31508002258830100EBC10101204870E6E701207047B9 +S315080022680220F2E70B4601F00F014268914230D886 +S3150800227810B5044613F0800F21D103F0070202EBCC +S315080022888201C90001F5B471014402EB820200EB30 +S31508002298C202002082F8690100228A7003F0070347 +S315080022A80B7094F8A832012B15D0012384F8A832AC +S315080022B8206800F07EFE002084F8A80210BD03F00E +S315080022C80702013202EB820100EBC10101204870C6 +S315080022D8E2E7012070470220F0E711F0800F0BD0E3 +S315080022E801F00701013101EB810100EBC10152B987 +S315080022F80A73CB800020704701EB8101C90001F5FC +S31508002308B4710144F3E701220A730B811B0C4B8154 +S31508002318F0E70000B0F1904F10D0314B984218D032 +S31508002328304B984223D0304B98422ED02F4B9842A8 +S3150800233839D02F4B984244D0012070472D4B9A6AC2 +S3150800234842F400329A629A6A22F400329A620020AB +S31508002358704703F1784303F503339A6A42F48022F7 +S315080023689A629A6A22F480229A620020704703F1D8 +S31508002378784303F502339A6A42F400229A629A6A03 +S3150800238822F400229A620020704703F1784303F585 +S3150800239801339A6A42F480129A629A6A22F480127F +S315080023A89A620020704703F1784303F500339A6A66 +S315080023B842F400129A629A6A22F400129A6200207B +S315080023C8704703F1784303F5FE339A6A42F48002AC +S315080023D89A629A6A22F480029A620020704700BFBD +S315080023E80004004800080048000C0048001000488F +S315080023F800140048001002400B6893FAA3F3B3FAD6 +S3150800240883FC57E08D68826893FAA3F4B4FA84F4D7 +S3150800241864004FF0030E0EFA04F422EA040293FA53 +S31508002428A3F4B4FA84F4640005FA04F42243826037 +S315080024380C68CD68426822EA040205FB04F42243C4 +S31508002448426045E093FAA3F2B2FA82F2072A15D84F +S315080024584D69026A93FAA3F4B4FA84F4A4000F2621 +S3150800246806FA04F422EA040293FAA3F4B4FA84F402 +S31508002478A40005FA04F42243026241E04C69456A5D +S315080024881A0A92FAA2FEBEFA8EFE4FEA8E0E0F2698 +S3150800249806FA0EFE25EA0E0592FAA2F2B2FA82F2B8 +S315080024A8920004FA02F22A43426229E0002070BD2B +S315080024B80CF1010C0B6833FA0CF244D0012202FA2B +S315080024C80CF21340F4D070B54A68013A012A99D932 +S315080024D8C26893FAA3F4B4FA84F46400032505FAE7 +S315080024E804F422EA040293FAA3F4B4FA84F464001E +S315080024F80D6905FA04F42243C2604A68022AA1D083 +S315080025084A68046893FAA3FEBEFA8EFE4FEA4E0E90 +S31508002518032505FA0EFE24EA0E0E93FAA3F3B3FA78 +S3150800252883F35B0002FA03F34EEA030303600CF134 +S31508002538010C0B6833FA0CF2B8D0012202FA0CF235 +S315080025481340F4D0C0E700207047000082B0224A42 +S31508002558136843F0010313601F4B1B6813F0020F3F +S31508002568FAD01D4A136823F0F80343F08003136072 +S315080025784FF0FF3301930199184B0B400193019BC8 +S315080025885360154B5B6813F00C0FFAD1124A13689F +S315080025980193019B23F0847323F480330193019BF1 +S315080025A813600D4B1B6813F0007FFAD10A4B1A68A3 +S315080025B822F480221A6000205860D86218634FF403 +S315080025C81F020192019A9A6098605A6A42F08072CC +S315080025D85A6202B0704700BF001002400CC0FFF8EC +S315080025E8034B5B68C3F30313024AD35CD8407047AE +S315080025F800100240E8580008034B5B68C3F302233F +S31508002608024AD35CD840704700100240F8580008C0 +S31508002618034B5B68C3F3C223024AD35CD8407047AE +S3150800262800100240F85800080E4B5B6803F4803324 +S31508002638ABB90D4B0B4AD06A00F00F000130B3FB5B +S31508002648F0F0536803F470134FF4701292FAA2F27A +S31508002658B2FA82F2D340023303FB00F07047034B09 +S31508002668E8E700BF0010024000093D0000127A00A2 +S3150800267808B5054B5B6803F00C03082B01D0034823 +S3150800268808BDFFF7D1FFFBE70010024000127A00E9 +S3150800269810B50446FFF7ECFF2060FFF7A1FF60605E +S315080026A8FFF7AAFFA0606068FFF7B2FFE06010BDF9 +S315080026B810B5044628BB414B1B6B032282401340C6 +S315080026C843EA0063022B14D0032B0BD0012B06D048 +S315080026D8FFF7CEFFFFF784FFFFF79AFF12E0FFF731 +S315080026E8C7FF0FE0354B186810F002000AD03448C7 +S315080026F808E0324B186A10F0020003D04FF4004085 +S3150800270800E00020102C02D0122C2BD010BD2B4B29 +S315080027181B6B0322A240134043EA0463294A9342E7 +S3150800272818D002F5803293420DD0A2F500329342B2 +S3150800273806D0FFF79DFFFFF753FFFFF75DFFE3E7B7 +S31508002748FFF796FFE0E71D4B1B6813F0020FDBD077 +S315080027581B48D9E7194B1B6A13F0020FD4D04FF45C +S315080027680040D1E7154B1B6B0322A240134043EAEE +S315080027780464154B9C4218D003F580239C420DD05F +S31508002788A3F500239C4206D0FFF772FFFFF728FF40 +S31508002798FFF732FFBAE7FFF76BFFB7E7074B1B6888 +S315080027A813F0020FB2D00648B0E7044B1B6A13F0C1 +S315080027B8020FABD04FF40040A8E700BF0010024054 +S315080027C800127A00000002100000081210B504462C +S315080027D8B0F5401F04D00020B4F5400F29D010BD2D +S315080027E8284B1B6B034043EA1023274A934218D009 +S315080027F802F5801293420DD0A2F50012934206D034 +S31508002808FFF736FFFFF7ECFEFFF7F6FEE4E7FFF7FC +S315080028182FFFE1E71B4B186810F00200DCD01B48B5 +S31508002828DAE7184B186A10F00200D5D04FF40040C2 +S31508002838D2E7144B1B6B234043EA1424144B9C42DF +S3150800284818D003F580039C420DD0A3F500039C42DB +S3150800285806D0FFF70DFFFFF7C3FEFFF7CDFEBEE76D +S31508002868FFF706FFBBE7074B1B6813F0020FB6D046 +S315080028780648B4E7034B1B6A13F0020FAFD04FF4B0 +S315080028880040ACE7001002400030200000127A0031 +S3150800289800C0800038B5036813F0010F5FD10446FD +S315080028A80D46036823F4164323F00C034A68C968DF +S315080028B80A4329690A43A9690A4313430360AB68AB +S315080028C8426822F44052134343606B69826822F4D3 +S315080028D8407213438360244B98420DD0234B984289 +S315080028E812D0234B984213D0224B984214D0224B2D +S315080028F8984216D0012033E00020FFF7D9FE80B3AE +S315080029082B689BB901202BE01020FFF7D1FEF6E7CC +S315080029181220FFF7CDFEF2E74FF44010FFF756FFF7 +S31508002928EDE74FF44000FFF751FFE8E7AA69B2F56B +S31508002938004F07D000EB5300B0FBF3F39BB2E360FC +S3150800294800200DE05A0802EB4000B0FBF3F34FF6FF +S31508002958F0721A40C3F342031343E360F0E7012019 +S3150800296838BD0120FCE700BF00380140004400409C +S3150800297800480040004C0040005000400346002034 +S31508002988A3F844004FF43F42A3F840207047B0F834 +S31508002998403023F47C535B045B0CA0F840300020DD +S315080029A8704784B0844601A880E80E000123ACF875 +S315080029B840300020ACF84000ACF84400ACF85000B1 +S315080029C804B0704710B503460A7830F822C01FFAD3 +S315080029D88CFC2CF4EC4C2CF0700C1FFA8CFCC87888 +S315080029E8032862D8DFE800F0565D0259002048F24D +S315080029F8800E4CEA0E0C23F822C091F800C033F872 +S31508002A082C2012B222F4E04222F070024CEA0202AA +S31508002A1892B242EA0E0223F82C200A7B002A40F0DA +S31508002A28DC804A78002A51D0B3F8502013FA82F28B +S31508002A380C7802EB0412B1F806C04FEA5C0C4FEAB0 +S31508002A484C0CA2F800C40C7833F8242012F0400F76 +S31508002A580CD033F8242092B222F4E04222F0700215 +S31508002A6842F4004242F0C00223F82420CA78012A18 +S31508002A781DD0097833F8212092B222F4E04222F0D8 +S31508002A88400282F0200242F4004242F0800223F813 +S31508002A98212017E14CF4007CA9E74CF4C06C00200F +S31508002AA8A5E74CF4806C0020A1E701209FE7097888 +S31508002AB833F8212092B222F4E04222F0400242F48E +S31508002AC8004242F0800223F82120FBE0B3F85020A8 +S31508002AD813FA82F20C7802EB0412B1F806C04FEA30 +S31508002AE85C0C4FEA4C0CA2F808C4B3F8502013FA49 +S31508002AF882F20C7802EB0412B2F80CC4CCF3090C77 +S31508002B08A2F80CC40C693E2C39D94FEA541E14F0A5 +S31508002B181F0F01D10EF1FF3EB2F80CC41FFA8CFC48 +S31508002B284FEA8E2E1FFA8EFE4CEA0E0C4CF4004C19 +S31508002B38A2F80CC40C7833F8242012F4804F0CD071 +S31508002B4833F8242092B222F4E04222F0700242F4CA +S31508002B58404242F0800223F82420097869BB33F8FA +S31508002B68212092B222F4804222F0700282F4405266 +S31508002B7842F4004242F0800223F82120A2E04CB930 +S31508002B88B2F80C446FEA44446FEA5444A4B2A2F873 +S31508002B980C44CFE74FEA540C14F0010F01D00CF19E +S31508002BA8010CB2F80C44A4B24FEA8C2C1FFA8CFC20 +S31508002BB844EA0C0CA2F80CC4BCE733F8212092B2FC +S31508002BC822F4804222F0700282F4005242F4004253 +S31508002BD842F0800223F8212074E0CA78022A72D0CB +S31508002BE80C7833F8242092B222F4E24222F07002DA +S31508002BF842F4004242F0800223F82420B3F8502019 +S31508002C0813FA82F291F800C002EB0C12B1F808C068 +S31508002C184FEA5C0C4FEA4C0CA2F800C4B3F85020F3 +S31508002C2813FA82F291F800C002EB0C12B1F80AC046 +S31508002C384FEA5C0C4FEA4C0CA2F808C44A78002AFA +S31508002C4850D10C7833F8242012F4804F0CD033F87E +S31508002C58242092B222F4E04222F0700242F4404262 +S31508002C6842F0800223F824200C7833F8242012F046 +S31508002C78400F0CD033F8242092B222F4E04222F016 +S31508002C88700242F4004242F0C00223F8242091F868 +S31508002C9800C033F82C2092B222F4804222F0700247 +S31508002CA882F4405248F28004224323F82C200978FB +S31508002CB833F8212092B222F4E04222F0400222435D +S31508002CC823F8212010BD0C7833F8242092B222F478 +S31508002CD8E04222F0700242F4014242F0800223F8F0 +S31508002CE824208BE70C7833F8242012F4804F0CD074 +S31508002CF833F8242092B222F4E04222F0700242F419 +S31508002D08404242F0800223F824200C7833F8242025 +S31508002D1812F0400F0CD033F8242092B222F4E04285 +S31508002D2822F0700242F4004242F0C00223F824203E +S31508002D38CA78012A1ED00C7833F8242092B222F4D5 +S31508002D48E04222F0400282F0200242F4004242F0B9 +S31508002D58800223F82420097833F8212092B222F435 +S31508002D68804222F0700242F4004242F0800223F8C0 +S31508002D782120A7E70C7833F8242092B222F4E042FF +S31508002D8822F0400242F4004242F0800223F824204E +S31508002D98E1E70B7B002B46D14B7813B30A7830F85A +S31508002DA8223013F0400F0CD030F822309BB223F4AF +S31508002DB8E04323F0700343F4004343F0C00320F8CC +S31508002DC822300A7830F822309BB223F4E04323F005 +S31508002DD8400343F4004343F0800320F822300020E0 +S31508002DE870470A7830F8223013F4804F0CD030F840 +S31508002DF822309BB223F4E04323F0700343F44043A4 +S31508002E0843F0800320F822300A7830F822309BB243 +S31508002E1823F4804323F0700343F4004343F080030C +S31508002E2820F82230DBE74B78002B4ED10A7830F8A9 +S31508002E38223013F4804F0CD030F822309BB223F49A +S31508002E48E04323F0700343F4404343F0800320F83B +S31508002E5822300A7830F8223013F0400F0CD030F8B8 +S31508002E6822309BB223F4E04323F0700343F4004373 +S31508002E7843F0C00320F822300A7830F822309BB293 +S31508002E8823F4E04323F0700343F4004343F0C003FC +S31508002E9820F822300B7830F8232092B222F48042A8 +S31508002EA822F0700248F2800C42EA0C0220F823202D +S31508002EB80A7830F822309BB223F4E04323F0400323 +S31508002EC843EA0C0320F8223089E70A7830F82230DA +S31508002ED813F4804F0CD030F822309BB223F4E04329 +S31508002EE823F0700343F4404343F0800320F822306C +S31508002EF80A7830F8223013F0400F0CD030F8223018 +S31508002F089BB223F4E04323F0700343F4004343F0F1 +S31508002F18C00320F822300A7830F822309BB223F40E +S31508002F28E04323F0700343F4404343F0800320F85A +S31508002F3822300B7830F8232092B222F4E04222F0AD +S31508002F48400248F2800C42EA0C0220F823200A784C +S31508002F5830F822309BB223F4804323F0700343EA07 +S31508002F680C0320F822303AE74B788BB10A7830F808 +S31508002F7822309BB223F4E04323F0400383F0100386 +S31508002F8843F4004343F0800320F8223000207047BA +S31508002F980A7830F822309BB223F4804323F0700372 +S31508002FA883F4805343F4004343F0800320F8223027 +S31508002FB8ECE70B7B002B4BD14B7833B30A7830F808 +S31508002FC8223013F0400F0CD030F822309BB223F48D +S31508002FD8E04323F0700343F4004343F0C00320F8AA +S31508002FE82230CB78012B33D00A7830F822309BB2BE +S31508002FF823F4E04323F0400383F0200343F400431B +S3150800300843F0800320F8223022E00A7830F822308C +S3150800301813F4804F0CD030F822309BB223F4E043E7 +S3150800302823F0700343F4404343F0800320F822302A +S315080030380A7830F822309BB223F4804323F07003D1 +S3150800304883F4405343F4004343F0800320F82230C6 +S315080030580020704703460122A0F840200020A3F864 +S3150800306844000322A3F84020704711B98023A0F82A +S315080030784C30002070470020704700207047B0F891 +S31508003088440080B2704710B45C1C640800EB420226 +S3150800309802F5806207E00B78487843EA002322F8AD +S315080030A8043B0231013C002CF5D15DF8044B70470E +S315080030B870B505460C464A78012A3BD00B7B002B8F +S315080030C840F0A6828B690A69934240F284829B1A69 +S315080030D88B61B5F8503015FA83F3217803EB0113A1 +S315080030E8B3F80C14C1F30901A3F80C143E2A40F2EC +S315080030F87682510912F01F0F00D10139B3F80C2452 +S3150800310892B2890289B20A4342F40042A3F80C240F +S31508003118227835F822309BB223F4804323F07003D3 +S3150800312883F4405343F4004343F0800325F82230E0 +S31508003138002070BD8E6909698E4200D90E46237B28 +S3150800314873B3E378022B4DD0236A9B1B236223783B +S3150800315835F8231011F0400F00F0F581002A40F0E9 +S31508003168E281B5F8502015FA82F202EB0313B3F898 +S315080031780C24C2F30902A3F80C243E2E40F2BA81A5 +S31508003188710916F01F0F00D10139B3F80C2492B251 +S31508003198890289B20A4342F40042A3F80C24CBE117 +S315080031A8B6B23346E28861692846FFF76CFFB5F878 +S315080031B8503015FA83F3227803EB0213A3F8046454 +S315080031C8227835F822309BB223F4E04323F04003F3 +S315080031D883F0300343F4004343F0800325F8223094 +S315080031E80020A6E7236A994280F06681227835F896 +S315080031F822309BB223F4E04323F0700343F40143DF +S3150800320843F0800325F82230236A9B1B2362237820 +S3150800321835F8232012F0400F00F0A7806278B2BB79 +S31508003228B5F8502015FA82F202EB0313B3F80C240A +S31508003238C2F30902A3F80C243E2E0FD9710916F019 +S315080032481F0F00D10139B3F80C2492B2890289B24A +S315080032580A4342F40042A3F80C241AE04EB9B3F81C +S315080032680C246FEA42426FEA524292B2A3F80C243F +S315080032780FE0720816F0010F00D00132B3F80C14EB +S3150800328889B2920292B20A43A3F80C2401E0012AF1 +S3150800329830D0B3B2628961692846FFF7F4FE6369DC +S315080032A833446361236A226993422DD99B1B23629F +S315080032B86378002B45D1B5F8503015FA83F3227890 +S315080032C803EB0213B3F80424C2F30902A3F804248F +S315080032D83E2E1DD9710916F01F0F00D10139B3F812 +S315080032E8042492B2890289B20A4342F40042A3F836 +S315080032F8042428E0B5F8502015FA82F202EB0313E5 +S31508003308B2B2A3F80C24C4E7002222621E46CFE70D +S315080033184EB9B3F804246FEA42426FEA524292B2AF +S31508003328A3F804240FE0720816F0010F00D0013242 +S31508003338B3F8041489B2920292B20A43A3F8042491 +S3150800334801E0012B06D0B3B2228961692846FFF746 +S315080033589AFE35E7B5F8503015FA83F3227803EB69 +S315080033680213B2B2A3F80424EDE76278B2BBB5F843 +S31508003378502015FA82F202EB0313B3F80424C2F3B9 +S315080033880902A3F804243E2E0FD9710916F01F0F57 +S3150800339800D10139B3F8042492B2890289B20A43E2 +S315080033A842F40042A3F804241AE04EB9B3F80424F8 +S315080033B86FEA42426FEA524292B2A3F804240FE037 +S315080033C8720816F0010F00D00132B3F8041489B256 +S315080033D8920292B20A43A3F8042401E0012A30D0E3 +S315080033E8B3B2228961692846FFF74DFE63693344FB +S315080033F86361236A226993422DD99B1B23626378EA +S31508003408002B45D1B5F8503015FA83F3227803EB2B +S315080034180213B3F80C24C2F30902A3F80C243E2EAF +S315080034281DD9710916F01F0F00D10139B3F80C24FC +S3150800343892B2890289B20A4342F40042A3F80C24DC +S3150800344828E0B5F8502015FA82F202EB0313B2B257 +S31508003458A3F80424C4E7002222621E46CFE74EB921 +S31508003468B3F80C246FEA42426FEA524292B2A3F8C2 +S315080034780C240FE0720816F0010F00D00132B3F8D9 +S315080034880C1489B2920292B20A43A3F80C2401E0FA +S31508003498012B06D0B3B2628961692846FFF7F3FDA6 +S315080034A88EE6B5F8503015FA83F3227803EB021343 +S315080034B8B2B2A3F80C24EDE7217835F8212092B2A8 +S315080034C822F4E24222F0700242F4004242F08002FC +S315080034D825F82120B5F8502015FA82F2217802EB52 +S315080034E801129BB2A2F80434228961692846FFF7BB +S315080034F8CAFD65E64EB9B3F80C246FEA42426FEA8C +S31508003508524292B2A3F80C2416E0720816F0010F7C +S3150800351800D00132B3F80C1489B2920292B20A4367 +S31508003528A3F80C2408E0B5F8502015FA82F202EB45 +S315080035380313B2B2A3F80C24B3B2628961692846A8 +S31508003548FFF7A1FD3CE6B2BBB5F8502015FA82F2A2 +S3150800355802EB0313B3F80424C2F30902A3F80424FC +S315080035683E2E0FD9710916F01F0F00D10139B3F88D +S31508003578042492B2890289B20A4342F40042A3F8A3 +S31508003588042421E04EB9B3F804246FEA42426FEAEC +S31508003598524292B2A3F8042416E0720816F0010FF4 +S315080035A800D00132B3F8041489B2920292B20A43DF +S315080035B8A3F8042408E0B5F8502015FA82F202EBBD +S315080035C80313B2B2A3F80424B3B222896169284660 +S315080035D8FFF759FDF4E500228A611A4679E54AB9E2 +S315080035E8B3F80C246FEA42426FEA524292B2A3F841 +S315080035F80C248DE5510812F0010F00D00131B3F8FB +S315080036080C2492B2890289B21143A3F80C147FE5F7 +S31508003618CB78022B4DD0012B40F02F81896923697D +S31508003628994240F2E680C91AA161F2B9B5F8502064 +S3150800363815FA82F2217802EB0112B2F80414C1F3E2 +S315080036480901A2F804143E2B40F2D780580913F052 +S315080036581F0F00D10138B2F8041489B2800280B26B +S31508003668014341F40041A2F804146278002A40F0A4 +S31508003678F680B5F8502015FA82F2217802EB011285 +S31508003688B2F80C14C1F30901A2F80C143E2B40F247 +S31508003698CD80590913F01F0F00D10139B2F80C343F +S315080036A89BB2890289B20B4343F40043A2F80C344F +S315080036B82EE5F2B9B0F8503010FA83F30A7803EB1E +S315080036C80213B3F80424C2F30902A3F804240A6906 +S315080036D83E2A31D9510912F01F0F00D10139B3F822 +S315080036E8042492B2890289B20A4342F40042A3F832 +S315080036F804246378002B51D1B5F8503015FA83F3B2 +S31508003708227803EB0213B3F80C24C2F30902A3F8D0 +S315080037180C2422693E2A28D9510912F01F0F00D114 +S315080037280139B3F80C2492B2890289B20A4342F4E1 +S315080037380042A3F80C2433E04AB9B3F804246FEA24 +S3150800374842426FEA524292B2A3F80424D1E75108DA +S3150800375812F0010F00D00131B3F8042490B28A029E +S3150800376892B20243A3F80424C3E74AB9B3F80C246F +S315080037786FEA42426FEA524292B2A3F80C240FE06B +S31508003788510812F0010F00D00131B3F80C2490B299 +S315080037988A0292B20243A3F80C2401E0012B1DD039 +S315080037A8E369002B3FF4B4AC227835F8221044F2CA +S315080037B8400303EA01008B4302D000287FF4A8AC33 +S315080037C835F822309BB223F4E04323F0700343F420 +S315080037D8004343F0C00325F8223099E4B5F8503081 +S315080037E815FA83F3227803EB0213228AA3F80C242A +S315080037F8D6E70023A3610B4617E74BB9B2F80414BA +S315080038086FEA41416FEA514189B2A2F804142CE7DC +S31508003818590813F0010F00D00131B2F8040480B238 +S31508003828890289B20143A2F804141EE74BB9B2F813 +S315080038380C346FEA43436FEA53439BB2A2F80C343D +S3150800384866E4590813F0010F00D00131B2F80C34B8 +S3150800385898B28B029BB20343A2F80C3458E4012AA7 +S315080038687FF456ACB5F8502015FA82F2217802EBA7 +S3150800387801129BB2A2F80C344AE4012059E410B4A8 +S315080038885C0800EB420000F5806007E030F8042B7E +S315080038980A70C2F307224A700231013C002CF5D19E +S315080038A813F0010F01D003880B705DF8044B7047BD +S315080038B8014B1860704700BF0000002098B108B592 +S315080038C80346D0F8B40210B10020C3F8B40209B10F +S315080038D8C3F8B012012183F89C121A70184601F031 +S315080038E80BFF002008BD0220704710B504460123C7 +S315080038F880F89C32D0F8B4325B680179984720463C +S3150800390801F052FF204601F03FFF002010BD19B113 +S31508003918C0F8B412002070470220704708B501F0B5 +S315080039283BFF002008BD08B5D0F8B4322BB11B6898 +S31508003938984700B908BD0220FCE70220FAE708B54F +S31508003948D0F8B4325B689847002008BD38B50446F5 +S3150800395800F52A75284600F035F90123C4F894328B +S31508003968B4F8AE32C4F8983294F8A81201F01F03D6 +S31508003978012B0ED0022B11D02BB101F08001204665 +S3150800398801F02DFF03E02946204600F0C9FA002079 +S3150800399838BD2946204600F0F7FAF8E729462046B2 +S315080039A800F022FBF3E738B504460D4691BB1346EB +S315080039B8D0F89422032A03D0052A24D0084633E0EF +S315080039C8D0F86011D0F8642191420DD9891AC0F847 +S315080039D860118A4206D98AB21946204600F027FCA1 +S315080039E8284621E092B2F7E7D0F8B4321B691BB132 +S315080039F890F89C22032A04D0204600F020FC28468A +S31508003A0812E09847F8E70021C0F8941201F0E7FE9B +S31508003A18284609E0D0F8B4329B6933B190F89C225D +S31508003A28032A04D19847002038BD0220FCE7022063 +S31508003A38FAE738B504460D46002953D11346D0F897 +S31508003A489422022A0CD0042A00D01AB980212046CA +S31508003A5801F0C5FE94F8A032012B3ED0284638BDA1 +S31508003A68016A426A91421BD8C169B1FBF2F302FBAB +S31508003A7813132BB98A4203D8D0F8983299421CD323 +S31508003A88D4F8B432DB681BB194F89C22032A21D0F7 +S31508003A988021204601F0A3FE204600F0DBFBD9E78B +S31508003AA88A1A026292B2194600F0B9FB00231A462E +S31508003AB81946204601F0CAFECCE70022114600F056 +S31508003AC8AEFB0021C4F898120B460A46204601F0B8 +S31508003AD8BDFEBFE720469847DAE7002384F8A032F8 +S31508003AE82846BCE7D0F8B4325B6933B190F89C2213 +S31508003AF8032A04D198470020B1E70220AFE702203D +S31508003B08ADE770B5044640230022114601F054FE7D +S31508003B180125C4F858514026C4F864613346002282 +S31508003B288021204601F048FEA561666284F89C5209 +S31508003B380023C4F894326360C4F8A432D4F8B832BF +S31508003B482BB1D4F8B4325B68002120469847002088 +S31508003B5870BD01740020704790F89C3280F89D3239 +S31508003B68042380F89C320020704790F89C32042B76 +S31508003B7801D00020704790F89D3280F89C32F8E70B +S31508003B8808B590F89C32032B01D0002008BDD0F860 +S31508003B98B432DB69002BF8D09847F6E703460020CD +S31508003BA802E00130C0B201331A78002AF9D1704709 +S31508003BB808B54B88012B00D008BDC0F8A43200F020 +S31508003BC83EFBF9E70B7803704B7843708B78CA7815 +S31508003BD803EB022343800B794A7903EB022383809C +S31508003BE88B79CA7903EB0223C380704710B504465C +S31508003BF8802101F0F4FD0021204601F0F0FD10BDFA +S31508003C0830B583B005460C460023ADF806304A8819 +S31508003C18130A013B062B00F2A480DFE803F0041818 +S31508003C282CA2A2869300D0F8B0321B680DF10601C3 +S31508003C38007C9847BDF806201AB1E388002B40F0A7 +S31508003C489480E388002B00F09A8003B030BD037C8B +S31508003C5843B9D0F8B4329B6A0DF106009847022397 +S31508003C684370E7E7D0F8B432DB6A0DF106009847E7 +S31508003C7802234370DEE7D2B2052A52D8DFE802F0FB +S31508003C8803101D2A3744D0F8B0325B6823B10DF10A +S31508003C980601007C9847CDE72146FFF7A7FFD4E73A +S31508003CA8D0F8B0329B6823B10DF10601007C98471D +S31508003CB8C0E72146FFF79AFFC7E7D0F8B032DB68B6 +S31508003CC823B10DF10601007C9847B3E72146FFF7B3 +S31508003CD88DFFBAE7D0F8B0321B6923B10DF106019A +S31508003CE8007C9847A6E72146FFF780FFADE7D0F89E +S31508003CF8B0325B6923B10DF10601007C984799E754 +S31508003D082146FFF773FFA0E7D0F8B0329B6923B1C5 +S31508003D180DF10601007C98478CE72146FFF766FFF8 +S31508003D2893E72146FFF762FF8FE7037C33B9D0F89C +S31508003D38B4325B6B0DF1060098477BE72146FFF71F +S31508003D4855FF82E7037C43B9D0F8B4321B6B0DF1F3 +S31508003D5806009847072343706CE72146FFF746FF96 +S31508003D6873E72146FFF742FF6FE79A4228BF1A46CC +S31508003D78ADF806200146284600F044FA61E72846C9 +S31508003D8800F05DFA61E738B504468B88F3B9CB8845 +S31508003D98E3B94B887F2B19D803F07F0590F89C3236 +S31508003DA8032B0CD080F89E52294601F03FFD204689 +S31508003DB800F045FA35B1022384F89C3209E0FFF78A +S31508003DC815FF06E0012384F89C3202E02046FFF737 +S31508003DD80DFF38BD38B504460D468978284B197045 +S31508003DE801290ED890F89C32022B0ED0032B21D02D +S31508003DF82946FFF7FBFE224B19782046FFF79FFD59 +S31508003E0802E02946FFF7F2FE38BD81B14160032377 +S31508003E1880F89C32FFF787FD022803D0204600F079 +S31508003E280EFAF1E729462046FFF7E0FEECE700F030 +S31508003E3806FAE9E789B1436899421DD0D9B2FFF76E +S31508003E487EFD0F4B197861602046FFF76CFD022846 +S31508003E580DD0204600F0F3F9D6E7022380F89C3205 +S31508003E684160FFF76CFD204600F0E9F9CCE72946E2 +S31508003E782046FFF7BBFEC7E700F0E1F9C4E700BF35 +S31508003E880004002008B5CB88012B0AD190F89C328B +S31508003E98022B09D9032B09D10122011D00F0B2F919 +S31508003EA801E0FFF7A3FE08BD5BB213B9FFF79EFE54 +S31508003EB8F9E70146002341F8083F012200F0A2F974 +S31508003EC8F1E708B590F89C32013B022B12D8CB884B +S31508003ED8022B0CD10123C360D0F8A4320BB10323FB +S31508003EE8C360022200F10C0100F08CF908BDFFF747 +S31508003EF87DFEFBE7FFF77AFEF8E708B590F89C32EF +S31508003F08013B022B09D84B88012B00D008BD00239A +S31508003F18C0F8A43200F093F9F8E7FFF767FEF5E76B +S31508003F2808B50B7803F06003202B05D0402B03D087 +S31508003F3843B1FFF75BFE03E0D0F8B4329B689847B5 +S31508003F48002008BD4B78092B1BD8DFE803F01117AA +S31508003F581A141A08051A0E0BFFF752FEF0E7FFF7B0 +S31508003F6812FFEDE7FFF736FFEAE7FFF78BFFE7E70C +S31508003F78FFF7A7FFE4E7FFF71BFEE1E7FFF7BDFF3B +S31508003F88DEE7FFF733FEDBE738B505460C460B7860 +S31508003F9803F06003202B06D0402B04D01BB1FFF793 +S31508003FA825FE002038BD95F89C32013B022B16D811 +S31508003FB82379012B0ED8D5F8B4329B6821462846B2 +S31508003FC89847E388002BECD10028EAD1284600F068 +S31508003FD836F9E6E721462846FFF708FEE1E72146CF +S31508003FE82846FFF703FEDCE770B505468B880C788C +S31508003FF804F06004202C07D0DAB2402C04D05CB157 +S31508004008FFF7F4FD002405E0D5F8B4329B68284686 +S3150800401898470024204670BD202C09D04E78012EDA +S3150800402833D0032E0AD0002E55D0FFF7DFFDF1E76F +S31508004038D0F8B4329B6898470446EBE790F89C3268 +S31508004048022B04D0032B11D0FFF7D0FDE2E70AB103 +S31508004058802A03D12846FFF7C9FDDBE7114601F098 +S31508004068BEFB8021284601F0BAFBD3E74B8823B963 +S315080040781AB1802A01D0CB881BB1284600F0DFF890 +S31508004088C8E7114601F0ABFBF7E790F89C32022B1C +S3150800409804D0032B11D0FFF7A9FDBBE70AB1802A84 +S315080040A803D12846FFF7A2FDB4E7114601F097FBAE +S315080040B88021284601F093FBACE74B88002BA9D151 +S315080040C812F07F0F03D1284600F0B9F8A2E7114687 +S315080040D801F08DFBF7E790F89C02022806D0032822 +S315080040E829D02846FFF782FD344693E70AB1802A85 +S315080040F813D113F0800F15D102F07F0202EB82026A +S31508004108910001F5A8712944043100230B600222A5 +S31508004118284600F077F834467CE72846FFF766FD18 +S31508004128344677E702F07F0202EB820291001031EB +S3150800413829440431E9E75BB2002B1FDB02F00F00C4 +S3150800414800EB800005EB8000D0F8580120B3002B5F +S3150800415827DB02F07F0303EB83039C0004F5A874AE +S315080041682C4404340AB1802A24D10023236002226D +S315080041782146284600F046F834464BE702F00F0079 +S3150800418800EB800005EB800080690028DFD128460F +S31508004198FFF72CFD34463DE72846FFF727FD34464A +S315080041A838E702F07F0303EB83039C0010342C44A2 +S315080041B80434D7E71146284601F021FB10B101233C +S315080041C82360D4E700232360D1E7D0B170B50D4644 +S315080041D816460446FFF7E2FC431C5B009BB2338095 +S315080041E82B7003236B70022307E001345A1CD2B2E2 +S315080041F8E8540233DBB20021A95420780028F4D108 +S3150800420870BD704708B513460222C0F89422C361E8 +S3150800421803620A46002101F011FB002008BD08B513 +S3150800422813460A46002101F009FB002008BD08B517 +S3150800423813460A46002101F009FB002008BD08B507 +S315080042480423C0F8943200231A46194601F0F6FAF0 +S31508004258002008BD08B50523C0F8943200231A467D +S31508004268194601F0F3FA002008BD72B6704762B61F +S31508004278704700002DE9F04184B004460D461746FC +S3150800428898466846FEF704FA0299174BA3FB0131CC +S315080042988909002301E00133DBB2112B1FD8134A21 +S315080042A812F8130002EB4302527800EB020C0CFBDF +S315080042B8044CB1FBFCFE0CFB1E16002EEBD11FFAB4 +S315080042C88EFCA5F800C00CF1FF3C1FFA8CFCBCF567 +S315080042D8806FE0D2387088F80020012000E00020BE +S315080042E804B0BDE8F08100BFD34D62103C59000800 +S315080042F870B58CB00023ADF82E308DF82D308DF8BA +S315080043082C300BAB0DF12D020DF12E014FF4FA707E +S31508004318FFF7B0FF002835D01D4C1E4B236000253B +S3150800432825766576A5760126E67625776577A560E6 +S31508004338E5609DF82D30013B1B0423619DF82C3060 +S31508004348013B1B056361BDF82E3063602046FCF708 +S3150800435839FA0695079508964CF6E04301930295AF +S315080043684FF6E073039304230493059509960E23E1 +S315080043780A9301A92046FCF7CBFA2046FCF74BFB23 +S315080043880CB070BDAF21044800F0F6FCC4E700BFC6 +S3150800439804040020006400400059000810B588B0DD +S315080043A8024640F2E17302930023049305930691AB +S315080043B801AB02A90B48FCF75CFB08B108B010BDB5 +S315080043C800F0E4FA00F1320401990648FCF7C6FB46 +S315080043D80028F3D000F0D8FD00F0D8FAA042F3D9A7 +S315080043E8ECE700BF0404002010B588B003460C4665 +S315080043F801AA00210848FCF7C4FB50B9019A40F203 +S3150800440867639A4206D1039B23B9059B237001204B +S3150800441800E0002008B010BD0404002008B5FFF726 +S3150800442824FF08BD10B500F0C5F900B910BDFBF7A3 +S31508004438CFFE0028FAD000F053FDFCF76DF900F01E +S315080044487DFA00F0BBF920F0604020F07F00044BAD +S31508004458986000F0B3F94468FFF709FFA047E5E755 +S3150800446800ED00E070B50D46044606E015F8013B78 +S3150800447804F8013B00F088FD3246531E9EB2002A16 +S31508004488F4D170BD08B5C1F3080353B903688B4264 +S3150800449809D040F8041B4FF40072FFF7E3FF012028 +S315080044A808BD0020FCE70120FAE72DE9F041074698 +S315080044B8FCF7A6FC00247F2C15D83E6806EB840872 +S315080044C807EB84035D6800F05FFD2A460023414632 +S315080044D80220FCF7E9FC804640B956F82430AB427E +S315080044E806D10134E7E74FF0010801E04FF000086C +S315080044F8FCF7A0FC4046BDE8F081000038B50D463B +S315080045080C4B984211D004460B4B994207D1094CDB +S3150800451829462046FFF7B6FF48B1204638BDFFF7BB +S31508004528C4FF0028F4D10024F7E7044CF0E7002478 +S31508004538F3E700BF30060020008000082C0400209E +S315080045482DE9F04106460C4617461D4621F4FF7824 +S3150800455828F001080368B3F1FF3F07D033684345DD +S315080045680AD13168641A3444043414E04146FFF722 +S3150800457889FF0028F2D11FE041463046FFF7BEFF03 +S3150800458806460028EDD1002016E017F8013B04F886 +S31508004598013B013D0FD000F0F7FC311D611AB1F55A +S315080045A8007FF2D308F500713046FFF7A7FF0646E5 +S315080045B820B1041DE9E70120BDE8F0810020FBE7EA +S315080045C84FF0FF33024A1360024A1360704700BF70 +S315080045D82C040020300600200B4601F1FF3C124946 +S315080045E8091A8C4519D81149884218D310B51918CB +S315080045F801390D4CA14214D820F4FF7121F00101AC +S315080046080A4CA14204D001460948FFF799FF10BD94 +S3150800461801460848FFF794FFF9E70020704700208D +S3150800462870470020F3E700BFFFFF03080080000873 +S315080046382C0400203006002030B585B000230393EB +S315080046484A1E1F4B1B1A9A4231D820F4FF6323F0DF +S3150800465807031C4A93422ED30A18013A184CA24259 +S315080046682BD8C01A0844C0F3CF25C0F30A0008B1EE +S315080046780135ADB200240094019301230293FCF797 +S31508004688BFFBA5420DD900F07FFC03A96846FCF7D5 +S315080046987FFC50B9019B03F5006301930134A4B26A +S315080046A8EFE70124FCF7C6FB02E00024FAE700243A +S315080046B8204605B030BD0024FAE70024F8E700BF15 +S315080046C8FFFF03080080000800B583B000230193A4 +S315080046D8134B1B68B3F1FF3F20D0114A5368019367 +S315080046E891680B440193D1680B44019311690B44F3 +S315080046F8019351690B44019391690B440193D2695B +S3150800470813440193DB4301930133019301AA04215E +S315080047180448FFF761FF03B05DF804FB0120FAE7D8 +S3150800472830060020888100080A4B1A68596811441F +S315080047389A681144DA6811441A6911445A69114485 +S315080047489A690A44D3F88831D34201D000207047C1 +S31508004758012070470080000808B50C4B1B68B3F1A8 +S31508004768FF3F06D10A4B1B68B3F1FF3F07D101206B +S3150800477808BD0648FFF799FE0028F3D1F8E704486C +S31508004788FFF793FE0028F3D00120F1E73006002052 +S315080047982C040020004870470080000808B5FFF779 +S315080047A80FFF08BD08B5FFF717FF08BD08B5FFF7DF +S315080047B843FF08BD08B5FFF7B7FF08BD08B5FFF7FB +S315080047C8E9FF08BD08B5FFF77FFF00B908BDFFF781 +S315080047D8C3FFFBE7054BDB6913F0200F04D0034B37 +S315080047E89B8C0370012070470020704700480040E2 +S315080047F810B5094B188500F0C9F800F10A04064BEC +S31508004808DB6913F0800F05D100F0BEFB00F0BEF897 +S31508004818A042F4D910BD00BF0048004010B588B0C2 +S315080048280C4C236823F0010323604FF4614301937A +S3150800483800230293039304930C2205920693079385 +S3150800484801A92046FEF726F8236843F001032360EA +S3150800485808B010BD0048004070B506460D468129C7 +S3150800486804D82846FFF7C4FF00240BE06F21074841 +S3150800487800F082FAF5E700F087FB305DFFF7B8FF2E +S315080048880134A4B2ABB2A342F5D870BD605900088A +S3150800489870B5254B1C78BCB92448FFF79BFF01283F +S315080048A801D0204670BD214B1B78013BDBB2802B1B +S315080048B8F7D800F06BF81E4B18601E4B00221A70CA +S315080048C8194B01221A70ECE706460D46194B1B7858 +S315080048D8013316481844FFF77DFF0446012815D109 +S315080048E8144B1A780132D2B21A70104B1B789A42B6 +S315080048F801D00024D5E710493046FFF7B3FD0A4B27 +S3150800490800221A700B4B1B782B70CAE700F03EF88A +S31508004918074B1B68C833984203D90024024B1C70FE +S31508004928BFE70024BDE700BFB6080020340800200A +S31508004938B8080020B7080020350800204FF0E02303 +S3150800494800221A615A619A617047000008B5FFF794 +S31508004958F5FF4FF0E023044A5A6100229A610521BF +S315080049681961024B1A6008BD3F190100BC080020EE +S315080049784FF0E0231B6913F4803F03D0024A1368FB +S3150800498801331360704700BFBC08002008B5FFF75D +S31508004998EFFF014B186808BDBC08002008B5FFF7EB +S315080049A8F5FF08BD094B03F11801002232B19A74C4 +S315080049B800225A61064B054A1A6070479A7459616B +S315080049C8183318310132D2B2F0E700BF00090020C7 +S315080049D8300900200A4B1B6883B110B4084A5C6981 +S315080049E8146019749860D86000225A7418600139DE +S315080049F808445860987C5DF8044B7047FF20704758 +S31508004A083009002038B504460D46012824D804EB99 +S31508004A184403164A02EBC3035A7C1B7C9A4221D0EC +S31508004A2804EB4403114A02EBC303DA6815705A7C8F +S31508004A3801325A74DA680132DA605B689A4213D925 +S31508004A480A4B04EB440253F8322004EB440403EB04 +S31508004A58C404E260012008E04FF4DE71044800F05F +S31508004A688BF9D4E7002000E0012038BD00090020B2 +S31508004A78A059000808B50146024B1878FFF7C2FF87 +S31508004A8808BD00BF3409002038B504460D4601287C +S31508004A9822D804EB4403144A02EBC303587C10B328 +S31508004AA804EB440302EBC3039A6812782A705A7C0B +S31508004AB8013A5A749A6801329A605B689A4211D91F +S31508004AC8094B04EB440253F8322004EB440403EB85 +S31508004AD8C404A260012006E04FF4EF71034800F011 +S31508004AE84BF9D6E7012038BD00090020A05900086F +S31508004AF808B50146024B1878FFF7C6FF08BD00BF80 +S31508004B087809002010B50446012806D804EB4404A1 +S31508004B18054800EBC404607C10BD4FF4FF710348D8 +S31508004B2800F02AF9F2E700BF00090020A05900089A +S31508004B3838B5FFF737FF194C4021601CFFF74AFFC5 +S31508004B482070174D4021681CFFF744FF287023780A +S31508004B58FF2B18D0FF2816D0124C002212492046DF +S31508004B68FEF7ACFE11492046FEF7D1FE2046FEF7B1 +S31508004B78D5FED4F8C002FDF7B2F900F029F9B0F568 +S31508004B88FA6F05D338BD8421094800F0F5F8E3E73C +S31508004B984FF4FA6000F016F9F4E700BF340900206C +S31508004BA878090020BC0900207400002010000020A5 +S31508004BB8A059000810B5044CD4F8C002FDF7A3F9AB +S31508004BC82046FEF792FE10BDBC09002070B50646C1 +S31508004BD80D463F2906D82846FFF74CFF012806D177 +S31508004BE800240BE0B5210D4800F0C6F8F3E7B92113 +S31508004BF80A4800F0C1F8F3E70134A4B2ABB2A342FD +S31508004C080BD900F0C1F9305DFFF734FF0128F3D05E +S31508004C18C221024800F0B0F8EEE770BDA0590008B6 +S31508004C2870B506460D461F4BD3F8C002FDF794F932 +S31508004C381D4B1C789CB91D48FFF75AFF012801D05F +S31508004C48204670BD194B1B78013BDBB23E2BF7D8C3 +S31508004C58154B01221A70164B00221A70F0E7144BEE +S31508004C681B78013311481844FFF742FF0446012808 +S31508004C7801D00024E4E70E4B1A780132D2B21A7032 +S31508004C880A4B1B789A4201D00024D9E709493046CD +S31508004C98FFF7E8FB044B00221A70054B1B782B70AC +S31508004CA8CEE700BFBC090020C00C0020800C0020FD +S31508004CB8C10C0020810C002030B583B0144B18783D +S31508004CC8FFF720FF08B30546402800D940250024E9 +S31508004CD805E09DF807200F4B1A550134E4B2A542A2 +S31508004CE80DD90DF107010A4B1878FFF7CDFE0128F3 +S31508004CF8EFD04FF4A171084800F03EF8E9E7ABB2E7 +S31508004D08044A8121054800F099FD03B030BD00BF6B +S31508004D1834090020C0080020A0590008BC09002052 +S31508004D2870B5044600F0EAFB064621460F4800F02F +S31508004D3895FD85B2002401E00134A4B2AC420CD238 +S31508004D48315D0B4B1878FFF75DFE0128F4D04FF458 +S31508004D58B271084800F010F8EEE700F0CFFB0246FB +S31508004D6840230121014800F071FD70BDBC090020EF +S31508004D7878090020A059000808B500F005F9FCE7ED +S31508004D8808B500F0F7F8012803D00B4B1B78012B60 +S31508004D9800D008BDFFF7FAFD084B1B68084A1268D9 +S31508004DA8134403F5FA739842F3D3034B00221A7097 +S31508004DB8FFF738FBEDE700BFC80C0020C40C00203D +S31508004DC8CC0C0020014B1860704700BFC40C0020AB +S31508004DD8014B1868704700BFC40C002008B5054B7E +S31508004DE81B78012B00D008BDFFF7D0FD024B1860D1 +S31508004DF8F9E700BFC80C0020CC0C002008B5044B06 +S31508004E0801221A70FFF7EAFFFFF7BAFF08BD00BFCD +S31508004E18C80C002008B5FFF701FB00F0B1F8FFF74A +S31508004E2895FDFFF7BBFC00F00DF8FFF7E7FF08BD97 +S31508004E3808B500F0A9F8FFF79BFD00F017F8FFF78B +S31508004E489FFF08BD10B500F04FFAFFF751FA064C58 +S31508004E5801232370FFF7E2FC00232370FFF768FE9F +S31508004E680223237010BD00BF0C00002000B583B0D4 +S31508004E780DF107011848FFF7B7FA012810D00DF108 +S31508004E8807011548FFF704FD012812D00DF107019F +S31508004E981148FFF7C5FE012814D003B05DF804FBD6 +S31508004EA80E4B01221A709DF807100B4800F03EFABF +S31508004EB8E5E70A4B00221A709DF80710064800F025 +S31508004EC835FAE3E7054B02221A709DF807100248DF +S31508004ED800F02CFAE1E700BFD00C00200C000020F7 +S31508004EE808B5FFF767FE08BD38B504460D460E4BEC +S31508004EF81B78012B09D00C4B1B7853B10A4B1B782E +S31508004F08022B0BD000F00AFA38BDC9B2FFF746FAE9 +S31508004F18F1E7E9B22046FFF79FFCEFE7E9B220463A +S31508004F28FFF754FEEEE700BF0C000020074B1B787E +S31508004F38022B07D0032B07D0012B01D081207047FD +S31508004F48082070473F207047002070470C00002053 +S31508004F58074B1B78022B07D0032B07D0012B01D050 +S31508004F6881207047082070473F2070470020704707 +S31508004F780C00002008B500F0C9F900B1012008BDE9 +S31508004F8808B5FBF743F908BD08B5FBF744F908BDAA +S31508004F98024B002283F88220704700BF540D002078 +S31508004FA8034BFE221A7058700222A3F8862070470F +S31508004FB8540D00200378427843EA0223827843EAAC +S31508004FC80243C07843EA006070470870C0F30723B5 +S31508004FD84B70C0F307438B70000EC870704700000B +S31508004FE810B5064C002384F88130FFF7D1FFFF235C +S31508004FF823700123A4F8863010BD00BF540D002085 +S31508005008074BFF221A7000225A7093F8821099707B +S31508005018DA701A715A710622A3F88620704700BFFB +S31508005028540D002008B50020FFF7BAFF08BD000098 +S3150800503810B5094CFF232370084BC4F888300023A1 +S315080050486370A370E370211D0720FFF7BEFF0823CE +S31508005058A4F8863010BD00BF540D0020DC5900089E +S3150800506810B5064CFF2323700430FFF7A3FFC4F8D6 +S3150800507888000123A4F8863010BD00BF540D00200F +S3150800508808B53120FFF78CFF08BD000038B5084C75 +S31508005098FF23237000256570A570FFF747FFE070AA +S315080050A825716571A5710723A4F8863038BD00BF38 +S315080050B8540D002038B5FFF76BFF0F4C012584F80F +S315080050C88150FF2323700023637010226270A37037 +S315080050D8FFF72CFFE070FFF73BFF2071FFF738FF5B +S315080050E8C0F307206071A571E5710823A4F8863016 +S315080050F8FFF754FB38BD00BF540D002038B50446E9 +S31508005108FFF714FF6278904212D90B4DD5F888102C +S31508005118681CFFF7A7F9FF232B706278D5F8883043 +S315080051281344C5F8883063780133A5F8863038BD46 +S315080051382220FFF735FFFAE7540D002038B5044654 +S31508005148FFF7F4FE6378984217D9201DFFF732FF58 +S3150800515801460C4DC5F888006278681CFFF782F985 +S31508005168FF232B706278D5F888301344C5F8883041 +S3150800517863780133A5F8863038BD2220FFF710FF7B +S31508005188FAE700BF540D0020F8B50546174600246F +S3150800519806E015F8013B1C44E4B2FFF7F5FE314674 +S315080051A84E1E0029F5D13C600120F8BD30B583B004 +S315080051B8002501950B4CFF2323700430FFF7FAFEF0 +S315080051C8014601AAD4F88800FFF7DEFF6070211DA2 +S315080051D80198FFF7FAFEA570E5700823A4F886304B +S315080051E803B030BD540D002038B504460E4BD3F82D +S315080051F88850FFF79BFE621C411E2846FFF7D2FA25 +S3150800520870B1094CFF232370FFF790FE0138D4F8D4 +S3150800521888300344C4F888300123A4F8863038BD9A +S315080052283120FFF7BDFEFAE7540D002010B50446F5 +S31508005238FFF77CFE01386378984216DD134BFF2288 +S315080052481A700122A3F88620617891B1A21C0F4B27 +S31508005258D3F88800FFF7A6FA98B161780B4AD2F80E +S3150800526888300B44C2F8883010BD2220FFF798FE14 +S31508005278FAE7FFF7A7FA0028F6D13120FFF790FEDC +S31508005288F2E73120FFF78CFEEEE700BF540D002049 +S3150800529810B50B4BD3F888400430FFF78BFE014650 +S315080052A82046FFF783FA30B1054BFF221A70012210 +S315080052B8A3F8862010BD3120FFF772FEFAE700BF73 +S315080052C8540D002008B5FFF7ADF8034BFF221A70F6 +S315080052D80122A3F8862008BD540D002008B589B216 +S315080052E8FFF702FE08BD0000074B002283F881205D +S315080052F8C3F8882083F88420A3F8862083F88320B7 +S3150800530883F88220704700BF540D0020024B93F89B +S31508005318810000B101207047540D0020024B00227D +S3150800532883F88420704700BF540D002008B5037819 +S31508005338FF2B24D0354A92F88120012A2BD1C93B64 +S31508005348352B53D8DFE803F04052524F52524C439C +S31508005358494652525252525252525252525252522C +S315080053685252525252525252525252525252525207 +S315080053785252312B282E5252523452373A3DFFF7A1 +S3150800538899FE224B93F88430012B33D01F4BB3F97F +S315080053988610002932DC08BDFFF7B0FEF1E7FFF7F3 +S315080053A8CDFEEEE7FFF75CFEEBE7FFF7FFFEE8E763 +S315080053B8FFF73EFEE5E7FFF735FEE2E7FFF720FED3 +S315080053C8DFE7FFF70DFEDCE7FFF70EFFD9E7FFF784 +S315080053D82DFFD6E7FFF75AFED3E7FFF759FFD0E7C1 +S315080053E8FFF770FFCDE7FFF74BFECAE72020FFF768 +S315080053F8D7FDC6E71020FFF7D3FDC7E718460123F0 +S3150800540880F88430FFF76AFFC5E700BF540D00200F +S315080054182023038000487047480000200A23038099 +S31508005428004870476800002008B590F89C32032B9E +S3150800543801D0002008BDFFF73FFCFAE708B5FFF7DB +S315080054483BFC002008BD08B50846FFF769FC0020A4 +S3150800545808BD000008B50B7813F0600F06D14B7825 +S315080054680A2B14D00B2B17D0062B01D0002008BD09 +S315080054784B881B0A212B04D00B491722FEF7C2FEBC +S31508005488F4E7CA88172A28BF17220849F6E7012227 +S315080054980749FEF7B7FEE9E78B7813B9044A13609C +S315080054A8E4E7FEF7A3FBE1E7510000205A000020D5 +S315080054B8200E002010B50446812100F088F9012144 +S315080054C8204600F084F9002010BD000010B50446F7 +S315080054D840230222812100F06FF94023022201218C +S315080054E8204600F069F94023034A0121204600F0C6 +S315080054F8ADF9002010BD00BFE00D00200048704738 +S31508005508E00D002012230B80004870479000002009 +S3150800551804230B8000487047A40000200023934208 +S315080055281ED200B510E00CF1370C01F813C00001C3 +S315080055384FEA430C0CF1010C4FF0000E01F80CE091 +S315080055480133DBB2934209D24FEA107CB0F1204FFF +S31508005558E9D20CF1300C01F813C0E8E75DF804FB52 +S315080055687047000038B50B4BD3F8AC07D3F8B047EB +S31508005578D3F8B437C01800D138BD074D0822A91C7E +S31508005588FFF7CCFF042205F112012046FFF7C6FFF4 +S31508005598F2E700BF00F0FF1FA800002008B51A238D +S315080055A80B80FFF7DFFF014808BD00BFA8000020F1 +S315080055B808B50A4628B905490548FEF706FE034808 +S315080055C808BD02490248FEF700FEF8E7240E002047 +S315080055D8E459000810B50A46034C21460348FEF765 +S315080055E8F4FD204610BD00BF240E0020F859000817 +S315080055F808B50A4628B905490548FEF7E6FD0348E9 +S3150800560808BD02490248FEF7E0FDF8E7240E002027 +S31508005618085A000808B50A4628B905490548FEF78C +S31508005628D4FD034808BD02490248FEF7CEFDF8E74F +S31508005638240E0020105A0008022805D8DFE800F0D2 +S3150800564805040200012070470220704708B500F5D6 +S315080056582C71D0F8E802FEF779F908BD08B501EB10 +S31508005668810300EBC303D3F87C21D0F8E802FEF7E0 +S315080056789AF908BD08B501EB810300EBC303DA6B99 +S31508005688D0F8E802FEF7D5F908BD08B5D0F8E8025B +S31508005698FEF776FA08BD000010B504468368022BA3 +S315080056A809D10121D4F8E802FEF753FAD4F8E8023A +S315080056B8FEF727FA10BD8E210148FFF75DFBF0E7D4 +S315080056C8285A000810B50446FAF79EFDD4F8E802E9 +S315080056D8FEF742FAA36923B1024A136943F006039F +S315080056E8136110BD00ED00E008B5D0F8E802FEF732 +S315080056F83CFAFAF78AFD08BD10B504461F48C0F8F3 +S31508005708E842C4F8C0021E4B03600823436002231C +S3150800571883600361002383610362FBF785FE30BB60 +S31508005728182300221146D4F8C002FCF7D6FD5823E0 +S3150800573800228021D4F8C002FCF7CFFDC02300223E +S315080057488121D4F8C002FCF7C8FD4FF488730022FB +S315080057580121D4F8C002FCF7C0FD4FF4807300227B +S315080057688221D4F8C002FCF7B8FD002010BD40F22B +S315080057781B110448FFF700FBD2E700BFEC00002026 +S31508005788005C0040285A000808B5D0F8C002FBF7A4 +S31508005798B0FEFFF751FF08BD08B5D0F8C002FBF701 +S315080057A8BFFEFFF749FF08BD08B5D0F8C002FBF7EA +S315080057B8D0FEFFF741FF08BD08B594461A4663466A +S315080057C8D0F8C002FCF761FCFFF736FF08BD08B53C +S315080057D8D0F8C002FCF797FCFFF72EFF08BD08B5FE +S315080057E8D0F8C002FCF709FDFFF726FF08BD08B583 +S315080057F8D0F8C002FCF736FDFFF71EFF08BDD0F843 +S31508005808C03211F0800F08D101F07F0101EB810148 +S3150800581803EBC10191F86A01704701F07F01013174 +S3150800582801EB810103EBC1018878704708B5D0F808 +S31508005838C002FCF77DFBFFF7FFFE08BD08B5D0F8E8 +S31508005848C002FCF7B8FCFFF7F7FE08BD08B5D0F8A4 +S31508005858C002FCF78AFCFFF7EFFE08BD08B5D0F8CA +S31508005868C002FCF79FFC08BD08B5012903D0002033 +S31508005878FAF7BCFC08BD0120FAF7B8FCFAE70000FD +S3150800588870B50D4D0D4C641BA4100026A64209D10F +S315080058980B4D0C4C00F018F8641BA4100026A64201 +S315080058A805D170BD55F8043B98470136EEE755F81B +S315080058B8043B98470136F2E74C5A00084C5A000848 +S315080058C84C5A0008505A0008F8B500BFF8BC08BC7E +S315080058D89E467047F8B500BFF8BC08BC9E46704798 +S315080058E8000000000000000001020304060708097A +S315080058F80000000001020304433A2F576F726B2F0A +S31508005908736F6674776172652F4F70656E424C5473 +S315080059182F5461726765742F536F757263652F41CB +S31508005928524D434D345F53544D333246332F6361DA +S315080059386E2E630005020602060307030803090319 +S3150800594809040A040B040C040C050D050E050F05BD +S315080059580F06100610071008433A2F576F726B2F59 +S31508005968736F6674776172652F4F70656E424C5413 +S315080059782F5461726765742F536F757263652F416B +S31508005988524D434D345F53544D333246332F727359 +S315080059983233322E63000000433A2F576F726B2F4B +S315080059A8736F6674776172652F4F70656E424C54D3 +S315080059B82F5461726765742F536F757263652F412B +S315080059C8524D434D345F53544D333246332F757316 +S315080059D8622E63004F70656E424C540057696E55C7 +S315080059E853422042756C6B204465766963650000EE +S315080059F84F70656E424C542055736572000000005E +S31508005A0844656661756C740057696E555342204241 +S31508005A18756C6B20496E7465726661636500000073 +S31508005A282E2E2F5553425F4445564943452F5461F8 +S31508005A38726765742F757362645F636F6E662E632B +S30908005A48000000004C +S30908005A4CAD01000892 +S30908005A5089010008B2 +S31508005A5400127A0001000000100000000400000093 +S31508005A64D5540008BD5400085D5400080000000021 +S31508005A7400000000455400084F540008315400083B +S31508005A84000000000000000000000000195400088F +S31508005A94000000002554000809022000010100C086 +S31508005AA4320904000002FF000000070581024000D5 +S31508005AB4FF070501024000FF0A0610010000004026 +S31508005AC4010000000D55000819550008DD550008A9 +S31508005AD4B9550008A5550008F95500081D560008CB +S31508005AE41201100100000040501DAC6000010102C3 +S31508005AF403010000040309041A030000000000005F +S31508005B040000000000000000000000000000000083 +S30908005B14000000007F +S705080006CD1F diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pcd.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pcd.h new file mode 100644 index 000000000..92467e595 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pcd.h @@ -0,0 +1,989 @@ +/** + ****************************************************************************** + * @file stm32f3xx_hal_pcd.h + * @author MCD Application Team + * @brief Header file of PCD HAL module. + ****************************************************************************** + * @attention + * + * Copyright (c) 2016 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. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef STM32F3xx_HAL_PCD_H +#define STM32F3xx_HAL_PCD_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f3xx_ll_usb.h" + +#if defined (USB) + +/** @addtogroup STM32F3xx_HAL_Driver + * @{ + */ + +/** @addtogroup PCD + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup PCD_Exported_Types PCD Exported Types + * @{ + */ + +/** + * @brief PCD State structure definition + */ +typedef enum +{ + HAL_PCD_STATE_RESET = 0x00, + HAL_PCD_STATE_READY = 0x01, + HAL_PCD_STATE_ERROR = 0x02, + HAL_PCD_STATE_BUSY = 0x03, + HAL_PCD_STATE_TIMEOUT = 0x04 +} PCD_StateTypeDef; + +/* Device LPM suspend state */ +typedef enum +{ + LPM_L0 = 0x00, /* on */ + LPM_L1 = 0x01, /* LPM L1 sleep */ + LPM_L2 = 0x02, /* suspend */ + LPM_L3 = 0x03, /* off */ +} PCD_LPM_StateTypeDef; + +typedef enum +{ + PCD_LPM_L0_ACTIVE = 0x00, /* on */ + PCD_LPM_L1_ACTIVE = 0x01, /* LPM L1 sleep */ +} PCD_LPM_MsgTypeDef; + +typedef enum +{ + PCD_BCD_ERROR = 0xFF, + PCD_BCD_CONTACT_DETECTION = 0xFE, + PCD_BCD_STD_DOWNSTREAM_PORT = 0xFD, + PCD_BCD_CHARGING_DOWNSTREAM_PORT = 0xFC, + PCD_BCD_DEDICATED_CHARGING_PORT = 0xFB, + PCD_BCD_DISCOVERY_COMPLETED = 0x00, + +} PCD_BCD_MsgTypeDef; + + + + + +typedef USB_TypeDef PCD_TypeDef; +typedef USB_CfgTypeDef PCD_InitTypeDef; +typedef USB_EPTypeDef PCD_EPTypeDef; + + +/** + * @brief PCD Handle Structure definition + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +typedef struct __PCD_HandleTypeDef +#else +typedef struct +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + PCD_TypeDef *Instance; /*!< Register base address */ + PCD_InitTypeDef Init; /*!< PCD required parameters */ + __IO uint8_t USB_Address; /*!< USB Address */ + PCD_EPTypeDef IN_ep[8]; /*!< IN endpoint parameters */ + PCD_EPTypeDef OUT_ep[8]; /*!< OUT endpoint parameters */ + HAL_LockTypeDef Lock; /*!< PCD peripheral status */ + __IO PCD_StateTypeDef State; /*!< PCD communication state */ + __IO uint32_t ErrorCode; /*!< PCD Error code */ + uint32_t Setup[12]; /*!< Setup packet buffer */ + PCD_LPM_StateTypeDef LPM_State; /*!< LPM State */ + uint32_t BESL; + + void *pData; /*!< Pointer to upper stack Handler */ + +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + void (* SOFCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD SOF callback */ + void (* SetupStageCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Setup Stage callback */ + void (* ResetCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Reset callback */ + void (* SuspendCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Suspend callback */ + void (* ResumeCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Resume callback */ + void (* ConnectCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Connect callback */ + void (* DisconnectCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Disconnect callback */ + + void (* DataOutStageCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD Data OUT Stage callback */ + void (* DataInStageCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD Data IN Stage callback */ + void (* ISOOUTIncompleteCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD ISO OUT Incomplete callback */ + void (* ISOINIncompleteCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD ISO IN Incomplete callback */ + + void (* MspInitCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Msp Init callback */ + void (* MspDeInitCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Msp DeInit callback */ +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +} PCD_HandleTypeDef; + +/** + * @} + */ + +/* Include PCD HAL Extended module */ +#include "stm32f3xx_hal_pcd_ex.h" + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PCD_Exported_Constants PCD Exported Constants + * @{ + */ + +/** @defgroup PCD_Speed PCD Speed + * @{ + */ +#define PCD_SPEED_FULL USBD_FS_SPEED +/** + * @} + */ + +/** @defgroup PCD_PHY_Module PCD PHY Module + * @{ + */ +#define PCD_PHY_ULPI 1U +#define PCD_PHY_EMBEDDED 2U +#define PCD_PHY_UTMI 3U +/** + * @} + */ + +/** @defgroup PCD_Error_Code_definition PCD Error Code definition + * @brief PCD Error Code definition + * @{ + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +#define HAL_PCD_ERROR_INVALID_CALLBACK (0x00000010U) /*!< Invalid Callback error */ +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + +/** + * @} + */ + +/** + * @} + */ + +/* Exported macros -----------------------------------------------------------*/ +/** @defgroup PCD_Exported_Macros PCD Exported Macros + * @brief macros to handle interrupts and specific clock configurations + * @{ + */ +#define __HAL_PCD_ENABLE(__HANDLE__) (void)USB_EnableGlobalInt ((__HANDLE__)->Instance) +#define __HAL_PCD_DISABLE(__HANDLE__) (void)USB_DisableGlobalInt ((__HANDLE__)->Instance) + +#define __HAL_PCD_GET_FLAG(__HANDLE__, __INTERRUPT__) \ + ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__)) + + +#define __HAL_PCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->ISTR)\ + &= (uint16_t)(~(__INTERRUPT__))) + +#define __HAL_USB_WAKEUP_EXTI_ENABLE_IT() EXTI->IMR |= USB_WAKEUP_EXTI_LINE +#define __HAL_USB_WAKEUP_EXTI_DISABLE_IT() EXTI->IMR &= ~(USB_WAKEUP_EXTI_LINE) +#define __HAL_USB_WAKEUP_EXTI_GET_FLAG() EXTI->PR & (USB_WAKEUP_EXTI_LINE) +#define __HAL_USB_WAKEUP_EXTI_CLEAR_FLAG() EXTI->PR = USB_WAKEUP_EXTI_LINE + +#define __HAL_USB_WAKEUP_EXTI_ENABLE_RISING_EDGE() \ + do { \ + EXTI->FTSR &= ~(USB_WAKEUP_EXTI_LINE); \ + EXTI->RTSR |= USB_WAKEUP_EXTI_LINE; \ + } while(0U) + + + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup PCD_Exported_Functions PCD Exported Functions + * @{ + */ + +/* Initialization/de-initialization functions ********************************/ +/** @addtogroup PCD_Exported_Functions_Group1 Initialization and de-initialization functions + * @{ + */ +HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd); +HAL_StatusTypeDef HAL_PCD_DeInit(PCD_HandleTypeDef *hpcd); +void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd); +void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd); + +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +/** @defgroup HAL_PCD_Callback_ID_enumeration_definition HAL USB OTG PCD Callback ID enumeration definition + * @brief HAL USB OTG PCD Callback ID enumeration definition + * @{ + */ +typedef enum +{ + HAL_PCD_SOF_CB_ID = 0x01, /*!< USB PCD SOF callback ID */ + HAL_PCD_SETUPSTAGE_CB_ID = 0x02, /*!< USB PCD Setup Stage callback ID */ + HAL_PCD_RESET_CB_ID = 0x03, /*!< USB PCD Reset callback ID */ + HAL_PCD_SUSPEND_CB_ID = 0x04, /*!< USB PCD Suspend callback ID */ + HAL_PCD_RESUME_CB_ID = 0x05, /*!< USB PCD Resume callback ID */ + HAL_PCD_CONNECT_CB_ID = 0x06, /*!< USB PCD Connect callback ID */ + HAL_PCD_DISCONNECT_CB_ID = 0x07, /*!< USB PCD Disconnect callback ID */ + + HAL_PCD_MSPINIT_CB_ID = 0x08, /*!< USB PCD MspInit callback ID */ + HAL_PCD_MSPDEINIT_CB_ID = 0x09 /*!< USB PCD MspDeInit callback ID */ + +} HAL_PCD_CallbackIDTypeDef; +/** + * @} + */ + +/** @defgroup HAL_PCD_Callback_pointer_definition HAL USB OTG PCD Callback pointer definition + * @brief HAL USB OTG PCD Callback pointer definition + * @{ + */ + +typedef void (*pPCD_CallbackTypeDef)(PCD_HandleTypeDef *hpcd); /*!< pointer to a common USB OTG PCD callback function */ +typedef void (*pPCD_DataOutStageCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD Data OUT Stage callback */ +typedef void (*pPCD_DataInStageCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD Data IN Stage callback */ +typedef void (*pPCD_IsoOutIncpltCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD ISO OUT Incomplete callback */ +typedef void (*pPCD_IsoInIncpltCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD ISO IN Incomplete callback */ + +/** + * @} + */ + +HAL_StatusTypeDef HAL_PCD_RegisterCallback(PCD_HandleTypeDef *hpcd, HAL_PCD_CallbackIDTypeDef CallbackID, + pPCD_CallbackTypeDef pCallback); + +HAL_StatusTypeDef HAL_PCD_UnRegisterCallback(PCD_HandleTypeDef *hpcd, HAL_PCD_CallbackIDTypeDef CallbackID); + +HAL_StatusTypeDef HAL_PCD_RegisterDataOutStageCallback(PCD_HandleTypeDef *hpcd, + pPCD_DataOutStageCallbackTypeDef pCallback); + +HAL_StatusTypeDef HAL_PCD_UnRegisterDataOutStageCallback(PCD_HandleTypeDef *hpcd); + +HAL_StatusTypeDef HAL_PCD_RegisterDataInStageCallback(PCD_HandleTypeDef *hpcd, + pPCD_DataInStageCallbackTypeDef pCallback); + +HAL_StatusTypeDef HAL_PCD_UnRegisterDataInStageCallback(PCD_HandleTypeDef *hpcd); + +HAL_StatusTypeDef HAL_PCD_RegisterIsoOutIncpltCallback(PCD_HandleTypeDef *hpcd, + pPCD_IsoOutIncpltCallbackTypeDef pCallback); + +HAL_StatusTypeDef HAL_PCD_UnRegisterIsoOutIncpltCallback(PCD_HandleTypeDef *hpcd); + +HAL_StatusTypeDef HAL_PCD_RegisterIsoInIncpltCallback(PCD_HandleTypeDef *hpcd, + pPCD_IsoInIncpltCallbackTypeDef pCallback); + +HAL_StatusTypeDef HAL_PCD_UnRegisterIsoInIncpltCallback(PCD_HandleTypeDef *hpcd); + +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +/** + * @} + */ + +/* I/O operation functions ***************************************************/ +/* Non-Blocking mode: Interrupt */ +/** @addtogroup PCD_Exported_Functions_Group2 Input and Output operation functions + * @{ + */ +HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd); +HAL_StatusTypeDef HAL_PCD_Stop(PCD_HandleTypeDef *hpcd); +void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd); +void HAL_PCD_WKUP_IRQHandler(PCD_HandleTypeDef *hpcd); + +void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd); +void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd); +void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd); +void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd); +void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd); +void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd); +void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd); + +void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); +void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); +void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); +void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); +/** + * @} + */ + +/* Peripheral Control functions **********************************************/ +/** @addtogroup PCD_Exported_Functions_Group3 Peripheral Control functions + * @{ + */ +HAL_StatusTypeDef HAL_PCD_DevConnect(PCD_HandleTypeDef *hpcd); +HAL_StatusTypeDef HAL_PCD_DevDisconnect(PCD_HandleTypeDef *hpcd); +HAL_StatusTypeDef HAL_PCD_SetAddress(PCD_HandleTypeDef *hpcd, uint8_t address); +HAL_StatusTypeDef HAL_PCD_EP_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type); +HAL_StatusTypeDef HAL_PCD_EP_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); +HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); +HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len); +HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); +HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); +HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); +HAL_StatusTypeDef HAL_PCD_EP_Abort(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); +HAL_StatusTypeDef HAL_PCD_ActivateRemoteWakeup(PCD_HandleTypeDef *hpcd); +HAL_StatusTypeDef HAL_PCD_DeActivateRemoteWakeup(PCD_HandleTypeDef *hpcd); +uint32_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr); +/** + * @} + */ + +/* Peripheral State functions ************************************************/ +/** @addtogroup PCD_Exported_Functions_Group4 Peripheral State functions + * @{ + */ +PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd); +/** + * @} + */ + +/** + * @} + */ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup PCD_Private_Constants PCD Private Constants + * @{ + */ +/** @defgroup USB_EXTI_Line_Interrupt USB EXTI line interrupt + * @{ + */ + + +#define USB_WAKEUP_EXTI_LINE (0x1U << 18) /*!< USB FS EXTI Line WakeUp Interrupt */ + + +/** + * @} + */ + +/** @defgroup PCD_EP0_MPS PCD EP0 MPS + * @{ + */ +#define PCD_EP0MPS_64 EP_MPS_64 +#define PCD_EP0MPS_32 EP_MPS_32 +#define PCD_EP0MPS_16 EP_MPS_16 +#define PCD_EP0MPS_08 EP_MPS_8 +/** + * @} + */ + +/** @defgroup PCD_ENDP PCD ENDP + * @{ + */ +#define PCD_ENDP0 0U +#define PCD_ENDP1 1U +#define PCD_ENDP2 2U +#define PCD_ENDP3 3U +#define PCD_ENDP4 4U +#define PCD_ENDP5 5U +#define PCD_ENDP6 6U +#define PCD_ENDP7 7U +/** + * @} + */ + +/** @defgroup PCD_ENDP_Kind PCD Endpoint Kind + * @{ + */ +#define PCD_SNG_BUF 0U +#define PCD_DBL_BUF 1U +/** + * @} + */ + +/** + * @} + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup PCD_Private_Macros PCD Private Macros + * @{ + */ + +/******************** Bit definition for USB_COUNTn_RX register *************/ +#define USB_CNTRX_NBLK_MSK (0x1FU << 10) +#define USB_CNTRX_BLSIZE (0x1U << 15) + +/* SetENDPOINT */ +#define PCD_SET_ENDPOINT(USBx, bEpNum, wRegValue) \ + (*(__IO uint16_t *)(&(USBx)->EP0R + ((bEpNum) * 2U)) = (uint16_t)(wRegValue)) + +/* GetENDPOINT */ +#define PCD_GET_ENDPOINT(USBx, bEpNum) (*(__IO uint16_t *)(&(USBx)->EP0R + ((bEpNum) * 2U))) + + +/** + * @brief sets the type in the endpoint register(bits EP_TYPE[1:0]) + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @param wType Endpoint Type. + * @retval None + */ +#define PCD_SET_EPTYPE(USBx, bEpNum, wType) \ + (PCD_SET_ENDPOINT((USBx), (bEpNum), \ + ((PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EP_T_MASK) | (wType) | USB_EP_CTR_TX | USB_EP_CTR_RX))) + + +/** + * @brief gets the type in the endpoint register(bits EP_TYPE[1:0]) + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval Endpoint Type + */ +#define PCD_GET_EPTYPE(USBx, bEpNum) (PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EP_T_FIELD) + +/** + * @brief free buffer used from the application realizing it to the line + * toggles bit SW_BUF in the double buffered endpoint register + * @param USBx USB device. + * @param bEpNum, bDir + * @retval None + */ +#define PCD_FREE_USER_BUFFER(USBx, bEpNum, bDir) \ + do { \ + if ((bDir) == 0U) \ + { \ + /* OUT double buffered endpoint */ \ + PCD_TX_DTOG((USBx), (bEpNum)); \ + } \ + else if ((bDir) == 1U) \ + { \ + /* IN double buffered endpoint */ \ + PCD_RX_DTOG((USBx), (bEpNum)); \ + } \ + } while(0) + +/** + * @brief sets the status for tx transfer (bits STAT_TX[1:0]). + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @param wState new state + * @retval None + */ +#define PCD_SET_EP_TX_STATUS(USBx, bEpNum, wState) \ + do { \ + uint16_t _wRegVal; \ + \ + _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPTX_DTOGMASK; \ + /* toggle first bit ? */ \ + if ((USB_EPTX_DTOG1 & (wState))!= 0U) \ + { \ + _wRegVal ^= USB_EPTX_DTOG1; \ + } \ + /* toggle second bit ? */ \ + if ((USB_EPTX_DTOG2 & (wState))!= 0U) \ + { \ + _wRegVal ^= USB_EPTX_DTOG2; \ + } \ + PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); \ + } while(0) /* PCD_SET_EP_TX_STATUS */ + +/** + * @brief sets the status for rx transfer (bits STAT_TX[1:0]) + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @param wState new state + * @retval None + */ +#define PCD_SET_EP_RX_STATUS(USBx, bEpNum,wState) \ + do { \ + uint16_t _wRegVal; \ + \ + _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPRX_DTOGMASK; \ + /* toggle first bit ? */ \ + if ((USB_EPRX_DTOG1 & (wState))!= 0U) \ + { \ + _wRegVal ^= USB_EPRX_DTOG1; \ + } \ + /* toggle second bit ? */ \ + if ((USB_EPRX_DTOG2 & (wState))!= 0U) \ + { \ + _wRegVal ^= USB_EPRX_DTOG2; \ + } \ + PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); \ + } while(0) /* PCD_SET_EP_RX_STATUS */ + +/** + * @brief sets the status for rx & tx (bits STAT_TX[1:0] & STAT_RX[1:0]) + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @param wStaterx new state. + * @param wStatetx new state. + * @retval None + */ +#define PCD_SET_EP_TXRX_STATUS(USBx, bEpNum, wStaterx, wStatetx) \ + do { \ + uint16_t _wRegVal; \ + \ + _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & (USB_EPRX_DTOGMASK | USB_EPTX_STAT); \ + /* toggle first bit ? */ \ + if ((USB_EPRX_DTOG1 & (wStaterx))!= 0U) \ + { \ + _wRegVal ^= USB_EPRX_DTOG1; \ + } \ + /* toggle second bit ? */ \ + if ((USB_EPRX_DTOG2 & (wStaterx))!= 0U) \ + { \ + _wRegVal ^= USB_EPRX_DTOG2; \ + } \ + /* toggle first bit ? */ \ + if ((USB_EPTX_DTOG1 & (wStatetx))!= 0U) \ + { \ + _wRegVal ^= USB_EPTX_DTOG1; \ + } \ + /* toggle second bit ? */ \ + if ((USB_EPTX_DTOG2 & (wStatetx))!= 0U) \ + { \ + _wRegVal ^= USB_EPTX_DTOG2; \ + } \ + \ + PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); \ + } while(0) /* PCD_SET_EP_TXRX_STATUS */ + +/** + * @brief gets the status for tx/rx transfer (bits STAT_TX[1:0] + * /STAT_RX[1:0]) + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval status + */ +#define PCD_GET_EP_TX_STATUS(USBx, bEpNum) ((uint16_t)PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPTX_STAT) +#define PCD_GET_EP_RX_STATUS(USBx, bEpNum) ((uint16_t)PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPRX_STAT) + +/** + * @brief sets directly the VALID tx/rx-status into the endpoint register + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval None + */ +#define PCD_SET_EP_TX_VALID(USBx, bEpNum) (PCD_SET_EP_TX_STATUS((USBx), (bEpNum), USB_EP_TX_VALID)) +#define PCD_SET_EP_RX_VALID(USBx, bEpNum) (PCD_SET_EP_RX_STATUS((USBx), (bEpNum), USB_EP_RX_VALID)) + +/** + * @brief checks stall condition in an endpoint. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval TRUE = endpoint in stall condition. + */ +#define PCD_GET_EP_TX_STALL_STATUS(USBx, bEpNum) (PCD_GET_EP_TX_STATUS((USBx), (bEpNum)) == USB_EP_TX_STALL) +#define PCD_GET_EP_RX_STALL_STATUS(USBx, bEpNum) (PCD_GET_EP_RX_STATUS((USBx), (bEpNum)) == USB_EP_RX_STALL) + +/** + * @brief set & clear EP_KIND bit. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval None + */ +#define PCD_SET_EP_KIND(USBx, bEpNum) \ + do { \ + uint16_t _wRegVal; \ + \ + _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK; \ + \ + PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX | USB_EP_KIND)); \ + } while(0) /* PCD_SET_EP_KIND */ + +#define PCD_CLEAR_EP_KIND(USBx, bEpNum) \ + do { \ + uint16_t _wRegVal; \ + \ + _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPKIND_MASK; \ + \ + PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); \ + } while(0) /* PCD_CLEAR_EP_KIND */ + +/** + * @brief Sets/clears directly STATUS_OUT bit in the endpoint register. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval None + */ +#define PCD_SET_OUT_STATUS(USBx, bEpNum) PCD_SET_EP_KIND((USBx), (bEpNum)) +#define PCD_CLEAR_OUT_STATUS(USBx, bEpNum) PCD_CLEAR_EP_KIND((USBx), (bEpNum)) + +/** + * @brief Sets/clears directly EP_KIND bit in the endpoint register. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval None + */ +#define PCD_SET_BULK_EP_DBUF(USBx, bEpNum) PCD_SET_EP_KIND((USBx), (bEpNum)) +#define PCD_CLEAR_BULK_EP_DBUF(USBx, bEpNum) PCD_CLEAR_EP_KIND((USBx), (bEpNum)) + +/** + * @brief Clears bit CTR_RX / CTR_TX in the endpoint register. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval None + */ +#define PCD_CLEAR_RX_EP_CTR(USBx, bEpNum) \ + do { \ + uint16_t _wRegVal; \ + \ + _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & (0x7FFFU & USB_EPREG_MASK); \ + \ + PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_TX)); \ + } while(0) /* PCD_CLEAR_RX_EP_CTR */ + +#define PCD_CLEAR_TX_EP_CTR(USBx, bEpNum) \ + do { \ + uint16_t _wRegVal; \ + \ + _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & (0xFF7FU & USB_EPREG_MASK); \ + \ + PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX)); \ + } while(0) /* PCD_CLEAR_TX_EP_CTR */ + +/** + * @brief Toggles DTOG_RX / DTOG_TX bit in the endpoint register. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval None + */ +#define PCD_RX_DTOG(USBx, bEpNum) \ + do { \ + uint16_t _wEPVal; \ + \ + _wEPVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK; \ + \ + PCD_SET_ENDPOINT((USBx), (bEpNum), (_wEPVal | USB_EP_CTR_RX | USB_EP_CTR_TX | USB_EP_DTOG_RX)); \ + } while(0) /* PCD_RX_DTOG */ + +#define PCD_TX_DTOG(USBx, bEpNum) \ + do { \ + uint16_t _wEPVal; \ + \ + _wEPVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK; \ + \ + PCD_SET_ENDPOINT((USBx), (bEpNum), (_wEPVal | USB_EP_CTR_RX | USB_EP_CTR_TX | USB_EP_DTOG_TX)); \ + } while(0) /* PCD_TX_DTOG */ +/** + * @brief Clears DTOG_RX / DTOG_TX bit in the endpoint register. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval None + */ +#define PCD_CLEAR_RX_DTOG(USBx, bEpNum) \ + do { \ + uint16_t _wRegVal; \ + \ + _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)); \ + \ + if ((_wRegVal & USB_EP_DTOG_RX) != 0U)\ + { \ + PCD_RX_DTOG((USBx), (bEpNum)); \ + } \ + } while(0) /* PCD_CLEAR_RX_DTOG */ + +#define PCD_CLEAR_TX_DTOG(USBx, bEpNum) \ + do { \ + uint16_t _wRegVal; \ + \ + _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)); \ + \ + if ((_wRegVal & USB_EP_DTOG_TX) != 0U)\ + { \ + PCD_TX_DTOG((USBx), (bEpNum)); \ + } \ + } while(0) /* PCD_CLEAR_TX_DTOG */ + +/** + * @brief Sets address in an endpoint register. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @param bAddr Address. + * @retval None + */ +#define PCD_SET_EP_ADDRESS(USBx, bEpNum, bAddr) \ + do { \ + uint16_t _wRegVal; \ + \ + _wRegVal = (PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK) | (bAddr); \ + \ + PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); \ + } while(0) /* PCD_SET_EP_ADDRESS */ + +/** + * @brief Gets address in an endpoint register. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval None + */ +#define PCD_GET_EP_ADDRESS(USBx, bEpNum) ((uint8_t)(PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPADDR_FIELD)) + +#define PCD_EP_TX_CNT(USBx, bEpNum) \ + ((uint16_t *)((((uint32_t)(USBx)->BTABLE + \ + ((uint32_t)(bEpNum) * 8U) + 2U) * PMA_ACCESS) + ((uint32_t)(USBx) + 0x400U))) + +#define PCD_EP_RX_CNT(USBx, bEpNum) \ + ((uint16_t *)((((uint32_t)(USBx)->BTABLE + \ + ((uint32_t)(bEpNum) * 8U) + 6U) * PMA_ACCESS) + ((uint32_t)(USBx) + 0x400U))) + + +/** + * @brief sets address of the tx/rx buffer. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @param wAddr address to be set (must be word aligned). + * @retval None + */ +#define PCD_SET_EP_TX_ADDRESS(USBx, bEpNum, wAddr) \ + do { \ + __IO uint16_t *_wRegVal; \ + uint32_t _wRegBase = (uint32_t)USBx; \ + \ + _wRegBase += (uint32_t)(USBx)->BTABLE; \ + _wRegVal = (__IO uint16_t *)(_wRegBase + 0x400U + (((uint32_t)(bEpNum) * 8U) * PMA_ACCESS)); \ + *_wRegVal = ((wAddr) >> 1) << 1; \ + } while(0) /* PCD_SET_EP_TX_ADDRESS */ + +#define PCD_SET_EP_RX_ADDRESS(USBx, bEpNum, wAddr) \ + do { \ + __IO uint16_t *_wRegVal; \ + uint32_t _wRegBase = (uint32_t)USBx; \ + \ + _wRegBase += (uint32_t)(USBx)->BTABLE; \ + _wRegVal = (__IO uint16_t *)(_wRegBase + 0x400U + ((((uint32_t)(bEpNum) * 8U) + 4U) * PMA_ACCESS)); \ + *_wRegVal = ((wAddr) >> 1) << 1; \ + } while(0) /* PCD_SET_EP_RX_ADDRESS */ + +/** + * @brief Gets address of the tx/rx buffer. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval address of the buffer. + */ +#define PCD_GET_EP_TX_ADDRESS(USBx, bEpNum) ((uint16_t)*PCD_EP_TX_ADDRESS((USBx), (bEpNum))) +#define PCD_GET_EP_RX_ADDRESS(USBx, bEpNum) ((uint16_t)*PCD_EP_RX_ADDRESS((USBx), (bEpNum))) + +/** + * @brief Sets counter of rx buffer with no. of blocks. + * @param pdwReg Register pointer + * @param wCount Counter. + * @param wNBlocks no. of Blocks. + * @retval None + */ +#define PCD_CALC_BLK32(pdwReg, wCount, wNBlocks) \ + do { \ + (wNBlocks) = (wCount) >> 5; \ + if (((wCount) & 0x1fU) == 0U) \ + { \ + (wNBlocks)--; \ + } \ + *(pdwReg) |= (uint16_t)(((wNBlocks) << 10) | USB_CNTRX_BLSIZE); \ + } while(0) /* PCD_CALC_BLK32 */ + +#define PCD_CALC_BLK2(pdwReg, wCount, wNBlocks) \ + do { \ + (wNBlocks) = (wCount) >> 1; \ + if (((wCount) & 0x1U) != 0U) \ + { \ + (wNBlocks)++; \ + } \ + *(pdwReg) |= (uint16_t)((wNBlocks) << 10); \ + } while(0) /* PCD_CALC_BLK2 */ + +#define PCD_SET_EP_CNT_RX_REG(pdwReg, wCount) \ + do { \ + uint32_t wNBlocks; \ + \ + *(pdwReg) &= 0x3FFU; \ + \ + if ((wCount) > 62U) \ + { \ + PCD_CALC_BLK32((pdwReg), (wCount), wNBlocks); \ + } \ + else \ + { \ + if ((wCount) == 0U) \ + { \ + *(pdwReg) |= USB_CNTRX_BLSIZE; \ + } \ + else \ + { \ + PCD_CALC_BLK2((pdwReg), (wCount), wNBlocks); \ + } \ + } \ + } while(0) /* PCD_SET_EP_CNT_RX_REG */ + +#define PCD_SET_EP_RX_DBUF0_CNT(USBx, bEpNum, wCount) \ + do { \ + uint32_t _wRegBase = (uint32_t)(USBx); \ + __IO uint16_t *pdwReg; \ + \ + _wRegBase += (uint32_t)(USBx)->BTABLE; \ + pdwReg = (__IO uint16_t *)(_wRegBase + 0x400U + ((((uint32_t)(bEpNum) * 8U) + 2U) * PMA_ACCESS)); \ + PCD_SET_EP_CNT_RX_REG(pdwReg, (wCount)); \ + } while(0) + +/** + * @brief sets counter for the tx/rx buffer. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @param wCount Counter value. + * @retval None + */ +#define PCD_SET_EP_TX_CNT(USBx, bEpNum, wCount) \ + do { \ + uint32_t _wRegBase = (uint32_t)(USBx); \ + __IO uint16_t *_wRegVal; \ + \ + _wRegBase += (uint32_t)(USBx)->BTABLE; \ + _wRegVal = (__IO uint16_t *)(_wRegBase + 0x400U + ((((uint32_t)(bEpNum) * 8U) + 2U) * PMA_ACCESS)); \ + *_wRegVal = (uint16_t)(wCount); \ + } while(0) + +#define PCD_SET_EP_RX_CNT(USBx, bEpNum, wCount) \ + do { \ + uint32_t _wRegBase = (uint32_t)(USBx); \ + __IO uint16_t *_wRegVal; \ + \ + _wRegBase += (uint32_t)(USBx)->BTABLE; \ + _wRegVal = (__IO uint16_t *)(_wRegBase + 0x400U + ((((uint32_t)(bEpNum) * 8U) + 6U) * PMA_ACCESS)); \ + PCD_SET_EP_CNT_RX_REG(_wRegVal, (wCount)); \ + } while(0) + +/** + * @brief gets counter of the tx buffer. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval Counter value + */ +#define PCD_GET_EP_TX_CNT(USBx, bEpNum) ((uint32_t)(*PCD_EP_TX_CNT((USBx), (bEpNum))) & 0x3ffU) +#define PCD_GET_EP_RX_CNT(USBx, bEpNum) ((uint32_t)(*PCD_EP_RX_CNT((USBx), (bEpNum))) & 0x3ffU) + +/** + * @brief Sets buffer 0/1 address in a double buffer endpoint. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @param wBuf0Addr buffer 0 address. + * @retval Counter value + */ +#define PCD_SET_EP_DBUF0_ADDR(USBx, bEpNum, wBuf0Addr) \ + do { \ + PCD_SET_EP_TX_ADDRESS((USBx), (bEpNum), (wBuf0Addr)); \ + } while(0) /* PCD_SET_EP_DBUF0_ADDR */ + +#define PCD_SET_EP_DBUF1_ADDR(USBx, bEpNum, wBuf1Addr) \ + do { \ + PCD_SET_EP_RX_ADDRESS((USBx), (bEpNum), (wBuf1Addr)); \ + } while(0) /* PCD_SET_EP_DBUF1_ADDR */ + +/** + * @brief Sets addresses in a double buffer endpoint. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @param wBuf0Addr: buffer 0 address. + * @param wBuf1Addr = buffer 1 address. + * @retval None + */ +#define PCD_SET_EP_DBUF_ADDR(USBx, bEpNum, wBuf0Addr, wBuf1Addr) \ + do { \ + PCD_SET_EP_DBUF0_ADDR((USBx), (bEpNum), (wBuf0Addr)); \ + PCD_SET_EP_DBUF1_ADDR((USBx), (bEpNum), (wBuf1Addr)); \ + } while(0) /* PCD_SET_EP_DBUF_ADDR */ + +/** + * @brief Gets buffer 0/1 address of a double buffer endpoint. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval None + */ +#define PCD_GET_EP_DBUF0_ADDR(USBx, bEpNum) (PCD_GET_EP_TX_ADDRESS((USBx), (bEpNum))) +#define PCD_GET_EP_DBUF1_ADDR(USBx, bEpNum) (PCD_GET_EP_RX_ADDRESS((USBx), (bEpNum))) + +/** + * @brief Gets buffer 0/1 address of a double buffer endpoint. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @param bDir endpoint dir EP_DBUF_OUT = OUT + * EP_DBUF_IN = IN + * @param wCount: Counter value + * @retval None + */ +#define PCD_SET_EP_DBUF0_CNT(USBx, bEpNum, bDir, wCount) \ + do { \ + if ((bDir) == 0U) \ + /* OUT endpoint */ \ + { \ + PCD_SET_EP_RX_DBUF0_CNT((USBx), (bEpNum), (wCount)); \ + } \ + else \ + { \ + if ((bDir) == 1U) \ + { \ + /* IN endpoint */ \ + PCD_SET_EP_TX_CNT((USBx), (bEpNum), (wCount)); \ + } \ + } \ + } while(0) /* SetEPDblBuf0Count*/ + +#define PCD_SET_EP_DBUF1_CNT(USBx, bEpNum, bDir, wCount) \ + do { \ + uint32_t _wBase = (uint32_t)(USBx); \ + __IO uint16_t *_wEPRegVal; \ + \ + if ((bDir) == 0U) \ + { \ + /* OUT endpoint */ \ + PCD_SET_EP_RX_CNT((USBx), (bEpNum), (wCount)); \ + } \ + else \ + { \ + if ((bDir) == 1U) \ + { \ + /* IN endpoint */ \ + _wBase += (uint32_t)(USBx)->BTABLE; \ + _wEPRegVal = (__IO uint16_t *)(_wBase + 0x400U + ((((uint32_t)(bEpNum) * 8U) + 6U) * PMA_ACCESS)); \ + *_wEPRegVal = (uint16_t)(wCount); \ + } \ + } \ + } while(0) /* SetEPDblBuf1Count */ + +#define PCD_SET_EP_DBUF_CNT(USBx, bEpNum, bDir, wCount) \ + do { \ + PCD_SET_EP_DBUF0_CNT((USBx), (bEpNum), (bDir), (wCount)); \ + PCD_SET_EP_DBUF1_CNT((USBx), (bEpNum), (bDir), (wCount)); \ + } while(0) /* PCD_SET_EP_DBUF_CNT */ + +/** + * @brief Gets buffer 0/1 rx/tx counter for double buffering. + * @param USBx USB peripheral instance register address. + * @param bEpNum Endpoint Number. + * @retval None + */ +#define PCD_GET_EP_DBUF0_CNT(USBx, bEpNum) (PCD_GET_EP_TX_CNT((USBx), (bEpNum))) +#define PCD_GET_EP_DBUF1_CNT(USBx, bEpNum) (PCD_GET_EP_RX_CNT((USBx), (bEpNum))) + + + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +#endif /* defined (USB) */ + +#ifdef __cplusplus +} +#endif + +#endif /* STM32F3xx_HAL_PCD_H */ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pcd_ex.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pcd_ex.h new file mode 100644 index 000000000..4d8e45e97 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_hal_pcd_ex.h @@ -0,0 +1,81 @@ +/** + ****************************************************************************** + * @file stm32f3xx_hal_pcd_ex.h + * @author MCD Application Team + * @brief Header file of PCD HAL Extension module. + ****************************************************************************** + * @attention + * + * Copyright (c) 2016 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. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef STM32F3xx_HAL_PCD_EX_H +#define STM32F3xx_HAL_PCD_EX_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f3xx_hal_def.h" + +#if defined (USB) +/** @addtogroup STM32F3xx_HAL_Driver + * @{ + */ + +/** @addtogroup PCDEx + * @{ + */ +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions + * @{ + */ +/** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions + * @{ + */ + + + +HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr, + uint16_t ep_kind, uint32_t pmaadress); + +void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state); + +void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); +void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +#endif /* defined (USB) */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* STM32F3xx_HAL_PCD_EX_H */ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_ll_usb.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_ll_usb.h new file mode 100644 index 000000000..f4501e942 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Inc/stm32f3xx_ll_usb.h @@ -0,0 +1,251 @@ +/** + ****************************************************************************** + * @file stm32f3xx_ll_usb.h + * @author MCD Application Team + * @brief Header file of USB Low Layer HAL module. + ****************************************************************************** + * @attention + * + * Copyright (c) 2016 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. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef STM32F3xx_LL_USB_H +#define STM32F3xx_LL_USB_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f3xx_hal_def.h" + +#if defined (USB) +/** @addtogroup STM32F3xx_HAL_Driver + * @{ + */ + +/** @addtogroup USB_LL + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ + +/** + * @brief USB Mode definition + */ + +typedef enum +{ + USB_DEVICE_MODE = 0 +} USB_ModeTypeDef; + + +/** + * @brief USB Instance Initialization Structure definition + */ +typedef struct +{ + uint32_t dev_endpoints; /*!< Device Endpoints number. + This parameter depends on the used USB core. + This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ + + uint32_t speed; /*!< USB Core speed. + This parameter can be any value of @ref PCD_Speed/HCD_Speed + (HCD_SPEED_xxx, HCD_SPEED_xxx) */ + + uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. */ + + uint32_t phy_itface; /*!< Select the used PHY interface. + This parameter can be any value of @ref PCD_PHY_Module/HCD_PHY_Module */ + + uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */ + + uint32_t low_power_enable; /*!< Enable or disable the low Power Mode. */ + + uint32_t lpm_enable; /*!< Enable or disable Link Power Management. */ + + uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */ +} USB_CfgTypeDef; + +typedef struct +{ + uint8_t num; /*!< Endpoint number + This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ + + uint8_t is_in; /*!< Endpoint direction + This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ + + uint8_t is_stall; /*!< Endpoint stall condition + This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ + + uint8_t type; /*!< Endpoint type + This parameter can be any value of @ref USB_LL_EP_Type */ + + uint8_t data_pid_start; /*!< Initial data PID + This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ + + + uint16_t pmaadress; /*!< PMA Address + This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ + + uint16_t pmaaddr0; /*!< PMA Address0 + This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ + + uint16_t pmaaddr1; /*!< PMA Address1 + This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ + + uint8_t doublebuffer; /*!< Double buffer enable + This parameter can be 0 or 1 */ + + + uint32_t maxpacket; /*!< Endpoint Max packet size + This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ + + uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ + + uint32_t xfer_len; /*!< Current transfer length */ + + uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ + + uint32_t xfer_len_db; /*!< double buffer transfer length used with bulk double buffer in */ + + uint8_t xfer_fill_db; /*!< double buffer Need to Fill new buffer used with bulk_in */ +} USB_EPTypeDef; + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup PCD_Exported_Constants PCD Exported Constants + * @{ + */ +/** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS + * @{ + */ +#define EP_MPS_64 0U +#define EP_MPS_32 1U +#define EP_MPS_16 2U +#define EP_MPS_8 3U +/** + * @} + */ + +/** @defgroup USB_LL_EP_Type USB Low Layer EP Type + * @{ + */ +#define EP_TYPE_CTRL 0U +#define EP_TYPE_ISOC 1U +#define EP_TYPE_BULK 2U +#define EP_TYPE_INTR 3U +#define EP_TYPE_MSK 3U +/** + * @} + */ + +/** @defgroup USB_LL Device Speed + * @{ + */ +#define USBD_FS_SPEED 2U +/** + * @} + */ + + +#define BTABLE_ADDRESS 0x000U +#if defined(STM32F303xC) || defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F301x8) || defined(STM32F373xC) || defined(STM32F378xx) || defined(STM32F302xC) +#define PMA_ACCESS 2U +#endif /* STM32F303xC || */ +/* STM32F303x8 || STM32F334x8 || */ +/* STM32F301x8 || */ +/* STM32F373xC || STM32F378xx */ + +#if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F302x8) +#define PMA_ACCESS 1U +#endif /* STM32F302xE || STM32F303xE || */ +/* STM32F302xC || */ +/* STM32F302x8 */ + +#ifndef USB_EP_RX_STRX +#define USB_EP_RX_STRX (0x3U << 12) +#endif /* USB_EP_RX_STRX */ + +#define EP_ADDR_MSK 0x7U + +#ifndef USE_USB_DOUBLE_BUFFER +#define USE_USB_DOUBLE_BUFFER 1U +#endif /* USE_USB_DOUBLE_BUFFER */ + + +/** + * @} + */ + +/* Exported macro ------------------------------------------------------------*/ +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions + * @{ + */ + + +HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg); +HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg); +HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx); +HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx); +HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode); + +#if defined (HAL_PCD_MODULE_ENABLED) +HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep); +HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep); +HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep); +HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx, USB_EPTypeDef *ep); +HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx, USB_EPTypeDef *ep); +HAL_StatusTypeDef USB_EPStopXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep); +#endif /* defined (HAL_PCD_MODULE_ENABLED) */ + +HAL_StatusTypeDef USB_SetDevAddress(USB_TypeDef *USBx, uint8_t address); +HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx); +HAL_StatusTypeDef USB_DevDisconnect(USB_TypeDef *USBx); +HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx); +uint32_t USB_ReadInterrupts(USB_TypeDef *USBx); +HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx); +HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx); + +void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, + uint16_t wPMABufAddr, uint16_t wNBytes); + +void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, + uint16_t wPMABufAddr, uint16_t wNBytes); + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +#endif /* defined (USB) */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* STM32F3xx_LL_USB_H */ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd.c new file mode 100644 index 000000000..8b1ab9213 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd.c @@ -0,0 +1,2064 @@ +/** + ****************************************************************************** + * @file stm32f3xx_hal_pcd.c + * @author MCD Application Team + * @brief PCD HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the USB Peripheral Controller: + * + Initialization and de-initialization functions + * + IO operation functions + * + Peripheral Control functions + * + Peripheral State functions + * + ****************************************************************************** + * @attention + * + * Copyright (c) 2016 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. + * + ****************************************************************************** + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + The PCD HAL driver can be used as follows: + + (#) Declare a PCD_HandleTypeDef handle structure, for example: + PCD_HandleTypeDef hpcd; + + (#) Fill parameters of Init structure in HCD handle + + (#) Call HAL_PCD_Init() API to initialize the PCD peripheral (Core, Device core, ...) + + (#) Initialize the PCD low level resources through the HAL_PCD_MspInit() API: + (##) Enable the PCD/USB Low Level interface clock using + (+++) __HAL_RCC_USB_CLK_ENABLE(); For USB Device FS peripheral + + (##) Initialize the related GPIO clocks + (##) Configure PCD pin-out + (##) Configure PCD NVIC interrupt + + (#)Associate the Upper USB device stack to the HAL PCD Driver: + (##) hpcd.pData = pdev; + + (#)Enable PCD transmission and reception: + (##) HAL_PCD_Start(); + + @endverbatim + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f3xx_hal.h" + +/** @addtogroup STM32F3xx_HAL_Driver + * @{ + */ + +/** @defgroup PCD PCD + * @brief PCD HAL module driver + * @{ + */ + +#ifdef HAL_PCD_MODULE_ENABLED + +#if defined (USB) + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup PCD_Private_Macros PCD Private Macros + * @{ + */ +#define PCD_MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define PCD_MAX(a, b) (((a) > (b)) ? (a) : (b)) +/** + * @} + */ + +/* Private functions prototypes ----------------------------------------------*/ +/** @defgroup PCD_Private_Functions PCD Private Functions + * @{ + */ + +static HAL_StatusTypeDef PCD_EP_ISR_Handler(PCD_HandleTypeDef *hpcd); +#if (USE_USB_DOUBLE_BUFFER == 1U) +static HAL_StatusTypeDef HAL_PCD_EP_DB_Transmit(PCD_HandleTypeDef *hpcd, PCD_EPTypeDef *ep, uint16_t wEPVal); +static uint16_t HAL_PCD_EP_DB_Receive(PCD_HandleTypeDef *hpcd, PCD_EPTypeDef *ep, uint16_t wEPVal); +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + +/** + * @} + */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup PCD_Exported_Functions PCD Exported Functions + * @{ + */ + +/** @defgroup PCD_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This section provides functions allowing to: + +@endverbatim + * @{ + */ + +/** + * @brief Initializes the PCD according to the specified + * parameters in the PCD_InitTypeDef and initialize the associated handle. + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd) +{ + uint8_t i; + + /* Check the PCD handle allocation */ + if (hpcd == NULL) + { + return HAL_ERROR; + } + + /* Check the parameters */ + assert_param(IS_PCD_ALL_INSTANCE(hpcd->Instance)); + + if (hpcd->State == HAL_PCD_STATE_RESET) + { + /* Allocate lock resource and initialize it */ + hpcd->Lock = HAL_UNLOCKED; + +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->SOFCallback = HAL_PCD_SOFCallback; + hpcd->SetupStageCallback = HAL_PCD_SetupStageCallback; + hpcd->ResetCallback = HAL_PCD_ResetCallback; + hpcd->SuspendCallback = HAL_PCD_SuspendCallback; + hpcd->ResumeCallback = HAL_PCD_ResumeCallback; + hpcd->ConnectCallback = HAL_PCD_ConnectCallback; + hpcd->DisconnectCallback = HAL_PCD_DisconnectCallback; + hpcd->DataOutStageCallback = HAL_PCD_DataOutStageCallback; + hpcd->DataInStageCallback = HAL_PCD_DataInStageCallback; + hpcd->ISOOUTIncompleteCallback = HAL_PCD_ISOOUTIncompleteCallback; + hpcd->ISOINIncompleteCallback = HAL_PCD_ISOINIncompleteCallback; + + if (hpcd->MspInitCallback == NULL) + { + hpcd->MspInitCallback = HAL_PCD_MspInit; + } + + /* Init the low level hardware */ + hpcd->MspInitCallback(hpcd); +#else + /* Init the low level hardware : GPIO, CLOCK, NVIC... */ + HAL_PCD_MspInit(hpcd); +#endif /* (USE_HAL_PCD_REGISTER_CALLBACKS) */ + } + + hpcd->State = HAL_PCD_STATE_BUSY; + + /* Disable the Interrupts */ + __HAL_PCD_DISABLE(hpcd); + + /* Init endpoints structures */ + for (i = 0U; i < hpcd->Init.dev_endpoints; i++) + { + /* Init ep structure */ + hpcd->IN_ep[i].is_in = 1U; + hpcd->IN_ep[i].num = i; + /* Control until ep is activated */ + hpcd->IN_ep[i].type = EP_TYPE_CTRL; + hpcd->IN_ep[i].maxpacket = 0U; + hpcd->IN_ep[i].xfer_buff = 0U; + hpcd->IN_ep[i].xfer_len = 0U; + } + + for (i = 0U; i < hpcd->Init.dev_endpoints; i++) + { + hpcd->OUT_ep[i].is_in = 0U; + hpcd->OUT_ep[i].num = i; + /* Control until ep is activated */ + hpcd->OUT_ep[i].type = EP_TYPE_CTRL; + hpcd->OUT_ep[i].maxpacket = 0U; + hpcd->OUT_ep[i].xfer_buff = 0U; + hpcd->OUT_ep[i].xfer_len = 0U; + } + + /* Init Device */ + (void)USB_DevInit(hpcd->Instance, hpcd->Init); + + hpcd->USB_Address = 0U; + hpcd->State = HAL_PCD_STATE_READY; + return HAL_OK; +} + +/** + * @brief DeInitializes the PCD peripheral. + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_DeInit(PCD_HandleTypeDef *hpcd) +{ + /* Check the PCD handle allocation */ + if (hpcd == NULL) + { + return HAL_ERROR; + } + + hpcd->State = HAL_PCD_STATE_BUSY; + + /* Stop Device */ + if (USB_StopDevice(hpcd->Instance) != HAL_OK) + { + return HAL_ERROR; + } + +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + if (hpcd->MspDeInitCallback == NULL) + { + hpcd->MspDeInitCallback = HAL_PCD_MspDeInit; /* Legacy weak MspDeInit */ + } + + /* DeInit the low level hardware */ + hpcd->MspDeInitCallback(hpcd); +#else + /* DeInit the low level hardware: CLOCK, NVIC.*/ + HAL_PCD_MspDeInit(hpcd); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + + hpcd->State = HAL_PCD_STATE_RESET; + + return HAL_OK; +} + +/** + * @brief Initializes the PCD MSP. + * @param hpcd PCD handle + * @retval None + */ +__weak void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_MspInit could be implemented in the user file + */ +} + +/** + * @brief DeInitializes PCD MSP. + * @param hpcd PCD handle + * @retval None + */ +__weak void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_MspDeInit could be implemented in the user file + */ +} + +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +/** + * @brief Register a User USB PCD Callback + * To be used instead of the weak predefined callback + * @param hpcd USB PCD handle + * @param CallbackID ID of the callback to be registered + * This parameter can be one of the following values: + * @arg @ref HAL_PCD_SOF_CB_ID USB PCD SOF callback ID + * @arg @ref HAL_PCD_SETUPSTAGE_CB_ID USB PCD Setup callback ID + * @arg @ref HAL_PCD_RESET_CB_ID USB PCD Reset callback ID + * @arg @ref HAL_PCD_SUSPEND_CB_ID USB PCD Suspend callback ID + * @arg @ref HAL_PCD_RESUME_CB_ID USB PCD Resume callback ID + * @arg @ref HAL_PCD_CONNECT_CB_ID USB PCD Connect callback ID + * @arg @ref HAL_PCD_DISCONNECT_CB_ID USB PCD Disconnect callback ID + * @arg @ref HAL_PCD_MSPINIT_CB_ID MspDeInit callback ID + * @arg @ref HAL_PCD_MSPDEINIT_CB_ID MspDeInit callback ID + * @param pCallback pointer to the Callback function + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_RegisterCallback(PCD_HandleTypeDef *hpcd, + HAL_PCD_CallbackIDTypeDef CallbackID, + pPCD_CallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (pCallback == NULL) + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + return HAL_ERROR; + } + /* Process locked */ + __HAL_LOCK(hpcd); + + if (hpcd->State == HAL_PCD_STATE_READY) + { + switch (CallbackID) + { + case HAL_PCD_SOF_CB_ID : + hpcd->SOFCallback = pCallback; + break; + + case HAL_PCD_SETUPSTAGE_CB_ID : + hpcd->SetupStageCallback = pCallback; + break; + + case HAL_PCD_RESET_CB_ID : + hpcd->ResetCallback = pCallback; + break; + + case HAL_PCD_SUSPEND_CB_ID : + hpcd->SuspendCallback = pCallback; + break; + + case HAL_PCD_RESUME_CB_ID : + hpcd->ResumeCallback = pCallback; + break; + + case HAL_PCD_CONNECT_CB_ID : + hpcd->ConnectCallback = pCallback; + break; + + case HAL_PCD_DISCONNECT_CB_ID : + hpcd->DisconnectCallback = pCallback; + break; + + case HAL_PCD_MSPINIT_CB_ID : + hpcd->MspInitCallback = pCallback; + break; + + case HAL_PCD_MSPDEINIT_CB_ID : + hpcd->MspDeInitCallback = pCallback; + break; + + default : + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else if (hpcd->State == HAL_PCD_STATE_RESET) + { + switch (CallbackID) + { + case HAL_PCD_MSPINIT_CB_ID : + hpcd->MspInitCallback = pCallback; + break; + + case HAL_PCD_MSPDEINIT_CB_ID : + hpcd->MspDeInitCallback = pCallback; + break; + + default : + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hpcd); + return status; +} + +/** + * @brief Unregister an USB PCD Callback + * USB PCD callback is redirected to the weak predefined callback + * @param hpcd USB PCD handle + * @param CallbackID ID of the callback to be unregistered + * This parameter can be one of the following values: + * @arg @ref HAL_PCD_SOF_CB_ID USB PCD SOF callback ID + * @arg @ref HAL_PCD_SETUPSTAGE_CB_ID USB PCD Setup callback ID + * @arg @ref HAL_PCD_RESET_CB_ID USB PCD Reset callback ID + * @arg @ref HAL_PCD_SUSPEND_CB_ID USB PCD Suspend callback ID + * @arg @ref HAL_PCD_RESUME_CB_ID USB PCD Resume callback ID + * @arg @ref HAL_PCD_CONNECT_CB_ID USB PCD Connect callback ID + * @arg @ref HAL_PCD_DISCONNECT_CB_ID USB PCD Disconnect callback ID + * @arg @ref HAL_PCD_MSPINIT_CB_ID MspDeInit callback ID + * @arg @ref HAL_PCD_MSPDEINIT_CB_ID MspDeInit callback ID + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_UnRegisterCallback(PCD_HandleTypeDef *hpcd, HAL_PCD_CallbackIDTypeDef CallbackID) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(hpcd); + + /* Setup Legacy weak Callbacks */ + if (hpcd->State == HAL_PCD_STATE_READY) + { + switch (CallbackID) + { + case HAL_PCD_SOF_CB_ID : + hpcd->SOFCallback = HAL_PCD_SOFCallback; + break; + + case HAL_PCD_SETUPSTAGE_CB_ID : + hpcd->SetupStageCallback = HAL_PCD_SetupStageCallback; + break; + + case HAL_PCD_RESET_CB_ID : + hpcd->ResetCallback = HAL_PCD_ResetCallback; + break; + + case HAL_PCD_SUSPEND_CB_ID : + hpcd->SuspendCallback = HAL_PCD_SuspendCallback; + break; + + case HAL_PCD_RESUME_CB_ID : + hpcd->ResumeCallback = HAL_PCD_ResumeCallback; + break; + + case HAL_PCD_CONNECT_CB_ID : + hpcd->ConnectCallback = HAL_PCD_ConnectCallback; + break; + + case HAL_PCD_DISCONNECT_CB_ID : + hpcd->DisconnectCallback = HAL_PCD_DisconnectCallback; + break; + + case HAL_PCD_MSPINIT_CB_ID : + hpcd->MspInitCallback = HAL_PCD_MspInit; + break; + + case HAL_PCD_MSPDEINIT_CB_ID : + hpcd->MspDeInitCallback = HAL_PCD_MspDeInit; + break; + + default : + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else if (hpcd->State == HAL_PCD_STATE_RESET) + { + switch (CallbackID) + { + case HAL_PCD_MSPINIT_CB_ID : + hpcd->MspInitCallback = HAL_PCD_MspInit; + break; + + case HAL_PCD_MSPDEINIT_CB_ID : + hpcd->MspDeInitCallback = HAL_PCD_MspDeInit; + break; + + default : + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + break; + } + } + else + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hpcd); + return status; +} + +/** + * @brief Register USB PCD Data OUT Stage Callback + * To be used instead of the weak HAL_PCD_DataOutStageCallback() predefined callback + * @param hpcd PCD handle + * @param pCallback pointer to the USB PCD Data OUT Stage Callback function + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_RegisterDataOutStageCallback(PCD_HandleTypeDef *hpcd, + pPCD_DataOutStageCallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (pCallback == NULL) + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + return HAL_ERROR; + } + + /* Process locked */ + __HAL_LOCK(hpcd); + + if (hpcd->State == HAL_PCD_STATE_READY) + { + hpcd->DataOutStageCallback = pCallback; + } + else + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hpcd); + + return status; +} + +/** + * @brief Unregister the USB PCD Data OUT Stage Callback + * USB PCD Data OUT Stage Callback is redirected to the weak HAL_PCD_DataOutStageCallback() predefined callback + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_UnRegisterDataOutStageCallback(PCD_HandleTypeDef *hpcd) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(hpcd); + + if (hpcd->State == HAL_PCD_STATE_READY) + { + hpcd->DataOutStageCallback = HAL_PCD_DataOutStageCallback; /* Legacy weak DataOutStageCallback */ + } + else + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hpcd); + + return status; +} + +/** + * @brief Register USB PCD Data IN Stage Callback + * To be used instead of the weak HAL_PCD_DataInStageCallback() predefined callback + * @param hpcd PCD handle + * @param pCallback pointer to the USB PCD Data IN Stage Callback function + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_RegisterDataInStageCallback(PCD_HandleTypeDef *hpcd, + pPCD_DataInStageCallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (pCallback == NULL) + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + return HAL_ERROR; + } + + /* Process locked */ + __HAL_LOCK(hpcd); + + if (hpcd->State == HAL_PCD_STATE_READY) + { + hpcd->DataInStageCallback = pCallback; + } + else + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hpcd); + + return status; +} + +/** + * @brief Unregister the USB PCD Data IN Stage Callback + * USB PCD Data OUT Stage Callback is redirected to the weak HAL_PCD_DataInStageCallback() predefined callback + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_UnRegisterDataInStageCallback(PCD_HandleTypeDef *hpcd) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(hpcd); + + if (hpcd->State == HAL_PCD_STATE_READY) + { + hpcd->DataInStageCallback = HAL_PCD_DataInStageCallback; /* Legacy weak DataInStageCallback */ + } + else + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hpcd); + + return status; +} + +/** + * @brief Register USB PCD Iso OUT incomplete Callback + * To be used instead of the weak HAL_PCD_ISOOUTIncompleteCallback() predefined callback + * @param hpcd PCD handle + * @param pCallback pointer to the USB PCD Iso OUT incomplete Callback function + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_RegisterIsoOutIncpltCallback(PCD_HandleTypeDef *hpcd, + pPCD_IsoOutIncpltCallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (pCallback == NULL) + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + return HAL_ERROR; + } + + /* Process locked */ + __HAL_LOCK(hpcd); + + if (hpcd->State == HAL_PCD_STATE_READY) + { + hpcd->ISOOUTIncompleteCallback = pCallback; + } + else + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hpcd); + + return status; +} + +/** + * @brief Unregister the USB PCD Iso OUT incomplete Callback + * USB PCD Iso OUT incomplete Callback is redirected + * to the weak HAL_PCD_ISOOUTIncompleteCallback() predefined callback + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_UnRegisterIsoOutIncpltCallback(PCD_HandleTypeDef *hpcd) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(hpcd); + + if (hpcd->State == HAL_PCD_STATE_READY) + { + hpcd->ISOOUTIncompleteCallback = HAL_PCD_ISOOUTIncompleteCallback; /* Legacy weak ISOOUTIncompleteCallback */ + } + else + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hpcd); + + return status; +} + +/** + * @brief Register USB PCD Iso IN incomplete Callback + * To be used instead of the weak HAL_PCD_ISOINIncompleteCallback() predefined callback + * @param hpcd PCD handle + * @param pCallback pointer to the USB PCD Iso IN incomplete Callback function + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_RegisterIsoInIncpltCallback(PCD_HandleTypeDef *hpcd, + pPCD_IsoInIncpltCallbackTypeDef pCallback) +{ + HAL_StatusTypeDef status = HAL_OK; + + if (pCallback == NULL) + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + return HAL_ERROR; + } + + /* Process locked */ + __HAL_LOCK(hpcd); + + if (hpcd->State == HAL_PCD_STATE_READY) + { + hpcd->ISOINIncompleteCallback = pCallback; + } + else + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hpcd); + + return status; +} + +/** + * @brief Unregister the USB PCD Iso IN incomplete Callback + * USB PCD Iso IN incomplete Callback is redirected + * to the weak HAL_PCD_ISOINIncompleteCallback() predefined callback + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_UnRegisterIsoInIncpltCallback(PCD_HandleTypeDef *hpcd) +{ + HAL_StatusTypeDef status = HAL_OK; + + /* Process locked */ + __HAL_LOCK(hpcd); + + if (hpcd->State == HAL_PCD_STATE_READY) + { + hpcd->ISOINIncompleteCallback = HAL_PCD_ISOINIncompleteCallback; /* Legacy weak ISOINIncompleteCallback */ + } + else + { + /* Update the error code */ + hpcd->ErrorCode |= HAL_PCD_ERROR_INVALID_CALLBACK; + + /* Return error status */ + status = HAL_ERROR; + } + + /* Release Lock */ + __HAL_UNLOCK(hpcd); + + return status; +} + +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + +/** + * @} + */ + +/** @defgroup PCD_Exported_Functions_Group2 Input and Output operation functions + * @brief Data transfers functions + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the PCD data + transfers. + +@endverbatim + * @{ + */ + +/** + * @brief Start the USB device + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd) +{ + __HAL_LOCK(hpcd); + __HAL_PCD_ENABLE(hpcd); + + HAL_PCDEx_SetConnectionState(hpcd, 1U); + + (void)USB_DevConnect(hpcd->Instance); + __HAL_UNLOCK(hpcd); + + return HAL_OK; +} + +/** + * @brief Stop the USB device. + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_Stop(PCD_HandleTypeDef *hpcd) +{ + __HAL_LOCK(hpcd); + __HAL_PCD_DISABLE(hpcd); + + HAL_PCDEx_SetConnectionState(hpcd, 0U); + + (void)USB_DevDisconnect(hpcd->Instance); + __HAL_UNLOCK(hpcd); + + return HAL_OK; +} + + +/** + * @brief This function handles PCD interrupt request. + * @param hpcd PCD handle + * @retval HAL status + */ +void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd) +{ + uint32_t wIstr = USB_ReadInterrupts(hpcd->Instance); + + if ((wIstr & USB_ISTR_CTR) == USB_ISTR_CTR) + { + /* servicing of the endpoint correct transfer interrupt */ + /* clear of the CTR flag into the sub */ + (void)PCD_EP_ISR_Handler(hpcd); + + return; + } + + if ((wIstr & USB_ISTR_RESET) == USB_ISTR_RESET) + { + __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_RESET); + +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->ResetCallback(hpcd); +#else + HAL_PCD_ResetCallback(hpcd); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + + (void)HAL_PCD_SetAddress(hpcd, 0U); + + return; + } + + if ((wIstr & USB_ISTR_PMAOVR) == USB_ISTR_PMAOVR) + { + __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_PMAOVR); + + return; + } + + if ((wIstr & USB_ISTR_ERR) == USB_ISTR_ERR) + { + __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_ERR); + + return; + } + + if ((wIstr & USB_ISTR_WKUP) == USB_ISTR_WKUP) + { + hpcd->Instance->CNTR &= (uint16_t) ~(USB_CNTR_LPMODE); + hpcd->Instance->CNTR &= (uint16_t) ~(USB_CNTR_FSUSP); + +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->ResumeCallback(hpcd); +#else + HAL_PCD_ResumeCallback(hpcd); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + + __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_WKUP); + + return; + } + + if ((wIstr & USB_ISTR_SUSP) == USB_ISTR_SUSP) + { + /* Force low-power mode in the macrocell */ + hpcd->Instance->CNTR |= (uint16_t)USB_CNTR_FSUSP; + + /* clear of the ISTR bit must be done after setting of CNTR_FSUSP */ + __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_SUSP); + + hpcd->Instance->CNTR |= (uint16_t)USB_CNTR_LPMODE; + +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->SuspendCallback(hpcd); +#else + HAL_PCD_SuspendCallback(hpcd); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + + return; + } + + if ((wIstr & USB_ISTR_SOF) == USB_ISTR_SOF) + { + __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_SOF); + +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->SOFCallback(hpcd); +#else + HAL_PCD_SOFCallback(hpcd); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + + return; + } + + if ((wIstr & USB_ISTR_ESOF) == USB_ISTR_ESOF) + { + /* clear ESOF flag in ISTR */ + __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_ESOF); + + return; + } +} + + +/** + * @brief Handles PCD Wakeup interrupt request. + * @param hpcd PCD handle + * @retval HAL status + */ +void HAL_PCD_WKUP_IRQHandler(PCD_HandleTypeDef *hpcd) +{ + /* Clear EXTI pending Bit */ + __HAL_USB_WAKEUP_EXTI_CLEAR_FLAG(); +} + + +/** + * @brief Data OUT stage callback. + * @param hpcd PCD handle + * @param epnum endpoint number + * @retval None + */ +__weak void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + UNUSED(epnum); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_DataOutStageCallback could be implemented in the user file + */ +} + +/** + * @brief Data IN stage callback + * @param hpcd PCD handle + * @param epnum endpoint number + * @retval None + */ +__weak void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + UNUSED(epnum); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_DataInStageCallback could be implemented in the user file + */ +} +/** + * @brief Setup stage callback + * @param hpcd PCD handle + * @retval None + */ +__weak void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_SetupStageCallback could be implemented in the user file + */ +} + +/** + * @brief USB Start Of Frame callback. + * @param hpcd PCD handle + * @retval None + */ +__weak void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_SOFCallback could be implemented in the user file + */ +} + +/** + * @brief USB Reset callback. + * @param hpcd PCD handle + * @retval None + */ +__weak void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_ResetCallback could be implemented in the user file + */ +} + +/** + * @brief Suspend event callback. + * @param hpcd PCD handle + * @retval None + */ +__weak void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_SuspendCallback could be implemented in the user file + */ +} + +/** + * @brief Resume event callback. + * @param hpcd PCD handle + * @retval None + */ +__weak void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_ResumeCallback could be implemented in the user file + */ +} + +/** + * @brief Incomplete ISO OUT callback. + * @param hpcd PCD handle + * @param epnum endpoint number + * @retval None + */ +__weak void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + UNUSED(epnum); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_ISOOUTIncompleteCallback could be implemented in the user file + */ +} + +/** + * @brief Incomplete ISO IN callback. + * @param hpcd PCD handle + * @param epnum endpoint number + * @retval None + */ +__weak void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + UNUSED(epnum); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_ISOINIncompleteCallback could be implemented in the user file + */ +} + +/** + * @brief Connection event callback. + * @param hpcd PCD handle + * @retval None + */ +__weak void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_ConnectCallback could be implemented in the user file + */ +} + +/** + * @brief Disconnection event callback. + * @param hpcd PCD handle + * @retval None + */ +__weak void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCD_DisconnectCallback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** @defgroup PCD_Exported_Functions_Group3 Peripheral Control functions + * @brief management functions + * +@verbatim + =============================================================================== + ##### Peripheral Control functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the PCD data + transfers. + +@endverbatim + * @{ + */ + +/** + * @brief Connect the USB device + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_DevConnect(PCD_HandleTypeDef *hpcd) +{ + __HAL_LOCK(hpcd); + + HAL_PCDEx_SetConnectionState(hpcd, 1U); + + (void)USB_DevConnect(hpcd->Instance); + __HAL_UNLOCK(hpcd); + + return HAL_OK; +} + +/** + * @brief Disconnect the USB device. + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_DevDisconnect(PCD_HandleTypeDef *hpcd) +{ + __HAL_LOCK(hpcd); + + HAL_PCDEx_SetConnectionState(hpcd, 0U); + + (void)USB_DevDisconnect(hpcd->Instance); + __HAL_UNLOCK(hpcd); + + return HAL_OK; +} + +/** + * @brief Set the USB Device address. + * @param hpcd PCD handle + * @param address new device address + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_SetAddress(PCD_HandleTypeDef *hpcd, uint8_t address) +{ + __HAL_LOCK(hpcd); + hpcd->USB_Address = address; + (void)USB_SetDevAddress(hpcd->Instance, address); + __HAL_UNLOCK(hpcd); + + return HAL_OK; +} +/** + * @brief Open and configure an endpoint. + * @param hpcd PCD handle + * @param ep_addr endpoint address + * @param ep_mps endpoint max packet size + * @param ep_type endpoint type + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_EP_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, + uint16_t ep_mps, uint8_t ep_type) +{ + HAL_StatusTypeDef ret = HAL_OK; + PCD_EPTypeDef *ep; + + if ((ep_addr & 0x80U) == 0x80U) + { + ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK]; + ep->is_in = 1U; + } + else + { + ep = &hpcd->OUT_ep[ep_addr & EP_ADDR_MSK]; + ep->is_in = 0U; + } + + ep->num = ep_addr & EP_ADDR_MSK; + ep->maxpacket = ep_mps; + ep->type = ep_type; + + /* Set initial data PID. */ + if (ep_type == EP_TYPE_BULK) + { + ep->data_pid_start = 0U; + } + + __HAL_LOCK(hpcd); + (void)USB_ActivateEndpoint(hpcd->Instance, ep); + __HAL_UNLOCK(hpcd); + + return ret; +} + +/** + * @brief Deactivate an endpoint. + * @param hpcd PCD handle + * @param ep_addr endpoint address + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_EP_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr) +{ + PCD_EPTypeDef *ep; + + if ((ep_addr & 0x80U) == 0x80U) + { + ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK]; + ep->is_in = 1U; + } + else + { + ep = &hpcd->OUT_ep[ep_addr & EP_ADDR_MSK]; + ep->is_in = 0U; + } + ep->num = ep_addr & EP_ADDR_MSK; + + __HAL_LOCK(hpcd); + (void)USB_DeactivateEndpoint(hpcd->Instance, ep); + __HAL_UNLOCK(hpcd); + return HAL_OK; +} + + +/** + * @brief Receive an amount of data. + * @param hpcd PCD handle + * @param ep_addr endpoint address + * @param pBuf pointer to the reception buffer + * @param len amount of data to be received + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len) +{ + PCD_EPTypeDef *ep; + + ep = &hpcd->OUT_ep[ep_addr & EP_ADDR_MSK]; + + /*setup and start the Xfer */ + ep->xfer_buff = pBuf; + ep->xfer_len = len; + ep->xfer_count = 0U; + ep->is_in = 0U; + ep->num = ep_addr & EP_ADDR_MSK; + + (void)USB_EPStartXfer(hpcd->Instance, ep); + + return HAL_OK; +} + +/** + * @brief Get Received Data Size + * @param hpcd PCD handle + * @param ep_addr endpoint address + * @retval Data Size + */ +uint32_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr) +{ + return hpcd->OUT_ep[ep_addr & EP_ADDR_MSK].xfer_count; +} +/** + * @brief Send an amount of data + * @param hpcd PCD handle + * @param ep_addr endpoint address + * @param pBuf pointer to the transmission buffer + * @param len amount of data to be sent + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len) +{ + PCD_EPTypeDef *ep; + + ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK]; + + /*setup and start the Xfer */ + ep->xfer_buff = pBuf; + ep->xfer_len = len; + ep->xfer_fill_db = 1U; + ep->xfer_len_db = len; + ep->xfer_count = 0U; + ep->is_in = 1U; + ep->num = ep_addr & EP_ADDR_MSK; + + (void)USB_EPStartXfer(hpcd->Instance, ep); + + return HAL_OK; +} + +/** + * @brief Set a STALL condition over an endpoint + * @param hpcd PCD handle + * @param ep_addr endpoint address + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr) +{ + PCD_EPTypeDef *ep; + + if (((uint32_t)ep_addr & EP_ADDR_MSK) > hpcd->Init.dev_endpoints) + { + return HAL_ERROR; + } + + if ((0x80U & ep_addr) == 0x80U) + { + ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK]; + ep->is_in = 1U; + } + else + { + ep = &hpcd->OUT_ep[ep_addr]; + ep->is_in = 0U; + } + + ep->is_stall = 1U; + ep->num = ep_addr & EP_ADDR_MSK; + + __HAL_LOCK(hpcd); + + (void)USB_EPSetStall(hpcd->Instance, ep); + + __HAL_UNLOCK(hpcd); + + return HAL_OK; +} + +/** + * @brief Clear a STALL condition over in an endpoint + * @param hpcd PCD handle + * @param ep_addr endpoint address + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr) +{ + PCD_EPTypeDef *ep; + + if (((uint32_t)ep_addr & 0x0FU) > hpcd->Init.dev_endpoints) + { + return HAL_ERROR; + } + + if ((0x80U & ep_addr) == 0x80U) + { + ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK]; + ep->is_in = 1U; + } + else + { + ep = &hpcd->OUT_ep[ep_addr & EP_ADDR_MSK]; + ep->is_in = 0U; + } + + ep->is_stall = 0U; + ep->num = ep_addr & EP_ADDR_MSK; + + __HAL_LOCK(hpcd); + (void)USB_EPClearStall(hpcd->Instance, ep); + __HAL_UNLOCK(hpcd); + + return HAL_OK; +} + +/** + * @brief Abort an USB EP transaction. + * @param hpcd PCD handle + * @param ep_addr endpoint address + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_EP_Abort(PCD_HandleTypeDef *hpcd, uint8_t ep_addr) +{ + HAL_StatusTypeDef ret; + PCD_EPTypeDef *ep; + + if ((0x80U & ep_addr) == 0x80U) + { + ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK]; + } + else + { + ep = &hpcd->OUT_ep[ep_addr & EP_ADDR_MSK]; + } + + /* Stop Xfer */ + ret = USB_EPStopXfer(hpcd->Instance, ep); + + return ret; +} + +/** + * @brief Flush an endpoint + * @param hpcd PCD handle + * @param ep_addr endpoint address + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + UNUSED(ep_addr); + + return HAL_OK; +} + +/** + * @brief Activate remote wakeup signalling + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_ActivateRemoteWakeup(PCD_HandleTypeDef *hpcd) +{ + return (USB_ActivateRemoteWakeup(hpcd->Instance)); +} + +/** + * @brief De-activate remote wakeup signalling. + * @param hpcd PCD handle + * @retval HAL status + */ +HAL_StatusTypeDef HAL_PCD_DeActivateRemoteWakeup(PCD_HandleTypeDef *hpcd) +{ + return (USB_DeActivateRemoteWakeup(hpcd->Instance)); +} + +/** + * @} + */ + +/** @defgroup PCD_Exported_Functions_Group4 Peripheral State functions + * @brief Peripheral State functions + * +@verbatim + =============================================================================== + ##### Peripheral State functions ##### + =============================================================================== + [..] + This subsection permits to get in run-time the status of the peripheral + and the data flow. + +@endverbatim + * @{ + */ + +/** + * @brief Return the PCD handle state. + * @param hpcd PCD handle + * @retval HAL state + */ +PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd) +{ + return hpcd->State; +} + +/** + * @} + */ + +/** + * @} + */ + +/* Private functions ---------------------------------------------------------*/ +/** @addtogroup PCD_Private_Functions + * @{ + */ + + +/** + * @brief This function handles PCD Endpoint interrupt request. + * @param hpcd PCD handle + * @retval HAL status + */ +static HAL_StatusTypeDef PCD_EP_ISR_Handler(PCD_HandleTypeDef *hpcd) +{ + PCD_EPTypeDef *ep; + uint16_t count; + uint16_t wIstr; + uint16_t wEPVal; + uint16_t TxPctSize; + uint8_t epindex; + +#if (USE_USB_DOUBLE_BUFFER != 1U) + count = 0U; +#endif /* USE_USB_DOUBLE_BUFFER */ + + /* stay in loop while pending interrupts */ + while ((hpcd->Instance->ISTR & USB_ISTR_CTR) != 0U) + { + wIstr = hpcd->Instance->ISTR; + + /* extract highest priority endpoint number */ + epindex = (uint8_t)(wIstr & USB_ISTR_EP_ID); + + if (epindex == 0U) + { + /* Decode and service control endpoint interrupt */ + + /* DIR bit = origin of the interrupt */ + if ((wIstr & USB_ISTR_DIR) == 0U) + { + /* DIR = 0 */ + + /* DIR = 0 => IN int */ + /* DIR = 0 implies that (EP_CTR_TX = 1) always */ + PCD_CLEAR_TX_EP_CTR(hpcd->Instance, PCD_ENDP0); + ep = &hpcd->IN_ep[0]; + + ep->xfer_count = PCD_GET_EP_TX_CNT(hpcd->Instance, ep->num); + ep->xfer_buff += ep->xfer_count; + + /* TX COMPLETE */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->DataInStageCallback(hpcd, 0U); +#else + HAL_PCD_DataInStageCallback(hpcd, 0U); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + + if ((hpcd->USB_Address > 0U) && (ep->xfer_len == 0U)) + { + hpcd->Instance->DADDR = ((uint16_t)hpcd->USB_Address | USB_DADDR_EF); + hpcd->USB_Address = 0U; + } + } + else + { + /* DIR = 1 */ + + /* DIR = 1 & CTR_RX => SETUP or OUT int */ + /* DIR = 1 & (CTR_TX | CTR_RX) => 2 int pending */ + ep = &hpcd->OUT_ep[0]; + wEPVal = PCD_GET_ENDPOINT(hpcd->Instance, PCD_ENDP0); + + if ((wEPVal & USB_EP_SETUP) != 0U) + { + /* Get SETUP Packet */ + ep->xfer_count = PCD_GET_EP_RX_CNT(hpcd->Instance, ep->num); + + USB_ReadPMA(hpcd->Instance, (uint8_t *)hpcd->Setup, + ep->pmaadress, (uint16_t)ep->xfer_count); + + /* SETUP bit kept frozen while CTR_RX = 1 */ + PCD_CLEAR_RX_EP_CTR(hpcd->Instance, PCD_ENDP0); + + /* Process SETUP Packet*/ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->SetupStageCallback(hpcd); +#else + HAL_PCD_SetupStageCallback(hpcd); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + } + else if ((wEPVal & USB_EP_CTR_RX) != 0U) + { + PCD_CLEAR_RX_EP_CTR(hpcd->Instance, PCD_ENDP0); + + /* Get Control Data OUT Packet */ + ep->xfer_count = PCD_GET_EP_RX_CNT(hpcd->Instance, ep->num); + + if ((ep->xfer_count != 0U) && (ep->xfer_buff != 0U)) + { + USB_ReadPMA(hpcd->Instance, ep->xfer_buff, + ep->pmaadress, (uint16_t)ep->xfer_count); + + ep->xfer_buff += ep->xfer_count; + + /* Process Control Data OUT Packet */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->DataOutStageCallback(hpcd, 0U); +#else + HAL_PCD_DataOutStageCallback(hpcd, 0U); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + } + + wEPVal = (uint16_t)PCD_GET_ENDPOINT(hpcd->Instance, PCD_ENDP0); + + if (((wEPVal & USB_EP_SETUP) == 0U) && ((wEPVal & USB_EP_RX_STRX) != USB_EP_RX_VALID)) + { + PCD_SET_EP_RX_CNT(hpcd->Instance, PCD_ENDP0, ep->maxpacket); + PCD_SET_EP_RX_STATUS(hpcd->Instance, PCD_ENDP0, USB_EP_RX_VALID); + } + } + } + } + else + { + /* Decode and service non control endpoints interrupt */ + /* process related endpoint register */ + wEPVal = PCD_GET_ENDPOINT(hpcd->Instance, epindex); + + if ((wEPVal & USB_EP_CTR_RX) != 0U) + { + /* clear int flag */ + PCD_CLEAR_RX_EP_CTR(hpcd->Instance, epindex); + ep = &hpcd->OUT_ep[epindex]; + + /* OUT Single Buffering */ + if (ep->doublebuffer == 0U) + { + count = (uint16_t)PCD_GET_EP_RX_CNT(hpcd->Instance, ep->num); + + if (count != 0U) + { + USB_ReadPMA(hpcd->Instance, ep->xfer_buff, ep->pmaadress, count); + } + } +#if (USE_USB_DOUBLE_BUFFER == 1U) + else + { + /* manage double buffer bulk out */ + if (ep->type == EP_TYPE_BULK) + { + count = HAL_PCD_EP_DB_Receive(hpcd, ep, wEPVal); + } + else /* manage double buffer iso out */ + { + /* free EP OUT Buffer */ + PCD_FREE_USER_BUFFER(hpcd->Instance, ep->num, 0U); + + if ((PCD_GET_ENDPOINT(hpcd->Instance, ep->num) & USB_EP_DTOG_RX) != 0U) + { + /* read from endpoint BUF0Addr buffer */ + count = (uint16_t)PCD_GET_EP_DBUF0_CNT(hpcd->Instance, ep->num); + + if (count != 0U) + { + USB_ReadPMA(hpcd->Instance, ep->xfer_buff, ep->pmaaddr0, count); + } + } + else + { + /* read from endpoint BUF1Addr buffer */ + count = (uint16_t)PCD_GET_EP_DBUF1_CNT(hpcd->Instance, ep->num); + + if (count != 0U) + { + USB_ReadPMA(hpcd->Instance, ep->xfer_buff, ep->pmaaddr1, count); + } + } + } + } +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + + /* multi-packet on the NON control OUT endpoint */ + ep->xfer_count += count; + ep->xfer_buff += count; + + if ((ep->xfer_len == 0U) || (count < ep->maxpacket)) + { + /* RX COMPLETE */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->DataOutStageCallback(hpcd, ep->num); +#else + HAL_PCD_DataOutStageCallback(hpcd, ep->num); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + } + else + { + (void)USB_EPStartXfer(hpcd->Instance, ep); + } + } + + if ((wEPVal & USB_EP_CTR_TX) != 0U) + { + ep = &hpcd->IN_ep[epindex]; + + /* clear int flag */ + PCD_CLEAR_TX_EP_CTR(hpcd->Instance, epindex); + + if (ep->type == EP_TYPE_ISOC) + { + ep->xfer_len = 0U; + +#if (USE_USB_DOUBLE_BUFFER == 1U) + if (ep->doublebuffer != 0U) + { + if ((wEPVal & USB_EP_DTOG_TX) != 0U) + { + PCD_SET_EP_DBUF0_CNT(hpcd->Instance, ep->num, ep->is_in, 0U); + } + else + { + PCD_SET_EP_DBUF1_CNT(hpcd->Instance, ep->num, ep->is_in, 0U); + } + } +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + + /* TX COMPLETE */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->DataInStageCallback(hpcd, ep->num); +#else + HAL_PCD_DataInStageCallback(hpcd, ep->num); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + } + else + { + /* Manage Single Buffer Transaction */ + if ((wEPVal & USB_EP_KIND) == 0U) + { + /* multi-packet on the NON control IN endpoint */ + TxPctSize = (uint16_t)PCD_GET_EP_TX_CNT(hpcd->Instance, ep->num); + + if (ep->xfer_len > TxPctSize) + { + ep->xfer_len -= TxPctSize; + } + else + { + ep->xfer_len = 0U; + } + + /* Zero Length Packet? */ + if (ep->xfer_len == 0U) + { + /* TX COMPLETE */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->DataInStageCallback(hpcd, ep->num); +#else + HAL_PCD_DataInStageCallback(hpcd, ep->num); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + } + else + { + /* Transfer is not yet Done */ + ep->xfer_buff += TxPctSize; + ep->xfer_count += TxPctSize; + (void)USB_EPStartXfer(hpcd->Instance, ep); + } + } +#if (USE_USB_DOUBLE_BUFFER == 1U) + /* Double Buffer bulk IN (bulk transfer Len > Ep_Mps) */ + else + { + (void)HAL_PCD_EP_DB_Transmit(hpcd, ep, wEPVal); + } +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + } + } + } + } + + return HAL_OK; +} + + +#if (USE_USB_DOUBLE_BUFFER == 1U) +/** + * @brief Manage double buffer bulk out transaction from ISR + * @param hpcd PCD handle + * @param ep current endpoint handle + * @param wEPVal Last snapshot of EPRx register value taken in ISR + * @retval HAL status + */ +static uint16_t HAL_PCD_EP_DB_Receive(PCD_HandleTypeDef *hpcd, + PCD_EPTypeDef *ep, uint16_t wEPVal) +{ + uint16_t count; + + /* Manage Buffer0 OUT */ + if ((wEPVal & USB_EP_DTOG_RX) != 0U) + { + /* Get count of received Data on buffer0 */ + count = (uint16_t)PCD_GET_EP_DBUF0_CNT(hpcd->Instance, ep->num); + + if (ep->xfer_len >= count) + { + ep->xfer_len -= count; + } + else + { + ep->xfer_len = 0U; + } + + if (ep->xfer_len == 0U) + { + /* set NAK to OUT endpoint since double buffer is enabled */ + PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_NAK); + } + + /* Check if Buffer1 is in blocked state which requires to toggle */ + if ((wEPVal & USB_EP_DTOG_TX) != 0U) + { + PCD_FREE_USER_BUFFER(hpcd->Instance, ep->num, 0U); + } + + if (count != 0U) + { + USB_ReadPMA(hpcd->Instance, ep->xfer_buff, ep->pmaaddr0, count); + } + } + /* Manage Buffer 1 DTOG_RX=0 */ + else + { + /* Get count of received data */ + count = (uint16_t)PCD_GET_EP_DBUF1_CNT(hpcd->Instance, ep->num); + + if (ep->xfer_len >= count) + { + ep->xfer_len -= count; + } + else + { + ep->xfer_len = 0U; + } + + if (ep->xfer_len == 0U) + { + /* set NAK on the current endpoint */ + PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_NAK); + } + + /*Need to FreeUser Buffer*/ + if ((wEPVal & USB_EP_DTOG_TX) == 0U) + { + PCD_FREE_USER_BUFFER(hpcd->Instance, ep->num, 0U); + } + + if (count != 0U) + { + USB_ReadPMA(hpcd->Instance, ep->xfer_buff, ep->pmaaddr1, count); + } + } + + return count; +} + + +/** + * @brief Manage double buffer bulk IN transaction from ISR + * @param hpcd PCD handle + * @param ep current endpoint handle + * @param wEPVal Last snapshot of EPRx register value taken in ISR + * @retval HAL status + */ +static HAL_StatusTypeDef HAL_PCD_EP_DB_Transmit(PCD_HandleTypeDef *hpcd, + PCD_EPTypeDef *ep, uint16_t wEPVal) +{ + uint32_t len; + uint16_t TxPctSize; + + /* Data Buffer0 ACK received */ + if ((wEPVal & USB_EP_DTOG_TX) != 0U) + { + /* multi-packet on the NON control IN endpoint */ + TxPctSize = (uint16_t)PCD_GET_EP_DBUF0_CNT(hpcd->Instance, ep->num); + + if (ep->xfer_len > TxPctSize) + { + ep->xfer_len -= TxPctSize; + } + else + { + ep->xfer_len = 0U; + } + + /* Transfer is completed */ + if (ep->xfer_len == 0U) + { + PCD_SET_EP_DBUF0_CNT(hpcd->Instance, ep->num, ep->is_in, 0U); + PCD_SET_EP_DBUF1_CNT(hpcd->Instance, ep->num, ep->is_in, 0U); + + /* TX COMPLETE */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->DataInStageCallback(hpcd, ep->num); +#else + HAL_PCD_DataInStageCallback(hpcd, ep->num); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + + if ((wEPVal & USB_EP_DTOG_RX) != 0U) + { + PCD_FREE_USER_BUFFER(hpcd->Instance, ep->num, 1U); + } + } + else /* Transfer is not yet Done */ + { + /* need to Free USB Buff */ + if ((wEPVal & USB_EP_DTOG_RX) != 0U) + { + PCD_FREE_USER_BUFFER(hpcd->Instance, ep->num, 1U); + } + + /* Still there is data to Fill in the next Buffer */ + if (ep->xfer_fill_db == 1U) + { + ep->xfer_buff += TxPctSize; + ep->xfer_count += TxPctSize; + + /* Calculate the len of the new buffer to fill */ + if (ep->xfer_len_db >= ep->maxpacket) + { + len = ep->maxpacket; + ep->xfer_len_db -= len; + } + else if (ep->xfer_len_db == 0U) + { + len = TxPctSize; + ep->xfer_fill_db = 0U; + } + else + { + ep->xfer_fill_db = 0U; + len = ep->xfer_len_db; + ep->xfer_len_db = 0U; + } + + /* Write remaining Data to Buffer */ + /* Set the Double buffer counter for pma buffer1 */ + PCD_SET_EP_DBUF0_CNT(hpcd->Instance, ep->num, ep->is_in, len); + + /* Copy user buffer to USB PMA */ + USB_WritePMA(hpcd->Instance, ep->xfer_buff, ep->pmaaddr0, (uint16_t)len); + } + } + } + else /* Data Buffer1 ACK received */ + { + /* multi-packet on the NON control IN endpoint */ + TxPctSize = (uint16_t)PCD_GET_EP_DBUF1_CNT(hpcd->Instance, ep->num); + + if (ep->xfer_len >= TxPctSize) + { + ep->xfer_len -= TxPctSize; + } + else + { + ep->xfer_len = 0U; + } + + /* Transfer is completed */ + if (ep->xfer_len == 0U) + { + PCD_SET_EP_DBUF0_CNT(hpcd->Instance, ep->num, ep->is_in, 0U); + PCD_SET_EP_DBUF1_CNT(hpcd->Instance, ep->num, ep->is_in, 0U); + + /* TX COMPLETE */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + hpcd->DataInStageCallback(hpcd, ep->num); +#else + HAL_PCD_DataInStageCallback(hpcd, ep->num); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + + /* need to Free USB Buff */ + if ((wEPVal & USB_EP_DTOG_RX) == 0U) + { + PCD_FREE_USER_BUFFER(hpcd->Instance, ep->num, 1U); + } + } + else /* Transfer is not yet Done */ + { + /* need to Free USB Buff */ + if ((wEPVal & USB_EP_DTOG_RX) == 0U) + { + PCD_FREE_USER_BUFFER(hpcd->Instance, ep->num, 1U); + } + + /* Still there is data to Fill in the next Buffer */ + if (ep->xfer_fill_db == 1U) + { + ep->xfer_buff += TxPctSize; + ep->xfer_count += TxPctSize; + + /* Calculate the len of the new buffer to fill */ + if (ep->xfer_len_db >= ep->maxpacket) + { + len = ep->maxpacket; + ep->xfer_len_db -= len; + } + else if (ep->xfer_len_db == 0U) + { + len = TxPctSize; + ep->xfer_fill_db = 0U; + } + else + { + len = ep->xfer_len_db; + ep->xfer_len_db = 0U; + ep->xfer_fill_db = 0; + } + + /* Set the Double buffer counter for pmabuffer1 */ + PCD_SET_EP_DBUF1_CNT(hpcd->Instance, ep->num, ep->is_in, len); + + /* Copy the user buffer to USB PMA */ + USB_WritePMA(hpcd->Instance, ep->xfer_buff, ep->pmaaddr1, (uint16_t)len); + } + } + } + + /*enable endpoint IN*/ + PCD_SET_EP_TX_STATUS(hpcd->Instance, ep->num, USB_EP_TX_VALID); + + return HAL_OK; +} +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + + + +/** + * @} + */ +#endif /* defined (USB) */ +#endif /* HAL_PCD_MODULE_ENABLED */ + +/** + * @} + */ + +/** + * @} + */ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd_ex.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd_ex.c new file mode 100644 index 000000000..8842132ab --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pcd_ex.c @@ -0,0 +1,186 @@ +/** + ****************************************************************************** + * @file stm32f3xx_hal_pcd_ex.c + * @author MCD Application Team + * @brief PCD Extended HAL module driver. + * This file provides firmware functions to manage the following + * functionalities of the USB Peripheral Controller: + * + Extended features functions + * + ****************************************************************************** + * @attention + * + * Copyright (c) 2016 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. + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f3xx_hal.h" + +/** @addtogroup STM32F3xx_HAL_Driver + * @{ + */ + +/** @defgroup PCDEx PCDEx + * @brief PCD Extended HAL module driver + * @{ + */ + +#ifdef HAL_PCD_MODULE_ENABLED + +#if defined (USB) +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ + +/** @defgroup PCDEx_Exported_Functions PCDEx Exported Functions + * @{ + */ + +/** @defgroup PCDEx_Exported_Functions_Group1 Peripheral Control functions + * @brief PCDEx control functions + * +@verbatim + =============================================================================== + ##### Extended features functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Update FIFO configuration + +@endverbatim + * @{ + */ + +/** + * @brief Configure PMA for EP + * @param hpcd Device instance + * @param ep_addr endpoint address + * @param ep_kind endpoint Kind + * USB_SNG_BUF: Single Buffer used + * USB_DBL_BUF: Double Buffer used + * @param pmaadress: EP address in The PMA: In case of single buffer endpoint + * this parameter is 16-bit value providing the address + * in PMA allocated to endpoint. + * In case of double buffer endpoint this parameter + * is a 32-bit value providing the endpoint buffer 0 address + * in the LSB part of 32-bit value and endpoint buffer 1 address + * in the MSB part of 32-bit value. + * @retval HAL status + */ + +HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr, + uint16_t ep_kind, uint32_t pmaadress) +{ + PCD_EPTypeDef *ep; + + /* initialize ep structure*/ + if ((0x80U & ep_addr) == 0x80U) + { + ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK]; + } + else + { + ep = &hpcd->OUT_ep[ep_addr]; + } + + /* Here we check if the endpoint is single or double Buffer*/ + if (ep_kind == PCD_SNG_BUF) + { + /* Single Buffer */ + ep->doublebuffer = 0U; + /* Configure the PMA */ + ep->pmaadress = (uint16_t)pmaadress; + } +#if (USE_USB_DOUBLE_BUFFER == 1U) + else /* USB_DBL_BUF */ + { + /* Double Buffer Endpoint */ + ep->doublebuffer = 1U; + /* Configure the PMA */ + ep->pmaaddr0 = (uint16_t)(pmaadress & 0xFFFFU); + ep->pmaaddr1 = (uint16_t)((pmaadress & 0xFFFF0000U) >> 16); + } +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + + return HAL_OK; +} + +/** + * @brief Software Device Connection, + * this function is not required by USB OTG FS peripheral, it is used + * only by USB Device FS peripheral. + * @param hpcd PCD handle + * @param state connection state (0 : disconnected / 1: connected) + * @retval None + */ +__weak void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + UNUSED(state); + /* NOTE : This function Should not be modified, when the callback is needed, + the HAL_PCDEx_SetConnectionState could be implemented in the user file + */ +} + + +/** + * @brief Send LPM message to user layer callback. + * @param hpcd PCD handle + * @param msg LPM message + * @retval HAL status + */ +__weak void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + UNUSED(msg); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCDEx_LPM_Callback could be implemented in the user file + */ +} + +/** + * @brief Send BatteryCharging message to user layer callback. + * @param hpcd PCD handle + * @param msg LPM message + * @retval HAL status + */ +__weak void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(hpcd); + UNUSED(msg); + + /* NOTE : This function should not be modified, when the callback is needed, + the HAL_PCDEx_BCD_Callback could be implemented in the user file + */ +} + +/** + * @} + */ + +/** + * @} + */ +#endif /* defined (USB) */ +#endif /* HAL_PCD_MODULE_ENABLED */ + +/** + * @} + */ + +/** + * @} + */ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_ll_usb.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_ll_usb.c new file mode 100644 index 000000000..b9a709c69 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_ll_usb.c @@ -0,0 +1,884 @@ +/** + ****************************************************************************** + * @file stm32f3xx_ll_usb.c + * @author MCD Application Team + * @brief USB Low Layer HAL module driver. + * + * This file provides firmware functions to manage the following + * functionalities of the USB Peripheral Controller: + * + Initialization/de-initialization functions + * + I/O operation functions + * + Peripheral Control functions + * + Peripheral State functions + * + ****************************************************************************** + * @attention + * + * Copyright (c) 2016 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. + * + ****************************************************************************** + @verbatim + ============================================================================== + ##### How to use this driver ##### + ============================================================================== + [..] + (#) Fill parameters of Init structure in USB_CfgTypeDef structure. + + (#) Call USB_CoreInit() API to initialize the USB Core peripheral. + + (#) The upper HAL HCD/PCD driver will call the right routines for its internal processes. + + @endverbatim + + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f3xx_hal.h" + +/** @addtogroup STM32F3xx_LL_USB_DRIVER + * @{ + */ + +#if defined (HAL_PCD_MODULE_ENABLED) || defined (HAL_HCD_MODULE_ENABLED) +#if defined (USB) +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/** + * @brief Initializes the USB Core + * @param USBx USB Instance + * @param cfg pointer to a USB_CfgTypeDef structure that contains + * the configuration information for the specified USBx peripheral. + * @retval HAL status + */ +HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(USBx); + UNUSED(cfg); + + /* NOTE : - This function is not required by USB Device FS peripheral, it is used + only by USB OTG FS peripheral. + - This function is added to ensure compatibility across platforms. + */ + + return HAL_OK; +} + +/** + * @brief USB_EnableGlobalInt + * Enables the controller's Global Int in the AHB Config reg + * @param USBx Selected device + * @retval HAL status + */ +HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx) +{ + uint32_t winterruptmask; + + /* Clear pending interrupts */ + USBx->ISTR = 0U; + + /* Set winterruptmask variable */ + winterruptmask = USB_CNTR_CTRM | USB_CNTR_WKUPM | + USB_CNTR_SUSPM | USB_CNTR_ERRM | + USB_CNTR_SOFM | USB_CNTR_ESOFM | + USB_CNTR_RESETM; + + /* Set interrupt mask */ + USBx->CNTR = (uint16_t)winterruptmask; + + return HAL_OK; +} + +/** + * @brief USB_DisableGlobalInt + * Disable the controller's Global Int in the AHB Config reg + * @param USBx Selected device + * @retval HAL status + */ +HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx) +{ + uint32_t winterruptmask; + + /* Set winterruptmask variable */ + winterruptmask = USB_CNTR_CTRM | USB_CNTR_WKUPM | + USB_CNTR_SUSPM | USB_CNTR_ERRM | + USB_CNTR_SOFM | USB_CNTR_ESOFM | + USB_CNTR_RESETM; + + /* Clear interrupt mask */ + USBx->CNTR &= (uint16_t)(~winterruptmask); + + return HAL_OK; +} + +/** + * @brief USB_SetCurrentMode Set functional mode + * @param USBx Selected device + * @param mode current core mode + * This parameter can be one of the these values: + * @arg USB_DEVICE_MODE Peripheral mode + * @retval HAL status + */ +HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(USBx); + UNUSED(mode); + + /* NOTE : - This function is not required by USB Device FS peripheral, it is used + only by USB OTG FS peripheral. + - This function is added to ensure compatibility across platforms. + */ + return HAL_OK; +} + +/** + * @brief USB_DevInit Initializes the USB controller registers + * for device mode + * @param USBx Selected device + * @param cfg pointer to a USB_CfgTypeDef structure that contains + * the configuration information for the specified USBx peripheral. + * @retval HAL status + */ +HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(cfg); + + /* Init Device */ + /* CNTR_FRES = 1 */ + USBx->CNTR = (uint16_t)USB_CNTR_FRES; + + /* CNTR_FRES = 0 */ + USBx->CNTR = 0U; + + /* Clear pending interrupts */ + USBx->ISTR = 0U; + + /*Set Btable Address*/ + USBx->BTABLE = BTABLE_ADDRESS; + + return HAL_OK; +} + +#if defined (HAL_PCD_MODULE_ENABLED) +/** + * @brief Activate and configure an endpoint + * @param USBx Selected device + * @param ep pointer to endpoint structure + * @retval HAL status + */ +HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep) +{ + HAL_StatusTypeDef ret = HAL_OK; + uint16_t wEpRegVal; + + wEpRegVal = PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_T_MASK; + + /* initialize Endpoint */ + switch (ep->type) + { + case EP_TYPE_CTRL: + wEpRegVal |= USB_EP_CONTROL; + break; + + case EP_TYPE_BULK: + wEpRegVal |= USB_EP_BULK; + break; + + case EP_TYPE_INTR: + wEpRegVal |= USB_EP_INTERRUPT; + break; + + case EP_TYPE_ISOC: + wEpRegVal |= USB_EP_ISOCHRONOUS; + break; + + default: + ret = HAL_ERROR; + break; + } + + PCD_SET_ENDPOINT(USBx, ep->num, (wEpRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); + + PCD_SET_EP_ADDRESS(USBx, ep->num, ep->num); + + if (ep->doublebuffer == 0U) + { + if (ep->is_in != 0U) + { + /*Set the endpoint Transmit buffer address */ + PCD_SET_EP_TX_ADDRESS(USBx, ep->num, ep->pmaadress); + PCD_CLEAR_TX_DTOG(USBx, ep->num); + + if (ep->type != EP_TYPE_ISOC) + { + /* Configure NAK status for the Endpoint */ + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); + } + else + { + /* Configure TX Endpoint to disabled state */ + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); + } + } + else + { + /* Set the endpoint Receive buffer address */ + PCD_SET_EP_RX_ADDRESS(USBx, ep->num, ep->pmaadress); + + /* Set the endpoint Receive buffer counter */ + PCD_SET_EP_RX_CNT(USBx, ep->num, ep->maxpacket); + PCD_CLEAR_RX_DTOG(USBx, ep->num); + + if (ep->num == 0U) + { + /* Configure VALID status for EP0 */ + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); + } + else + { + /* Configure NAK status for OUT Endpoint */ + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_NAK); + } + } + } +#if (USE_USB_DOUBLE_BUFFER == 1U) + /* Double Buffer */ + else + { + if (ep->type == EP_TYPE_BULK) + { + /* Set bulk endpoint as double buffered */ + PCD_SET_BULK_EP_DBUF(USBx, ep->num); + } + else + { + /* Set the ISOC endpoint in double buffer mode */ + PCD_CLEAR_EP_KIND(USBx, ep->num); + } + + /* Set buffer address for double buffered mode */ + PCD_SET_EP_DBUF_ADDR(USBx, ep->num, ep->pmaaddr0, ep->pmaaddr1); + + if (ep->is_in == 0U) + { + /* Clear the data toggle bits for the endpoint IN/OUT */ + PCD_CLEAR_RX_DTOG(USBx, ep->num); + PCD_CLEAR_TX_DTOG(USBx, ep->num); + + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); + } + else + { + /* Clear the data toggle bits for the endpoint IN/OUT */ + PCD_CLEAR_RX_DTOG(USBx, ep->num); + PCD_CLEAR_TX_DTOG(USBx, ep->num); + + if (ep->type != EP_TYPE_ISOC) + { + /* Configure NAK status for the Endpoint */ + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); + } + else + { + /* Configure TX Endpoint to disabled state */ + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); + } + + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); + } + } +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + + return ret; +} + +/** + * @brief De-activate and de-initialize an endpoint + * @param USBx Selected device + * @param ep pointer to endpoint structure + * @retval HAL status + */ +HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep) +{ + if (ep->doublebuffer == 0U) + { + if (ep->is_in != 0U) + { + PCD_CLEAR_TX_DTOG(USBx, ep->num); + + /* Configure DISABLE status for the Endpoint */ + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); + } + + else + { + PCD_CLEAR_RX_DTOG(USBx, ep->num); + + /* Configure DISABLE status for the Endpoint */ + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); + } + } +#if (USE_USB_DOUBLE_BUFFER == 1U) + /* Double Buffer */ + else + { + if (ep->is_in == 0U) + { + /* Clear the data toggle bits for the endpoint IN/OUT*/ + PCD_CLEAR_RX_DTOG(USBx, ep->num); + PCD_CLEAR_TX_DTOG(USBx, ep->num); + + /* Reset value of the data toggle bits for the endpoint out*/ + PCD_TX_DTOG(USBx, ep->num); + + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); + } + else + { + /* Clear the data toggle bits for the endpoint IN/OUT*/ + PCD_CLEAR_RX_DTOG(USBx, ep->num); + PCD_CLEAR_TX_DTOG(USBx, ep->num); + PCD_RX_DTOG(USBx, ep->num); + + /* Configure DISABLE status for the Endpoint*/ + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); + } + } +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + + return HAL_OK; +} + +/** + * @brief USB_EPStartXfer setup and starts a transfer over an EP + * @param USBx Selected device + * @param ep pointer to endpoint structure + * @retval HAL status + */ +HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep) +{ + uint32_t len; +#if (USE_USB_DOUBLE_BUFFER == 1U) + uint16_t pmabuffer; + uint16_t wEPVal; +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + + /* IN endpoint */ + if (ep->is_in == 1U) + { + /*Multi packet transfer*/ + if (ep->xfer_len > ep->maxpacket) + { + len = ep->maxpacket; + } + else + { + len = ep->xfer_len; + } + + /* configure and validate Tx endpoint */ + if (ep->doublebuffer == 0U) + { + USB_WritePMA(USBx, ep->xfer_buff, ep->pmaadress, (uint16_t)len); + PCD_SET_EP_TX_CNT(USBx, ep->num, len); + } +#if (USE_USB_DOUBLE_BUFFER == 1U) + else + { + /* double buffer bulk management */ + if (ep->type == EP_TYPE_BULK) + { + if (ep->xfer_len_db > ep->maxpacket) + { + /* enable double buffer */ + PCD_SET_BULK_EP_DBUF(USBx, ep->num); + + /* each Time to write in PMA xfer_len_db will */ + ep->xfer_len_db -= len; + + /* Fill the two first buffer in the Buffer0 & Buffer1 */ + if ((PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_DTOG_TX) != 0U) + { + /* Set the Double buffer counter for pmabuffer1 */ + PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); + pmabuffer = ep->pmaaddr1; + + /* Write the user buffer to USB PMA */ + USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); + ep->xfer_buff += len; + + if (ep->xfer_len_db > ep->maxpacket) + { + ep->xfer_len_db -= len; + } + else + { + len = ep->xfer_len_db; + ep->xfer_len_db = 0U; + } + + /* Set the Double buffer counter for pmabuffer0 */ + PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); + pmabuffer = ep->pmaaddr0; + + /* Write the user buffer to USB PMA */ + USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); + } + else + { + /* Set the Double buffer counter for pmabuffer0 */ + PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); + pmabuffer = ep->pmaaddr0; + + /* Write the user buffer to USB PMA */ + USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); + ep->xfer_buff += len; + + if (ep->xfer_len_db > ep->maxpacket) + { + ep->xfer_len_db -= len; + } + else + { + len = ep->xfer_len_db; + ep->xfer_len_db = 0U; + } + + /* Set the Double buffer counter for pmabuffer1 */ + PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); + pmabuffer = ep->pmaaddr1; + + /* Write the user buffer to USB PMA */ + USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); + } + } + /* auto Switch to single buffer mode when transfer xfer_len_db; + + /* disable double buffer mode for Bulk endpoint */ + PCD_CLEAR_BULK_EP_DBUF(USBx, ep->num); + + /* Set Tx count with nbre of byte to be transmitted */ + PCD_SET_EP_TX_CNT(USBx, ep->num, len); + pmabuffer = ep->pmaaddr0; + + /* Write the user buffer to USB PMA */ + USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); + } + } + else /* manage isochronous double buffer IN mode */ + { + /* each Time to write in PMA xfer_len_db will */ + ep->xfer_len_db -= len; + + /* Fill the data buffer */ + if ((PCD_GET_ENDPOINT(USBx, ep->num) & USB_EP_DTOG_TX) != 0U) + { + /* Set the Double buffer counter for pmabuffer1 */ + PCD_SET_EP_DBUF1_CNT(USBx, ep->num, ep->is_in, len); + pmabuffer = ep->pmaaddr1; + + /* Write the user buffer to USB PMA */ + USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); + } + else + { + /* Set the Double buffer counter for pmabuffer0 */ + PCD_SET_EP_DBUF0_CNT(USBx, ep->num, ep->is_in, len); + pmabuffer = ep->pmaaddr0; + + /* Write the user buffer to USB PMA */ + USB_WritePMA(USBx, ep->xfer_buff, pmabuffer, (uint16_t)len); + } + } + } +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_VALID); + } + else /* OUT endpoint */ + { + if (ep->doublebuffer == 0U) + { + /* Multi packet transfer */ + if (ep->xfer_len > ep->maxpacket) + { + len = ep->maxpacket; + ep->xfer_len -= len; + } + else + { + len = ep->xfer_len; + ep->xfer_len = 0U; + } + /* configure and validate Rx endpoint */ + PCD_SET_EP_RX_CNT(USBx, ep->num, len); + } +#if (USE_USB_DOUBLE_BUFFER == 1U) + else + { + /* First Transfer Coming From HAL_PCD_EP_Receive & From ISR */ + /* Set the Double buffer counter */ + if (ep->type == EP_TYPE_BULK) + { + PCD_SET_EP_DBUF_CNT(USBx, ep->num, ep->is_in, ep->maxpacket); + + /* Coming from ISR */ + if (ep->xfer_count != 0U) + { + /* update last value to check if there is blocking state */ + wEPVal = PCD_GET_ENDPOINT(USBx, ep->num); + + /*Blocking State */ + if ((((wEPVal & USB_EP_DTOG_RX) != 0U) && ((wEPVal & USB_EP_DTOG_TX) != 0U)) || + (((wEPVal & USB_EP_DTOG_RX) == 0U) && ((wEPVal & USB_EP_DTOG_TX) == 0U))) + { + PCD_FREE_USER_BUFFER(USBx, ep->num, 0U); + } + } + } + /* iso out double */ + else if (ep->type == EP_TYPE_ISOC) + { + /* Multi packet transfer */ + if (ep->xfer_len > ep->maxpacket) + { + len = ep->maxpacket; + ep->xfer_len -= len; + } + else + { + len = ep->xfer_len; + ep->xfer_len = 0U; + } + PCD_SET_EP_DBUF_CNT(USBx, ep->num, ep->is_in, len); + } + else + { + return HAL_ERROR; + } + } +#endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ + + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); + } + + return HAL_OK; +} + + +/** + * @brief USB_EPSetStall set a stall condition over an EP + * @param USBx Selected device + * @param ep pointer to endpoint structure + * @retval HAL status + */ +HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx, USB_EPTypeDef *ep) +{ + if (ep->is_in != 0U) + { + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_STALL); + } + else + { + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_STALL); + } + + return HAL_OK; +} + +/** + * @brief USB_EPClearStall Clear a stall condition over an EP + * @param USBx Selected device + * @param ep pointer to endpoint structure + * @retval HAL status + */ +HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx, USB_EPTypeDef *ep) +{ + if (ep->doublebuffer == 0U) + { + if (ep->is_in != 0U) + { + PCD_CLEAR_TX_DTOG(USBx, ep->num); + + if (ep->type != EP_TYPE_ISOC) + { + /* Configure NAK status for the Endpoint */ + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); + } + } + else + { + PCD_CLEAR_RX_DTOG(USBx, ep->num); + + /* Configure VALID status for the Endpoint */ + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_VALID); + } + } + + return HAL_OK; +} + +/** + * @brief USB_EPStoptXfer Stop transfer on an EP + * @param USBx usb device instance + * @param ep pointer to endpoint structure + * @retval HAL status + */ +HAL_StatusTypeDef USB_EPStopXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep) +{ + /* IN endpoint */ + if (ep->is_in == 1U) + { + if (ep->doublebuffer == 0U) + { + if (ep->type != EP_TYPE_ISOC) + { + /* Configure NAK status for the Endpoint */ + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_NAK); + } + else + { + /* Configure TX Endpoint to disabled state */ + PCD_SET_EP_TX_STATUS(USBx, ep->num, USB_EP_TX_DIS); + } + } + } + else /* OUT endpoint */ + { + if (ep->doublebuffer == 0U) + { + if (ep->type != EP_TYPE_ISOC) + { + /* Configure NAK status for the Endpoint */ + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_NAK); + } + else + { + /* Configure RX Endpoint to disabled state */ + PCD_SET_EP_RX_STATUS(USBx, ep->num, USB_EP_RX_DIS); + } + } + } + + return HAL_OK; +} +#endif /* defined (HAL_PCD_MODULE_ENABLED) */ + +/** + * @brief USB_StopDevice Stop the usb device mode + * @param USBx Selected device + * @retval HAL status + */ +HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx) +{ + /* disable all interrupts and force USB reset */ + USBx->CNTR = (uint16_t)USB_CNTR_FRES; + + /* clear interrupt status register */ + USBx->ISTR = 0U; + + /* switch-off device */ + USBx->CNTR = (uint16_t)(USB_CNTR_FRES | USB_CNTR_PDWN); + + return HAL_OK; +} + +/** + * @brief USB_SetDevAddress Stop the usb device mode + * @param USBx Selected device + * @param address new device address to be assigned + * This parameter can be a value from 0 to 255 + * @retval HAL status + */ +HAL_StatusTypeDef USB_SetDevAddress(USB_TypeDef *USBx, uint8_t address) +{ + if (address == 0U) + { + /* set device address and enable function */ + USBx->DADDR = (uint16_t)USB_DADDR_EF; + } + + return HAL_OK; +} + +/** + * @brief USB_DevConnect Connect the USB device by enabling the pull-up/pull-down + * @param USBx Selected device + * @retval HAL status + */ +HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(USBx); + + /* NOTE : - This function is not required by USB Device FS peripheral, it is used + only by USB OTG FS peripheral. + - This function is added to ensure compatibility across platforms. + */ + + return HAL_OK; +} + +/** + * @brief USB_DevDisconnect Disconnect the USB device by disabling the pull-up/pull-down + * @param USBx Selected device + * @retval HAL status + */ +HAL_StatusTypeDef USB_DevDisconnect(USB_TypeDef *USBx) +{ + /* Prevent unused argument(s) compilation warning */ + UNUSED(USBx); + + /* NOTE : - This function is not required by USB Device FS peripheral, it is used + only by USB OTG FS peripheral. + - This function is added to ensure compatibility across platforms. + */ + + return HAL_OK; +} + +/** + * @brief USB_ReadInterrupts return the global USB interrupt status + * @param USBx Selected device + * @retval USB Global Interrupt status + */ +uint32_t USB_ReadInterrupts(USB_TypeDef *USBx) +{ + uint32_t tmpreg; + + tmpreg = USBx->ISTR; + return tmpreg; +} + +/** + * @brief USB_ActivateRemoteWakeup : active remote wakeup signalling + * @param USBx Selected device + * @retval HAL status + */ +HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx) +{ + USBx->CNTR |= (uint16_t)USB_CNTR_RESUME; + + return HAL_OK; +} + +/** + * @brief USB_DeActivateRemoteWakeup de-active remote wakeup signalling + * @param USBx Selected device + * @retval HAL status + */ +HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx) +{ + USBx->CNTR &= (uint16_t)(~USB_CNTR_RESUME); + + return HAL_OK; +} + +/** + * @brief Copy a buffer from user memory area to packet memory area (PMA) + * @param USBx USB peripheral instance register address. + * @param pbUsrBuf pointer to user memory area. + * @param wPMABufAddr address into PMA. + * @param wNBytes no. of bytes to be copied. + * @retval None + */ +void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) +{ + uint32_t n = ((uint32_t)wNBytes + 1U) >> 1; + uint32_t BaseAddr = (uint32_t)USBx; + uint32_t count; + uint16_t WrVal; + __IO uint16_t *pdwVal; + uint8_t *pBuf = pbUsrBuf; + + pdwVal = (__IO uint16_t *)(BaseAddr + 0x400U + ((uint32_t)wPMABufAddr * PMA_ACCESS)); + + for (count = n; count != 0U; count--) + { + WrVal = pBuf[0]; + WrVal |= (uint16_t)pBuf[1] << 8; + *pdwVal = (WrVal & 0xFFFFU); + pdwVal++; + +#if PMA_ACCESS > 1U + pdwVal++; +#endif /* PMA_ACCESS */ + + pBuf++; + pBuf++; + } +} + +/** + * @brief Copy data from packet memory area (PMA) to user memory buffer + * @param USBx USB peripheral instance register address. + * @param pbUsrBuf pointer to user memory area. + * @param wPMABufAddr address into PMA. + * @param wNBytes no. of bytes to be copied. + * @retval None + */ +void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) +{ + uint32_t n = (uint32_t)wNBytes >> 1; + uint32_t BaseAddr = (uint32_t)USBx; + uint32_t count; + uint32_t RdVal; + __IO uint16_t *pdwVal; + uint8_t *pBuf = pbUsrBuf; + + pdwVal = (__IO uint16_t *)(BaseAddr + 0x400U + ((uint32_t)wPMABufAddr * PMA_ACCESS)); + + for (count = n; count != 0U; count--) + { + RdVal = *(__IO uint16_t *)pdwVal; + pdwVal++; + *pBuf = (uint8_t)((RdVal >> 0) & 0xFFU); + pBuf++; + *pBuf = (uint8_t)((RdVal >> 8) & 0xFFU); + pBuf++; + +#if PMA_ACCESS > 1U + pdwVal++; +#endif /* PMA_ACCESS */ + } + + if ((wNBytes % 2U) != 0U) + { + RdVal = *pdwVal; + *pBuf = (uint8_t)((RdVal >> 0) & 0xFFU); + } +} + + +/** + * @} + */ + +/** + * @} + */ +#endif /* defined (USB) */ +#endif /* defined (HAL_PCD_MODULE_ENABLED) || defined (HAL_HCD_MODULE_ENABLED) */ + +/** + * @} + */ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_core.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_core.h new file mode 100644 index 000000000..030927b3a --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_core.h @@ -0,0 +1,161 @@ +/** + ****************************************************************************** + * @file usbd_core.h + * @author MCD Application Team + * @brief Header file for usbd_core.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2015 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USBD_CORE_H +#define __USBD_CORE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_conf.h" +#include "usbd_def.h" +#include "usbd_ioreq.h" +#include "usbd_ctlreq.h" + +/** @addtogroup STM32_USB_DEVICE_LIBRARY + * @{ + */ + +/** @defgroup USBD_CORE + * @brief This file is the Header file for usbd_core.c file + * @{ + */ + + +/** @defgroup USBD_CORE_Exported_Defines + * @{ + */ +#ifndef USBD_DEBUG_LEVEL +#define USBD_DEBUG_LEVEL 0U +#endif /* USBD_DEBUG_LEVEL */ +/** + * @} + */ + + +/** @defgroup USBD_CORE_Exported_TypesDefinitions + * @{ + */ + + +/** + * @} + */ + + + +/** @defgroup USBD_CORE_Exported_Macros + * @{ + */ + +/** + * @} + */ + +/** @defgroup USBD_CORE_Exported_Variables + * @{ + */ +#define USBD_SOF USBD_LL_SOF +/** + * @} + */ + +/** @defgroup USBD_CORE_Exported_FunctionsPrototype + * @{ + */ +USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev, USBD_DescriptorsTypeDef *pdesc, uint8_t id); +USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_Start(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_Stop(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass); + +USBD_StatusTypeDef USBD_RunTestMode(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx); +USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx); + +USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup); +USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata); +USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata); + +USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed); +USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev); + +USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum); +USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum); + +USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev); + +/* USBD Low Level Driver */ +USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev); +USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, + uint8_t ep_addr, + uint8_t ep_type, + uint16_t ep_mps); + +USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); +USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); +USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); +USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); +uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); +USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr); +USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev, + uint8_t ep_addr, + uint8_t *pbuf, + uint16_t size); + +USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, + uint8_t ep_addr, + uint8_t *pbuf, + uint16_t size); + +uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr); +void USBD_LL_Delay(uint32_t Delay); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USBD_CORE_H */ + +/** + * @} + */ + +/** +* @} +*/ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + + + diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h new file mode 100644 index 000000000..25a475826 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h @@ -0,0 +1,105 @@ +/** + ****************************************************************************** + * @file usbd_req.h + * @author MCD Application Team + * @brief Header file for the usbd_req.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2015 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USB_REQUEST_H +#define __USB_REQUEST_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_def.h" + + +/** @addtogroup STM32_USB_DEVICE_LIBRARY + * @{ + */ + +/** @defgroup USBD_REQ + * @brief header file for the usbd_req.c file + * @{ + */ + +/** @defgroup USBD_REQ_Exported_Defines + * @{ + */ +/** + * @} + */ + + +/** @defgroup USBD_REQ_Exported_Types + * @{ + */ +/** + * @} + */ + + + +/** @defgroup USBD_REQ_Exported_Macros + * @{ + */ +/** + * @} + */ + +/** @defgroup USBD_REQ_Exported_Variables + * @{ + */ +/** + * @} + */ + +/** @defgroup USBD_REQ_Exported_FunctionsPrototype + * @{ + */ + +USBD_StatusTypeDef USBD_StdDevReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); +USBD_StatusTypeDef USBD_StdItfReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); +USBD_StatusTypeDef USBD_StdEPReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); + + +void USBD_CtlError(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); + +void USBD_ParseSetupRequest(USBD_SetupReqTypedef *req, uint8_t *pdata); + +void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len); +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USB_REQUEST_H */ + +/** + * @} + */ + +/** +* @} +*/ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_def.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_def.h new file mode 100644 index 000000000..8d7502f34 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_def.h @@ -0,0 +1,348 @@ +/** + ****************************************************************************** + * @file usbd_def.h + * @author MCD Application Team + * @brief General defines for the usb device library + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2015 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USBD_DEF_H +#define __USBD_DEF_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_conf.h" + +/** @addtogroup STM32_USBD_DEVICE_LIBRARY + * @{ + */ + +/** @defgroup USB_DEF + * @brief general defines for the usb device library file + * @{ + */ + +/** @defgroup USB_DEF_Exported_Defines + * @{ + */ + +#ifndef NULL +#define NULL 0U +#endif /* NULL */ + +#ifndef USBD_MAX_NUM_INTERFACES +#define USBD_MAX_NUM_INTERFACES 1U +#endif /* USBD_MAX_NUM_CONFIGURATION */ + +#ifndef USBD_MAX_NUM_CONFIGURATION +#define USBD_MAX_NUM_CONFIGURATION 1U +#endif /* USBD_MAX_NUM_CONFIGURATION */ + +#ifndef USBD_LPM_ENABLED +#define USBD_LPM_ENABLED 0U +#endif /* USBD_LPM_ENABLED */ + +#ifndef USBD_SELF_POWERED +#define USBD_SELF_POWERED 1U +#endif /*USBD_SELF_POWERED */ + +#ifndef USBD_SUPPORT_USER_STRING_DESC +#define USBD_SUPPORT_USER_STRING_DESC 0U +#endif /* USBD_SUPPORT_USER_STRING_DESC */ + +#define USB_LEN_DEV_QUALIFIER_DESC 0x0AU +#define USB_LEN_DEV_DESC 0x12U +#define USB_LEN_CFG_DESC 0x09U +#define USB_LEN_IF_DESC 0x09U +#define USB_LEN_EP_DESC 0x07U +#define USB_LEN_OTG_DESC 0x03U +#define USB_LEN_LANGID_STR_DESC 0x04U +#define USB_LEN_OTHER_SPEED_DESC_SIZ 0x09U + +#define USBD_IDX_LANGID_STR 0x00U +#define USBD_IDX_MFC_STR 0x01U +#define USBD_IDX_PRODUCT_STR 0x02U +#define USBD_IDX_SERIAL_STR 0x03U +#define USBD_IDX_CONFIG_STR 0x04U +#define USBD_IDX_INTERFACE_STR 0x05U + +#define USB_REQ_TYPE_STANDARD 0x00U +#define USB_REQ_TYPE_CLASS 0x20U +#define USB_REQ_TYPE_VENDOR 0x40U +#define USB_REQ_TYPE_MASK 0x60U + +#define USB_REQ_RECIPIENT_DEVICE 0x00U +#define USB_REQ_RECIPIENT_INTERFACE 0x01U +#define USB_REQ_RECIPIENT_ENDPOINT 0x02U +#define USB_REQ_RECIPIENT_MASK 0x03U + +#define USB_REQ_GET_STATUS 0x00U +#define USB_REQ_CLEAR_FEATURE 0x01U +#define USB_REQ_SET_FEATURE 0x03U +#define USB_REQ_SET_ADDRESS 0x05U +#define USB_REQ_GET_DESCRIPTOR 0x06U +#define USB_REQ_SET_DESCRIPTOR 0x07U +#define USB_REQ_GET_CONFIGURATION 0x08U +#define USB_REQ_SET_CONFIGURATION 0x09U +#define USB_REQ_GET_INTERFACE 0x0AU +#define USB_REQ_SET_INTERFACE 0x0BU +#define USB_REQ_SYNCH_FRAME 0x0CU + +#define USB_DESC_TYPE_DEVICE 0x01U +#define USB_DESC_TYPE_CONFIGURATION 0x02U +#define USB_DESC_TYPE_STRING 0x03U +#define USB_DESC_TYPE_INTERFACE 0x04U +#define USB_DESC_TYPE_ENDPOINT 0x05U +#define USB_DESC_TYPE_DEVICE_QUALIFIER 0x06U +#define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 0x07U +#define USB_DESC_TYPE_BOS 0x0FU + +#define USB_CONFIG_REMOTE_WAKEUP 0x02U +#define USB_CONFIG_SELF_POWERED 0x01U + +#define USB_FEATURE_EP_HALT 0x00U +#define USB_FEATURE_REMOTE_WAKEUP 0x01U +#define USB_FEATURE_TEST_MODE 0x02U + +#define USB_DEVICE_CAPABITY_TYPE 0x10U + +#define USB_HS_MAX_PACKET_SIZE 512U +#define USB_FS_MAX_PACKET_SIZE 64U +#define USB_MAX_EP0_SIZE 64U + +/* Device Status */ +#define USBD_STATE_DEFAULT 0x01U +#define USBD_STATE_ADDRESSED 0x02U +#define USBD_STATE_CONFIGURED 0x03U +#define USBD_STATE_SUSPENDED 0x04U + + +/* EP0 State */ +#define USBD_EP0_IDLE 0x00U +#define USBD_EP0_SETUP 0x01U +#define USBD_EP0_DATA_IN 0x02U +#define USBD_EP0_DATA_OUT 0x03U +#define USBD_EP0_STATUS_IN 0x04U +#define USBD_EP0_STATUS_OUT 0x05U +#define USBD_EP0_STALL 0x06U + +#define USBD_EP_TYPE_CTRL 0x00U +#define USBD_EP_TYPE_ISOC 0x01U +#define USBD_EP_TYPE_BULK 0x02U +#define USBD_EP_TYPE_INTR 0x03U + + +/** + * @} + */ + + +/** @defgroup USBD_DEF_Exported_TypesDefinitions + * @{ + */ + +typedef struct usb_setup_req +{ + uint8_t bmRequest; + uint8_t bRequest; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; +} USBD_SetupReqTypedef; + +struct _USBD_HandleTypeDef; + +typedef struct _Device_cb +{ + uint8_t (*Init)(struct _USBD_HandleTypeDef *pdev, uint8_t cfgidx); + uint8_t (*DeInit)(struct _USBD_HandleTypeDef *pdev, uint8_t cfgidx); + /* Control Endpoints*/ + uint8_t (*Setup)(struct _USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); + uint8_t (*EP0_TxSent)(struct _USBD_HandleTypeDef *pdev); + uint8_t (*EP0_RxReady)(struct _USBD_HandleTypeDef *pdev); + /* Class Specific Endpoints*/ + uint8_t (*DataIn)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum); + uint8_t (*DataOut)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum); + uint8_t (*SOF)(struct _USBD_HandleTypeDef *pdev); + uint8_t (*IsoINIncomplete)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum); + uint8_t (*IsoOUTIncomplete)(struct _USBD_HandleTypeDef *pdev, uint8_t epnum); + + uint8_t *(*GetHSConfigDescriptor)(uint16_t *length); + uint8_t *(*GetFSConfigDescriptor)(uint16_t *length); + uint8_t *(*GetOtherSpeedConfigDescriptor)(uint16_t *length); + uint8_t *(*GetDeviceQualifierDescriptor)(uint16_t *length); +#if (USBD_SUPPORT_USER_STRING_DESC == 1U) + uint8_t *(*GetUsrStrDescriptor)(struct _USBD_HandleTypeDef *pdev, uint8_t index, uint16_t *length); +#endif + +} USBD_ClassTypeDef; + +/* Following USB Device Speed */ +typedef enum +{ + USBD_SPEED_HIGH = 0U, + USBD_SPEED_FULL = 1U, + USBD_SPEED_LOW = 2U, +} USBD_SpeedTypeDef; + +/* Following USB Device status */ +typedef enum +{ + USBD_OK = 0U, + USBD_BUSY, + USBD_FAIL, +} USBD_StatusTypeDef; + +/* USB Device descriptors structure */ +typedef struct +{ + uint8_t *(*GetDeviceDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length); + uint8_t *(*GetLangIDStrDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length); + uint8_t *(*GetManufacturerStrDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length); + uint8_t *(*GetProductStrDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length); + uint8_t *(*GetSerialStrDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length); + uint8_t *(*GetConfigurationStrDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length); + uint8_t *(*GetInterfaceStrDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length); +#if (USBD_LPM_ENABLED == 1U) + uint8_t *(*GetBOSDescriptor)(USBD_SpeedTypeDef speed, uint16_t *length); +#endif +} USBD_DescriptorsTypeDef; + +/* USB Device handle structure */ +typedef struct +{ + uint32_t status; + uint32_t is_used; + uint32_t total_length; + uint32_t rem_length; + uint32_t maxpacket; +} USBD_EndpointTypeDef; + +/* USB Device handle structure */ +typedef struct _USBD_HandleTypeDef +{ + uint8_t id; + uint32_t dev_config; + uint32_t dev_default_config; + uint32_t dev_config_status; + USBD_SpeedTypeDef dev_speed; + USBD_EndpointTypeDef ep_in[16]; + USBD_EndpointTypeDef ep_out[16]; + uint32_t ep0_state; + uint32_t ep0_data_len; + uint8_t dev_state; + uint8_t dev_old_state; + uint8_t dev_address; + uint8_t dev_connection_status; + uint8_t dev_test_mode; + uint32_t dev_remote_wakeup; + + USBD_SetupReqTypedef request; + USBD_DescriptorsTypeDef *pDesc; + USBD_ClassTypeDef *pClass; + void *pClassData; + void *pUserData; + void *pData; +} USBD_HandleTypeDef; + +/** + * @} + */ + + + +/** @defgroup USBD_DEF_Exported_Macros + * @{ + */ +#define SWAPBYTE(addr) (((uint16_t)(*((uint8_t *)(addr)))) + \ + (((uint16_t)(*(((uint8_t *)(addr)) + 1U))) << 8U)) + +#define LOBYTE(x) ((uint8_t)((x) & 0x00FFU)) +#define HIBYTE(x) ((uint8_t)(((x) & 0xFF00U) >> 8U)) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + + +#if defined ( __GNUC__ ) +#ifndef __weak +#define __weak __attribute__((weak)) +#endif /* __weak */ +#ifndef __packed +#define __packed __attribute__((__packed__)) +#endif /* __packed */ +#endif /* __GNUC__ */ + + +/* In HS mode and when the DMA is used, all variables and data structures dealing + with the DMA during the transaction process should be 4-bytes aligned */ + +#if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ +#ifndef __ALIGN_END +#define __ALIGN_END __attribute__ ((aligned (4U))) +#endif /* __ALIGN_END */ +#ifndef __ALIGN_BEGIN +#define __ALIGN_BEGIN +#endif /* __ALIGN_BEGIN */ +#else +#ifndef __ALIGN_END +#define __ALIGN_END +#endif /* __ALIGN_END */ +#ifndef __ALIGN_BEGIN +#if defined (__CC_ARM) /* ARM Compiler */ +#define __ALIGN_BEGIN __align(4U) +#elif defined (__ICCARM__) /* IAR Compiler */ +#define __ALIGN_BEGIN +#endif /* __CC_ARM */ +#endif /* __ALIGN_BEGIN */ +#endif /* __GNUC__ */ + + +/** + * @} + */ + +/** @defgroup USBD_DEF_Exported_Variables + * @{ + */ + +/** + * @} + */ + +/** @defgroup USBD_DEF_Exported_FunctionsPrototype + * @{ + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USBD_DEF_H */ + +/** + * @} + */ + +/** +* @} +*/ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h new file mode 100644 index 000000000..8a6dd5f76 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h @@ -0,0 +1,119 @@ +/** + ****************************************************************************** + * @file usbd_ioreq.h + * @author MCD Application Team + * @brief Header file for the usbd_ioreq.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2015 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USBD_IOREQ_H +#define __USBD_IOREQ_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_def.h" +#include "usbd_core.h" + +/** @addtogroup STM32_USB_DEVICE_LIBRARY + * @{ + */ + +/** @defgroup USBD_IOREQ + * @brief header file for the usbd_ioreq.c file + * @{ + */ + +/** @defgroup USBD_IOREQ_Exported_Defines + * @{ + */ +/** + * @} + */ + + +/** @defgroup USBD_IOREQ_Exported_Types + * @{ + */ + + +/** + * @} + */ + + + +/** @defgroup USBD_IOREQ_Exported_Macros + * @{ + */ + +/** + * @} + */ + +/** @defgroup USBD_IOREQ_Exported_Variables + * @{ + */ + +/** + * @} + */ + +/** @defgroup USBD_IOREQ_Exported_FunctionsPrototype + * @{ + */ + +USBD_StatusTypeDef USBD_CtlSendData(USBD_HandleTypeDef *pdev, + uint8_t *pbuf, + uint16_t len); + +USBD_StatusTypeDef USBD_CtlContinueSendData(USBD_HandleTypeDef *pdev, + uint8_t *pbuf, + uint16_t len); + +USBD_StatusTypeDef USBD_CtlPrepareRx(USBD_HandleTypeDef *pdev, + uint8_t *pbuf, + uint16_t len); + +USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev, + uint8_t *pbuf, + uint16_t len); + +USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev); + +USBD_StatusTypeDef USBD_CtlReceiveStatus(USBD_HandleTypeDef *pdev); + +uint32_t USBD_GetRxCount(USBD_HandleTypeDef *pdev, uint8_t ep_addr); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USBD_IOREQ_H */ + +/** + * @} + */ + +/** +* @} +*/ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_core.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_core.c new file mode 100644 index 000000000..b1a60ae2b --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_core.c @@ -0,0 +1,611 @@ +/** + ****************************************************************************** + * @file usbd_core.c + * @author MCD Application Team + * @brief This file provides all the USBD core functions. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2015 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_core.h" + +/** @addtogroup STM32_USBD_DEVICE_LIBRARY +* @{ +*/ + + +/** @defgroup USBD_CORE +* @brief usbd core module +* @{ +*/ + +/** @defgroup USBD_CORE_Private_TypesDefinitions +* @{ +*/ + +/** +* @} +*/ + + +/** @defgroup USBD_CORE_Private_Defines +* @{ +*/ + +/** +* @} +*/ + + +/** @defgroup USBD_CORE_Private_Macros +* @{ +*/ + +/** +* @} +*/ + + +/** @defgroup USBD_CORE_Private_FunctionPrototypes +* @{ +*/ + +/** +* @} +*/ + +/** @defgroup USBD_CORE_Private_Variables +* @{ +*/ + +/** +* @} +*/ + + +/** @defgroup USBD_CORE_Private_Functions +* @{ +*/ + +/** +* @brief USBD_Init +* Initializes the device stack and load the class driver +* @param pdev: device instance +* @param pdesc: Descriptor structure address +* @param id: Low level core index +* @retval None +*/ +USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev, + USBD_DescriptorsTypeDef *pdesc, uint8_t id) +{ + /* Check whether the USB Host handle is valid */ + if (pdev == NULL) + { +#if (USBD_DEBUG_LEVEL > 1U) + USBD_ErrLog("Invalid Device handle"); +#endif + return USBD_FAIL; + } + + /* Unlink previous class*/ + if (pdev->pClass != NULL) + { + pdev->pClass = NULL; + } + + /* Assign USBD Descriptors */ + if (pdesc != NULL) + { + pdev->pDesc = pdesc; + } + + /* Set Device initial State */ + pdev->dev_state = USBD_STATE_DEFAULT; + pdev->id = id; + /* Initialize low level driver */ + USBD_LL_Init(pdev); + + return USBD_OK; +} + +/** +* @brief USBD_DeInit +* Re-Initialize th device library +* @param pdev: device instance +* @retval status: status +*/ +USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev) +{ + /* Set Default State */ + pdev->dev_state = USBD_STATE_DEFAULT; + + /* Free Class Resources */ + pdev->pClass->DeInit(pdev, (uint8_t)pdev->dev_config); + + /* Stop the low level driver */ + USBD_LL_Stop(pdev); + + /* Initialize low level driver */ + USBD_LL_DeInit(pdev); + + return USBD_OK; +} + +/** + * @brief USBD_RegisterClass + * Link class driver to Device Core. + * @param pDevice : Device Handle + * @param pclass: Class handle + * @retval USBD Status + */ +USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass) +{ + USBD_StatusTypeDef status = USBD_OK; + if (pclass != NULL) + { + /* link the class to the USB Device handle */ + pdev->pClass = pclass; + status = USBD_OK; + } + else + { +#if (USBD_DEBUG_LEVEL > 1U) + USBD_ErrLog("Invalid Class handle"); +#endif + status = USBD_FAIL; + } + + return status; +} + +/** + * @brief USBD_Start + * Start the USB Device Core. + * @param pdev: Device Handle + * @retval USBD Status + */ +USBD_StatusTypeDef USBD_Start(USBD_HandleTypeDef *pdev) +{ + /* Start the low level driver */ + USBD_LL_Start(pdev); + + return USBD_OK; +} + +/** + * @brief USBD_Stop + * Stop the USB Device Core. + * @param pdev: Device Handle + * @retval USBD Status + */ +USBD_StatusTypeDef USBD_Stop(USBD_HandleTypeDef *pdev) +{ + /* Free Class Resources */ + pdev->pClass->DeInit(pdev, (uint8_t)pdev->dev_config); + + /* Stop the low level driver */ + USBD_LL_Stop(pdev); + + return USBD_OK; +} + +/** +* @brief USBD_RunTestMode +* Launch test mode process +* @param pdev: device instance +* @retval status +*/ +USBD_StatusTypeDef USBD_RunTestMode(USBD_HandleTypeDef *pdev) +{ + /* Prevent unused argument compilation warning */ + UNUSED(pdev); + + return USBD_OK; +} + +/** +* @brief USBD_SetClassConfig +* Configure device and start the interface +* @param pdev: device instance +* @param cfgidx: configuration index +* @retval status +*/ + +USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx) +{ + USBD_StatusTypeDef ret = USBD_FAIL; + + if (pdev->pClass != NULL) + { + /* Set configuration and Start the Class*/ + if (pdev->pClass->Init(pdev, cfgidx) == 0U) + { + ret = USBD_OK; + } + } + + return ret; +} + +/** +* @brief USBD_ClrClassConfig +* Clear current configuration +* @param pdev: device instance +* @param cfgidx: configuration index +* @retval status: USBD_StatusTypeDef +*/ +USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx) +{ + /* Clear configuration and De-initialize the Class process*/ + pdev->pClass->DeInit(pdev, cfgidx); + + return USBD_OK; +} + + +/** +* @brief USBD_SetupStage +* Handle the setup stage +* @param pdev: device instance +* @retval status +*/ +USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup) +{ + USBD_ParseSetupRequest(&pdev->request, psetup); + + pdev->ep0_state = USBD_EP0_SETUP; + + pdev->ep0_data_len = pdev->request.wLength; + + switch (pdev->request.bmRequest & 0x1FU) + { + case USB_REQ_RECIPIENT_DEVICE: + USBD_StdDevReq(pdev, &pdev->request); + break; + + case USB_REQ_RECIPIENT_INTERFACE: + USBD_StdItfReq(pdev, &pdev->request); + break; + + case USB_REQ_RECIPIENT_ENDPOINT: + USBD_StdEPReq(pdev, &pdev->request); + break; + + default: + USBD_LL_StallEP(pdev, (pdev->request.bmRequest & 0x80U)); + break; + } + + return USBD_OK; +} + +/** +* @brief USBD_DataOutStage +* Handle data OUT stage +* @param pdev: device instance +* @param epnum: endpoint index +* @retval status +*/ +USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev, + uint8_t epnum, uint8_t *pdata) +{ + USBD_EndpointTypeDef *pep; + + if (epnum == 0U) + { + pep = &pdev->ep_out[0]; + + if (pdev->ep0_state == USBD_EP0_DATA_OUT) + { + if (pep->rem_length > pep->maxpacket) + { + pep->rem_length -= pep->maxpacket; + + USBD_CtlContinueRx(pdev, pdata, + (uint16_t)MIN(pep->rem_length, pep->maxpacket)); + } + else + { + if ((pdev->pClass->EP0_RxReady != NULL) && + (pdev->dev_state == USBD_STATE_CONFIGURED)) + { + pdev->pClass->EP0_RxReady(pdev); + } + USBD_CtlSendStatus(pdev); + } + } + else + { + if (pdev->ep0_state == USBD_EP0_STATUS_OUT) + { + /* + * STATUS PHASE completed, update ep0_state to idle + */ + pdev->ep0_state = USBD_EP0_IDLE; + USBD_LL_StallEP(pdev, 0U); + } + } + } + else if ((pdev->pClass->DataOut != NULL) && + (pdev->dev_state == USBD_STATE_CONFIGURED)) + { + pdev->pClass->DataOut(pdev, epnum); + } + else + { + /* should never be in this condition */ + return USBD_FAIL; + } + + return USBD_OK; +} + +/** +* @brief USBD_DataInStage +* Handle data in stage +* @param pdev: device instance +* @param epnum: endpoint index +* @retval status +*/ +USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev, + uint8_t epnum, uint8_t *pdata) +{ + USBD_EndpointTypeDef *pep; + + if (epnum == 0U) + { + pep = &pdev->ep_in[0]; + + if (pdev->ep0_state == USBD_EP0_DATA_IN) + { + if (pep->rem_length > pep->maxpacket) + { + pep->rem_length -= pep->maxpacket; + + USBD_CtlContinueSendData(pdev, pdata, (uint16_t)pep->rem_length); + + /* Prepare endpoint for premature end of transfer */ + USBD_LL_PrepareReceive(pdev, 0U, NULL, 0U); + } + else + { + /* last packet is MPS multiple, so send ZLP packet */ + if ((pep->total_length % pep->maxpacket == 0U) && + (pep->total_length >= pep->maxpacket) && + (pep->total_length < pdev->ep0_data_len)) + { + USBD_CtlContinueSendData(pdev, NULL, 0U); + pdev->ep0_data_len = 0U; + + /* Prepare endpoint for premature end of transfer */ + USBD_LL_PrepareReceive(pdev, 0U, NULL, 0U); + } + else + { + if ((pdev->pClass->EP0_TxSent != NULL) && + (pdev->dev_state == USBD_STATE_CONFIGURED)) + { + pdev->pClass->EP0_TxSent(pdev); + } + USBD_LL_StallEP(pdev, 0x80U); + USBD_CtlReceiveStatus(pdev); + } + } + } + else + { + if ((pdev->ep0_state == USBD_EP0_STATUS_IN) || + (pdev->ep0_state == USBD_EP0_IDLE)) + { + USBD_LL_StallEP(pdev, 0x80U); + } + } + + if (pdev->dev_test_mode == 1U) + { + USBD_RunTestMode(pdev); + pdev->dev_test_mode = 0U; + } + } + else if ((pdev->pClass->DataIn != NULL) && + (pdev->dev_state == USBD_STATE_CONFIGURED)) + { + pdev->pClass->DataIn(pdev, epnum); + } + else + { + /* should never be in this condition */ + return USBD_FAIL; + } + + return USBD_OK; +} + +/** +* @brief USBD_LL_Reset +* Handle Reset event +* @param pdev: device instance +* @retval status +*/ + +USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev) +{ + /* Open EP0 OUT */ + USBD_LL_OpenEP(pdev, 0x00U, USBD_EP_TYPE_CTRL, USB_MAX_EP0_SIZE); + pdev->ep_out[0x00U & 0xFU].is_used = 1U; + + pdev->ep_out[0].maxpacket = USB_MAX_EP0_SIZE; + + /* Open EP0 IN */ + USBD_LL_OpenEP(pdev, 0x80U, USBD_EP_TYPE_CTRL, USB_MAX_EP0_SIZE); + pdev->ep_in[0x80U & 0xFU].is_used = 1U; + + pdev->ep_in[0].maxpacket = USB_MAX_EP0_SIZE; + + /* Upon Reset call user call back */ + pdev->dev_state = USBD_STATE_DEFAULT; + pdev->ep0_state = USBD_EP0_IDLE; + pdev->dev_config = 0U; + pdev->dev_remote_wakeup = 0U; + + if (pdev->pClassData) + { + pdev->pClass->DeInit(pdev, (uint8_t)pdev->dev_config); + } + + return USBD_OK; +} + +/** +* @brief USBD_LL_Reset +* Handle Reset event +* @param pdev: device instance +* @retval status +*/ +USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, + USBD_SpeedTypeDef speed) +{ + pdev->dev_speed = speed; + + return USBD_OK; +} + +/** +* @brief USBD_Suspend +* Handle Suspend event +* @param pdev: device instance +* @retval status +*/ + +USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev) +{ + pdev->dev_old_state = pdev->dev_state; + pdev->dev_state = USBD_STATE_SUSPENDED; + + return USBD_OK; +} + +/** +* @brief USBD_Resume +* Handle Resume event +* @param pdev: device instance +* @retval status +*/ + +USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev) +{ + if (pdev->dev_state == USBD_STATE_SUSPENDED) + { + pdev->dev_state = pdev->dev_old_state; + } + + return USBD_OK; +} + +/** +* @brief USBD_SOF +* Handle SOF event +* @param pdev: device instance +* @retval status +*/ + +USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev) +{ + if (pdev->dev_state == USBD_STATE_CONFIGURED) + { + if (pdev->pClass->SOF != NULL) + { + pdev->pClass->SOF(pdev); + } + } + + return USBD_OK; +} + +/** +* @brief USBD_IsoINIncomplete +* Handle iso in incomplete event +* @param pdev: device instance +* @retval status +*/ +USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, + uint8_t epnum) +{ + /* Prevent unused arguments compilation warning */ + UNUSED(pdev); + UNUSED(epnum); + + return USBD_OK; +} + +/** +* @brief USBD_IsoOUTIncomplete +* Handle iso out incomplete event +* @param pdev: device instance +* @retval status +*/ +USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, + uint8_t epnum) +{ + /* Prevent unused arguments compilation warning */ + UNUSED(pdev); + UNUSED(epnum); + + return USBD_OK; +} + +/** +* @brief USBD_DevConnected +* Handle device connection event +* @param pdev: device instance +* @retval status +*/ +USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev) +{ + /* Prevent unused argument compilation warning */ + UNUSED(pdev); + + return USBD_OK; +} + +/** +* @brief USBD_DevDisconnected +* Handle device disconnection event +* @param pdev: device instance +* @retval status +*/ +USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev) +{ + /* Free Class Resources */ + pdev->dev_state = USBD_STATE_DEFAULT; + pdev->pClass->DeInit(pdev, (uint8_t)pdev->dev_config); + + return USBD_OK; +} +/** +* @} +*/ + + +/** +* @} +*/ + + +/** +* @} +*/ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c new file mode 100644 index 000000000..e57c1bcda --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c @@ -0,0 +1,918 @@ +/** + ****************************************************************************** + * @file usbd_req.c + * @author MCD Application Team + * @brief This file provides the standard USB requests following chapter 9. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2015 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_ctlreq.h" +#include "usbd_ioreq.h" + + +/** @addtogroup STM32_USBD_STATE_DEVICE_LIBRARY + * @{ + */ + + +/** @defgroup USBD_REQ + * @brief USB standard requests module + * @{ + */ + +/** @defgroup USBD_REQ_Private_TypesDefinitions + * @{ + */ + +/** + * @} + */ + + +/** @defgroup USBD_REQ_Private_Defines + * @{ + */ + +/** + * @} + */ + + +/** @defgroup USBD_REQ_Private_Macros + * @{ + */ + +/** + * @} + */ + + +/** @defgroup USBD_REQ_Private_Variables + * @{ + */ + +/** + * @} + */ + + +/** @defgroup USBD_REQ_Private_FunctionPrototypes + * @{ + */ +static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req); + +static void USBD_SetAddress(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req); + +static void USBD_SetConfig(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req); + +static void USBD_GetConfig(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req); + +static void USBD_GetStatus(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req); + +static void USBD_SetFeature(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req); + +static void USBD_ClrFeature(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req); + +static uint8_t USBD_GetLen(uint8_t *buf); + +/** + * @} + */ + + +/** @defgroup USBD_REQ_Private_Functions + * @{ + */ + + +/** +* @brief USBD_StdDevReq +* Handle standard usb device requests +* @param pdev: device instance +* @param req: usb request +* @retval status +*/ +USBD_StatusTypeDef USBD_StdDevReq(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req) +{ + USBD_StatusTypeDef ret = USBD_OK; + + switch (req->bmRequest & USB_REQ_TYPE_MASK) + { + case USB_REQ_TYPE_CLASS: + case USB_REQ_TYPE_VENDOR: + pdev->pClass->Setup(pdev, req); + break; + + case USB_REQ_TYPE_STANDARD: + switch (req->bRequest) + { + case USB_REQ_GET_DESCRIPTOR: + USBD_GetDescriptor(pdev, req); + break; + + case USB_REQ_SET_ADDRESS: + USBD_SetAddress(pdev, req); + break; + + case USB_REQ_SET_CONFIGURATION: + USBD_SetConfig(pdev, req); + break; + + case USB_REQ_GET_CONFIGURATION: + USBD_GetConfig(pdev, req); + break; + + case USB_REQ_GET_STATUS: + USBD_GetStatus(pdev, req); + break; + + case USB_REQ_SET_FEATURE: + USBD_SetFeature(pdev, req); + break; + + case USB_REQ_CLEAR_FEATURE: + USBD_ClrFeature(pdev, req); + break; + + default: + USBD_CtlError(pdev, req); + break; + } + break; + + default: + USBD_CtlError(pdev, req); + break; + } + + return ret; +} + +/** +* @brief USBD_StdItfReq +* Handle standard usb interface requests +* @param pdev: device instance +* @param req: usb request +* @retval status +*/ +USBD_StatusTypeDef USBD_StdItfReq(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req) +{ + USBD_StatusTypeDef ret = USBD_OK; + + switch (req->bmRequest & USB_REQ_TYPE_MASK) + { + case USB_REQ_TYPE_CLASS: + case USB_REQ_TYPE_VENDOR: + case USB_REQ_TYPE_STANDARD: + switch (pdev->dev_state) + { + case USBD_STATE_DEFAULT: + case USBD_STATE_ADDRESSED: + case USBD_STATE_CONFIGURED: + + if (LOBYTE(req->wIndex) <= USBD_MAX_NUM_INTERFACES) + { + ret = (USBD_StatusTypeDef)pdev->pClass->Setup(pdev, req); + + if ((req->wLength == 0U) && (ret == USBD_OK)) + { + USBD_CtlSendStatus(pdev); + } + } + else + { + USBD_CtlError(pdev, req); + } + break; + + default: + USBD_CtlError(pdev, req); + break; + } + break; + + default: + USBD_CtlError(pdev, req); + break; + } + + return USBD_OK; +} + +/** +* @brief USBD_StdEPReq +* Handle standard usb endpoint requests +* @param pdev: device instance +* @param req: usb request +* @retval status +*/ +USBD_StatusTypeDef USBD_StdEPReq(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req) +{ + USBD_EndpointTypeDef *pep; + uint8_t ep_addr; + USBD_StatusTypeDef ret = USBD_OK; + ep_addr = LOBYTE(req->wIndex); + + switch (req->bmRequest & USB_REQ_TYPE_MASK) + { + case USB_REQ_TYPE_CLASS: + case USB_REQ_TYPE_VENDOR: + pdev->pClass->Setup(pdev, req); + break; + + case USB_REQ_TYPE_STANDARD: + /* Check if it is a class request */ + if ((req->bmRequest & 0x60U) == 0x20U) + { + ret = (USBD_StatusTypeDef)pdev->pClass->Setup(pdev, req); + + return ret; + } + + switch (req->bRequest) + { + case USB_REQ_SET_FEATURE: + switch (pdev->dev_state) + { + case USBD_STATE_ADDRESSED: + if ((ep_addr != 0x00U) && (ep_addr != 0x80U)) + { + USBD_LL_StallEP(pdev, ep_addr); + USBD_LL_StallEP(pdev, 0x80U); + } + else + { + USBD_CtlError(pdev, req); + } + break; + + case USBD_STATE_CONFIGURED: + if (req->wValue == USB_FEATURE_EP_HALT) + { + if ((ep_addr != 0x00U) && + (ep_addr != 0x80U) && (req->wLength == 0x00U)) + { + USBD_LL_StallEP(pdev, ep_addr); + } + } + USBD_CtlSendStatus(pdev); + + break; + + default: + USBD_CtlError(pdev, req); + break; + } + break; + + case USB_REQ_CLEAR_FEATURE: + + switch (pdev->dev_state) + { + case USBD_STATE_ADDRESSED: + if ((ep_addr != 0x00U) && (ep_addr != 0x80U)) + { + USBD_LL_StallEP(pdev, ep_addr); + USBD_LL_StallEP(pdev, 0x80U); + } + else + { + USBD_CtlError(pdev, req); + } + break; + + case USBD_STATE_CONFIGURED: + if (req->wValue == USB_FEATURE_EP_HALT) + { + if ((ep_addr & 0x7FU) != 0x00U) + { + USBD_LL_ClearStallEP(pdev, ep_addr); + } + USBD_CtlSendStatus(pdev); + } + break; + + default: + USBD_CtlError(pdev, req); + break; + } + break; + + case USB_REQ_GET_STATUS: + switch (pdev->dev_state) + { + case USBD_STATE_ADDRESSED: + if ((ep_addr != 0x00U) && (ep_addr != 0x80U)) + { + USBD_CtlError(pdev, req); + break; + } + pep = ((ep_addr & 0x80U) == 0x80U) ? &pdev->ep_in[ep_addr & 0x7FU] : \ + &pdev->ep_out[ep_addr & 0x7FU]; + + pep->status = 0x0000U; + + USBD_CtlSendData(pdev, (uint8_t *)(void *)&pep->status, 2U); + break; + + case USBD_STATE_CONFIGURED: + if ((ep_addr & 0x80U) == 0x80U) + { + if (pdev->ep_in[ep_addr & 0xFU].is_used == 0U) + { + USBD_CtlError(pdev, req); + break; + } + } + else + { + if (pdev->ep_out[ep_addr & 0xFU].is_used == 0U) + { + USBD_CtlError(pdev, req); + break; + } + } + + pep = ((ep_addr & 0x80U) == 0x80U) ? &pdev->ep_in[ep_addr & 0x7FU] : \ + &pdev->ep_out[ep_addr & 0x7FU]; + + if ((ep_addr == 0x00U) || (ep_addr == 0x80U)) + { + pep->status = 0x0000U; + } + else if (USBD_LL_IsStallEP(pdev, ep_addr)) + { + pep->status = 0x0001U; + } + else + { + pep->status = 0x0000U; + } + + USBD_CtlSendData(pdev, (uint8_t *)(void *)&pep->status, 2U); + break; + + default: + USBD_CtlError(pdev, req); + break; + } + break; + + default: + USBD_CtlError(pdev, req); + break; + } + break; + + default: + USBD_CtlError(pdev, req); + break; + } + + return ret; +} + + +/** +* @brief USBD_GetDescriptor +* Handle Get Descriptor requests +* @param pdev: device instance +* @param req: usb request +* @retval status +*/ +static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req) +{ + uint16_t len = 0U; + uint8_t *pbuf = NULL; + uint8_t err = 0U; + + switch (req->wValue >> 8) + { +#if (USBD_LPM_ENABLED == 1U) + case USB_DESC_TYPE_BOS: + if (pdev->pDesc->GetBOSDescriptor != NULL) + { + pbuf = pdev->pDesc->GetBOSDescriptor(pdev->dev_speed, &len); + } + else + { + USBD_CtlError(pdev, req); + err++; + } + break; +#endif + case USB_DESC_TYPE_DEVICE: + pbuf = pdev->pDesc->GetDeviceDescriptor(pdev->dev_speed, &len); + break; + + case USB_DESC_TYPE_CONFIGURATION: + if (pdev->dev_speed == USBD_SPEED_HIGH) + { + pbuf = pdev->pClass->GetHSConfigDescriptor(&len); + pbuf[1] = USB_DESC_TYPE_CONFIGURATION; + } + else + { + pbuf = pdev->pClass->GetFSConfigDescriptor(&len); + pbuf[1] = USB_DESC_TYPE_CONFIGURATION; + } + break; + + case USB_DESC_TYPE_STRING: + switch ((uint8_t)(req->wValue)) + { + case USBD_IDX_LANGID_STR: + if (pdev->pDesc->GetLangIDStrDescriptor != NULL) + { + pbuf = pdev->pDesc->GetLangIDStrDescriptor(pdev->dev_speed, &len); + } + else + { + USBD_CtlError(pdev, req); + err++; + } + break; + + case USBD_IDX_MFC_STR: + if (pdev->pDesc->GetManufacturerStrDescriptor != NULL) + { + pbuf = pdev->pDesc->GetManufacturerStrDescriptor(pdev->dev_speed, &len); + } + else + { + USBD_CtlError(pdev, req); + err++; + } + break; + + case USBD_IDX_PRODUCT_STR: + if (pdev->pDesc->GetProductStrDescriptor != NULL) + { + pbuf = pdev->pDesc->GetProductStrDescriptor(pdev->dev_speed, &len); + } + else + { + USBD_CtlError(pdev, req); + err++; + } + break; + + case USBD_IDX_SERIAL_STR: + if (pdev->pDesc->GetSerialStrDescriptor != NULL) + { + pbuf = pdev->pDesc->GetSerialStrDescriptor(pdev->dev_speed, &len); + } + else + { + USBD_CtlError(pdev, req); + err++; + } + break; + + case USBD_IDX_CONFIG_STR: + if (pdev->pDesc->GetConfigurationStrDescriptor != NULL) + { + pbuf = pdev->pDesc->GetConfigurationStrDescriptor(pdev->dev_speed, &len); + } + else + { + USBD_CtlError(pdev, req); + err++; + } + break; + + case USBD_IDX_INTERFACE_STR: + if (pdev->pDesc->GetInterfaceStrDescriptor != NULL) + { + pbuf = pdev->pDesc->GetInterfaceStrDescriptor(pdev->dev_speed, &len); + } + else + { + USBD_CtlError(pdev, req); + err++; + } + break; + + default: +#if (USBD_SUPPORT_USER_STRING_DESC == 1U) + if (pdev->pClass->GetUsrStrDescriptor != NULL) + { + pbuf = pdev->pClass->GetUsrStrDescriptor(pdev, (req->wValue), &len); + } + else + { + USBD_CtlError(pdev, req); + err++; + } + break; +#else + USBD_CtlError(pdev, req); + err++; +#endif + } + break; + + case USB_DESC_TYPE_DEVICE_QUALIFIER: + if (pdev->dev_speed == USBD_SPEED_HIGH) + { + pbuf = pdev->pClass->GetDeviceQualifierDescriptor(&len); + } + else + { + USBD_CtlError(pdev, req); + err++; + } + break; + + case USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION: + if (pdev->dev_speed == USBD_SPEED_HIGH) + { + pbuf = pdev->pClass->GetOtherSpeedConfigDescriptor(&len); + pbuf[1] = USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION; + } + else + { + USBD_CtlError(pdev, req); + err++; + } + break; + + default: + USBD_CtlError(pdev, req); + err++; + break; + } + + if (err != 0U) + { + return; + } + else + { + if ((len != 0U) && (req->wLength != 0U)) + { + len = MIN(len, req->wLength); + (void)USBD_CtlSendData(pdev, pbuf, len); + } + + if (req->wLength == 0U) + { + (void)USBD_CtlSendStatus(pdev); + } + } +} + +/** +* @brief USBD_SetAddress +* Set device address +* @param pdev: device instance +* @param req: usb request +* @retval status +*/ +static void USBD_SetAddress(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req) +{ + uint8_t dev_addr; + + if ((req->wIndex == 0U) && (req->wLength == 0U) && (req->wValue < 128U)) + { + dev_addr = (uint8_t)(req->wValue) & 0x7FU; + + if (pdev->dev_state == USBD_STATE_CONFIGURED) + { + USBD_CtlError(pdev, req); + } + else + { + pdev->dev_address = dev_addr; + USBD_LL_SetUSBAddress(pdev, dev_addr); + USBD_CtlSendStatus(pdev); + + if (dev_addr != 0U) + { + pdev->dev_state = USBD_STATE_ADDRESSED; + } + else + { + pdev->dev_state = USBD_STATE_DEFAULT; + } + } + } + else + { + USBD_CtlError(pdev, req); + } +} + +/** +* @brief USBD_SetConfig +* Handle Set device configuration request +* @param pdev: device instance +* @param req: usb request +* @retval status +*/ +static void USBD_SetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req) +{ + static uint8_t cfgidx; + + cfgidx = (uint8_t)(req->wValue); + + if (cfgidx > USBD_MAX_NUM_CONFIGURATION) + { + USBD_CtlError(pdev, req); + } + else + { + switch (pdev->dev_state) + { + case USBD_STATE_ADDRESSED: + if (cfgidx) + { + pdev->dev_config = cfgidx; + pdev->dev_state = USBD_STATE_CONFIGURED; + if (USBD_SetClassConfig(pdev, cfgidx) == USBD_FAIL) + { + USBD_CtlError(pdev, req); + return; + } + USBD_CtlSendStatus(pdev); + } + else + { + USBD_CtlSendStatus(pdev); + } + break; + + case USBD_STATE_CONFIGURED: + if (cfgidx == 0U) + { + pdev->dev_state = USBD_STATE_ADDRESSED; + pdev->dev_config = cfgidx; + USBD_ClrClassConfig(pdev, cfgidx); + USBD_CtlSendStatus(pdev); + } + else if (cfgidx != pdev->dev_config) + { + /* Clear old configuration */ + USBD_ClrClassConfig(pdev, (uint8_t)pdev->dev_config); + + /* set new configuration */ + pdev->dev_config = cfgidx; + if (USBD_SetClassConfig(pdev, cfgidx) == USBD_FAIL) + { + USBD_CtlError(pdev, req); + return; + } + USBD_CtlSendStatus(pdev); + } + else + { + USBD_CtlSendStatus(pdev); + } + break; + + default: + USBD_CtlError(pdev, req); + USBD_ClrClassConfig(pdev, cfgidx); + break; + } + } +} + +/** +* @brief USBD_GetConfig +* Handle Get device configuration request +* @param pdev: device instance +* @param req: usb request +* @retval status +*/ +static void USBD_GetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req) +{ + if (req->wLength != 1U) + { + USBD_CtlError(pdev, req); + } + else + { + switch (pdev->dev_state) + { + case USBD_STATE_DEFAULT: + case USBD_STATE_ADDRESSED: + pdev->dev_default_config = 0U; + USBD_CtlSendData(pdev, (uint8_t *)(void *)&pdev->dev_default_config, 1U); + break; + + case USBD_STATE_CONFIGURED: + USBD_CtlSendData(pdev, (uint8_t *)(void *)&pdev->dev_config, 1U); + break; + + default: + USBD_CtlError(pdev, req); + break; + } + } +} + +/** +* @brief USBD_GetStatus +* Handle Get Status request +* @param pdev: device instance +* @param req: usb request +* @retval status +*/ +static void USBD_GetStatus(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req) +{ + switch (pdev->dev_state) + { + case USBD_STATE_DEFAULT: + case USBD_STATE_ADDRESSED: + case USBD_STATE_CONFIGURED: + if (req->wLength != 0x2U) + { + USBD_CtlError(pdev, req); + break; + } + +#if (USBD_SELF_POWERED == 1U) + pdev->dev_config_status = USB_CONFIG_SELF_POWERED; +#else + pdev->dev_config_status = 0U; +#endif + + if (pdev->dev_remote_wakeup) + { + pdev->dev_config_status |= USB_CONFIG_REMOTE_WAKEUP; + } + + USBD_CtlSendData(pdev, (uint8_t *)(void *)&pdev->dev_config_status, 2U); + break; + + default: + USBD_CtlError(pdev, req); + break; + } +} + + +/** +* @brief USBD_SetFeature +* Handle Set device feature request +* @param pdev: device instance +* @param req: usb request +* @retval status +*/ +static void USBD_SetFeature(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req) +{ + if (req->wValue == USB_FEATURE_REMOTE_WAKEUP) + { + pdev->dev_remote_wakeup = 1U; + USBD_CtlSendStatus(pdev); + } +} + + +/** +* @brief USBD_ClrFeature +* Handle clear device feature request +* @param pdev: device instance +* @param req: usb request +* @retval status +*/ +static void USBD_ClrFeature(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req) +{ + switch (pdev->dev_state) + { + case USBD_STATE_DEFAULT: + case USBD_STATE_ADDRESSED: + case USBD_STATE_CONFIGURED: + if (req->wValue == USB_FEATURE_REMOTE_WAKEUP) + { + pdev->dev_remote_wakeup = 0U; + USBD_CtlSendStatus(pdev); + } + break; + + default: + USBD_CtlError(pdev, req); + break; + } +} + +/** +* @brief USBD_ParseSetupRequest +* Copy buffer into setup structure +* @param pdev: device instance +* @param req: usb request +* @retval None +*/ + +void USBD_ParseSetupRequest(USBD_SetupReqTypedef *req, uint8_t *pdata) +{ + req->bmRequest = *(uint8_t *)(pdata); + req->bRequest = *(uint8_t *)(pdata + 1U); + req->wValue = SWAPBYTE(pdata + 2U); + req->wIndex = SWAPBYTE(pdata + 4U); + req->wLength = SWAPBYTE(pdata + 6U); + +} + +/** +* @brief USBD_CtlError +* Handle USB low level Error +* @param pdev: device instance +* @param req: usb request +* @retval None +*/ + +void USBD_CtlError(USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req) +{ + USBD_LL_StallEP(pdev, 0x80U); + USBD_LL_StallEP(pdev, 0U); +} + + +/** + * @brief USBD_GetString + * Convert Ascii string into unicode one + * @param desc : descriptor buffer + * @param unicode : Formatted string buffer (unicode) + * @param len : descriptor length + * @retval None + */ +void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len) +{ + uint8_t idx = 0U; + + if (desc != NULL) + { + *len = (uint16_t)USBD_GetLen(desc) * 2U + 2U; + unicode[idx++] = *(uint8_t *)(void *)len; + unicode[idx++] = USB_DESC_TYPE_STRING; + + while (*desc != '\0') + { + unicode[idx++] = *desc++; + unicode[idx++] = 0U; + } + } +} + +/** + * @brief USBD_GetLen + * return the string length + * @param buf : pointer to the ascii string buffer + * @retval string length + */ +static uint8_t USBD_GetLen(uint8_t *buf) +{ + uint8_t len = 0U; + + while (*buf != '\0') + { + len++; + buf++; + } + + return len; +} +/** + * @} + */ + + +/** + * @} + */ + + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c new file mode 100644 index 000000000..33519727b --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/Library/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c @@ -0,0 +1,216 @@ +/** + ****************************************************************************** + * @file usbd_ioreq.c + * @author MCD Application Team + * @brief This file provides the IO requests APIs for control endpoints. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2015 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_ioreq.h" + +/** @addtogroup STM32_USB_DEVICE_LIBRARY + * @{ + */ + + +/** @defgroup USBD_IOREQ + * @brief control I/O requests module + * @{ + */ + +/** @defgroup USBD_IOREQ_Private_TypesDefinitions + * @{ + */ +/** + * @} + */ + + +/** @defgroup USBD_IOREQ_Private_Defines + * @{ + */ + +/** + * @} + */ + + +/** @defgroup USBD_IOREQ_Private_Macros + * @{ + */ +/** + * @} + */ + + +/** @defgroup USBD_IOREQ_Private_Variables + * @{ + */ + +/** + * @} + */ + + +/** @defgroup USBD_IOREQ_Private_FunctionPrototypes + * @{ + */ +/** + * @} + */ + + +/** @defgroup USBD_IOREQ_Private_Functions + * @{ + */ + +/** +* @brief USBD_CtlSendData +* send data on the ctl pipe +* @param pdev: device instance +* @param buff: pointer to data buffer +* @param len: length of data to be sent +* @retval status +*/ +USBD_StatusTypeDef USBD_CtlSendData(USBD_HandleTypeDef *pdev, + uint8_t *pbuf, uint16_t len) +{ + /* Set EP0 State */ + pdev->ep0_state = USBD_EP0_DATA_IN; + pdev->ep_in[0].total_length = len; + pdev->ep_in[0].rem_length = len; + + /* Start the transfer */ + USBD_LL_Transmit(pdev, 0x00U, pbuf, len); + + return USBD_OK; +} + +/** +* @brief USBD_CtlContinueSendData +* continue sending data on the ctl pipe +* @param pdev: device instance +* @param buff: pointer to data buffer +* @param len: length of data to be sent +* @retval status +*/ +USBD_StatusTypeDef USBD_CtlContinueSendData(USBD_HandleTypeDef *pdev, + uint8_t *pbuf, uint16_t len) +{ + /* Start the next transfer */ + USBD_LL_Transmit(pdev, 0x00U, pbuf, len); + + return USBD_OK; +} + +/** +* @brief USBD_CtlPrepareRx +* receive data on the ctl pipe +* @param pdev: device instance +* @param buff: pointer to data buffer +* @param len: length of data to be received +* @retval status +*/ +USBD_StatusTypeDef USBD_CtlPrepareRx(USBD_HandleTypeDef *pdev, + uint8_t *pbuf, uint16_t len) +{ + /* Set EP0 State */ + pdev->ep0_state = USBD_EP0_DATA_OUT; + pdev->ep_out[0].total_length = len; + pdev->ep_out[0].rem_length = len; + + /* Start the transfer */ + USBD_LL_PrepareReceive(pdev, 0U, pbuf, len); + + return USBD_OK; +} + +/** +* @brief USBD_CtlContinueRx +* continue receive data on the ctl pipe +* @param pdev: device instance +* @param buff: pointer to data buffer +* @param len: length of data to be received +* @retval status +*/ +USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev, + uint8_t *pbuf, uint16_t len) +{ + USBD_LL_PrepareReceive(pdev, 0U, pbuf, len); + + return USBD_OK; +} + +/** +* @brief USBD_CtlSendStatus +* send zero lzngth packet on the ctl pipe +* @param pdev: device instance +* @retval status +*/ +USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev) +{ + /* Set EP0 State */ + pdev->ep0_state = USBD_EP0_STATUS_IN; + + /* Start the transfer */ + USBD_LL_Transmit(pdev, 0x00U, NULL, 0U); + + return USBD_OK; +} + +/** +* @brief USBD_CtlReceiveStatus +* receive zero lzngth packet on the ctl pipe +* @param pdev: device instance +* @retval status +*/ +USBD_StatusTypeDef USBD_CtlReceiveStatus(USBD_HandleTypeDef *pdev) +{ + /* Set EP0 State */ + pdev->ep0_state = USBD_EP0_STATUS_OUT; + + /* Start the transfer */ + USBD_LL_PrepareReceive(pdev, 0U, NULL, 0U); + + return USBD_OK; +} + +/** +* @brief USBD_GetRxCount +* returns the received data length +* @param pdev: device instance +* @param ep_addr: endpoint address +* @retval Rx Data blength +*/ +uint32_t USBD_GetRxCount(USBD_HandleTypeDef *pdev, uint8_t ep_addr) +{ + return USBD_LL_GetRxDataSize(pdev, ep_addr); +} + +/** + * @} + */ + + +/** + * @} + */ + + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_bulk.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_bulk.c new file mode 100644 index 000000000..2c60ddd79 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_bulk.c @@ -0,0 +1,400 @@ +/** + ****************************************************************************** + * @file usbd_bulk.c + * @author MCD Application Team + * @version V2.4.2 + * @date 11-December-2015 + * @brief This file provides the high layer firmware functions to manage a + * USB bulk device. + * + ****************************************************************************** + * @attention + * + *

© COPYRIGHT 2015 STMicroelectronics

+ * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_bulk.h" +#include "usbd_desc.h" +#include "usbd_ctlreq.h" + + +/** @addtogroup STM32_USB_DEVICE_LIBRARY + * @{ + */ + + +/** @defgroup USBD_Bulk + * @brief usbd core module + * @{ + */ + +/** @defgroup USBD_Bulk_Private_TypesDefinitions + * @{ + */ +/** + * @} + */ + + +/** @defgroup USBD_Bulk_Private_Defines + * @{ + */ +/** + * @} + */ + + +/** @defgroup USBD_Bulk_Private_Macros + * @{ + */ + +/** + * @} + */ + + +/** @defgroup USBD_Bulk_Private_FunctionPrototypes + * @{ + */ +extern void UsbReceivePipeBulkOUT(uint8_t epnum); +extern void UsbTransmitPipeBulkIN(void); + + +static uint8_t USBD_Bulk_Init (USBD_HandleTypeDef *pdev, + uint8_t cfgidx); + +static uint8_t USBD_Bulk_DeInit (USBD_HandleTypeDef *pdev, + uint8_t cfgidx); + +static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req); + +static uint8_t USBD_Bulk_DataIn (USBD_HandleTypeDef *pdev, + uint8_t epnum); + +static uint8_t USBD_Bulk_DataOut (USBD_HandleTypeDef *pdev, + uint8_t epnum); + +static uint8_t USBD_Bulk_SOF (USBD_HandleTypeDef *pdev); + +static uint8_t *USBD_Bulk_GetFSCfgDesc (uint16_t *length); + +uint8_t *USBD_Bulk_GetDeviceQualifierDescriptor (uint16_t *length); + +/* USB Standard Device Descriptor */ +__ALIGN_BEGIN static uint8_t USBD_Bulk_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALIGN_END = +{ + USB_LEN_DEV_QUALIFIER_DESC, + USB_DESC_TYPE_DEVICE_QUALIFIER, + 0x10, + 0x01, + 0x00, + 0x00, + 0x00, + 0x40, + 0x01, + 0x00, +}; + +/** + * @} + */ + +/** @defgroup USBD_Bulk_Private_Variables + * @{ + */ +#if defined ( __ICCARM__ ) /* IAR Compiler */ + #pragma data_alignment=4 +#endif /* defined ( __ICCARM__ ) */ +__ALIGN_BEGIN static volatile uint32_t usbd_bulk_AltSet __ALIGN_END = 0; +__ALIGN_BEGIN uint8_t USB_Rx_Buffer[BULK_DATA_MAX_PACKET_SIZE] __ALIGN_END ; + + +/* Bulk interface class callbacks structure */ +USBD_ClassTypeDef USBD_Bulk = +{ + USBD_Bulk_Init, + USBD_Bulk_DeInit, + USBD_Bulk_Setup, + NULL, + NULL, + USBD_Bulk_DataIn, + USBD_Bulk_DataOut, + USBD_Bulk_SOF, + NULL, + NULL, + NULL, + USBD_Bulk_GetFSCfgDesc, + NULL, + USBD_Bulk_GetDeviceQualifierDescriptor, +}; + +/* USB Bulk device Configuration Descriptor */ +__ALIGN_BEGIN uint8_t USBD_Bulk_CfgFSDesc[USB_BULK_CONFIG_DESC_SIZ] __ALIGN_END = +{ + /*Configuration Descriptor*/ + 0x09, /* bLength: Configuration Descriptor size */ + USB_DESC_TYPE_CONFIGURATION, /* bDescriptorType: Configuration */ + USB_BULK_CONFIG_DESC_SIZ, /* wTotalLength:no of returned bytes */ + 0x00, + 0x01, /* bNumInterfaces: 1 interface */ + 0x01, /* bConfigurationValue: Configuration value */ + 0x00, /* iConfiguration: Index of string descriptor describing the configuration */ + 0xC0, /* bmAttributes: self powered */ + 0x32, /* MaxPower 100 mA */ + + /*---------------------------------------------------------------------------*/ + + /*Interface Descriptor */ + 0x09, /* bLength: Interface Descriptor size */ + USB_DESC_TYPE_INTERFACE, /* bDescriptorType: Interface */ + /* Interface descriptor type */ + 0x00, /* bInterfaceNumber: Number of Interface */ + 0x00, /* bAlternateSetting: Alternate setting */ + 0x02, /* bNumEndpoints: One endpoints used */ + 0xFF, /* bInterfaceClass: vendor specific */ + 0x00, /* bInterfaceSubClass */ + 0x00, /* bInterfaceProtocol */ + 0x00, /* iInterface: */ + + /*Endpoint IN Descriptor*/ + 0x07, /* bLength: Endpoint Descriptor size */ + USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */ + BULK_IN_EP, /* bEndpointAddress */ + 0x02, /* bmAttributes: Bulk */ + LOBYTE(BULK_DATA_MAX_PACKET_SIZE), /* wMaxPacketSize: */ + HIBYTE(BULK_DATA_MAX_PACKET_SIZE), + 0xFF, /* bInterval: ignore for Bulk transfer */ + + /*Endpoint OUT Descriptor*/ + 0x07, /* bLength: Endpoint Descriptor size */ + USB_DESC_TYPE_ENDPOINT, /* bDescriptorType: Endpoint */ + BULK_OUT_EP, /* bEndpointAddress */ + 0x02, /* bmAttributes: Bulk */ + LOBYTE(BULK_DATA_MAX_PACKET_SIZE), /* wMaxPacketSize: */ + HIBYTE(BULK_DATA_MAX_PACKET_SIZE), + 0xFF /* bInterval: ignore for Bulk transfer */ +} ; + + +/** + * @} + */ + +/** @defgroup USBD_Bulk_Private_Functions + * @{ + */ + +/** + * @brief USBD_Bulk_Init + * Initialize the Bulk interface + * @param pdev: device instance + * @param cfgidx: Configuration index + * @retval status + */ +static uint8_t USBD_Bulk_Init (USBD_HandleTypeDef *pdev, + uint8_t cfgidx) +{ + uint8_t ret = 0; + + /* Open EP IN */ + USBD_LL_OpenEP(pdev, + BULK_IN_EP, + USBD_EP_TYPE_BULK, + BULK_DATA_FS_IN_PACKET_SIZE); + + /* Open EP OUT */ + USBD_LL_OpenEP(pdev, + BULK_OUT_EP, + USBD_EP_TYPE_BULK, + BULK_DATA_FS_OUT_PACKET_SIZE); + + /* Prepare Out endpoint to receive next packet */ + USBD_LL_PrepareReceive(pdev, + BULK_OUT_EP, + &USB_Rx_Buffer[0], + BULK_DATA_FS_OUT_PACKET_SIZE); + + return ret; +} + +/** + * @brief USBD_Bulk_DeInit + * DeInitialize the Bulk layer + * @param pdev: device instance + * @param cfgidx: Configuration index + * @retval status + */ +static uint8_t USBD_Bulk_DeInit (USBD_HandleTypeDef *pdev, + uint8_t cfgidx) +{ + uint8_t ret = 0; + + /* Close EP IN */ + USBD_LL_CloseEP(pdev, BULK_IN_EP); + + /* lose EP OUT */ + USBD_LL_CloseEP(pdev, BULK_OUT_EP); + + return ret; +} + +/** + * @brief USBD_Bulk_Setup + * Handle the bulk specific requests + * @param pdev: instance + * @param req: usb requests + * @retval status + */ +static uint8_t USBD_Bulk_Setup (USBD_HandleTypeDef *pdev, + USBD_SetupReqTypedef *req) +{ + uint16_t len=USB_BULK_DESC_SIZ; + uint8_t *pbuf=USBD_Bulk_CfgFSDesc + 9; + + switch (req->bmRequest & USB_REQ_TYPE_MASK) + { + case USB_REQ_TYPE_STANDARD: + switch (req->bRequest) + { + case USB_REQ_GET_DESCRIPTOR : + if ( (req->wValue >> 8) == BULK_DESCRIPTOR_TYPE) + { + pbuf = USBD_Bulk_CfgFSDesc + 9 + (9 * USBD_MAX_NUM_INTERFACES); + len = MIN(USB_BULK_DESC_SIZ , req->wLength); + + } + USBD_CtlSendData (pdev, pbuf, len); + break; + + case USB_REQ_GET_INTERFACE : + USBD_CtlSendData (pdev, + (uint8_t *)&usbd_bulk_AltSet, + 1); + break; + + case USB_REQ_SET_INTERFACE : + if ((uint8_t)(req->wValue) < USBD_MAX_NUM_INTERFACES) + { + usbd_bulk_AltSet = (uint8_t)(req->wValue); + } + else + { + /* Call the error management function (command will be nacked */ + USBD_CtlError (pdev, req); + } + break; + } + + default: + break; + } + return USBD_OK; +} + +/** + * @brief USBD_Bulk_DataIn + * Data sent on non-control IN endpoint + * @param pdev: device instance + * @param epnum: endpoint number + * @retval status + */ +static uint8_t USBD_Bulk_DataIn (USBD_HandleTypeDef *pdev, uint8_t epnum) +{ + /* endpoint finished the previous transmission so see if more data is left */ + UsbTransmitPipeBulkIN(); + return USBD_OK; +} + +/** + * @brief USBD_Bulk_DataOut + * Data received on non-control Out endpoint + * @param pdev: device instance + * @param epnum: endpoint number + * @retval status + */ +static uint8_t USBD_Bulk_DataOut (USBD_HandleTypeDef *pdev, uint8_t epnum) +{ + /* read the data from the bulk OUT pipe */ + UsbReceivePipeBulkOUT(epnum); + return USBD_OK; +} + +/** + * @brief USBD_Bulk_SOF + * Start Of Frame event management + * @param pdev: device instance + * @retval status + */ +static uint8_t USBD_Bulk_SOF (USBD_HandleTypeDef *pdev) +{ + if (pdev->dev_state == USBD_STATE_CONFIGURED ) + { + /* Check the data to be sent through IN pipe */ + UsbTransmitPipeBulkIN(); + } + return USBD_OK; + +} + +/** + * @brief USBD_Bulk_GetFSCfgDesc + * Return configuration descriptor + * @param speed : current device speed + * @param length : pointer data length + * @retval pointer to descriptor buffer + */ +static uint8_t *USBD_Bulk_GetFSCfgDesc (uint16_t *length) +{ + *length = sizeof (USBD_Bulk_CfgFSDesc); + return USBD_Bulk_CfgFSDesc; +} + +/** +* @brief DeviceQualifierDescriptor +* return Device Qualifier descriptor +* @param length : pointer data length +* @retval pointer to descriptor buffer +*/ +uint8_t *USBD_Bulk_GetDeviceQualifierDescriptor (uint16_t *length) +{ + *length = sizeof (USBD_Bulk_DeviceQualifierDesc); + return USBD_Bulk_DeviceQualifierDesc; +} + +/** + * @brief USBD_Bulk_GetRxBufferPtr + * @retval Pointer to reception buffer. + */ +uint8_t * USBD_Bulk_GetRxBufferPtr(void) +{ + return &USB_Rx_Buffer[0]; +} +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_bulk.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_bulk.h new file mode 100644 index 000000000..6de356534 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_bulk.h @@ -0,0 +1,120 @@ +/** + ****************************************************************************** + * @file usbd_bulk.h + * @author MCD Application Team + * @version V2.4.2 + * @date 11-December-2015 + * @brief header file for the usbd_bulk.c file. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT 2015 STMicroelectronics

+ * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USB_CDC_H +#define __USB_CDC_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_ioreq.h" + +/** @addtogroup STM32_USB_DEVICE_LIBRARY + * @{ + */ + +/** @defgroup usbd_cdc + * @brief This file is the Header file for usbd_cdc.c + * @{ + */ + + +/** @defgroup usbd_cdc_Exported_Defines + * @{ + */ +#define BULK_IN_EP 0x81 /* EP1 for data IN */ +#define BULK_OUT_EP 0x01 /* EP1 for data OUT */ + +/* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */ +#define BULK_DATA_MAX_PACKET_SIZE 64 /* Endpoint IN & OUT Packet size */ + +#define USB_BULK_CONFIG_DESC_SIZ 32 +#define USB_BULK_DESC_SIZ (32-9) + +#define BULK_DESCRIPTOR_TYPE 0x21 + + +#define BULK_DATA_FS_IN_PACKET_SIZE BULK_DATA_MAX_PACKET_SIZE +#define BULK_DATA_FS_OUT_PACKET_SIZE BULK_DATA_MAX_PACKET_SIZE + + +/** + * @} + */ + + +/** @defgroup USBD_CORE_Exported_TypesDefinitions + * @{ + */ + +/** + * @} + */ + + +/** @defgroup USBD_CORE_Exported_Macros + * @{ + */ + +/** + * @} + */ + +/** @defgroup USBD_CORE_Exported_Variables + * @{ + */ + +extern USBD_ClassTypeDef USBD_Bulk; +/** + * @} + */ + +/** @defgroup USB_CORE_Exported_Functions + * @{ + */ +uint8_t * USBD_Bulk_GetRxBufferPtr(void); +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USB_CDC_H */ +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_desc.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_desc.c new file mode 100644 index 000000000..de92f0271 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_desc.c @@ -0,0 +1,424 @@ +/** + ****************************************************************************** + * @file : usbd_desc.c + * @version : v2.0_Cube + * @brief : This file implements the USB device descriptors. + ****************************************************************************** + * This notice applies to any and all portions of this file + * that are not between comment pairs USER CODE BEGIN and + * USER CODE END. Other portions of this file, whether + * inserted by the user or by software development tools + * are owned by their respective copyright owners. + * + * Copyright (c) 2018 STMicroelectronics International N.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted, provided that the following conditions are met: + * + * 1. Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific written permission. + * 4. This software, including modifications and/or derivative works of this + * software, must execute solely and exclusively on microcontroller or + * microprocessor devices manufactured by or for STMicroelectronics. + * 5. Redistribution and use of this software other than as permitted under + * this license is void and will automatically terminate your rights under + * this license. + * + * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY + * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT + * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_core.h" +#include "usbd_desc.h" +#include "usbd_conf.h" + +/* USER CODE BEGIN INCLUDE */ + +/* USER CODE END INCLUDE */ + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ + +/* USER CODE BEGIN PV */ +/* Private variables ---------------------------------------------------------*/ + +/* USER CODE END PV */ + +/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY + * @{ + */ + +/** @addtogroup USBD_DESC + * @{ + */ + +/** @defgroup USBD_DESC_Private_TypesDefinitions USBD_DESC_Private_TypesDefinitions + * @brief Private types. + * @{ + */ + +/* USER CODE BEGIN PRIVATE_TYPES */ + +/* USER CODE END PRIVATE_TYPES */ + +/** + * @} + */ + +/** @defgroup USBD_DESC_Private_Defines USBD_DESC_Private_Defines + * @brief Private defines. + * @{ + */ + +#define USBD_VID 0x1d50 +#define USBD_LANGID_STRING 1033 +#define USBD_MANUFACTURER_STRING "OpenBLT User" +#define USBD_PID_FS 0x60ac +#define USBD_PRODUCT_STRING_FS "WinUSB Bulk Device" +#define USBD_SERIALNUMBER_STRING_FS "00000000050C" +#define USBD_CONFIGURATION_STRING_FS "Default" +#define USBD_INTERFACE_STRING_FS "WinUSB Bulk Interface" + +/* USER CODE BEGIN PRIVATE_DEFINES */ + +/* USER CODE END PRIVATE_DEFINES */ + +/** + * @} + */ + +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/** @defgroup USBD_DESC_Private_Macros USBD_DESC_Private_Macros + * @brief Private macros. + * @{ + */ + +/* USER CODE BEGIN PRIVATE_MACRO */ + +/* USER CODE END PRIVATE_MACRO */ + +/** + * @} + */ + +/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes + * @brief Private functions declaration. + * @{ + */ + +static void Get_SerialNum(void); +static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len); + +/** + * @} + */ + + +/** @defgroup USBD_DESC_Private_FunctionPrototypes USBD_DESC_Private_FunctionPrototypes + * @brief Private functions declaration for FS. + * @{ + */ + +uint8_t * USBD_FS_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); +uint8_t * USBD_FS_LangIDStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); +uint8_t * USBD_FS_ManufacturerStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); +uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); +uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); +uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); +uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length); + +/** + * @} + */ + +/** @defgroup USBD_DESC_Private_Variables USBD_DESC_Private_Variables + * @brief Private variables. + * @{ + */ + +USBD_DescriptorsTypeDef FS_Desc = +{ + USBD_FS_DeviceDescriptor +, USBD_FS_LangIDStrDescriptor +, USBD_FS_ManufacturerStrDescriptor +, USBD_FS_ProductStrDescriptor +, USBD_FS_SerialStrDescriptor +, USBD_FS_ConfigStrDescriptor +, USBD_FS_InterfaceStrDescriptor +}; + +#if defined ( __ICCARM__ ) /* IAR Compiler */ + #pragma data_alignment=4 +#endif /* defined ( __ICCARM__ ) */ +/** USB standard device descriptor. */ +__ALIGN_BEGIN uint8_t USBD_FS_DeviceDesc[USB_LEN_DEV_DESC] __ALIGN_END = +{ + 0x12, /*bLength */ + USB_DESC_TYPE_DEVICE, /*bDescriptorType*/ + 0x10, /*bcdUSB */ + 0x01, + 0x00, /*bDeviceClass*/ + 0x00, /*bDeviceSubClass*/ + 0x00, /*bDeviceProtocol*/ + USB_MAX_EP0_SIZE, /*bMaxPacketSize*/ + LOBYTE(USBD_VID), /*idVendor*/ + HIBYTE(USBD_VID), /*idVendor*/ + LOBYTE(USBD_PID_FS), /*idProduct*/ + HIBYTE(USBD_PID_FS), /*idProduct*/ + 0x00, /*bcdDevice rel. 2.00*/ + 0x01, + USBD_IDX_MFC_STR, /*Index of manufacturer string*/ + USBD_IDX_PRODUCT_STR, /*Index of product string*/ + USBD_IDX_SERIAL_STR, /*Index of serial number string*/ + USBD_MAX_NUM_CONFIGURATION /*bNumConfigurations*/ +}; + +/* USB_DeviceDescriptor */ + +/** + * @} + */ + +/** @defgroup USBD_DESC_Private_Variables USBD_DESC_Private_Variables + * @brief Private variables. + * @{ + */ + +#if defined ( __ICCARM__ ) /* IAR Compiler */ + #pragma data_alignment=4 +#endif /* defined ( __ICCARM__ ) */ + +/** USB lang indentifier descriptor. */ +__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END = +{ + USB_LEN_LANGID_STR_DESC, + USB_DESC_TYPE_STRING, + LOBYTE(USBD_LANGID_STRING), + HIBYTE(USBD_LANGID_STRING) +}; + +#if defined ( __ICCARM__ ) /* IAR Compiler */ + #pragma data_alignment=4 +#endif /* defined ( __ICCARM__ ) */ +/* Internal string descriptor. */ +__ALIGN_BEGIN uint8_t USBD_StrDesc[USBD_MAX_STR_DESC_SIZ] __ALIGN_END; + +#if defined ( __ICCARM__ ) /*!< IAR Compiler */ + #pragma data_alignment=4 +#endif +__ALIGN_BEGIN uint8_t USBD_StringSerial[USB_SIZ_STRING_SERIAL] __ALIGN_END = { + USB_SIZ_STRING_SERIAL, + USB_DESC_TYPE_STRING, +}; + +/** + * @} + */ + +/** @defgroup USBD_DESC_Private_Functions USBD_DESC_Private_Functions + * @brief Private functions. + * @{ + */ + +/** + * @brief Return the device descriptor + * @param speed : Current device speed + * @param length : Pointer to data length variable + * @retval Pointer to descriptor buffer + */ +uint8_t * USBD_FS_DeviceDescriptor(USBD_SpeedTypeDef speed, uint16_t *length) +{ + UNUSED(speed); + *length = sizeof(USBD_FS_DeviceDesc); + return USBD_FS_DeviceDesc; +} + +/** + * @brief Return the LangID string descriptor + * @param speed : Current device speed + * @param length : Pointer to data length variable + * @retval Pointer to descriptor buffer + */ +uint8_t * USBD_FS_LangIDStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length) +{ + UNUSED(speed); + *length = sizeof(USBD_LangIDDesc); + return USBD_LangIDDesc; +} + +/** + * @brief Return the product string descriptor + * @param speed : Current device speed + * @param length : Pointer to data length variable + * @retval Pointer to descriptor buffer + */ +uint8_t * USBD_FS_ProductStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length) +{ + if(speed == 0) + { + USBD_GetString((uint8_t *)USBD_PRODUCT_STRING_FS, USBD_StrDesc, length); + } + else + { + USBD_GetString((uint8_t *)USBD_PRODUCT_STRING_FS, USBD_StrDesc, length); + } + return USBD_StrDesc; +} + +/** + * @brief Return the manufacturer string descriptor + * @param speed : Current device speed + * @param length : Pointer to data length variable + * @retval Pointer to descriptor buffer + */ +uint8_t * USBD_FS_ManufacturerStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length) +{ + UNUSED(speed); + USBD_GetString((uint8_t *)USBD_MANUFACTURER_STRING, USBD_StrDesc, length); + return USBD_StrDesc; +} + +/** + * @brief Return the serial number string descriptor + * @param speed : Current device speed + * @param length : Pointer to data length variable + * @retval Pointer to descriptor buffer + */ +uint8_t * USBD_FS_SerialStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length) +{ + UNUSED(speed); + *length = USB_SIZ_STRING_SERIAL; + + /* Update the serial number string descriptor with the data from the unique + * ID */ + Get_SerialNum(); + /* USER CODE BEGIN USBD_FS_SerialStrDescriptor */ + + /* USER CODE END USBD_FS_SerialStrDescriptor */ + return (uint8_t *) USBD_StringSerial; +} + +/** + * @brief Return the configuration string descriptor + * @param speed : Current device speed + * @param length : Pointer to data length variable + * @retval Pointer to descriptor buffer + */ +uint8_t * USBD_FS_ConfigStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length) +{ + if(speed == USBD_SPEED_HIGH) + { + USBD_GetString((uint8_t *)USBD_CONFIGURATION_STRING_FS, USBD_StrDesc, length); + } + else + { + USBD_GetString((uint8_t *)USBD_CONFIGURATION_STRING_FS, USBD_StrDesc, length); + } + return USBD_StrDesc; +} + +/** + * @brief Return the interface string descriptor + * @param speed : Current device speed + * @param length : Pointer to data length variable + * @retval Pointer to descriptor buffer + */ +uint8_t * USBD_FS_InterfaceStrDescriptor(USBD_SpeedTypeDef speed, uint16_t *length) +{ + if(speed == 0) + { + USBD_GetString((uint8_t *)USBD_INTERFACE_STRING_FS, USBD_StrDesc, length); + } + else + { + USBD_GetString((uint8_t *)USBD_INTERFACE_STRING_FS, USBD_StrDesc, length); + } + return USBD_StrDesc; +} + +/** + * @brief Create the serial number string descriptor + * @param None + * @retval None + */ +static void Get_SerialNum(void) +{ + uint32_t deviceserial0, deviceserial1, deviceserial2; + + deviceserial0 = *(uint32_t *) DEVICE_ID1; + deviceserial1 = *(uint32_t *) DEVICE_ID2; + deviceserial2 = *(uint32_t *) DEVICE_ID3; + + deviceserial0 += deviceserial2; + + if (deviceserial0 != 0) + { + IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8); + IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4); + } +} + +/** + * @brief Convert Hex 32Bits value into char + * @param value: value to convert + * @param pbuf: pointer to the buffer + * @param len: buffer length + * @retval None + */ +static void IntToUnicode(uint32_t value, uint8_t * pbuf, uint8_t len) +{ + uint8_t idx = 0; + + for (idx = 0; idx < len; idx++) + { + if (((value >> 28)) < 0xA) + { + pbuf[2 * idx] = (value >> 28) + '0'; + } + else + { + pbuf[2 * idx] = (value >> 28) + 'A' - 10; + } + + value = value << 4; + + pbuf[2 * idx + 1] = 0; + } +} +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_desc.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_desc.h new file mode 100644 index 000000000..3588db37b --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/App/usbd_desc.h @@ -0,0 +1,174 @@ +/** + ****************************************************************************** + * @file : usbd_desc.h + * @version : v2.0_Cube + * @brief : Header for usbd_desc.c file. + ****************************************************************************** + * This notice applies to any and all portions of this file + * that are not between comment pairs USER CODE BEGIN and + * USER CODE END. Other portions of this file, whether + * inserted by the user or by software development tools + * are owned by their respective copyright owners. + * + * Copyright (c) 2018 STMicroelectronics International N.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted, provided that the following conditions are met: + * + * 1. Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific written permission. + * 4. This software, including modifications and/or derivative works of this + * software, must execute solely and exclusively on microcontroller or + * microprocessor devices manufactured by or for STMicroelectronics. + * 5. Redistribution and use of this software other than as permitted under + * this license is void and will automatically terminate your rights under + * this license. + * + * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY + * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT + * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USBD_DESC__H__ +#define __USBD_DESC__H__ + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "usbd_def.h" + +/* USER CODE BEGIN INCLUDE */ + +/* USER CODE END INCLUDE */ + +/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY + * @{ + */ + +/** @defgroup USBD_DESC USBD_DESC + * @brief Usb device descriptors module. + * @{ + */ + +/** @defgroup USBD_DESC_Exported_Constants USBD_DESC_Exported_Constants + * @brief Constants. + * @{ + */ +#define DEVICE_ID1 (UID_BASE) +#define DEVICE_ID2 (UID_BASE + 0x4) +#define DEVICE_ID3 (UID_BASE + 0x8) + +#define USB_SIZ_STRING_SERIAL 0x1A + +/* USER CODE BEGIN EXPORTED_CONSTANTS */ + +/* USER CODE END EXPORTED_CONSTANTS */ + +/** + * @} + */ + +/** @defgroup USBD_DESC_Exported_Defines USBD_DESC_Exported_Defines + * @brief Defines. + * @{ + */ + +/* USER CODE BEGIN EXPORTED_DEFINES */ + +/* USER CODE END EXPORTED_DEFINES */ + +/** + * @} + */ + +/** @defgroup USBD_DESC_Exported_TypesDefinitions USBD_DESC_Exported_TypesDefinitions + * @brief Types. + * @{ + */ + +/* USER CODE BEGIN EXPORTED_TYPES */ + +/* USER CODE END EXPORTED_TYPES */ + +/** + * @} + */ + +/** @defgroup USBD_DESC_Exported_Macros USBD_DESC_Exported_Macros + * @brief Aliases. + * @{ + */ + +/* USER CODE BEGIN EXPORTED_MACRO */ + +/* USER CODE END EXPORTED_MACRO */ + +/** + * @} + */ + +/** @defgroup USBD_DESC_Exported_Variables USBD_DESC_Exported_Variables + * @brief Public variables. + * @{ + */ + +/** Descriptor for the Usb device. */ +extern USBD_DescriptorsTypeDef FS_Desc; + +/* USER CODE BEGIN EXPORTED_VARIABLES */ + +/* USER CODE END EXPORTED_VARIABLES */ + +/** + * @} + */ + +/** @defgroup USBD_DESC_Exported_FunctionsPrototype USBD_DESC_Exported_FunctionsPrototype + * @brief Public functions declaration. + * @{ + */ + +/* USER CODE BEGIN EXPORTED_FUNCTIONS */ + +/* USER CODE END EXPORTED_FUNCTIONS */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USBD_DESC__H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/Target/usbd_conf.c b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/Target/usbd_conf.c new file mode 100644 index 000000000..21baac33d --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/Target/usbd_conf.c @@ -0,0 +1,611 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : usbd_conf.c + * @version : v2.0_Cube + * @brief : This file implements the board support package for the USB device library + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2020 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f3xx.h" +#include "stm32f3xx_hal.h" +#include "usbd_def.h" +#include "usbd_core.h" +#include "usbd_bulk.h" +#include "boot.h" +#include "usb.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 PCD_HandleTypeDef hpcd_USB_FS; +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* USER CODE BEGIN PFP */ +/* Private function prototypes -----------------------------------------------*/ + +/* USER CODE END PFP */ + +/* Private functions ---------------------------------------------------------*/ +static USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status); +/* USER CODE BEGIN 1 */ + +/* USER CODE END 1 */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state); +#else +void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + +/******************************************************************************* + LL Driver Callbacks (PCD -> USB Device Library) +*******************************************************************************/ + +/** + * @brief Setup stage callback + * @param hpcd: PCD handle + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd) +#else +void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + USBD_LL_SetupStage((USBD_HandleTypeDef*)hpcd->pData, (uint8_t *)hpcd->Setup); +} + +/** + * @brief Data Out stage callback. + * @param hpcd: PCD handle + * @param epnum: Endpoint number + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +#else +void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + USBD_LL_DataOutStage((USBD_HandleTypeDef*)hpcd->pData, epnum, hpcd->OUT_ep[epnum].xfer_buff); +} + +/** + * @brief Data In stage callback. + * @param hpcd: PCD handle + * @param epnum: Endpoint number + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +#else +void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + USBD_LL_DataInStage((USBD_HandleTypeDef*)hpcd->pData, epnum, hpcd->IN_ep[epnum].xfer_buff); +} + +/** + * @brief SOF callback. + * @param hpcd: PCD handle + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_SOFCallback(PCD_HandleTypeDef *hpcd) +#else +void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + USBD_LL_SOF((USBD_HandleTypeDef*)hpcd->pData); +} + +/** + * @brief Reset callback. + * @param hpcd: PCD handle + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_ResetCallback(PCD_HandleTypeDef *hpcd) +#else +void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + USBD_SpeedTypeDef speed = USBD_SPEED_FULL; + + if ( hpcd->Init.speed != PCD_SPEED_FULL) + { + ASSERT_RT(BLT_FALSE); + } + /* Set Speed. */ + USBD_LL_SetSpeed((USBD_HandleTypeDef*)hpcd->pData, speed); + + /* Reset Device. */ + USBD_LL_Reset((USBD_HandleTypeDef*)hpcd->pData); +} + +/** + * @brief Suspend callback. + * When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it) + * @param hpcd: PCD handle + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_SuspendCallback(PCD_HandleTypeDef *hpcd) +#else +void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + /* Invoke hook function to allow the application to prepare entry into low power + * mode. + */ + UsbEnterLowPowerModeHook(); + /* Inform USB library that core enters in suspend Mode. */ + USBD_LL_Suspend((USBD_HandleTypeDef*)hpcd->pData); + /* Enter in STOP mode. */ + /* USER CODE BEGIN 2 */ + if (hpcd->Init.low_power_enable) + { + /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register. */ + SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk)); + } + /* USER CODE END 2 */ +} + +/** + * @brief Resume callback. + * When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it) + * @param hpcd: PCD handle + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_ResumeCallback(PCD_HandleTypeDef *hpcd) +#else +void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + /* USER CODE BEGIN 3 */ + + /* USER CODE END 3 */ + USBD_LL_Resume((USBD_HandleTypeDef*)hpcd->pData); + /* Invoke hook function to allow the application to process exit from low power + * mode. + */ + UsbLeaveLowPowerModeHook(); +} + +/** + * @brief ISOOUTIncomplete callback. + * @param hpcd: PCD handle + * @param epnum: Endpoint number + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +#else +void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + USBD_LL_IsoOUTIncomplete((USBD_HandleTypeDef*)hpcd->pData, epnum); +} + +/** + * @brief ISOINIncomplete callback. + * @param hpcd: PCD handle + * @param epnum: Endpoint number + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +#else +void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + USBD_LL_IsoINIncomplete((USBD_HandleTypeDef*)hpcd->pData, epnum); +} + +/** + * @brief Connect callback. + * @param hpcd: PCD handle + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_ConnectCallback(PCD_HandleTypeDef *hpcd) +#else +void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + USBD_LL_DevConnected((USBD_HandleTypeDef*)hpcd->pData); +} + +/** + * @brief Disconnect callback. + * @param hpcd: PCD handle + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +static void PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd) +#else +void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + USBD_LL_DevDisconnected((USBD_HandleTypeDef*)hpcd->pData); +} + +/******************************************************************************* + LL Driver Interface (USB Device Library --> PCD) +*******************************************************************************/ + +/** + * @brief Initializes the low level portion of the device driver. + * @param pdev: Device handle + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) +{ + /* Init USB Ip. */ + /* Link the driver to the stack. */ + hpcd_USB_FS.pData = pdev; + pdev->pData = &hpcd_USB_FS; + + hpcd_USB_FS.Instance = USB; + hpcd_USB_FS.Init.dev_endpoints = 8; + hpcd_USB_FS.Init.speed = PCD_SPEED_FULL; + hpcd_USB_FS.Init.phy_itface = PCD_PHY_EMBEDDED; + hpcd_USB_FS.Init.low_power_enable = DISABLE; + hpcd_USB_FS.Init.battery_charging_enable = DISABLE; + if (HAL_PCD_Init(&hpcd_USB_FS) != HAL_OK) + { + ASSERT_RT(BLT_FALSE); + } + +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) + /* Register USB PCD CallBacks */ + HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_SOF_CB_ID, PCD_SOFCallback); + HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_SETUPSTAGE_CB_ID, PCD_SetupStageCallback); + HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_RESET_CB_ID, PCD_ResetCallback); + HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_SUSPEND_CB_ID, PCD_SuspendCallback); + HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_RESUME_CB_ID, PCD_ResumeCallback); + HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_CONNECT_CB_ID, PCD_ConnectCallback); + HAL_PCD_RegisterCallback(&hpcd_USB_FS, HAL_PCD_DISCONNECT_CB_ID, PCD_DisconnectCallback); + + HAL_PCD_RegisterDataOutStageCallback(&hpcd_USB_FS, PCD_DataOutStageCallback); + HAL_PCD_RegisterDataInStageCallback(&hpcd_USB_FS, PCD_DataInStageCallback); + HAL_PCD_RegisterIsoOutIncpltCallback(&hpcd_USB_FS, PCD_ISOOUTIncompleteCallback); + HAL_PCD_RegisterIsoInIncpltCallback(&hpcd_USB_FS, PCD_ISOINIncompleteCallback); +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ + /* USER CODE BEGIN EndPoint_Configuration */ + HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x00 , PCD_SNG_BUF, 0x18); + HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x80 , PCD_SNG_BUF, 0x58); + /* USER CODE END EndPoint_Configuration */ + /* USER CODE BEGIN EndPoint_Configuration_CDC */ + HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x81 , PCD_SNG_BUF, 0xC0); + HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x01 , PCD_SNG_BUF, 0x110); + HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x82 , PCD_SNG_BUF, 0x100); + /* USER CODE END EndPoint_Configuration_CDC */ + return USBD_OK; +} + +/** + * @brief De-Initializes the low level portion of the device driver. + * @param pdev: Device handle + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_DeInit(pdev->pData); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Starts the low level portion of the device driver. + * @param pdev: Device handle + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_Start(pdev->pData); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Stops the low level portion of the device driver. + * @param pdev: Device handle + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_Stop(pdev->pData); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Opens an endpoint of the low level driver. + * @param pdev: Device handle + * @param ep_addr: Endpoint number + * @param ep_type: Endpoint type + * @param ep_mps: Endpoint max packet size + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t ep_type, uint16_t ep_mps) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_EP_Open(pdev->pData, ep_addr, ep_mps, ep_type); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Closes an endpoint of the low level driver. + * @param pdev: Device handle + * @param ep_addr: Endpoint number + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_EP_Close(pdev->pData, ep_addr); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Flushes an endpoint of the Low Level Driver. + * @param pdev: Device handle + * @param ep_addr: Endpoint number + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_EP_Flush(pdev->pData, ep_addr); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Sets a Stall condition on an endpoint of the Low Level Driver. + * @param pdev: Device handle + * @param ep_addr: Endpoint number + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_EP_SetStall(pdev->pData, ep_addr); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Clears a Stall condition on an endpoint of the Low Level Driver. + * @param pdev: Device handle + * @param ep_addr: Endpoint number + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_EP_ClrStall(pdev->pData, ep_addr); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Returns Stall condition. + * @param pdev: Device handle + * @param ep_addr: Endpoint number + * @retval Stall (1: Yes, 0: No) + */ +uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) +{ + PCD_HandleTypeDef *hpcd = (PCD_HandleTypeDef*) pdev->pData; + + if((ep_addr & 0x80) == 0x80) + { + return hpcd->IN_ep[ep_addr & 0x7F].is_stall; + } + else + { + return hpcd->OUT_ep[ep_addr & 0x7F].is_stall; + } +} + +/** + * @brief Assigns a USB address to the device. + * @param pdev: Device handle + * @param dev_addr: Device address + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_SetAddress(pdev->pData, dev_addr); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Transmits data over an endpoint. + * @param pdev: Device handle + * @param ep_addr: Endpoint number + * @param pbuf: Pointer to data to be sent + * @param size: Data size + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_EP_Transmit(pdev->pData, ep_addr, pbuf, size); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Prepares an endpoint for reception. + * @param pdev: Device handle + * @param ep_addr: Endpoint number + * @param pbuf: Pointer to data to be received + * @param size: Data size + * @retval USBD status + */ +USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size) +{ + HAL_StatusTypeDef hal_status = HAL_OK; + USBD_StatusTypeDef usb_status = USBD_OK; + + hal_status = HAL_PCD_EP_Receive(pdev->pData, ep_addr, pbuf, size); + + usb_status = USBD_Get_USB_Status(hal_status); + + return usb_status; +} + +/** + * @brief Returns the last transfered packet size. + * @param pdev: Device handle + * @param ep_addr: Endpoint number + * @retval Recived Data Size + */ +uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr) +{ + return HAL_PCD_EP_GetRxCount((PCD_HandleTypeDef*) pdev->pData, ep_addr); +} + +/** + * @brief Delays routine for the USB device library. + * @param Delay: Delay in ms + * @retval None + */ +void USBD_LL_Delay(uint32_t Delay) +{ + HAL_Delay(Delay); +} + +/** + * @brief Software device connection + * @param hpcd: PCD handle + * @param state: Connection state (0: disconnected / 1: connected) + * @retval None + */ +#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) +void PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state) +#else +void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state) +#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ +{ + /* USER CODE BEGIN 6 */ + if (state == 1) + { + /* Configure Low connection state. */ + UsbConnectHook(BLT_TRUE); + } + else + { + /* Configure High connection state. */ + UsbConnectHook(BLT_FALSE); + } + /* USER CODE END 6 */ +} + +/** + * @brief Retuns the USB status depending on the HAL status: + * @param hal_status: HAL status + * @retval USB status + */ +USBD_StatusTypeDef USBD_Get_USB_Status(HAL_StatusTypeDef hal_status) +{ + USBD_StatusTypeDef usb_status = USBD_OK; + + switch (hal_status) + { + case HAL_OK : + usb_status = USBD_OK; + break; + case HAL_ERROR : + usb_status = USBD_FAIL; + break; + case HAL_BUSY : + usb_status = USBD_BUSY; + break; + case HAL_TIMEOUT : + usb_status = USBD_FAIL; + break; + default : + usb_status = USBD_FAIL; + break; + } + return usb_status; +} + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/Target/usbd_conf.h b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/Target/usbd_conf.h new file mode 100644 index 000000000..2a5602c47 --- /dev/null +++ b/Target/Demo/ARMCM4_STM32F3_Olimexino_STM32F3_CubeIDE/Boot/USB_DEVICE/Target/usbd_conf.h @@ -0,0 +1,198 @@ +/** + ****************************************************************************** + * @file : usbd_conf.h + * @version : v2.0_Cube + * @brief : Header for usbd_conf.c file. + ****************************************************************************** + * This notice applies to any and all portions of this file + * that are not between comment pairs USER CODE BEGIN and + * USER CODE END. Other portions of this file, whether + * inserted by the user or by software development tools + * are owned by their respective copyright owners. + * + * Copyright (c) 2018 STMicroelectronics International N.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted, provided that the following conditions are met: + * + * 1. Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific written permission. + * 4. This software, including modifications and/or derivative works of this + * software, must execute solely and exclusively on microcontroller or + * microprocessor devices manufactured by or for STMicroelectronics. + * 5. Redistribution and use of this software other than as permitted under + * this license is void and will automatically terminate your rights under + * this license. + * + * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY + * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT + * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USBD_CONF__H__ +#define __USBD_CONF__H__ + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include +#include +#include +#include "stm32f3xx.h" +#include "stm32f3xx_hal.h" +#include "usbd_def.h" + +/* USER CODE BEGIN INCLUDE */ + +/* USER CODE END INCLUDE */ + +/** @addtogroup USBD_OTG_DRIVER + * @{ + */ + +/** @defgroup USBD_CONF USBD_CONF + * @brief Configuration file for Usb otg low level driver. + * @{ + */ + +/** @defgroup USBD_CONF_Exported_Variables USBD_CONF_Exported_Variables + * @brief Public variables. + * @{ + */ + +/** + * @} + */ + +/** @defgroup USBD_CONF_Exported_Defines USBD_CONF_Exported_Defines + * @brief Defines for configuration of the Usb device. + * @{ + */ + +/*---------- -----------*/ +#define USBD_MAX_NUM_INTERFACES 1U +/*---------- -----------*/ +#define USBD_MAX_NUM_CONFIGURATION 1U +/*---------- -----------*/ +#define USBD_MAX_STR_DESC_SIZ 512U +/*---------- -----------*/ +#define USBD_DEBUG_LEVEL 0U +/*---------- -----------*/ +#define USBD_SELF_POWERED 1U + +/****************************************/ +/* #define for FS and HS identification */ +#define DEVICE_FS 0 + +/** + * @} + */ + +/** @defgroup USBD_CONF_Exported_Macros USBD_CONF_Exported_Macros + * @brief Aliases. + * @{ + */ + +/* Memory management macros */ + +/** Alias for memory allocation. */ +#define USBD_malloc /* Not used */ + +/** Alias for memory release. */ +#define USBD_free /* Not used */ + +/** Alias for memory set. */ +#define USBD_memset /* Not used */ + +/** Alias for memory copy. */ +#define USBD_memcpy /* Not used */ + +/** Alias for delay. */ +#define USBD_Delay HAL_Delay + +/* DEBUG macros */ + +#if (USBD_DEBUG_LEVEL > 0) +#define USBD_UsrLog(...) printf(__VA_ARGS__);\ + printf("\n"); +#else +#define USBD_UsrLog(...) +#endif + +#if (USBD_DEBUG_LEVEL > 1) + +#define USBD_ErrLog(...) printf("ERROR: ") ;\ + printf(__VA_ARGS__);\ + printf("\n"); +#else +#define USBD_ErrLog(...) +#endif + +#if (USBD_DEBUG_LEVEL > 2) +#define USBD_DbgLog(...) printf("DEBUG : ") ;\ + printf(__VA_ARGS__);\ + printf("\n"); +#else +#define USBD_DbgLog(...) +#endif + +/** + * @} + */ + +/** @defgroup USBD_CONF_Exported_Types USBD_CONF_Exported_Types + * @brief Types. + * @{ + */ + +/** + * @} + */ + +/** @defgroup USBD_CONF_Exported_FunctionsPrototype USBD_CONF_Exported_FunctionsPrototype + * @brief Declaration of public functions for Usb device. + * @{ + */ + +/* Exported functions -------------------------------------------------------*/ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USBD_CONF__H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/