Draft implementation of downstream SPI interface. Significant mods

required to USB MSC class, mainly in usbd_msc_scsi.c. Currently
untested!
pull/7/head
Robert Fisk 10 years ago
parent 5acf8bbb88
commit d3da69eb07

@ -108,7 +108,7 @@
</toolChain> </toolChain>
</folderInfo> </folderInfo>
<sourceEntries> <sourceEntries>
<entry excluding="Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_storage_template.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_smartcard.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pccard.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nor.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nand.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_iwdg.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_irda.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_eth.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_msp_template.c|Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_conf_template.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> <entry excluding="Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_crc.c|Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_storage_template.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_smartcard.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pccard.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nor.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nand.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_iwdg.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_irda.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_eth.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_msp_template.c|Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_conf_template.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries> </sourceEntries>
</configuration> </configuration>
</storageModule> </storageModule>
@ -227,7 +227,7 @@
</toolChain> </toolChain>
</folderInfo> </folderInfo>
<sourceEntries> <sourceEntries>
<entry excluding="Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_storage_template.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_smartcard.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pccard.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nor.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nand.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_iwdg.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_irda.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_eth.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_msp_template.c|Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_conf_template.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/> <entry excluding="Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_crc.c|Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_storage_template.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fmc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_smartcard.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sdram.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sai.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pccard.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nor.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_nand.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_ltdc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_iwdg.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_irda.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2s_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hash_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_eth.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma2d.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dcmi.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cryp_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c|Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_msp_template.c|Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_conf_template.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries> </sourceEntries>
</configuration> </configuration>
</storageModule> </storageModule>

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1683135697176326939" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true"> <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1687181002117189685" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <language-scope id="org.eclipse.cdt.core.g++"/>
</provider> </provider>
@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1645847539306661941" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true"> <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1669631317434636379" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/> <language-scope id="org.eclipse.cdt.core.g++"/>
</provider> </provider>

Binary file not shown.

@ -1,29 +1,29 @@
:020000040800F2 :020000040800F2
:1000000000C00120F53600084137000841370008DC :1000000000C00120E9360008353700083537000800
:100010004137000841370008413700080000000060 :100010003537000835370008353700080000000084
:100020000000000000000000000000004137000850 :10002000000000000000000000000000353700085C
:100030004137000800000000413700080D070008A4 :100030003537000800000000353700080D070008BC
:1000400041370008413700084137000841370008B0 :1000400035370008353700083537000835370008E0
:1000500041370008413700084137000841370008A0 :1000500035370008353700083537000835370008D0
:100060004137000841370008413700084137000890 :1000600035370008353700083537000835370008C0
:100070004137000841370008413700084137000880 :1000700035370008353700083537000835370008B0
:100080004137000841370008413700084137000870 :1000800035370008353700083537000835370008A0
:100090004137000841370008413700084137000860 :100090003537000835370008353700083537000890
:1000A0004137000841370008413700084137000850 :1000A0003537000835370008353700083537000880
:1000B0004137000841370008413700084137000840 :1000B0003537000835370008353700083537000870
:1000C0004137000841370008413700084137000830 :1000C0003537000835370008353700083537000860
:1000D0004137000841370008413700084137000820 :1000D0003537000835370008353700083537000850
:1000E0004137000841370008413700084137000810 :1000E0003537000835370008353700083537000840
:1000F0004137000841370008413700084137000800 :1000F0003537000835370008353700083537000830
:1001000041370008413700084137000841370008EF :10010000353700083537000835370008353700081F
:1001100041370008413700084137000841370008DF :10011000353700083537000835370008353700080F
:1001200041370008413700084137000841370008CF :1001200035370008353700083537000835370008FF
:1001300041370008000000000000000041370008BF :1001300035370008000000000000000035370008D7
:10014000413700084137000841370008ED06000834 :10014000353700083537000835370008ED06000858
:10015000413700084137000841370008413700089F :1001500035370008353700083537000835370008CF
:10016000413700084137000841370008413700088F :1001600035370008353700083537000835370008BF
:10017000413700084137000800000000000000007F :100170003537000835370008000000000000000097
:10018000413700084137000808B1022070470020BD :10018000353700083537000808B1022070470020D5
:10019000704700BF30B94FF480330B604FF40073E9 :10019000704700BF30B94FF480330B604FF40073E9
:1001A000138070470220704708B10220704700207A :1001A000138070470220704708B10220704700207A
:1001B000704700BF08B1022070470020704700BFA1 :1001B000704700BF08B1022070470020704700BFA1
@ -34,20 +34,20 @@
:1002000040B270470020704712230B8000487047AF :1002000040B270470020704712230B8000487047AF
:100210004000002004230B80004870473C00002071 :100210004000002004230B80004870473C00002071
:1002200010B50A46034C0448214600F04DFD204617 :1002200010B50A46034C0448214600F04DFD204617
:1002300010BD00BF74010020F838000810B50A4650 :1002300010BD00BF74010020EC38000810B50A465C
:10024000034C0448214600F03FFD204610BD00BF8E :10024000034C0448214600F03FFD204610BD00BF8E
:10025000740100200C39000808B50A4620B9054889 :10025000740100200039000808B50A4620B9054895
:10026000054900F031FD03E00248034900F02CFD90 :10026000054900F031FD03E00248034900F02CFD90
:10027000014808BD203900087401002008B50A466D :10027000014808BD143900087401002008B50A4679
:1002800020B90548054900F01FFD03E00248034975 :1002800020B90548054900F01FFD03E00248034975
:1002900000F01AFD014808BD303900087401002043 :1002900000F01AFD014808BD24390008740100204F
:1002A00008B50A4620B90548054900F00DFD03E0F0 :1002A00008B50A4620B90548054900F00DFD03E0F0
:1002B0000248034900F008FD014808BD3C39000828 :1002B0000248034900F008FD014808BD3039000834
:1002C000740100200368B3F1A04F22D130B587B08C :1002C000740100200368B3F1A04F22D130B587B08C
:1002D000104B5A6B42F080025A635A6C42F48042CF :1002D000104B5A6B42F080025A635A6C42F48042CF
:1002E0005A644FF4C05301930223029300240394F1 :1002E0005A644FF4C05301930223029300240394F1
:1002F00004940A250595084801A903F041F8432014 :1002F00004940A250595084801A903F03BF843201A
:100300002946224603F044F9432003F073F907B06D :100300002946224603F03EF9432003F06DF907B079
:1003100030BD7047003802400000024008B5014679 :1003100030BD7047003802400000024008B5014679
:10032000D0F8AC0301F55F7100F024FD08BD00BFFB :10032000D0F8AC0301F55F7100F024FD08BD00BFFB
:1003300008B5C1EBC1039B000344D0F8AC03D3F86C :1003300008B5C1EBC1039B000344D0F8AC03D3F86C
@ -65,59 +65,59 @@
:1003F000ABFD08BD38B503782BBB144CC4F8AC0377 :1003F000ABFD08BD38B503782BBB144CC4F8AC0377
:10040000C0F820424FF0A04323600723636002231B :10040000C0F820424FF0A04323600723636002231B
:10041000E360002525616561A361E5612562656290 :10041000E360002525616561A361E5612562656290
:10042000A562E562204602F09FFB2046802102F093 :10042000A562E562204602F099FB2046802102F099
:1004300039FB20462946402202F010FB20460121CC :1004300033FB20462946402202F00AFB20460121D8
:10044000802202F00BFB002038BD00BF74030020A7 :10044000802202F005FB002038BD00BF74030020AD
:1004500008B5D0F8200202F0F5FB002008BD00BF6F :1004500008B5D0F8200202F0EFFB002008BD00BF75
:1004600010B51446D0F820021A46234602F03AFE90 :1004600010B51446D0F820021A46234602F034FE96
:10047000002010BD08B5D0F8200202F067FE002071 :10047000002010BD08B5D0F8200202F061FE002077
:1004800008BD00BF08B5D0F8200202F05DFF0020D3 :1004800008BD00BF08B5D0F8200202F057FF0020D9
:1004900008BD00BF08B5D0F8200202F0F7FE00202A :1004900008BD00BF08B5D0F8200202F0F1FE002030
:1004A00008BD00BF08B5D0F8200202F021FF0020EF :1004A00008BD00BF08B5D0F8200202F01BFF0020F5
:1004B00008BD00BFD0F8202211F0800F08D001F055 :1004B00008BD00BFD0F8202211F0800F08D001F055
:1004C0007F03C3EBC3039B00134493F832007047D0 :1004C0007F03C3EBC3039B00134493F832007047D0
:1004D00001F07F01C1EBC1018900114491F8D601FF :1004D00001F07F01C1EBC1018900114491F8D601FF
:1004E000704700BF08B5D0F8200202F0E9FD0020F7 :1004E000704700BF08B5D0F8200202F0E3FD0020FD
:1004F00008BD00BF08B5D0F8200202F093FE00202E :1004F00008BD00BF08B5D0F8200202F08DFE002034
:1005000008BD00BF08B5D0F8200202F04BFE002065 :1005000008BD00BF08B5D0F8200202F045FE00206B
:1005100008BD00BF08B5D0F8200202F079FE08BD82 :1005100008BD00BF08B5D0F8200202F073FE08BD88
:1005200010B5094C20460949002200F0EBFB20469B :1005200010B5094C20460949002200F0EBFB20469B
:10053000074900F0FBFB2046064901F061FA20461E :10053000074900F0FBFB2046064901F05BFA204624
:1005400000F0FCFB10BD00BF2407002020000020AD :1005400000F0FCFB10BD00BF2407002020000020AD
:10055000A000002000000020F0B587B0224B1A6BED :10055000A000002000000020F0B587B0224B1A6BED
:1005600042F001021A631A6B42F002021A631A6B1C :1005600042F001021A631A6B42F002021A631A6B1C
:1005700042F004021A631A6B42F008021A6341F651 :1005700042F004021A631A6B42F008021A6341F651
:10058000FF730193002502950127039704950595B4 :10058000FF730193002502950127039704950595B4
:10059000164801A902F0F4FE4FF6E77301931448E0 :10059000164801A902F0EEFE4FF6E77301931448E6
:1005A00001A902F0EDFE4FF6FF730193114C2046B6 :1005A00001A902F0E7FE4FF6FF730193114C2046BC
:1005B00001A902F0E5FE104801A902F0E1FE1023B6 :1005B00001A902F0DFFE104801A902F0DBFE1023C2
:1005C000019303230293204601A902F0D9FE4FF4C0 :1005C000019303230293204601A902F0D3FE4FF4C6
:1005D0008056019602970395204601A902F0D0FEAD :1005D0008056019602970395204601A902F0CAFEB3
:1005E000A66107B0F0BD00BF003802400000024025 :1005E000A66107B0F0BD00BF003802400000024025
:1005F0000004024000080240000C024008B5044814 :1005F0000004024000080240000C024008B5044814
:10060000044B03600023437102F0A0FF08BD00BF4C :10060000044B03600023437102F09AFF08BD00BF52
:10061000480900200030024008B50D480D4B03602A :10061000480900200030024008B50D480D4B03602A
:10062000002380F851304FF4827242608360C360CF :10062000002380F851304FF4827242608360C360CF
:10063000036143614FF480228261C36103624362BC :10063000036143614FF480228261C36103624362BC
:100640004FF4005383620723C36201F0C1FE08BD6B :100640004FF4005383620723C36201F0BBFE08BD71
:10065000500900200030014000B593B01B4A136CD4 :10065000500900200030014000B593B01B4A136CD4
:1006600043F080531364A2F5E432136823F440434B :1006600043F080531364A2F5E432136823F440434B
:1006700043F40043136001230693079302230C9372 :1006700043F40043136001230693079302230C9372
:100680004FF480030D9308230E934FF4A8730F9338 :100680004FF480030D9308230E934FF4A8730F9338
:10069000042310930723119306A801F0D9FE00B19B :10069000042310930723119306A801F0D3FE00B1A1
:1006A000FEE70D23019302210291002303934FF4EF :1006A000FEE70D23019302210291002303934FF4EF
:1006B000A05304934FF48053059301A802F050F81F :1006B000A05304934FF48053059301A802F04AF825
:1006C00000B1FEE713B05DF804FB00BF0038024044 :1006C00000B1FEE713B05DF804FB00BF0038024044
:1006D00008B502F0B9FFFFF7BFFFFFF73DFFFFF7D7 :1006D00008B502F0B3FFFFF7BFFFFFF73DFFFFF7DD
:1006E0008DFFFFF799FFFFF71BFFFEE710B5054CE5 :1006E0008DFFFFF799FFFFF71BFFFEE710B5054CE5
:1006F0004FF08053A361044802F0BAFA4FF48053DC :1006F0004FF08053A361044802F0B4FA4FF48053E2
:10070000A36110BD000802407403002008B502F088 :10070000A36110BD000802407403002008B502F088
:10071000B5FF08BD08B54FF0FF300221002202F0FE :10071000AFFF08BD08B54FF0FF300221002202F004
:1007200037FF08BD0268044B9A4204D1034A136B99 :1007200031FF08BD0268044B9A4204D1034A136B9F
:1007300043F4805313637047003002400038024096 :1007300043F4805313637047003002400038024096
:1007400002680D4B9A4216D100B587B00B4A536C24 :1007400002680D4B9A4216D100B587B00B4A536C24
:1007500043F480535364F0230193022302930393E1 :1007500043F480535364F0230193022302930393E1
:100760000123049305230593054801A902F008FE1F :100760000123049305230593054801A902F002FE25
:1007700007B05DF804FB70470030014000380240CC :1007700007B05DF804FB70470030014000380240CC
:100780000000024038B50D4613460222C0F8F4219D :100780000000024038B50D4613460222C0F8F4219D
:100790008361C36100212A46FFF7ACFE002038BD0B :100790008361C36100212A46FFF7ACFE002038BD0B
@ -249,12 +249,12 @@
:100F70001C32D86901EBC1018900084401790531AF :100F70001C32D86901EBC1018900084401790531AF
:100F800013798B4203D90B4601E00723064863819E :100F800013798B4203D90B4601E00723064863819E
:100F900004E0013B9BB2C15CE2181173002BF8D155 :100F900004E0013B9BB2C15CE2181173002BF8D155
:100FA00000205DF8044B70474C390008D0F8180257 :100FA00000205DF8044B704740390008D0F8180263
:100FB0000823438105E0013B9BB2044AD15CC2187F :100FB0000823438105E0013B9BB2044AD15CC2187F
:100FC0001173002BF7D10020704700BF5C39000877 :100FC0001173002BF7D10020704700BF5039000883
:100FD000D0F818020823438105E0013B9BB2044A84 :100FD000D0F818020823438105E0013B9BB2044A84
:100FE000D15CC2181173002BF7D10020704700BFED :100FE000D15CC2181173002BF7D10020704700BFED
:100FF0005439000810B4D0F81842002304E0E11876 :100FF0004839000810B4D0F81842002304E0E11882
:10100000002008730133DBB2112BF8D9702323734E :10100000002008730133DBB2112BF8D9702323734E
:101010000C23E37494F85C3294F85D128B4212D086 :101010000C23E37494F85C3294F85D128B4212D086
:1010200003F1470104EBC1010879A073487A2076E7 :1010200003F1470104EBC1010879A073487A2076E7
@ -277,669 +277,668 @@
:101130002074C3F307406074C3F30723A374013A18 :101130002074C3F307406074C3F30723A374013A18
:10114000E27402232375BDF80630002262751A0A84 :10114000E27402232375BDF80630002262751A0A84
:10115000A275E3750C23638148B202B070BD00BF75 :10115000A275E3750C23638148B202B070BD00BF75
:1011600070B505460E46D0F81842D0F81C325B68C0 :10116000F8B505460F46D0F81842D0F81C325B6837
:10117000084604F5187104F25E22984738B12846F3 :10117000084604F5187104F25E22984738B12846F3
:10118000314602223A23FFF76FFFFF2117E00146A5 :10118000394602223A23FFF76FFFFF261DE006468D
:10119000D4F86022531E180E2073C3F30740607307 :10119000B4F85E124FF4007393FBF1F3A4F86A32D3
:1011A000C3F30723A373013AE273B4F85E3200225B :1011A000D4F86022531E180E2073C3F307406073F7
:1011B000227462741A0AA274E3740823638148B229 :1011B000C3F30723A373013AE27300232374637418
:1011C00070BD00BF10B5D0F818421344D4F8604287 :1011C0000B0AA374E1740823638170B2F8BD00BFF9
:1011D000A34205D905222123FFF746FFFF2000E0A7 :1011D00010B5D0F818421344D4F86042A34205D9A0
:1011E000002040B210BD00BF2DE9F0410646884600 :1011E00005222123FFF740FFFF2000E0002040B24E
:1011F000D0F81842D4F86852B5F5007F28BF4FF4F4 :1011F00010BD00BF2DE9F84307468946D0F81842D4
:101200000075D0F81C32D3F810C004F10C07B4F804 :10120000B4F86A52B4F868329D4228BF1D46B4F85B
:101210005E22B5FBF2FE08463946D4F86432B3FBD1 :101210005E6206FB05F6D0F81C32D3F810C004F16C
:10122000F2F21FFA8EF3E047002807DA3046414613 :101220000C0808464146D4F864222B46E0470028C3
:1012300004221123FFF718FFFF201AE03046812116 :1012300007DA3846494604221123FFF715FFFF203D
:101240003A46ABB2FFF756F9D4F864322B44C4F8EF :101240001BE0384681214246B3B2FFF753F9D4F888
:101250006432D4F868325B1BC4F86832D4F83422A4 :1012500064322B44C4F86432B4F868325D1BADB21A
:10126000551BC4F834521BB903232372002000E03D :10126000A4F86852D4F834329E1BC4F834621DB915
:10127000002040B2BDE8F081F8B506460F46D0F830 :1012700003232372002000E0002040B2BDE8F88381
:101280001842237A002B4FD1154694F91832002BBF :10128000F8B506460F46D0F81842237A002B47D10E
:1012900007DB94F8191205222023FFF7E5FEFF2053 :10129000154694F91832002B07DB94F81912052231
:1012A0004BE0D0F81C329B680846984738B130466E :1012A0002023FFF7E1FEFF2043E0D0F81C329B68CB
:1012B000394602223A23FFF7D7FEFF203DE0AA7805 :1012B0000846984738B13046394602223A23FFF7AC
:1012C000EB781B0443EA02632A7943EA02236A7932 :1012C000D3FEFF2035E0AA78EB781B0443EA0263E3
:1012D0001A43C4F86422EB79297A41EA0323C4F85B :1012D0002A7943EA02236A791A43C4F86422EB7933
:1012E000683230463946FFF76DFF002824DB0223C1 :1012E000297A41EA0323A4F8683230463946FFF7E9
:1012F0002372B4F85E12D4F8642201FB02F2C4F83F :1012F0006FFF00281CDB02232372D4F81422B4F8F9
:101300006422D4F8683203FB01F3C4F86832D4F8DD :101300006812B4F85E3203FB01F39A4208D030460B
:101310001422934208D0304694F819120522202353 :1013100094F8191205222023FFF7A6FEFF2008E00B
:10132000FFF7A2FEFF2008E04FF400736381304610 :101320004FF40073638130463946FFF763FF00E0F6
:101330003946FFF759FF00E0FF2040B2F8BD00BF7B :10133000FF2040B2F8BD00BF2DE9F04106468846C7
:101340002DE9F04106468846D0F81842D4F8685294 :10134000D0F81842B4F86852B5F5007F01D34FF4D5
:10135000B5F5007F28BF4FF40075D0F81C32D3F8E4 :101350000075D6F81C32D3F814C004F10C07D4F889
:1013600014C004F10C07B4F85E22B5FBF2FE084687 :101360006422B4F85E3240463946B2FBF3F2B5FB74
:101370003946D4F86432B3FBF2F21FFA8EF3E04739 :10137000F3F3E047002807DA30464146042203230E
:10138000002807DA3046414604220323FFF76CFEAB :10138000FFF772FEFF2021E0D4F864322B44C4F84A
:10139000FF2021E0D4F864322B44C4F86432D4F83E :101390006432B4F868325B1B9BB2A4F86832D4F8AC
:1013A00068325B1BC4F86832D4F83422551BC4F889 :1013A0003422551BC4F834522BB93046002100F0CA
:1013B00034522BB93046002100F07CF900200BE0BC :1013B0007BF900200AE0304601213A46B3F5007F70
:1013C000B3F5007F28BF4FF40073304601213A4641 :1013C00028BF4FF40073FFF79DF8002040B2BDE83E
:1013D0009BB2FFF797F8002040B2BDE8F08100BF54 :1013D000F08100BF2DE9F04105460F46D0F81842D4
:1013E0002DE9F04105460F46D0F81842237A002B2C :1013E000237A002B6ED1164694F91832002B08DAB6
:1013F0006ED1164694F91832002B08DA94F81912B7 :1013F00094F8191205222023FFF736FE4FF0FF085C
:1014000005222023FFF730FE4FF0FF0866E0D0F8FA :1014000066E0D0F81C329B680846984740B12846F1
:101410001C329B680846984740B12846394602224C :10141000394602223A23FFF727FE4FF0FF0857E034
:101420003A23FFF721FE4FF0FF0857E0D5F81C32B2 :10142000D5F81C32DB6838469847804640B12846DC
:10143000DB6838469847804640B128463946022244 :10143000394602222723FFF717FE4FF0FF0847E047
:101440002723FFF711FE4FF0FF0847E0B278F3784B :10144000B278F3781B0443EA0263327943EA022359
:101450001B0443EA0263327943EA022372791A4396 :1014500072791A43C4F86422F379317A41EA03239A
:10146000C4F86422F379317A41EA0323C4F868327C :10146000A4F8683228463946FFF7B2FE00282DDB83
:1014700028463946FFF7A6FE00282DDBB4F85E1299 :10147000B4F85E12D4F8642201FB02F2C4F86422CC
:10148000D4F8642201FB02F2C4F86422D4F8683272 :10148000B4F8683203FB01F39BB2A4F86832D4F8D5
:1014900003FB01F3C4F86832D4F81422934209D054 :1014900014229A4209D0284694F8191205222023D2
:1014A000284694F8191205222023FFF7DDFD4FF09E :1014A000FFF7E2FD4FF0FF0812E00121217228460C
:1014B000FF0813E001212172B3F5007F28BF4FF42C :1014B00004F10C02B3F5007F28BF4FF40073FFF76F
:1014C0000073284604F10C029BB2FFF71BF805E0FD :1014C00021F805E0FFF738FF804601E04FF0FF0804
:1014D000FFF736FF804601E04FF0FF084FFA88F033 :1014D0004FFA88F0BDE8F08110B5D0F81842537883
:1014E000BDE8F08110B5D0F81842537813F0020F20 :1014E00013F0020F05D005222423FFF7BDFDFF20D6
:1014F00005D005222423FFF7B7FDFF200BE0D4F829 :1014F0000BE0D4F86422B4F86832FFF769FE0028E4
:101500006422B4F86832FFF75DFE002802DB002099 :1015000002DB0020608100E0FF2040B210BD00BF80
:10151000608100E0FF2040B210BD00BF08B5137825 :1015100008B513785A2B53D8DFE803F02E52523116
:101520005A2B53D8DFE803F02E5252315252525206 :1015200052525252525252525252525252523452B9
:1015300052525252525252525252345252525252A9 :101530005252525252523D3752523A5252525243E2
:1015400052523D3752523A525252524352465252DE :101540005246525249524C525252524F5252525299
:1015500049524C525252524F52525252525252527D :10155000525252525252525252525252525252526B
:10156000525252525252525252525252525252525B :10156000525252525252525252525252525252525B
:10157000525252525252525252525252525252524B :101570005252525252524000FFF78EFD25E0FFF7C3
:1015800052524000FFF788FD25E0FFF733FD22E0CF :1015800039FD22E0FFF7ECFC1FE0FFF767FD1CE0F0
:10159000FFF7E6FC1FE0FFF761FD1CE0FFF75EFDD3 :10159000FFF764FD19E0FFF709FD16E0FFF718FDFE
:1015A00019E0FFF703FD16E0FFF712FD13E0FFF768 :1015A00013E0FFF79FFD10E0FFF7DAFD0DE0FFF716
:1015B00099FD10E0FFF7D4FD0DE0FFF75DFE0AE0B6 :1015B00067FE0AE0FFF70EFF07E0FFF78DFF04E08C
:1015C000FFF70EFF07E0FFF78DFF04E00522202361 :1015C00005222023FFF750FDFF2040B208BD00BFD9
:1015D000FFF74AFDFF2040B208BD00BF38B5054601 :1015D00038B50546D0F8184294F818323BB9D4F81B
:1015E000D0F8184294F818323BB9D4F8143223B129 :1015E000143223B1637A13B90121FEF753FF284661
:1015F000637A13B90121FEF74DFF28468121FEF7DA :1015F0008121FEF74FFF637A022B06D12846012195
:1016000049FF637A022B06D12846012104F50372B3 :1016000004F503721F23FEF77DFF38BD10B50C46AD
:101610001F23FEF777FF38BD10B50C46D0F818121F :10161000D0F81812D1F814329A4228BF1A4693B261
:10162000D1F814329A4228BF1A4693B2D1F8342224 :10162000D1F83422D21AC1F83422002281F83822AB
:10163000D21AC1F83422002281F8382204220A7218 :1016300004220A7281212246FEF75CFF10BD00BF22
:1016400081212246FEF756FF10BD00BF38B5054682 :1016400038B50546D0F8184200202072607284F840
:10165000D0F8184200202072607284F85D0284F88D :101650005D0284F85C02D5F81C321B689847284666
:101660005C02D5F81C321B68984728460121FEF71A :101660000121FEF70FFF28468121FEF70BFF2846D8
:1016700009FF28468121FEF705FF2846012104F5D0 :10167000012104F503721F23FEF744FF38BD00BFAC
:1016800003721F23FEF73EFF38BD00BF08B5D0F838 :1016800008B5D0F81822002313720121517202F517
:101690001822002313720121517202F503721F23D5 :1016900003721F23FEF736FF08BD00BFD0F81832D3
:1016A000FEF730FF08BD00BFD0F8183200221A72D2 :1016A00000221A72704700BF38B50546D0F81842BC
:1016B000704700BF38B50546D0F818420A4BC4F849 :1016B0000A4BC4F82C3284F838120023237281219B
:1016C0002C3284F8381200232372812104F50B7226 :1016C00004F50B720D23FEF715FF2846012104F5E2
:1016D0000D23FEF70FFF2846012104F503721F2397 :1016D00003721F23FEF716FF38BD00BF5553425358
:1016E000FEF710FF38BD00BF5553425310B50446F6 :1016E00010B50446D0F81822137A022B03D012D377
:1016F000D0F81822137A022B03D012D3042B0DD961 :1016F000042B0DD910BD92F8191202F21B22FFF72C
:1017000010BD92F8191202F21B22FFF707FF002802 :1017000007FF002807DA20460121FFF7CDFF10BDB3
:1017100007DA20460121FFF7CDFF10BD0021FFF7BA :101710000021FFF7C9FF10BD38B50546D0F81842C3
:10172000C9FF10BD38B50546D0F81842D4F81032BC :10172000D4F81032C4F83032D4F81432C4F8343259
:10173000C4F83032D4F81432C4F834320121FEF740 :101730000121FEF7EFFE1F280DD1D4F80C221F4B1C
:10174000E9FE1F280DD1D4F80C221F4B9A4208D174 :101740009A4208D194F81912012904D894F81A324F
:1017500094F81912012904D894F81A320BB1102BFD :101750000BB1102B0CD9284694F81912052220231E
:101760000CD9284694F8191205222023FFF77CFC97 :10176000FFF782FC022363722846FFF731FF38BD82
:10177000022363722846FFF731FF38BD284604F282 :10177000284604F21B22FFF7CBFE00280BDA237A5F
:101780001B22FFF7CBFE00280BDA237A052B04D1AE :10178000052B04D128460121FFF78EFF38BD2846DE
:1017900028460121FFF78EFF38BD2846FFF71EFFC0 :10179000FFF71EFF38BD237A013BDBB2022B0CD9C9
:1017A00038BD237A013BDBB2022B0CD962892AB106 :1017A00062892AB1284604F10C01FFF72FFF38BDEA
:1017B000284604F10C01FFF72FFF38BD1AB928465F :1017B0001AB928460021FFF777FF38BD5553424339
:1017C0000021FFF777FF38BD5553424310B504465B :1017C00010B50446D0F81822137A13B1012B03D0B8
:1017D000D0F81822137A13B1012B03D010BDFFF7F4 :1017D00010BDFFF7A1FF10BD92F8191202F21B22F3
:1017E000A1FF10BD92F8191202F21B22FFF796FE1C :1017E000FFF796FE002803DA20460121FFF75CFF91
:1017F000002803DA20460121FFF75CFF10BD00BF7F :1017F00010BD00BF10B5D0F81842637A022B05D196
:1018000010B5D0F81842637A022B05D18121FEF77A :101800008121FEF747FE0023637210BD11F0800FA7
:1018100041FE0023637210BD11F0800F04D0012B34 :1018100004D0012B02D00121FFF746FF10BD00BF0D
:1018200002D00121FFF746FF10BD00BF2023038037 :10182000202303800048704780000020202303808D
:101830000048704780000020202303800048704744 :1018300000487047D80000202023038000487047EC
:10184000D800002020230380004870475400002067 :10184000540000200A2303800048704774000020E1
:101850000A230380004870477400002010B5044636 :1018500010B50446037C6BB9012102224FF40073DA
:10186000037C6BB9012102224FF40073FEF7F8FDEF :10186000FEF7FEFD2046812102224FF40073FEF7B1
:101870002046812102224FF40073FEF7F1FD0AE0B9 :10187000F7FD0AE0012102224023FEF7F1FD204698
:10188000012102224023FEF7EBFD204681210222A6 :10188000812102224023FEF7EBFD4FF41B7001F093
:101890004023FEF7E5FD4FF41B7001F053FFC4F841 :1018900053FFC4F8180220B12046FFF7D1FE002004
:1018A000180220B12046FFF7D1FE002010BD012014 :1018A00010BD012010BD00BF10B504460121FEF798
:1018B00010BD00BF10B504460121FEF7DBFD204638 :1018B000E1FD20468121FEF7DDFD2046FFF7EEFE2B
:1018C0008121FEF7D7FD2046FFF7EEFED4F818027F :1018C000D4F8180220B101F03FFF0023C4F8183209
:1018D00020B101F03FFF0023C4F81832002010BDF2 :1018D000002010BDF8B506460C46D0F818720B78FB
:1018E000F8B506460C46D0F818720B7813F0600570 :1018E00013F0600536D0202D75D14A78FE2A02D03B
:1018F00036D0202D75D14A78FE2A02D0FF2A1AD080 :1018F000FF2A1AD02AE04A888AB9CA88012A0ED15A
:101900002AE04A888AB9CA88012A0ED113F0800FCA :1019000013F0800F0BD0D0F81C329B6998473860D9
:101910000BD0D0F81C329B69984738603046394666 :10191000304639460122FEF735FF00255CE03046AF
:101920000122FEF72FFF00255CE030462146FEF73E :101920002146FEF797FF022556E04A8842B9CA8849
:1019300091FF022556E04A8842B9CA8832B913F0AD :1019300032B913F0800F03D1FFF7A2FE00254BE070
:10194000800F03D1FFF7A2FE00254BE03046214671 :1019400030462146FEF786FF022545E0FEF782FF7E
:10195000FEF780FF022545E0FEF77CFF022541E00F :10195000022541E04B780A2B04D00B2B07D0012B3A
:101960004B780A2B04D00B2B07D0012B3AD107E080 :101960003AD107E0391D0122FEF70CFF34E08B78F5
:10197000391D0122FEF706FF34E08B787B6031E0F1 :101970007B6031E00979FEF785FD30462179FEF77D
:101980000979FEF77FFD30462179FEF773FD94F962 :1019800079FD94F90430002B10DA337C3BB93046F2
:101990000430002B10DA337C3BB93046812102221F :10199000812102224FF40073FEF762FD16E030460B
:1019A0004FF40073FEF75CFD16E030468121022201 :1019A000812102224023FEF75BFD0FE0337C3BB92F
:1019B0004023FEF755FD0FE0337C3BB93046012153 :1019B0003046012102224FF40073FEF751FD05E08D
:1019C00002224FF40073FEF74BFD05E03046012183 :1019C0003046012102224023FEF74AFD30462179AC
:1019D00002224023FEF744FD30462179FFF710FF35 :1019D000FFF710FF00E000252846F8BD08B5FFF727
:1019E00000E000252846F8BD08B5FFF77FFE00207F :1019E0007FFE002008BD00BF08B5FFF7E9FE00201C
:1019F00008BD00BF08B5FFF7E9FE002008BD00BF25 :1019F00008BD00BF09B1C0F81C120020704700BF2D
:101A000009B1C0F81C120020704700BF0C4B01E068 :101A00000C4B01E0013B10D00269002AFADA0369AD
:101A1000013B10D00269002AFADA036943F001039E :101A100043F001030361074B01E0013B07D002697A
:101A20000361074B01E0013B07D0026912F0010F8F :101A200012F0010FF9D10020704703207047032006
:101A3000F9D100207047032070470320704700BF92 :101A3000704700BF400D030084B010B5044603A8F2
:101A4000400D030084B010B5044603A880E80E00E2 :101A400080E80E00089B012B18D1A36B23F4803390
:101A5000089B012B18D1A36B23F48033A363E368A5 :101A5000A363E36823F4840323F04003E360E368B3
:101A600023F4840323F04003E360E36823F440138A :101A600023F44013E3600D9B012B03D1E36843F49F
:101A7000E3600D9B012B03D1E36843F48013E36023 :101A70008013E3602046FFF7C3FF09E0E36843F00B
:101A80002046FFF7C3FF09E0E36843F04003E3604B :101A80004003E3602046FFF7BBFF4FF48033A363BE
:101A90002046FFF7BBFF4FF48033A363069B012B67 :101A9000069B012B07D1A36843F00C03A360A36846
:101AA00007D1A36843F00C03A360A36843F02003AD :101AA00043F02003A3600020BDE8104004B070475D
:101AB000A3600020BDE8104004B07047836843F085 :101AB000836843F00103836000207047836823F04C
:101AC0000103836000207047836823F00103836073 :101AC000010383600020704708B5C36823F0C0435A
:101AD0000020704708B5C36823F0C043C3600129E4 :101AD000C360012904D1C36843F00053C36004E02C
:101AE00004D1C36843F00053C36004E019B9C3686C :101AE00019B9C36843F08043C360322001F0CEFDD2
:101AF00043F08043C360322001F0CEFD002008BDDA :101AF000002008BD490141F020010161054B01E0D2
:101B0000490141F020010161054B01E0013B05D095 :101B0000013B05D0026912F0200FF9D10020704787
:101B1000026912F0200FF9D10020704703207047AE :101B100003207047400D030010230361054B01E0D3
:101B2000400D030010230361054B01E0013B05D08C :101B2000013B05D0026912F0100FF9D10020704777
:101B3000026912F0100FF9D100207047032070479E :101B300003207047400D0300D0F800381943C0F867
:101B4000400D0300D0F800381943C0F800180020F9 :101B400000180020704700BF84B0F8B5044607A80D
:101B5000704700BF84B0F8B5044607A880E80E00BF :101B500080E80E00A36B43F40023A3630F9E1EB91D
:101B6000A36B43F40023A3630F9E1EB9A36B43F43E :101B6000A36B43F40013A3630023C4F8003E04F501
:101B70000013A3630023C4F8003E04F50065D4F805 :101B70000065D4F80038C4F800380C9B012B0BD159
:101B80000038C4F800380C9B012B0BD1099B23B9FA :101B8000099B23B920460021FFF7D6FF08E0204635
:101B900020460021FFF7D6FF08E020460121FFF78D :101B90000121FFF7D1FF03E020460321FFF7CCFF2F
:101BA000D1FF03E020460321FFF7CCFF20461021A0 :101BA00020461021FFF7A6FF2046FFF7B5FF0023D0
:101BB000FFF7A6FF2046FFF7B5FF00232B616B61FF :101BB0002B616B614FF0FF32AA61EB61079848B36C
:101BC0004FF0FF32AA61EB61079848B304F5106348 :101BC00004F51063002219461F68002F03DA4FF056
:101BD000002219461F68002F03DA4FF090471F605C :101BD00090471F6001E000271F6000270F61FF276B
:101BE00001E000271F6000270F61FF278F6001328F :101BE0008F60013220338242EDD304F5306300224E
:101BF00020338242EDD304F53063002219461F687A :101BF00019461F68002F03DA4FF090471F6001E07D
:101C0000002F03DA4FF090471F6001E000271F60AC :101C000000271F6000270F61FF278F6001322033FC
:101C100000270F61FF278F60013220338242EDD110 :101C10008242EDD12B6923F480732B610A9B012B47
:101C20002B6923F480732B610A9B012B0ED1184B77 :101C20000ED1184B2B632B6B43F4803343F003032B
:101C30002B632B6B43F4803343F003032B632B6B39 :101C30002B632B6B0023A3616FF08043636109E08A
:101C40000023A3616FF08043636109E00022A26179 :101C40000022A2616FF0804262611BB9A36943F078
:101C50006FF0804262611BB9A36943F01003A36176 :101C50001003A361A2690C4B1343A3610D9B1BB13D
:101C6000A2690C4B1343A3610D9B1BB1A36943F005 :101C6000A36943F00803A361012E05D1A36943F0E2
:101C70000803A361012E05D1A36943F0804343F01B :101C7000804343F00403A3610020BDE8F84004B0B2
:101C80000403A3610020BDE8F84004B0704700BF22 :101C8000704700BF0001800000383C80D0F8083861
:101C90000001800000383C80D0F8083800F5006072 :101C900000F5006013F0060F10D0836803F0060310
:101CA00013F0060F10D0836803F00603022B0DD04B :101CA000022B0DD0836803F00603062B0AD083684D
:101CB000836803F00603062B0AD0836803F006034B :101CB00003F00603042B07D1022070470020704771
:101CC000042B07D102207047002070470320704783 :101CC00003207047032070470020704770B44B78A2
:101CD000032070470020704770B44B78012B1FD150 :101CD000012B1FD1D0F81C280D78AB409BB21343C9
:101CE000D0F81C280D78AB409BB21343C0F81C38C9 :101CE000C0F81C380E78730103F510631A5812F40B
:101CF0000E78730103F510631A5812F4004F2DD1BA :101CF000004F2DD11C5844F0805545F400458A68AA
:101D00001C5844F0805545F400458A68C2F30A0423 :101D0000C2F30A042C43CA7844EA824242EA865269
:101D10002C43CA7844EA824242EA86521A501DE0B5 :101D10001A501DE0D0F81C280D784FF48033AB40EA
:101D2000D0F81C280D784FF48033AB401343C0F833 :101D20001343C0F81C380B785B0103F530631A5875
:101D30001C380B785B0103F530631A5812F4004F1E :101D300012F4004F0CD11A5842F0805444F400447D
:101D40000CD11A5842F0805444F400448A68C2F31B :101D40008A68C2F30A022243C97842EA81421A50E1
:101D50000A022243C97842EA81421A50002070BC2C :101D5000002070BC704700BF30B44B78012B1BD102
:101D6000704700BF30B44B78012B1BD1D0F83C58E2 :101D6000D0F83C580C7803FA04F4A4B225EA040431
:101D70000C7803FA04F4A4B225EA0404C0F83C4841 :101D7000C0F83C48D0F81C480D78AB409BB224EA30
:101D8000D0F81C480D78AB409BB224EA0303C0F89E :101D80000303C0F81C380B785B0103F510631A5885
:101D90001C380B785B0103F510631A5822F40042DB :101D900022F400421A5019E0D0F83C480D78012294
:101DA0001A5019E0D0F83C480D78012202FA05F5E6 :101DA00002FA05F524EA0544C0F83C48D0F81C487E
:101DB00024EA0544C0F83C48D0F81C480D78AA40F5 :101DB0000D78AA4024EA0242C0F81C280B785B0187
:101DC00024EA0242C0F81C280B785B0103F530635B :101DC00003F530631A5822F400421A50002030BC48
:101DD0001A5822F400421A50002030BC704700BF4D :101DD000704700BF30B44B78012B68D14B69EBB929
:101DE00030B44B78012B68D14B69EBB90B7800EB21 :101DE0000B7800EB4313D3F8104924F0FF5424F48C
:101DF0004313D3F8104924F0FF5424F4C014C3F85B :101DF000C014C3F810490B7800EB4313D3F8104913
:101E000010490B7800EB4313D3F8104944F4002435 :101E000044F40024C3F810490B7800EB4313D3F8D3
:101E1000C3F810490B7800EB4313D3F81049E40CD6 :101E10001049E40CE404C3F810492CE00B7800EB03
:101E2000E404C3F810492CE00B7800EB4313D3F81B :101E20004313D3F81049E40CE404C3F810490B78C9
:101E30001049E40CE404C3F810490B7800EB431399 :101E300000EB4313D3F8104924F0FF5424F4C014EA
:101E4000D3F8104924F0FF5424F4C014C3F8104907 :101E4000C3F810498B684C699C4200D94B610B78F0
:101E50008B684C699C4200D94B610B7800EB4313B3 :101E500000EB4313D3F8104944F40024C3F81049AD
:101E6000D3F8104944F40024C3F810490B7800EB70 :101E60000B7800EB4313D3F810594C69C4F31204F8
:101E70004313D3F810594C69C4F312042C43C3F82C :101E70002C43C3F81049012A06D10B7800EB431319
:101E80001049012A06D10B7800EB43130A69C3F805 :101E80000A69C3F8142909E04B693BB1D0F834283A
:101E9000142909E04B693BB1D0F834280D780123AF :101E90000D780123AB401343C0F834380B785B0155
:101EA000AB401343C0F834380B785B0103F5106383 :101EA00003F51063C25842F00442C2503BE00B7885
:101EB000C25842F00442C2503BE00B7800EB43139F :101EB00000EB4313D3F8104BE40CE404C3F8104BCD
:101EC000D3F8104BE40CE404C3F8104B0B7800EB90 :101EC0000B7800EB4313D3F8104B24F0FF5424F4A9
:101ED0004313D3F8104B24F0FF5424F4C014C3F878 :101ED000C014C3F8104B4B690BB18B684B610B7886
:101EE000104B4B690BB18B684B610B7800EB4313C4 :101EE00000EB4313D3F8104B44F40024C3F8104B19
:101EF000D3F8104B44F40024C3F8104B0B7800EBDC :101EF0000B7800EB4313D3F8105B8C68C4F3120427
:101F00004313D3F8105B8C68C4F312042C43C3F85A :101F00002C43C3F8104B012A05D10B7800EB431387
:101F1000104B012A05D10B7800EB4313CA68C3F8B4 :101F1000CA68C3F8142B0B785B0103F53063C25811
:101F2000142B0B785B0103F53063C25842F0044276 :101F200042F00442C250002030BC704730B49DF8EB
:101F3000C250002030BC704730B49DF8084064B9EE :101F3000084064B903339B1009D000F5805000EBD2
:101F400003339B1009D000F5805000EB023251F8AA :101F4000023251F8045B15600134A342F9D100203C
:101F5000045B15600134A342F9D1002030BC704706 :101F500030BC704770B582B04B78012B40F0A9803F
:101F600070B582B04B78012B40F0A9804B69EBB97A :101F60004B69EBB90B7800EB4313D3F8104924F01D
:101F70000B7800EB4313D3F8104924F0FF5424F4FA :101F7000FF5424F4C014C3F810490B7800EB43134A
:101F8000C014C3F810490B7800EB4313D3F8104981 :101F8000D3F8104944F40024C3F810490B7800EB4F
:101F900044F40024C3F810490B7800EB4313D3F842 :101F90004313D3F81049E40CE404C3F8104945E0B6
:101FA0001049E40CE404C3F8104945E00B7800EB59 :101FA0000B7800EB4313D3F81049E40CE404C3F8B6
:101FB0004313D3F81049E40CE404C3F810490B7838 :101FB00010490B7800EB4313D3F8104924F0FF5479
:101FC00000EB4313D3F8104924F0FF5424F4C01459 :101FC00024F4C014C3F810490C7800EB4414D4F87E
:101FD000C3F810490C7800EB4414D4F810598E68FB :101FD00010598E684B693344013BB3FBF6F3724EE4
:101FE0004B693344013BB3FBF6F3724E06EAC3433D :101FE00006EAC3432B43C4F810390B7800EB4313C4
:101FF0002B43C4F810390B7800EB4313D3F8105976 :101FF000D3F810594C69C4F312042C43C3F81049A8
:102000004C69C4F312042C43C3F81049CB78012B5C :10200000CB78012B40F0C8800B7800EB4313D3F85A
:1020100040F0C8800B7800EB4313D3F8104924F04C :10201000104924F0C044C3F810490B7800EB431377
:10202000C044C3F810490B7800EB4313D3F81049B0 :10202000D3F8104944F00054C3F81049012A06D1EE
:1020300044F00054C3F81049012A06D10B7800EB94 :102030000B7800EB43130C69C3F814490CE0CB7820
:1020400043130C69C3F814490CE0CB78012B0CD076 :10204000012B0CD04B6903B3D0F834480E78012330
:102050004B6903B3D0F834480E780123B3402343CF :10205000B3402343C0F83438CB78012B15D1D0F8E6
:10206000C0F83438CB78012B15D1D0F8083813F4E8 :10206000083813F4807F08D10B785B0103F5106307
:10207000807F08D10B785B0103F51063C45844F0EE :10207000C45844F00054C45007E00B785B0103F5EA
:102080000054C45007E00B785B0103F51063C4589B :102080001063C45844F08054C4500B785B0103F5CE
:1020900044F08054C4500B785B0103F51063C458BE :102090001063C45844F00444C450CB78012B7FD162
:1020A00044F00444C450CB78012B7FD114460B4636 :1020A00014460B46C9681A789B8A0094FFF73EFFD6
:1020B000C9681A789B8A0094FFF73EFF76E00B7898 :1020B00076E00B7800EB4313D3F8104BE40CE40408
:1020C00000EB4313D3F8104BE40CE404C3F8104BBB :1020C000C3F8104B0B7800EB4313D3F8104B24F0FC
:1020D0000B7800EB4313D3F8104B24F0FF5424F497 :1020D000FF5424F4C014C3F8104B4B69A3B90B7818
:1020E000C014C3F8104B4B69A3B90B7800EB431332 :1020E00000EB4313D3F8105B8C68C4F312042C4349
:1020F000D3F8105B8C68C4F312042C43C3F8104B64 :1020F000C3F8104B0B7800EB4313D3F8104B44F4A8
:102100000B7800EB4313D3F8104B44F40024C3F8CE :102100000024C3F8104B1DE08D680C7800EB4414DC
:10211000104B1DE08D680C7800EB4414D4F8106B64 :10211000D4F8106B2B44013BB3FBF5F39BB2224D7B
:102120002B44013BB3FBF5F39BB2224D05EAC345BB :1021200005EAC3453543C4F8105B0C7800EB441452
:102130003543C4F8105B0C7800EB4414D4F8106BF2 :10213000D4F8106B8D6805FB03F3C3F3120333432C
:102140008D6805FB03F3C3F312033343C4F8103B5C :10214000C4F8103B012A05D10B7800EB4313CA6891
:10215000012A05D10B7800EB4313CA68C3F8142B8E :10215000C3F8142BCB78012B15D1D0F8083813F421
:10216000CB78012B15D1D0F8083813F4807F08D133 :10216000807F08D10B785B0103F53063C25842F0E1
:102170000B785B0103F53063C25842F00052C25045 :102170000052C25007E00B785B0103F53063C25890
:1021800007E00B785B0103F53063C25842F08052E0 :1021800042F08052C2500B785B0103F53063C258B5
:10219000C2500B785B0103F53063C25842F0044231 :1021900042F00442C25003E0012A7FF453AF47E704
:1021A000C25003E0012A7FF453AF47E7002002B09A :1021A000002002B070BD00BF0000F81F0332921083
:1021B00070BD00BF0000F81F033292100FD030B482 :1021B0000FD030B40C46002300F580552D6844F84C
:1021C0000C46002300F580552D6844F8045B01336C :1021C000045B01339A42F7D101EB8201084630BC2F
:1021D0009A42F7D101EB8201084630BC70470846AD :1021D00070470846704700BF4B78012B13D10B782E
:1021E000704700BF4B78012B13D10B785B0103F5CF :1021E0005B0103F51063C258002A03DBC25822F0DA
:1021F0001063C258002A03DBC25822F08042C2504A :1021F0008042C2500B785B0103F51063C25842F471
:102200000B785B0103F51063C25842F40012C25010 :102200000012C25012E00B785B0103F53063C25834
:1022100012E00B785B0103F53063C258002A03DB40 :10221000002A03DBC25822F08042C2500B785B01D7
:10222000C25822F08042C2500B785B0103F5306344 :1022200003F53063C25842F40012C25000207047D8
:10223000C25842F40012C250002070474B78012B64 :102230004B78012B15D10B785B0103F51063C25865
:1022400015D10B785B0103F51063C25822F400121C :1022400022F40012C250CB78023BDBB2012B1DD826
:10225000C250CB78023BDBB2012B1DD80B785B015F :102250000B785B0103F51063C25842F08052C25004
:1022600003F51063C25842F08052C25014E00B785C :1022600014E00B785B0103F53063C25822F40012CE
:102270005B0103F53063C25822F40012C250CB78E0 :10227000C250CB78023BDBB2012B07D80B785B0155
:10228000023BDBB2012B07D80B785B0103F530630F :1022800003F53063C25842F08052C25000207047BC
:10229000C25842F08052C25000207047D0F8003837 :10229000D0F8003823F4FE63C0F80038D0F80038D6
:1022A00023F4FE63C0F80038D0F80038090101F4C7 :1022A000090101F4FE610B43C0F8003800207047BB
:1022B000FE610B43C0F800380020704708B5D0F825 :1022B00008B5D0F8043823F00203C0F8043803202E
:1022C000043823F00203C0F80438032001F0E4F9D5 :1022C00001F0E4F9002008BD08B5D0F8043843F067
:1022D000002008BD08B5D0F8043843F00203C0F868 :1022D0000203C0F80438032001F0D8F9002008BD3B
:1022E0000438032001F0D8F9002008BD4369806953 :1022E0004369806918407047D0F8183800F50060DD
:1022F00018407047D0F8183800F50060C0691840E1 :1022F000C0691840000C704700F50063D0F818085A
:10230000000C704700F50063D0F81808DB6918402E :10230000DB69184080B2704700F5306303EB411180
:1023100080B2704700F5306303EB41118B6800F524 :102310008B6800F5006040691840704710B4D0F831
:10232000006040691840704710B4D0F81048D0F8E9 :102320001048D0F8343800EB4110D0F80809CB4001
:10233000343800EB4110D0F80809CB40DB01DBB2A8 :10233000DB01DBB2234318405DF8044B704700BF5C
:10234000234318405DF8044B704700BF406900F01C :10234000406900F001007047D0F8003923F4FF63C2
:1023500001007047D0F8003923F4FF6323F007032E :1023500023F00703C0F8003900F500639A6802F023
:10236000C0F8003900F500639A6802F00602042AFA :102360000602042A05D1D0F8002942F00302C0F881
:1023700005D1D0F8002942F00302C0F800295A68BC :1023700000295A6842F480725A600020704700BFFA
:1023800042F480725A600020704700BF10B40024ED :1023800010B40024C0F8104BD0F8104B44F40024D3
:10239000C0F8104BD0F8104B44F40024C0F8104B98 :10239000C0F8104BD0F8104B44F01804C0F8104BA4
:1023A000D0F8104B44F01804C0F8104BD0F8104B84 :1023A000D0F8104B44F0C044C0F8104B012905D1BF
:1023B00044F0C044C0F8104B012905D1C0F8142BDB :1023B000C0F8142B4FF08023C0F8003B00205DF8DC
:1023C0004FF08023C0F8003B00205DF8044B7047BD :1023C000044B704700283AD010B5044690F85130BD
:1023D00000283AD010B5044690F8513013F0FF0FA2 :1023D00013F0FF0F01D1FEF7B3F9022384F8513057
:1023E00001D1FEF7ADF9022384F851302268136859 :1023E0002268136823F04003136021686268A368C1
:1023F00023F04003136021686268A3681A43E3680E :1023F0001A43E3681A4323691A4363691A43A369BA
:102400001A4323691A4363691A43A36903F40073E7 :1024000003F400731343E2691343226A1343A26A7D
:102410001343E2691343226A1343A26A1A430A6010 :102410001A430A602168638B03F00402636A134362
:102420002168638B03F00402636A13434B602368E3 :102420004B602368E26A1A612268D36923F400636F
:10243000E26A1A612268D36923F40063D361002041 :10243000D36100206065012384F8513010BD012074
:102440006065012384F8513010BD0120704700BF42 :10244000704700BF38B50446036813F0010F3AD057
:1024500038B50446036813F0010F3AD0B34B9B68BC :10245000B34B9B6803F00C03042B00F04B81B04B93
:1024600003F00C03042B00F04B81B04B9B6803F08E :102460009B6803F00C03082B05D1AD4B5B6813F49C
:102470000C03082B05D1AD4B5B6813F4800F40F0C3 :10247000800F40F041810022AA4B1A7001F000F950
:1024800041810022AA4B1A7001F000F9054606E0CE :10248000054606E001F0FCF8401BB0F5FA7F00F2CB
:1024900001F0FCF8401BB0F5FA7F00F23581A34B48 :102490003581A34B1B6813F4003FF3D12279A14B84
:1024A0001B6813F4003FF3D12279A14B1A706368C3 :1024A0001A7063687BB101F0EBF8054606E001F0B5
:1024B0007BB101F0EBF8054606E001F0E7F8401BC0 :1024B000E7F8401BB0F5FA7F00F22281984B1B68C9
:1024C000B0F5FA7F00F22281984B1B6813F4003FAD :1024C00013F4003FF3D0236813F0020F49D0944B6C
:1024D000F3D0236813F0020F49D0944B9B6813F09C :1024D0009B6813F00C0F0AD0914B9B6803F00C0320
:1024E0000C0F0AD0914B9B6803F00C03082B09D109 :1024E000082B09D18E4B5B6813F4800F04D1E3688D
:1024F0008E4B5B6813F4800F04D1E368012B40F02E :1024F000012B40F0078126E0E36893B101228A4B6B
:10250000078126E0E36893B101228A4B1A6001F04B :102500001A6001F0BDF8054605E001F0B9F8401B7E
:10251000BDF8054605E001F0B9F8401B642800F25B :10251000642800F2F980824B1B6813F0020FF4D09C
:10252000F980824B1B6813F0020FF4D011E00022F7 :1025200011E00022804B1A6001F0AAF8054605E090
:10253000804B1A6001F0AAF8054605E001F0A6F804 :1025300001F0A6F8401B642800F2E880784B1B6885
:10254000401B642800F2E880784B1B6813F0020FF0 :1025400013F0020FF4D17648026822F0F8012269F4
:10255000F4D17648026822F0F8012269F82393FA50 :10255000F82393FAA3F3B3FA83F3DBB29A400A4366
:10256000A3F3B3FA83F3DBB29A400A430260236811 :102560000260236813F0080F26D0636993B101223B
:1025700013F0080F26D0636993B101226E4B1A60E5 :102570006E4B1A6001F084F8054605E001F080F822
:1025800001F084F8054605E001F080F8401B64285E :10258000401B642800F2C480654B5B6F13F0020FA0
:1025900000F2C480654B5B6F13F0020FF4D011E0C2 :10259000F4D011E00022654B1A6001F071F8054695
:1025A0000022654B1A6001F071F8054605E001F064 :1025A00005E001F06DF8401B642800F2B3805C4B3D
:1025B0006DF8401B642800F2B3805C4B5B6F13F036 :1025B0005B6F13F0020FF4D1236813F0040F42D0C5
:1025C000020FF4D1236813F0040F42D0574A136C62 :1025C000574A136C43F080531364A2F5E432136846
:1025D00043F080531364A2F5E432136843F480732C :1025D00043F48073136001F053F8054605E001F001
:1025E000136001F053F8054605E001F04FF8401B79 :1025E0004FF8401B642800F29780514B1B6813F48E
:1025F000642800F29780514B1B6813F4807FF4D05D :1025F000807FF4D000224F4B1A7001F041F805465D
:1026000000224F4B1A7001F041F8054607E001F037 :1026000007E001F03DF8401B41F28833984200F2A8
:102610003DF8401B41F28833984200F28580434BDD :102610008580434B1B6F13F0020FF2D1227A454B9A
:102620001B6F13F0020FF2D1227A454B1A70A36888 :102620001A70A3687BB101F02BF8054606E001F0B3
:102630007BB101F02BF8054606E001F027F8401BBE :1026300027F8401B41F2883398427FD8384B1B6FF4
:1026400041F2883398427FD8384B1B6F13F0020F4A :1026400013F0020FF3D0A369002B79D0344B9B68B1
:10265000F3D0A369002B79D0344B9B6803F00C03B3 :1026500003F00C03082B75D00022374B1A6001F0F1
:10266000082B75D00022374B1A6001F00FF8054691 :102660000FF8054604E001F00BF8401B64286BD816
:1026700004E001F00BF8401B64286BD82B4B1B685F :102670002B4B1B6813F0007FF5D1A369022B65D1AA
:1026800013F0007FF5D1A369022B65D1216A626A3C :10268000216A626A47F6C07393FAA3F3B3FA83F33D
:1026900047F6C07393FAA3F3B3FA83F3DBB29A401D :10269000DBB29A401143A36A5B08013B4FF440321E
:1026A0001143A36A5B08013B4FF4403292FAA2F255 :1026A00092FAA2F2B2FA82F2D2B293400B43E269FA
:1026B000B2FA82F2D2B293400B43E2691343E26A68 :1026B0001343E26A4FF0706191FAA1F1B1FA81F12E
:1026C0004FF0706191FAA1F1B1FA81F1C9B28A407B :1026C000C9B28A40134343F00053154A53600122B4
:1026D000134343F00053154A53600122194B1A600B :1026D000194B1A6000F0D4FF044604E000F0D0FF6C
:1026E00000F0D4FF044604E000F0D0FF001B642893 :1026E000001B642834D80E4B1B6813F0007FF5D014
:1026F00034D80E4B1B6813F0007FF5D0002038BD96 :1026F000002038BD012038BD012038BD032038BD81
:10270000012038BD012038BD032038BD032038BD6D :10270000032038BD012038BD032038BD032038BD6B
:10271000012038BD032038BD032038BD032038BD5B :10271000032038BD032038BD032038BD032038BD59
:10272000032038BD032038BD032038BD00380240E7 :10272000003802400238024000004742800E474213
:102730000238024000004742800E474200700040CD :10273000007000407038024060004742032038BDFE
:102740007038024060004742032038BD002038BD89 :10274000002038BD012038BD032038BD002038BD31
:10275000012038BD032038BD002038BD032038BD1E :10275000032038BD70B504460D46874B1B6803F057
:1027600070B504460D46874B1B6803F00F038B4280 :102760000F038B426BD2CAB2834B1A701B6803F003
:102770006BD2CAB2834B1A701B6803F00F038B42F3 :102770000F038B4240F0E480036813F0020F06D091
:1027800040F0E480036813F0020F06D07E498B68A6 :102780007E498B6823F0F002836813438B602368D3
:1027900023F0F002836813438B60236813F0010F6A :1027900013F0010F00F0B8806268012A05D1774B71
:1027A00000F0B8806268012A05D1774B1B6813F4EA :1027A0001B6813F4003F0ED1CCE0022A05D1734B15
:1027B000003F0ED1CCE0022A05D1734B1B6813F009 :1027B0001B6813F0007F06D1C6E0704B1B6813F056
:1027C000007F06D1C6E0704B1B6813F0020F00F0CB :1027C000020F00F0C3806D498B6823F003031343AD
:1027D000C3806D498B6823F0030313438B6000F0C3 :1027D0008B6000F055FF05466368012B0FD107E0C1
:1027E00055FF05466368012B0FD107E000F04EFF4F :1027E00000F04EFF401B41F28833984200F2B08067
:1027F000401B41F28833984200F2B080624B9B68E4 :1027F000624B9B6803F00C03042BF1D184E0022BA5
:1028000003F00C03042BF1D184E0022B17D107E075 :1028000017D107E000F03CFF401B41F288339842AB
:1028100000F03CFF401B41F28833984200F2A08058 :1028100000F2A080594B9B6803F00C03082BF1D108
:10282000594B9B6803F00C03082BF1D172E000F0C8 :1028200072E000F02DFF401B41F28833984200F225
:102830002DFF401B41F28833984200F29380524BA7 :102830009380524B9B6813F00C0FF2D164E0036855
:102840009B6813F00C0FF2D164E0036813F0020FE1 :1028400013F0020F06D04D498B6823F0F002836825
:1028500006D04D498B6823F0F002836813438B60E8 :1028500013438B60236813F0010F4DD06268012A87
:10286000236813F0010F4DD06268012A05D1464B51 :1028600005D1464B1B6813F4003F0DD176E0022AD8
:102870001B6813F4003F0DD176E0022A05D1424BCC :1028700005D1424B1B6813F0007F05D170E03F4B40
:102880001B6813F0007F05D170E03F4B1B6813F00D :102880001B6813F0020F6DD03C498B6823F00303E3
:10289000020F6DD03C498B6823F0030313438B6018 :1028900013438B6000F0F4FE06466368012B0ED1F3
:1028A00000F0F4FE06466368012B0ED106E000F04E :1028A00006E000F0EDFE801B41F2883398425BD8D1
:1028B000EDFE801B41F2883398425BD8324B9B6817 :1028B000324B9B6803F00C03042BF2D11CE0022B7B
:1028C00003F00C03042BF2D11CE0022B15D106E01F :1028C00015D106E000F0DCFE801B41F2883398420F
:1028D00000F0DCFE801B41F2883398424CD82A4B32 :1028D0004CD82A4B9B6803F00C03082BF2D10BE079
:1028E0009B6803F00C03082BF2D10BE000F0CEFE46 :1028E00000F0CEFE801B41F28833984240D8234B43
:1028F000801B41F28833984240D8234B9B6813F0E9 :1028F0009B6813F00C0FF3D1EAB21F4B1A701B68E0
:102900000C0FF3D1EAB21F4B1A701B6803F00F03D0 :1029000003F00F03AB4235D1236813F0040F06D058
:10291000AB4235D1236813F0040F06D01A498B68F7 :102910001A498B6823F4E052E36813438B60236801
:1029200023F4E052E36813438B60236813F0080F2D :1029200013F0080F07D0154A936823F46043216918
:1029300007D0154A936823F46043216943EAC10331 :1029300043EAC1039360002000F072FE002070BDE6
:102940009360002000F072FE002070BD012070BD79 :10294000012070BD012070BD012070BD012070BD4F
:10295000012070BD012070BD012070BD032070BD3D :10295000032070BD032070BD032070BD012070BD39
:10296000032070BD032070BD012070BD012070BD2B :10296000012070BD012070BD032070BD032070BD2B
:10297000012070BD032070BD032070BD032070BD19 :10297000032070BD012070BD003C024000380240C1
:10298000012070BD003C024000380240224B9B6891 :10298000224B9B6803F00C03042B3DD0082B01D095
:1029900003F00C03042B3DD0082B01D01F487047D7 :102990001F4870471D4B586800F03F005B6813F4F8
:1029A0001D4B586800F03F005B6813F4800F10D097 :1029A000800F10D01B4BB3FBF0F3184A506847F66A
:1029B0001B4BB3FBF0F3184A506847F6C072104047 :1029B000C072104092FAA2F2B2FA82F2D2B2D040C1
:1029C00092FAA2F2B2FA82F2D2B2D04000FB03F342 :1029C00000FB03F30FE0124BB3FBF0F30F4A506828
:1029D0000FE0124BB3FBF0F30F4A506847F6C0729A :1029D00047F6C072104092FAA2F2B2FA82F2D2B274
:1029E000104092FAA2F2B2FA82F2D2B2D04000FBC8 :1029E000D04000FB03F3094A506800F440304FF434
:1029F00003F3094A506800F440304FF4403292FA31 :1029F000403292FAA2F2B2FA82F2D2B2D040013060
:102A0000A2F2B2FA82F2D2B2D04001304000B3FB5F :102A00004000B3FBF0F070470248704700380240C6
:102A1000F0F0704702487047003802400024F4008C :102A10000024F40000127A0008B5FFF7B1FF094B5B
:102A200000127A0008B5FFF7B1FF094B9B6803F06D :102A20009B6803F0F002F02393FAA3F3B3FA83F365
:102A3000F002F02393FAA3F3B3FA83F3DBB222FAA2 :102A3000DBB222FA03F3044AD35CD840034B18609C
:102A400003F3044AD35CD840034B186008BD00BFB1 :102A400008BD00BF0038024058390008F8000020D7
:102A50000038024064390008F800002030B40468EF :102A500030B40468636A19B943EA0240A06218E01E
:102A6000636A19B943EA0240A06218E00D46A06A01 :102A60000D46A06A03EB1040002308E003F140018B
:102A700003EB1040002308E003F1400104EB810167 :102A700004EB8101496800EB11400133DBB2691EB0
:102A8000496800EB11400133DBB2691E8B42F3DB76 :102A80008B42F3DB40EA024005F13F0104EB810198
:102A900040EA024005F13F0104EB8101486000205B :102A90004860002030BC70470368596200207047CE
:102AA00030BC704703685962002070472DE9F04739 :102AA0002DE9F04782B007460D46D0F80080CB00F4
:102AB00082B007460D46D0F80080CB005B1A9B0021 :102AB0005B1A9B0003445E6C9A6CB61A9B6B9E4239
:102AC00003445E6C9A6CB61A9B6B9E4200D91E46FC :102AC00000D91E4616F1030901D509F103094FEAA1
:102AD00016F1030901D509F103094FEAA90921E01B :102AD000A90921E05E1AC5EBC5039B003B449B6B33
:102AE0005E1AC5EBC5039B003B449B6B9E4200D91D :102AE0009E4200D91E4616F1030901D509F10309DA
:102AF0001E4616F1030901D509F103094FEAA90998 :102AF0004FEAA909EC00641BA4003C44E16B3B7C59
:102B0000EC00641BA4003C44E16B3B7C009340461A :102B000000934046EAB2B3B2FFF710FAE36B3344E6
:102B1000EAB2B3B2FFF710FAE36B3344E363A36C9A :102B1000E363A36C3344A364424608EB451303F517
:102B20003344A364424608EB451303F510639B69E5 :102B200010639B699BB24B4509D9EB005B1B9B0073
:102B30009BB24B4509D9EB005B1B9B003B44996C56 :102B30003B44996C5B6C994201D2002BCAD1002EA8
:102B40005B6C994201D2002BCAD1002E07DC012315 :102B400007DC0123AB40D2F8341821EA0303C2F8B2
:102B5000AB40D2F8341821EA0303C2F8343800201D :102B50003438002002B0BDE8F08700BF002866D0FE
:102B600002B0BDE8F08700BF002866D0F0B589B09C :102B6000F0B589B00446032380F87933FDF7AAFB5A
:102B70000446032380F87933FDF7A4FB2068FEF7B1 :102B70002068FEF7A3FF254655F8107B6E460FCD63
:102B8000A3FF254655F8107B6E460FCD0FC695E87E :102B80000FC695E80F0086E80F00231D0ECB3846D0
:102B90000F0086E80F00231D0ECB3846FEF752FFCC :102B9000FEF752FF20680021FEF796FF002210E0AA
:102BA00020680021FEF796FF002210E0D3009B1A58 :102BA000D3009B1A9B002344012183F8311083F842
:102BB0009B002344012183F8311083F83020DA860A :102BB0003020DA86002183F833109963D963596491
:102BC000002183F833109963D963596401320E2AC6 :102BC00001320E2AECD9002218E0D3009B1A9B0098
:102BD000ECD9002218E0D3009B1A9B00234400216B :102BD0002344002183F8D51183F8D421DA8683F8C1
:102BE00083F8D51183F8D421DA8683F8D711C3F896 :102BE000D711C3F8DC11C3F8E011C3F8E81123686A
:102BF000DC11C3F8E011C3F8E811236802F14000CA :102BF00002F1400003EB8003596001320E2AE4D950
:102C000003EB8003596001320E2AE4D9254655F8BA :102C0000254655F8107B6E460FCD0FC695E80F0090
:102C1000107B6E460FCD0FC695E80F0086E80F00BB :102C100086E80F00231D0ECB3846FEF795FF0123F3
:102C2000231D0ECB3846FEF795FF012384F8793338 :102C200084F879332068FFF74FFB002001E0012092
:102C30002068FFF74FFB002001E00120704709B03A :102C3000704709B0F0BD00BF90F87833012B0ED07B
:102C4000F0BD00BF90F87833012B0ED010B50446CC :102C400010B50446012380F878330068FFF730FBA5
:102C5000012380F878330068FFF730FB2068FEF727 :102C50002068FEF72DFF002084F8780310BD0220C5
:102C60002DFF002084F8780310BD0220704700BFBC :102C6000704700BF2DE9F84F044606683046FFF76D
:102C70002DE9F84F044606683046FFF767FB002849 :102C700067FB002840F01B822068FFF731FB00282B
:102C800040F01B822068FFF731FB002800F015821E :102C800000F015822068FFF72BFB10F0020F02D036
:102C90002068FFF72BFB10F0020F02D023680222FE :102C9000236802225A612068FFF722FB10F4002FFC
:102CA0005A612068FFF722FB10F4002F5CD02068E7 :102CA0005CD02068FFF720FB0746002553E017F0B3
:102CB000FFF720FB0746002553E017F0010F4ED029 :102CB000010F4ED05FFA85F920684946FFF724FBE3
:102CC0005FFA85F920684946FFF724FB804610F03B :102CC000804610F0010F31D006EB45130122C3F806
:102CD000010F31D006EB45130122C3F8082B03F591 :102CD000082B03F530632269012A12D1EA00521B46
:102CE00030632269012A12D1EA00521B9200224469 :102CE0009200224402F5EC71D2F8DC011B69C3F3B7
:102CF00002F5EC71D2F8DC011B69C3F31203C01AB0 :102CF0001203C01AC2F8EC01D2F8E0214B68134469
:102D0000C2F8EC01D2F8E0214B6813448B602046F6 :102D00008B6020464946FDF713FB2369012B0DD14B
:102D10004946FDF70DFB2369012B0DD165B9C5EBC4 :102D100065B9C5EBC5039B002344D3F8E8312BB953
:102D2000C5039B002344D3F8E8312BB92068012167 :102D20002068012104F55F72FFF72AFB18F0080FF5
:102D300004F55F72FFF72AFB18F0080F07D0204652 :102D300007D02046FDF7F2FA06EB45130822C3F848
:102D4000FDF7ECFA06EB45130822C3F8082B18F040 :102D4000082B18F0100F04D006EB45131022C3F81F
:102D5000100F04D006EB45131022C3F8082B0135E1 :102D5000082B01357F08002FA9D100E0002520684D
:102D60007F08002FA9D100E000252068FFF7BEFAF8 :102D6000FFF7BEFA10F4802F6BD02068FFF7C4FA8B
:102D700010F4802F6BD02068FFF7C4FA07460025B7 :102D70000746002563E017F0010F5ED05FFA85F982
:102D800063E017F0010F5ED05FFA85F920684946CD :102D800020684946FFF7CAFA804610F0010F2DD09F
:102D9000FFF7CAFA804610F0010F2DD0012202FA87 :102D9000012202FA05F0D6F8343823EA0003C6F817
:102DA00005F0D6F8343823EA0003C6F8343806EBC9 :102DA000343806EB4513C3F808292369934209D147
:102DB0004513C3F808292369934209D1EB005B1B33 :102DB000EB005B1B9B00234403F13802D96B9B6B38
:102DC0009B00234403F13802D96B9B6B0B44536087 :102DC0000B44536020464946FDF7BEFA2369012BA8
:102DD00020464946FDF7B8FA2369012B0CD15DB9AD :102DD0000CD15DB9C5EBC5039B0023445B6C2BB9DB
:102DE000C5EBC5039B0023445B6C2BB92068012114 :102DE0002068012104F55F72FFF7CAFA18F0080F96
:102DF00004F55F72FFF7CAFA18F0080F04D006EB6B :102DF00004D006EB45130822C3F8082918F0100F79
:102E000045130822C3F8082918F0100F04D006EB68 :102E000004D006EB45131022C3F8082918F0400F30
:102E100045131022C3F8082918F0400F04D006EB20 :102E100004D006EB45134022C3F8082918F0020F2E
:102E200045134022C3F8082918F0020F04D006EB1E :102E200004D006EB45130222C3F8082918F0800FDE
:102E300045130222C3F8082918F0800F03D020465A :102E300003D020462946FFF733FE01357F08002FD7
:102E40002946FFF733FE01357F08002F99D120680E :102E400099D12068FFF74CFA00280CDAD6F804383C
:102E5000FFF74CFA00280CDAD6F8043823F0010307 :102E500023F00103C6F804382046FDF7A5FA2368DD
:102E6000C6F804382046FDF79FFA23684FF0004269 :102E60004FF000425A612068FFF73AFA10F4006F01
:102E70005A612068FFF73AFA10F4006F0BD0D6F8C9 :102E70000BD0D6F8083813F0010F02D02046FDF72A
:102E8000083813F0010F02D02046FDF77FFA2368BF :102E800085FA23684FF400625A612068FFF728FA38
:102E90004FF400625A612068FFF728FA10F4805F4F :102E900010F4805F4ED0374606F50068D8F804304D
:102EA0004ED0374606F50068D8F8043023F0010309 :102EA00023F00103C8F8043020680021FEF722FE59
:102EB000C8F8043020680021FEF722FE002207E057 :102EB000002207E007EB4213FF21C3F80819C3F80B
:102EC00007EB4213FF21C3F80819C3F8081B0132AE :102EC000081B013263689342F4D84FF0FF33C8F80F
:102ED00063689342F4D84FF0FF33C8F81830D8F83D :102ED0001830D8F81C3043F00113C8F81C30A36A2E
:102EE0001C3043F00113C8F81C30A36A63B1D8F852 :102EE00063B1D8F8843043F00B03C8F88430D8F8C5
:102EF000843043F00B03C8F88430D8F8443043F0F2 :102EF000443043F00B03C8F844300BE0D8F81430EA
:102F00000B03C8F844300BE0D8F8143043F00B033F :102F000043F00B03C8F81430D8F8103043F00B032B
:102F1000C8F81430D8F8103043F00B03C8F810305C :102F1000C8F81030D6F8003823F4FE63C6F800383D
:102F2000D6F8003823F4FE63C6F800382068217C08 :102F20002068217C04F55F72FFF72AFA23684FF4CA
:102F300004F55F72FFF72AFA23684FF480525A6152 :102F300080525A612068FFF7D3F910F4005F26D061
:102F40002068FFF7D3F910F4005F26D02068FFF760 :102F40002068FFF701FA2268D36823F47053D36036
:102F500001FA2268D36823F47053D3602068FEF727 :102F50002068FEF79BFE50B90023E3604FF4007336
:102F60009BFE50B90023E3604FF400736361226855 :102F600063612268D36843F41053D36008E00323FD
:102F7000D36843F41053D36008E00323E360402395 :102F7000E360402363612268D36843F4A053D360C5
:102F800063612268D36843F4A053D3602046FDF701 :102F80002046FDF7F3F923684FF400525A61206898
:102F9000EDF923684FF400525A612068FFF7A6F953 :102F9000FFF7A6F910F0100F42D02268936923F0D2
:102FA00010F0100F42D02268936923F01003936150 :102FA00010039361376A07F00F08C7F34343022BFE
:102FB000376A07F00F08C7F34343022B1CD147F6CB :102FB0001CD147F6F0731F402DD03F094FEAC809D6
:102FC000F0731F402DD03F094FEAC809C8EB090A2A :102FC000C8EB090A4FEA8A0AA2443046DAF8E0114F
:102FD0004FEA8A0AA2443046DAF8E0113A46FFF78F :102FD0003A46FFF7EBF8DAF8E0313B44CAF8E03163
:102FE000EBF8DAF8E0313B44CAF8E031DAF8EC31DA :102FE000DAF8EC311F44CAF8EC7114E0062B12D168
:102FF0001F44CAF8EC7114E0062B12D1304604F5D8 :102FF000304604F55F710822FFF7D8F8C7F30A17C7
:103000005F710822FFF7D8F8C7F30A174FEAC80321 :103000004FEAC803C8EB030292002244D2F8EC3125
:10301000C8EB030292002244D2F8EC313B44C2F8E0 :103010003B44C2F8EC312268936943F0100393619A
:10302000EC312268936943F0100393612068FFF745 :103020002068FFF75DF910F0080F05D02046FDF786
:103030005DF910F0080F05D02046FDF791F92368DF :1030300097F9236808225A612068FFF751F910F4C4
:1030400008225A612068FFF751F910F4801F07D059 :10304000801F07D02046E9B2FDF7C2F923684FF48C
:103050002046E9B2FDF7BCF923684FF480125A61AB :1030500080125A612068FFF743F910F4001F07D06F
:103060002068FFF743F910F4001F07D02046E9B2AB :103060002046E9B2FDF7AEF923684FF400125A6129
:10307000FDF7A8F923684FF400125A612068FFF7A2 :103070002068FFF735F910F0804F06D02046FDF7A5
:1030800035F910F0804F06D02046FDF7A7F92368E8 :10308000ADF923684FF080425A612068FFF728F9B4
:103090004FF080425A612068FFF728F910F0040FC2 :1030900010F0040F0BD023685D6815F0040F02D008
:1030A0000BD023685D6815F0040F02D02046FDF7B1 :1030A0002046FDF7A1F923685A6815435D60BDE825
:1030B0009BF923685A6815435D60BDE8F88F00BF2F :1030B000F88F00BF90F87833012B0BD010B5044681
:1030C00090F87833012B0BD010B50446012380F81B :1030C000012380F878330068FFF7E2F8002084F8E5
:1030D00078330068FFF7E2F8002084F8780310BD29 :1030D000780310BD0220704738B50546C8B210F01D
:1030E0000220704738B50546C8B210F0800F07D0EF :1030E000800F07D001F07F04C4EBC404A400303487
:1030F00001F07F04C4EBC404A40030342C4407E086 :1030F0002C4407E001F07F04C4EBC404A4002C447A
:1031000001F07F04C4EBC404A4002C4404F5EA7469 :1031000004F5EA7401F07F012170C0096070A260CB
:1031100001F07F012170C0096070A260E37000B10E :10311000E37000B1E180022B01D10023237195F807
:10312000E180022B01D10023237195F87833012B24 :103120007833012B0AD0012385F8783328682146AB
:103130000AD0012385F8783328682146FEF7CCFDB4 :10313000FEF7CCFD002085F8780338BD022038BDAD
:10314000002085F8780338BD022038BD10B504464C :1031400010B50446CAB212F0800F07D001F07F0319
:10315000CAB212F0800F07D001F07F03C3EBC303A4 :10315000C3EBC3039B003033034407E001F07F035C
:103160009B003033034407E001F07F03C3EBC3034C :10316000C3EBC3039B00034403F5EA7301F07F0143
:103170009B00034403F5EA7301F07F011970D20943 :103170001970D2095A7094F87823012A0AD00122D2
:103180005A7094F87823012A0AD0012284F878230F :1031800084F8782320681946FEF7E6FD002084F8CD
:1031900020681946FEF7E6FD002084F8780310BD8C :10319000780310BD022010BD70B501F07F06F40069
:1031A000022010BD70B501F07F06F400A51BAD0034 :1031A000A51BAD00054405F5EA712C46C5F8E021E4
:1031B000054405F5EA712C46C5F8E021C5F8E8316B :1031B000C5F8E8310023C4F8EC3184F8D53184F83F
:1031C0000023C4F8EC3184F8D53184F8D461036964 :1031C000D4610369012B05D1C6EBC604A4000444F5
:1031D000012B05D1C6EBC604A4000444C4F8E421C5 :1031D000C4F8E42190F87823012A11D00446012292
:1031E00090F87823012A11D00446012280F8782330 :1031E00080F8782326B90068DAB2FEF7F3FD03E031
:1031F00026B90068DAB2FEF7F3FD03E00068DAB240 :1031F0000068DAB2FEF7AEFE002084F8780370BDF6
:10320000FEF7AEFE002084F8780370BD022070BD8A :10320000022070BD01F07F01C1EBC10189000844BB
:1032100001F07F01C1EBC10189000844B0F8EC0165 :10321000B0F8EC01704700BF70B501F07F06F40014
:10322000704700BF70B501F07F06F400A51BAD002C :10322000A51BAD0030354119A41BA4000444E26382
:1032300030354119A41BA4000444E26363640023F5 :1032300063640023A364012384F8313084F8306090
:10324000A364012384F8313084F830600369012BD2 :103240000369012B04D1C6EBC604A4000444226424
:1032500004D1C6EBC604A4000444226490F8782389 :1032500090F87823012A11D00446012280F87823BF
:10326000012A11D00446012280F8782326B900688B :1032600026B90068DAB2FEF7B5FD03E00068DAB20D
:10327000DAB2FEF7B5FD03E00068DAB2FEF770FEE1 :10327000FEF770FE002084F8780370BD022070BD58
:10328000002084F8780370BD022070BD38B5044674 :1032800038B50446CAB212F0800F07D001F07F03B0
:10329000CAB212F0800F07D001F07F03C3EBC30363 :10329000C3EBC3039B003033034405E0C1EBC10320
:1032A0009B003033034405E0C1EBC1039B000344A2 :1032A0009B00034403F5EA730120987001F07F0549
:1032B00003F5EA730120987001F07F051D70D209B3 :1032B0001D70D2095A7094F87823824210D084F895
:1032C0005A7094F87823824210D084F878032068EA :1032C000780320681946FEF787FF2DB92068217C16
:1032D0001946FEF787FF2DB92068217C04F55F723F :1032D00004F55F72FFF754F8002084F8780338BDD6
:1032E000FFF754F8002084F8780338BD022038BD79 :1032E000022038BD10B50446CAB212F0800F07D0D4
:1032F00010B50446CAB212F0800F07D001F07F0368 :1032F00001F07F03C3EBC3039B003033034405E0BD
:10330000C3EBC3039B003033034405E0C1EBC103AF :10330000C1EBC1039B00034403F5EA7300209870EE
:103310009B00034403F5EA730020987001F07F01DD :1033100001F07F011970D2095A7094F87823012ABC
:103320001970D2095A7094F87823012A0AD0012220 :103320000AD0012284F8782320681946FEF780FF2E
:1033300084F8782320681946FEF780FF002084F87F :10333000002084F8780310BD022010BD90F8783387
:10334000780310BD022010BD90F87833012B14D003 :10334000012B14D010B50446012380F8783311F016
:1033500010B50446012380F8783311F0800F05D0B2 :10335000800F05D0006801F07F01FEF7CBFB02E093
:10336000006801F07F01FEF7CBFB02E00068FEF78A :103360000068FEF7D9FB002084F8780310BD022026
:10337000D9FB002084F8780310BD0220704700BFFD :10337000704700BF2DE9F0410023D3E09C460122B5
:103380002DE9F0410023D3E09C4601229A400C68CD :103380009A400C681440944240F0CB804D68022D66
:103390001440944240F0CB804D68022D01D0122D94 :1033900001D0122D14D14FEAD30808F1080850F8D3
:1033A00014D14FEAD30808F1080850F8287003F048 :1033A000287003F0070E4FEA8E0E0F2505FA0EF572
:1033B000070E4FEA8E0E0F2505FA0EF527EA0506D1 :1033B00027EA05060D6905FA0EF5354340F8285051
:1033C0000D6905FA0EF5354340F8285006684FEAB6 :1033C00006684FEA430E032505FA0EF5ED4305EABC
:1033D000430E032505FA0EF5ED4305EA06074E6890 :1033D00006074E6806F0030606FA0EF63E43066040
:1033E00006F0030606FA0EF63E4306604E68771EA8 :1033E0004E68771E012F03D9112E01D0122E12D153
:1033F000012F03D9112E01D0122E12D1866805EAB1 :1033F000866805EA0607CE6806FA0EF63E43866042
:103400000607CE6806FA0EF63E438660476827EA4E :10340000476827EA02074E68C6F3001202FA0CF674
:1034100002074E68C6F3001202FA0CF646EA0702EB :1034100046EA07024260C2682A408D6805FA0EF546
:103420004260C2682A408D6805FA0EF51543C560F2 :103420001543C5604A6812F0805F7AD0404D6A6CDF
:103430004A6812F0805F7AD0404D6A6C42F4804254 :1034300042F480426A649A08961CA5F5803555F8D6
:103440006A649A08961CA5F5803555F8266003F045 :10344000266003F00307BF000F25BD4026EA0506EE
:103450000307BF000F25BD4026EA0506384DA842E8 :10345000384DA84231D005F58065A8422BD005F53E
:1034600031D005F58065A8422BD005F58065A842CE :103460008065A84225D005F58065A8421FD005F5E6
:1034700025D005F58065A8421FD005F58065A842D6 :103470008065A84219D005F58065A84213D005F5EE
:1034800019D005F58065A84213D005F58065A842DE :103480008065A8420DD005F58065A84207D005F5F6
:103490000DD005F58065A84207D005F58065A842E6 :103490008065A84201D1082510E009250EE0072526
:1034A00001D1082510E009250EE007250CE00625CE :1034A0000CE006250AE0052508E0042506E00325D2
:1034B0000AE0052508E0042506E0032504E00225CE :1034B00004E0022502E0012500E00025BD4035437F
:1034C00002E0012500E00025BD40354302321D4EDB :1034C00002321D4E46F822501C4A1568E24302EAB9
:1034D00046F822501C4A1568E24302EA05064F6886 :1034D00005064F6817F4803F01D044EA0506174DF2
:1034E00017F4803F01D044EA0506174D2E606D6841 :1034E0002E606D6802EA05064F6817F4003F01D0B0
:1034F00002EA05064F6817F4003F01D044EA0506CA :1034F00044EA0506114D6E60AD6802EA05064F68A4
:10350000114D6E60AD6802EA05064F6817F4801F22 :1035000017F4801F01D044EA05060C4DAE60ED684B
:1035100001D044EA05060C4DAE60ED682A404E68C5 :103510002A404E6816F4001F01D044EA0502074C09
:1035200016F4001F01D044EA0502074CE2600133A3 :10352000E26001330F2B7FF629AFBDE8F08100BFC9
:103530000F2B7FF629AFBDE8F08100BF00380240B5 :10353000003802400000024000380140003C0140D9
:103540000000024000380140003C014058B110B575 :1035400058B110B50446437913F0FF0F01D1FDF7D0
:103550000446437913F0FF0F01D1FDF7E3F801238F :10355000E9F801236371002010BD0120704700BF0E
:103560006371002010BD0120704700BF00F007000C :1035600000F00700064AD36823F4E0631B041B0C39
:10357000064AD36823F4E0631B041B0C43EA0020D3 :1035700043EA002040F0BF6040F40030D060704764
:1035800040F0BF6040F40030D060704700ED00E0D4 :1035800000ED00E030B4164BDC68C4F30224C4F153
:1035900030B4164BDC68C4F30224C4F10705042DD3 :103590000705042D28BF0425231D062B01D9033C54
:1035A00028BF0425231D062B01D9033C00E000247D :1035A00000E00024012303FA05F5013D2940A14074
:1035B000012303FA05F5013D2940A140A340013B49 :1035B000A340013B1A400A43002806DA00F00F003E
:1035C0001A400A43002806DA00F00F001201D2B2B6 :1035C0001201D2B2074B1A5407E01201D2B200F135
:1035D000074B1A5407E01201D2B200F1604000F527 :1035D000604000F5614080F8002330BC704700BFB8
:1035E000614080F8002330BC704700BF00ED00E070 :1035E00000ED00E014ED00E0410900F01F000123B0
:1035F00014ED00E0410900F01F0001238340024A5E :1035F0008340024A42F82130704700BF00E100E0FA
:1036000042F82130704700BF00E100E00138B0F11E :103600000138B0F1807F06D2044B586000209860EA
:10361000807F06D2044B58600020986007221A6011 :1036100007221A6070470120704700BF10E000E0E9
:1036200070470120704700BF10E000E008B5FFF7C9 :1036200008B5FFF7F9F9044BA3FB00308009FFF759
:10363000F9F9044BA3FB00308009FFF7E7FF0020F6 :10363000E7FF002008BD00BFD34D621008B50B4B5B
:1036400008BD00BFD34D621008B50B4B1A6842F499 :103640001A6842F400721A601A6842F480621A60C2
:1036500000721A601A6842F480621A601A6842F4B2 :103650001A6842F480721A600320FFF781FF00208D
:1036600080721A600320FFF781FF0020FFF7DEFF62 :10366000FFF7DEFFFDF756F8002008BD003C0240E2
:10367000FDF750F8002008BD003C0240024A1368E4 :10367000024A136801331360704700BF64010020E1
:1036800001331360704700BF64010020014B1868CC :10368000014B1868704700BF6401002010B582B07C
:10369000704700BF6401002010B582B00190FFF7B1 :103690000190FFF7F5FF0446FFF7F2FF001B019BC7
:1036A000F5FF0446FFF7F2FF001B019B9842F9D398 :1036A0009842F9D302B010BD0C4B1A6842F00102E7
:1036B00002B010BD0C4B1A6842F001021A600021E2 :1036B0001A60002199601A6822F0847222F4803224
:1036C00099601A6822F0847222F480321A60074AE4 :1036C0001A60074A5A601A6822F480221A60D96088
:1036D0005A601A6822F480221A60D9604FF00062A2 :1036D0004FF00062034B9A60704700BF0038024011
:1036E000034B9A60704700BF00380240103000243E :1036E0001030002400ED00E0DFF830D0002103E0CE
:1036F00000ED00E0DFF830D0002103E00B4B5B5819 :1036F0000B4B5B58435004310A480B4B42189A421B
:10370000435004310A480B4B42189A42F6D30A4AF6 :10370000F6D30A4A02E0002342F8043B084B9A42EF
:1037100002E0002342F8043B084B9A42F9D3FFF73A :10371000F9D3FFF7C9FFFCF7DBFF704700C00120BA
:10372000C9FFFCF7D5FF704700C0012076390008BB :103720006A390008000000206001002060010020CC
:10373000000000206001002060010020AC09002092 :10373000AC090020FEE70000024B0146186800F0CB
:10374000FEE70000024B0146186800F04FB800BFCA :103740004FB800BF5C010020024B0146186800F032
:103750005C010020024B0146186800F003B800BF6E :1037500003B800BF5C01002030B500293CD051F80F
:103760005C01002030B500293CD051F8042C0B1F1F :10376000042C0B1F1D49002AB8BF9B180A680C4681
:103770001D49002AB8BF9B180A680C4612B95A6046 :1037700012B95A600B6030BD93420DD219685818C7
:103780000B6030BD93420DD219685818904201BFAA :10378000904201BF5A5852181A60426823605A602A
:103790005A5852181A60426823605A6030BD9942E4 :1037900030BD994203D80A4651680029F9D114680E
:1037A00003D80A4651680029F9D1146815199D42B9 :1037A00015199D420AD11B682344D0188842136022
:1037B0000AD11B682344D0188842136012D10868CC :1037B00012D10868034413604B680CE002D90C2353
:1037C000034413604B680CE002D90C23036030BD46 :1037C000036030BD1C681819884201BF0868496849
:1037D0001C681819884201BF0868496800191860F8 :1037D000001918605960536030BD00BF6C010020B3
:1037E0005960536030BD00BF6C01002070B5CC1C27 :1037E00070B5CC1C24F0030408340C2C38BF0C2416
:1037F00024F0030408340C2C38BF0C24002C06469B :1037F000002C064603DA0C233360002070BD8C4297
:1038000003DA0C233360002070BD8C42F9D3204AC8 :10380000F9D3204A136810461946A1B10A68121B61
:10381000136810461946A1B10A68121B0ED40B2A70 :103810000ED40B2A03D90A608B188C501FE08B4200
:1038200003D90A608B188C501FE08B420BBF5A687B :103820000BBF5A684A6802605A6018BF0B4616E020
:103830004A6802605A6018BF0B4616E00B4649689A :103830000B464968E9E7144D2B681BB9304600F088
:10384000E9E7144D2B681BB9304600F025F82860D5 :1038400025F828603046214600F020F8421C034647
:103850003046214600F020F8421C0346D1D0C51C5A :10385000D1D0C51C25F0030585420AD11C6003F1B7
:1038600025F0030585420AD11C6003F10B001A1DE7 :103860000B001A1D20F00700821A0AD0514299500D
:1038700020F00700821A0AD05142995070BD30469C :1038700070BD3046E91A00F009F80130BBD02B4684
:10388000E91A00F009F80130BBD02B46ECE770BD17 :10388000ECE770BD6C0100206801002038B5064CE3
:103890006C0100206801002038B5064C0023054665 :10389000002305460846236000F008F8431C02D1C7
:1038A0000846236000F008F8431C02D1236803B1E6 :1038A000236803B12B6038BDA8090020044A0549EC
:1038B0002B6038BDA8090020044A05491368002B75 :1038B0001368002B08BF0B46184410601846704769
:1038C00008BF0B461844106018467047700100206E :1038C00070010020AC090020008002021F000000EF
:1038D000AC090020008002021F00000053544D205C :1038D00053544D202020202050726F647563742053
:1038E0002020202050726F647563742020202020D7 :1038E0002020202020202020302E303153544D33F2
:1038F00020202020302E303153544D3332204D6162 :1038F00032204D6173732053746F726167650000ED
:1039000073732053746F72616765000053544D697F :1039000053544D6963726F656C656374726F6E6951
:1039100063726F656C656374726F6E6963730000C8 :10391000637300003030303030303030303031417F
:103920003030303030303030303031410000000045 :10392000000000004D534320436F6E66696700003E
:103930004D534320436F6E66696700004D5343202B :103930004D534320496E74657266616365000000F3
:10394000496E7465726661636500000000000003E3 :10394000000000030080830000060000000000006B
:10395000008083000006000000000000000000005E :10395000000000000000000000000000010203045D
:103960000000000000000000010203040102030443 :0A39600001020304060708094300F2
:06397000060708094300F0 :10396A008901000895010008A9010008B5010008AD
:103976008901000895010008A9010008B5010008A1 :10397A00C1010008F901000805020008C83800085A
:10398600C1010008F901000805020008D438000842 :10398A0009020008150200083D0200082102000889
:1039960009020008150200083D020008210200087D :10399A00590200087D020008A10200080403090474
:1039A600590200087D020008A10200080403090468 :1039AA00120100020000004083042A5700020102AB
:1039B600120100020000004083042A57000201029F :1039BA000301000009072000010104C032090400C4
:1039C6000301000009072000010104C032090400B8 :1039CA0000020806500507058102400000070501AC
:1039D60000020806500507058102400000070501A0 :1039DA00024000000A060002000000400100000048
:1039E600024000000A06000200000040010000003C :1039EA0009022000010104C032090400000208068D
:1039F60009022000010104C0320904000002080681 :1039FA0050050705810200020007050102000200C6
:103A060050050705810200020007050102000200B9 :103A0A0051180008A9180008D5180008000000007D
:103A16005D180008B5180008E1180008000000004D :103A1A0000000000DD190008E91900080000000094
:103A260000000000E9190008F51900080000000070 :103A2A000000000000000000211800082D180008FE
:103A360000000000000000002D18000839180008DA :103A3A00391800084518000809022000010104C0CD
:103A4600451800085118000809022000010104C0A9 :103A4A0032090400000208065005070581024000F9
:103A560032090400000208065005070581024000ED :103A5A0000070501024000000024F40000000000F5
:103A660000070501024000000024F40000000000E9 :103A6A00000000000000000000000000000000004C
:103A76000000000000000000000000000000000040 :103A7A000000000000000000000000006839000893
:103A8600000000000000000000000000743900087B :103A8A00000000000000000000000000000000002C
:103A96000000000000000000000000000000000020 :103A9A00000000000000000000000000000000001C
:103AA6000000000000000000000000000000000010 :103AAA00000000000000000000000000000000000C
:103AB6000000000000000000000000000000000000 :103ABA00000000000000000000000000FC000020E0
:103AC600000000000000000000000000FC000020D4 :04000005080036E9D0
:04000005080036F5C4
:00000001FF :00000001FF

File diff suppressed because it is too large Load Diff

@ -45,7 +45,7 @@
#endif #endif
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include <hal_conf.h> #include <hal_config.h>
/** @addtogroup STM32F4xx_HAL_Driver /** @addtogroup STM32F4xx_HAL_Driver
* @{ * @{

@ -233,6 +233,8 @@ void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum);
void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum); void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum);
void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd); void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd);
void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd); void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd);
void HAL_PCD_BufferFreedCallBack(PCD_HandleTypeDef *hpcd);
/** /**
* @} * @}
*/ */

@ -266,7 +266,7 @@ __weak HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
/*Configure the SysTick IRQ priority */ /*Configure the SysTick IRQ priority */
//*** Leave Systick interrupt at lowest priority //*** HAL_MspInit() will set our desired priority
//HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority ,0); //HAL_NVIC_SetPriority(SysTick_IRQn, TickPriority ,0);
/* Return function status */ /* Return function status */

@ -259,6 +259,7 @@ HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma)
/* Initialize the DMA state */ /* Initialize the DMA state */
hdma->State = HAL_DMA_STATE_READY; hdma->State = HAL_DMA_STATE_READY;
__HAL_UNLOCK(hdma);
return HAL_OK; return HAL_OK;
} }

@ -191,6 +191,7 @@ HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd)
USB_DevInit(hpcd->Instance, hpcd->Init); USB_DevInit(hpcd->Instance, hpcd->Init);
hpcd->State= HAL_PCD_STATE_READY; hpcd->State= HAL_PCD_STATE_READY;
__HAL_UNLOCK(hpcd);
USB_DevDisconnect (hpcd->Instance); USB_DevDisconnect (hpcd->Instance);
return HAL_OK; return HAL_OK;
@ -1128,7 +1129,7 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t
len32b = (len + 3) / 4; len32b = (len + 3) / 4;
while ( (USBx_INEP(epnum)->DTXFSTS & USB_OTG_DTXFSTS_INEPTFSAV) > len32b && while ( (USBx_INEP(epnum)->DTXFSTS & USB_OTG_DTXFSTS_INEPTFSAV) > len32b && /* SHOULD THIS BE ">=" ??????? */
ep->xfer_count < ep->xfer_len && ep->xfer_count < ep->xfer_len &&
ep->xfer_len != 0) ep->xfer_len != 0)
{ {
@ -1147,11 +1148,12 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t
ep->xfer_count += len; ep->xfer_count += len;
} }
if(len <= 0) if(len <= 0) //SHOULD THIS BE "if (ep->xfer_count >= ep->xfer_len)" ???????
{ { //or just move USB_WritePacket up below the while check???????
fifoemptymsk = 0x1 << epnum; fifoemptymsk = 0x1 << epnum;
USBx_DEVICE->DIEPEMPMSK &= ~fifoemptymsk; USBx_DEVICE->DIEPEMPMSK &= ~fifoemptymsk;
HAL_PCD_BufferFreedCallBack(hpcd);
} }
return HAL_OK; return HAL_OK;

@ -222,6 +222,7 @@ HAL_StatusTypeDef HAL_SPI_Init(SPI_HandleTypeDef *hspi)
hspi->ErrorCode = HAL_SPI_ERROR_NONE; hspi->ErrorCode = HAL_SPI_ERROR_NONE;
hspi->State = HAL_SPI_STATE_READY; hspi->State = HAL_SPI_STATE_READY;
__HAL_UNLOCK(hspi);
return HAL_OK; return HAL_OK;
} }

@ -9,6 +9,8 @@
#define INC_BOARD_CONFIG_H_ #define INC_BOARD_CONFIG_H_
#define BSRR_SHIFT_HIGH 0
#define BSRR_SHIFT_LOW 16
#define PA_JTMS GPIO_PIN_13 #define PA_JTMS GPIO_PIN_13
#define PA_JTCK GPIO_PIN_14 #define PA_JTCK GPIO_PIN_14
@ -21,10 +23,17 @@
#define STAT_LED_PIN GPIO_PIN_12 #define STAT_LED_PIN GPIO_PIN_12
#define STAT_LED_PORT GPIOC #define STAT_LED_PORT GPIOC
#define STAT_LED_BSRR_OFF (STAT_LED_PIN) #define STAT_LED_ON STAT_LED_PORT->BSRR = (STAT_LED_PIN << BSRR_SHIFT_LOW) //Stat LED is active-low
#define STAT_LED_BSRR_ON (STAT_LED_PIN << 16) #define STAT_LED_OFF STAT_LED_PORT->BSRR = (STAT_LED_PIN << BSRR_SHIFT_HIGH)
#define SPI1_NSS_PIN GPIO_PIN_4
#define SPI1_NSS_PORT GPIOA
#define SPI1_NSS_ASSERT SPI1_NSS_PORT->BSRR = (SPI1_NSS_PIN << BSRR_SHIFT_LOW)
#define SPI1_NSS_DEASSERT SPI1_NSS_PORT->BSRR = (SPI1_NSS_PIN << BSRR_SHIFT_HIGH)
#define DOWNSTREAM_TX_OK_PIN GPIO_PIN_3
#define DOWNSTREAM_TX_OK_PORT GPIOA
#define DOWNSTREAM_TX_OK_ACTIVE (!(DOWNSTREAM_TX_OK_PORT->IDR & DOWNSTREAM_TX_OK_PIN))
#endif /* INC_BOARD_CONFIG_H_ */ #endif /* INC_BOARD_CONFIG_H_ */

@ -0,0 +1,39 @@
/*
* interface_def.h
*
* Created on: 22/06/2015
* Author: Robert Fisk
*/
#ifndef INC_DOWNSTREAM_INTERFACE_DEF_H_
#define INC_DOWNSTREAM_INTERFACE_DEF_H_
//Upstream only supports one LUN.
//Downstream may support > 1 LUN and only report the first active one to upstream.
#define UPSTREAM_LUN_NBR 1
#define COMMAND_CLASS_DATA_FLAG 0x80
#define COMMAND_CLASS_MASK ((uint8_t)(~COMMAND_CLASS_DATA_FLAG))
typedef enum
{
COMMAND_CLASS_INTERFACE = 0,
COMMAND_CLASS_MASS_STORAGE = 1,
COMMAND_CLASS_MAX = 2,
}
InterfaceCommandClassTypeDef;
typedef enum
{
COMMAND_MSC_TEST_UNIT_READY = 0, //Returns HAL_StatusTypeDef result
COMMAND_MSC_GET_CAPACITY = 2, //Returns uint32_t blk_nbr, uint32_t blk_size
COMMAND_MSC_BEGIN_READ = 3, //Returns HAL_StatusTypeDef result, then data stream
COMMAND_MSC_BEGIN_WRITE = 4, //Returns HAL_OK, HAL_ERROR if medium not present, HAL_BUSY if write-protected result, then waits for data stream
COMMAND_MSC_MAX = 5,
}
InterfaceCommandMscTypeDef;
#endif /* INC_DOWNSTREAM_INTERFACE_DEF_H_ */

@ -0,0 +1,38 @@
/*
* downstream_interface_msc.h
*
* Created on: 4/07/2015
* Author: Robert Fisk
*/
#ifndef INC_DOWNSTREAM_INTERFACE_MSC_H_
#define INC_DOWNSTREAM_INTERFACE_MSC_H_
#include "downstream_spi.h"
typedef void (*DownstreamInterfaceMSCCallbackTypeDef)(HAL_StatusTypeDef result);
typedef void (*DownstreamInterfaceMSCCallbackPacketTypeDef)(HAL_StatusTypeDef result,
DownstreamPacketTypeDef* downstreamPacket);
typedef void (*DownstreamInterfaceMSCCallbackUintPacketTypeDef)(HAL_StatusTypeDef result,
uint32_t result_uint[],
DownstreamPacketTypeDef* downstreamPacket);
HAL_StatusTypeDef DownstreamInterface_TestReady(DownstreamInterfaceMSCCallbackTypeDef callback);
HAL_StatusTypeDef DownstreamInterface_GetCapacity(DownstreamInterfaceMSCCallbackUintPacketTypeDef callback);
HAL_StatusTypeDef DownstreamInterface_BeginRead(DownstreamInterfaceMSCCallbackTypeDef callback,
uint64_t readBlockStart,
uint32_t readBlockCount,
uint32_t readByteCount);
HAL_StatusTypeDef DownstreamInterface_GetStreamDataPacket(DownstreamInterfaceMSCCallbackPacketTypeDef callback);
HAL_StatusTypeDef DownstreamInterface_BeginWrite(DownstreamInterfaceMSCCallbackTypeDef callback,
uint64_t readBlockStart,
uint32_t readBlockCount);
HAL_StatusTypeDef DownstreamInterface_PutStreamDataPacket(DownstreamPacketTypeDef* packetToSend,
uint32_t dataLength);
#endif /* INC_DOWNSTREAM_INTERFACE_MSC_H_ */

@ -0,0 +1,89 @@
/*
* downstream_spi.h
*
* Created on: 21/06/2015
* Author: Robert Fisk
*/
#ifndef INC_DOWNSTREAM_SPI_H_
#define INC_DOWNSTREAM_SPI_H_
#include "usbd_def.h"
#define DOWNSTREAM_PACKET_HEADER_LEN (2) //Min length = CommandClass & Command bytes
#define DOWNSTREAM_PACKET_LEN (DOWNSTREAM_PACKET_HEADER_LEN + USB_HS_MAX_PACKET_SIZE)
#define DOWNSTREAM_PACKET_LEN_MIN (DOWNSTREAM_PACKET_HEADER_LEN)
#define SPI_INTERFACE_FREAKOUT_VOID \
do { \
while (1); \
/*DownstreamInterfaceState = INTERFACE_STATE_ERROR;*/ \
/*return;*/ \
} while (0);
#define SPI_INTERFACE_FREAKOUT_HAL_ERROR \
do { \
while (1); \
/*DownstreamInterfaceState = INTERFACE_STATE_ERROR;*/ \
/*return HAL_ERROR;*/ \
} while (0);
typedef enum
{
INTERFACE_STATE_RESET = 0,
INTERFACE_STATE_WAITING_CLIENT = 1,
INTERFACE_STATE_IDLE = 2,
INTERFACE_STATE_TX_SIZE_WAIT = 3,
INTERFACE_STATE_TX_SIZE = 4,
INTERFACE_STATE_TX_PACKET_WAIT = 5,
INTERFACE_STATE_TX_PACKET = 6,
INTERFACE_STATE_RX_SIZE_WAIT = 7,
INTERFACE_STATE_RX_SIZE = 8,
INTERFACE_STATE_RX_PACKET_WAIT = 9,
INTERFACE_STATE_RX_PACKET = 10,
INTERFACE_STATE_ERROR = 11
} InterfaceStateTypeDef;
typedef enum
{
NOT_BUSY = 0,
BUSY = 1
} PacketBusyTypeDef;
typedef struct
{
PacketBusyTypeDef Busy; //Everything after Busy should be word-aligned
uint16_t Length __ALIGN_END; //Packet length includes CommandClass, Command, and Data
uint8_t CommandClass;
uint8_t Command;
uint8_t Data[USB_HS_MAX_PACKET_SIZE]; //Should (must?) be word-aligned, for USB copy routine
uint8_t RxCrc;
}
DownstreamPacketTypeDef;
typedef void (*FreePacketCallbackTypeDef)(DownstreamPacketTypeDef* freePacket);
typedef void (*SpiPacketReceivedCallbackTypeDef)(DownstreamPacketTypeDef* replyPacket);
void Downstream_InitInterface(void);
HAL_StatusTypeDef Downstream_GetFreePacket(FreePacketCallbackTypeDef callback);
DownstreamPacketTypeDef* Downstream_GetFreePacketImmediately(void);
void Downstream_ReleasePacket(DownstreamPacketTypeDef* packetToRelease);
HAL_StatusTypeDef Downstream_SendPacket(DownstreamPacketTypeDef* packetToWrite);
HAL_StatusTypeDef Downstream_GetPacket(SpiPacketReceivedCallbackTypeDef callback);
void Downstream_TxOkInterrupt(void);
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi);
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi);
#endif /* INC_DOWNSTREAM_SPI_H_ */

@ -50,7 +50,7 @@
#define HAL_MODULE_ENABLED #define HAL_MODULE_ENABLED
//#define HAL_ADC_MODULE_ENABLED //#define HAL_ADC_MODULE_ENABLED
//#define HAL_CAN_MODULE_ENABLED //#define HAL_CAN_MODULE_ENABLED
#define HAL_CRC_MODULE_ENABLED //#define HAL_CRC_MODULE_ENABLED
//#define HAL_CRYP_MODULE_ENABLED //#define HAL_CRYP_MODULE_ENABLED
//#define HAL_DAC_MODULE_ENABLED //#define HAL_DAC_MODULE_ENABLED
//#define HAL_DCMI_MODULE_ENABLED //#define HAL_DCMI_MODULE_ENABLED

@ -47,8 +47,11 @@
/* The preemption priority for the IRQn channel. /* The preemption priority for the IRQn channel.
* This parameter can be a value between 0 and 15 * This parameter can be a value between 0 and 15
* A lower priority value indicates a higher priority. */ * A lower priority value indicates a higher priority. */
#define INT_PRIORITY_SYSTICK 2 #define INT_PRIORITY_SYSTICK 2
#define INT_PRIORITY_OTG_FS 10 #define INT_PRIORITY_SPI_DMA 10 //SPI interacts heavily with USB_OTG,
#define INT_PRIORITY_OTG_FS 10 //so set them at the same priority.
/* Exported macro ------------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */ /* Exported functions ------------------------------------------------------- */

@ -1,401 +0,0 @@
/**
******************************************************************************
* @file stm32f4xx_hal_conf.h
* @brief HAL configuration file.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions 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 its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 __STM32F4xx_HAL_CONF_H
#define __STM32F4xx_HAL_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* ########################## Module Selection ############################## */
/**
* @brief This is the list of modules to be used in the HAL driver
*/
#define HAL_MODULE_ENABLED
//#define HAL_ADC_MODULE_ENABLED
//#define HAL_CAN_MODULE_ENABLED
#define HAL_CRC_MODULE_ENABLED
//#define HAL_CRYP_MODULE_ENABLED
//#define HAL_DAC_MODULE_ENABLED
//#define HAL_DCMI_MODULE_ENABLED
//#define HAL_DMA2D_MODULE_ENABLED
//#define HAL_ETH_MODULE_ENABLED
//#define HAL_NAND_MODULE_ENABLED
//#define HAL_NOR_MODULE_ENABLED
//#define HAL_PCCARD_MODULE_ENABLED
//#define HAL_SRAM_MODULE_ENABLED
//#define HAL_SDRAM_MODULE_ENABLED
//#define HAL_HASH_MODULE_ENABLED
//#define HAL_I2C_MODULE_ENABLED
//#define HAL_I2S_MODULE_ENABLED
//#define HAL_IWDG_MODULE_ENABLED
//#define HAL_LTDC_MODULE_ENABLED
//#define HAL_RNG_MODULE_ENABLED
//#define HAL_RTC_MODULE_ENABLED
//#define HAL_SAI_MODULE_ENABLED
//#define HAL_SD_MODULE_ENABLED
#define HAL_SPI_MODULE_ENABLED
//#define HAL_TIM_MODULE_ENABLED
//#define HAL_UART_MODULE_ENABLED
//#define HAL_USART_MODULE_ENABLED
//#define HAL_IRDA_MODULE_ENABLED
//#define HAL_SMARTCARD_MODULE_ENABLED
//#define HAL_WWDG_MODULE_ENABLED
#define HAL_PCD_MODULE_ENABLED
//#define HAL_HCD_MODULE_ENABLED
#define HAL_GPIO_MODULE_ENABLED
#define HAL_DMA_MODULE_ENABLED
#define HAL_RCC_MODULE_ENABLED
#define HAL_FLASH_MODULE_ENABLED
#define HAL_PWR_MODULE_ENABLED
#define HAL_CORTEX_MODULE_ENABLED
/* ########################## HSE/HSI Values adaptation ##################### */
/**
* @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
* This value is used by the RCC HAL module to compute the system frequency
* (when HSE is used as system clock source, directly or through the PLL).
*/
#if !defined (HSE_VALUE)
#define HSE_VALUE ((uint32_t)8000000) /*!< Value of the External oscillator in Hz */
#endif /* HSE_VALUE */
#if !defined (HSE_STARTUP_TIMEOUT)
#define HSE_STARTUP_TIMEOUT ((uint32_t)500) /*!< Time out for HSE start up, in ms */
#endif /* HSE_STARTUP_TIMEOUT */
/**
* @brief Internal High Speed oscillator (HSI) value.
* This value is used by the RCC HAL module to compute the system frequency
* (when HSI is used as system clock source, directly or through the PLL).
*/
#if !defined (HSI_VALUE)
#define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
#endif /* HSI_VALUE */
/**
* @brief Internal Low Speed oscillator (LSI) value.
*/
#if !defined (LSI_VALUE)
#define LSI_VALUE ((uint32_t)32000)
#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
The real value may vary depending on the variations
in voltage and temperature. */
/**
* @brief External Low Speed oscillator (LSE) value.
*/
#if !defined (LSE_VALUE)
#define LSE_VALUE ((uint32_t)32768) /*!< Value of the External Low Speed oscillator in Hz */
#endif /* LSE_VALUE */
/**
* @brief External clock source for I2S peripheral
* This value is used by the I2S HAL module to compute the I2S clock source
* frequency, this source is inserted directly through I2S_CKIN pad.
*/
#if !defined (EXTERNAL_CLOCK_VALUE)
#define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000) /*!< Value of the External audio frequency in Hz*/
#endif /* EXTERNAL_CLOCK_VALUE */
/* Tip: To avoid modifying this file each time you need to use different HSE,
=== you can define the HSE value in your toolchain compiler preprocessor. */
/* ########################### System Configuration ######################### */
/**
* @brief This is the HAL system configuration section
*/
#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
#define TICK_INT_PRIORITY ((uint32_t)0) /*!< tick interrupt priority */
#define USE_RTOS 0
#define PREFETCH_ENABLE 1
#define INSTRUCTION_CACHE_ENABLE 1
#define DATA_CACHE_ENABLE 1
/* ########################## Assert Selection ############################## */
/**
* @brief Uncomment the line below to expanse the "assert_param" macro in the
* HAL drivers code
*/
/* #define USE_FULL_ASSERT 1 */
/* ################## Ethernet peripheral configuration ##################### */
/* Section 1 : Ethernet peripheral configuration */
/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
#define MAC_ADDR0 2
#define MAC_ADDR1 0
#define MAC_ADDR2 0
#define MAC_ADDR3 0
#define MAC_ADDR4 0
#define MAC_ADDR5 0
/* Definition of the Ethernet driver buffers size and count */
#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
#define ETH_RXBUFNB ((uint32_t)4) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
#define ETH_TXBUFNB ((uint32_t)4) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
/* Section 2: PHY configuration section */
/* DP83848 PHY Address*/
#define DP83848_PHY_ADDRESS 0x01
/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
#define PHY_RESET_DELAY ((uint32_t)0x000000FF)
/* PHY Configuration delay */
#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFF)
#define PHY_READ_TO ((uint32_t)0x0000FFFF)
#define PHY_WRITE_TO ((uint32_t)0x0000FFFF)
/* Section 3: Common PHY Registers */
#define PHY_BCR ((uint16_t)0x00) /*!< Transceiver Basic Control Register */
#define PHY_BSR ((uint16_t)0x01) /*!< Transceiver Basic Status Register */
#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */
#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */
#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */
#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */
#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */
#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */
#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */
#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */
#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */
#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */
#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */
#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */
#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */
/* Section 4: Extended PHY Registers */
#define PHY_SR ((uint16_t)0x10) /*!< PHY status register Offset */
#define PHY_MICR ((uint16_t)0x11) /*!< MII Interrupt Control Register */
#define PHY_MISR ((uint16_t)0x12) /*!< MII Interrupt Status and Misc. Control Register */
#define PHY_LINK_STATUS ((uint16_t)0x0001) /*!< PHY Link mask */
#define PHY_SPEED_STATUS ((uint16_t)0x0002) /*!< PHY Speed mask */
#define PHY_DUPLEX_STATUS ((uint16_t)0x0004) /*!< PHY Duplex mask */
#define PHY_MICR_INT_EN ((uint16_t)0x0002) /*!< PHY Enable interrupts */
#define PHY_MICR_INT_OE ((uint16_t)0x0001) /*!< PHY Enable output interrupt events */
#define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020) /*!< Enable Interrupt on change of link status */
#define PHY_LINK_INTERRUPT ((uint16_t)0x2000) /*!< PHY link status interrupt mask */
/* Includes ------------------------------------------------------------------*/
/**
* @brief Include module's header file
*/
#ifdef HAL_RCC_MODULE_ENABLED
#include "stm32f4xx_hal_rcc.h"
#endif /* HAL_RCC_MODULE_ENABLED */
#ifdef HAL_GPIO_MODULE_ENABLED
#include "stm32f4xx_hal_gpio.h"
#endif /* HAL_GPIO_MODULE_ENABLED */
#ifdef HAL_DMA_MODULE_ENABLED
#include "stm32f4xx_hal_dma.h"
#endif /* HAL_DMA_MODULE_ENABLED */
#ifdef HAL_CORTEX_MODULE_ENABLED
#include "stm32f4xx_hal_cortex.h"
#endif /* HAL_CORTEX_MODULE_ENABLED */
#ifdef HAL_ADC_MODULE_ENABLED
#include "stm32f4xx_hal_adc.h"
#endif /* HAL_ADC_MODULE_ENABLED */
#ifdef HAL_CAN_MODULE_ENABLED
#include "stm32f4xx_hal_can.h"
#endif /* HAL_CAN_MODULE_ENABLED */
#ifdef HAL_CRC_MODULE_ENABLED
#include "stm32f4xx_hal_crc.h"
#endif /* HAL_CRC_MODULE_ENABLED */
#ifdef HAL_CRYP_MODULE_ENABLED
#include "stm32f4xx_hal_cryp.h"
#endif /* HAL_CRYP_MODULE_ENABLED */
#ifdef HAL_DMA2D_MODULE_ENABLED
#include "stm32f4xx_hal_dma2d.h"
#endif /* HAL_DMA2D_MODULE_ENABLED */
#ifdef HAL_DAC_MODULE_ENABLED
#include "stm32f4xx_hal_dac.h"
#endif /* HAL_DAC_MODULE_ENABLED */
#ifdef HAL_DCMI_MODULE_ENABLED
#include "stm32f4xx_hal_dcmi.h"
#endif /* HAL_DCMI_MODULE_ENABLED */
#ifdef HAL_ETH_MODULE_ENABLED
#include "stm32f4xx_hal_eth.h"
#endif /* HAL_ETH_MODULE_ENABLED */
#ifdef HAL_FLASH_MODULE_ENABLED
#include "stm32f4xx_hal_flash.h"
#endif /* HAL_FLASH_MODULE_ENABLED */
#ifdef HAL_SRAM_MODULE_ENABLED
#include "stm32f4xx_hal_sram.h"
#endif /* HAL_SRAM_MODULE_ENABLED */
#ifdef HAL_NOR_MODULE_ENABLED
#include "stm32f4xx_hal_nor.h"
#endif /* HAL_NOR_MODULE_ENABLED */
#ifdef HAL_NAND_MODULE_ENABLED
#include "stm32f4xx_hal_nand.h"
#endif /* HAL_NAND_MODULE_ENABLED */
#ifdef HAL_PCCARD_MODULE_ENABLED
#include "stm32f4xx_hal_pccard.h"
#endif /* HAL_PCCARD_MODULE_ENABLED */
#ifdef HAL_SDRAM_MODULE_ENABLED
#include "stm32f4xx_hal_sdram.h"
#endif /* HAL_SDRAM_MODULE_ENABLED */
#ifdef HAL_HASH_MODULE_ENABLED
#include "stm32f4xx_hal_hash.h"
#endif /* HAL_HASH_MODULE_ENABLED */
#ifdef HAL_I2C_MODULE_ENABLED
#include "stm32f4xx_hal_i2c.h"
#endif /* HAL_I2C_MODULE_ENABLED */
#ifdef HAL_I2S_MODULE_ENABLED
#include "stm32f4xx_hal_i2s.h"
#endif /* HAL_I2S_MODULE_ENABLED */
#ifdef HAL_IWDG_MODULE_ENABLED
#include "stm32f4xx_hal_iwdg.h"
#endif /* HAL_IWDG_MODULE_ENABLED */
#ifdef HAL_LTDC_MODULE_ENABLED
#include "stm32f4xx_hal_ltdc.h"
#endif /* HAL_LTDC_MODULE_ENABLED */
#ifdef HAL_PWR_MODULE_ENABLED
#include "stm32f4xx_hal_pwr.h"
#endif /* HAL_PWR_MODULE_ENABLED */
#ifdef HAL_RNG_MODULE_ENABLED
#include "stm32f4xx_hal_rng.h"
#endif /* HAL_RNG_MODULE_ENABLED */
#ifdef HAL_RTC_MODULE_ENABLED
#include "stm32f4xx_hal_rtc.h"
#endif /* HAL_RTC_MODULE_ENABLED */
#ifdef HAL_SAI_MODULE_ENABLED
#include "stm32f4xx_hal_sai.h"
#endif /* HAL_SAI_MODULE_ENABLED */
#ifdef HAL_SD_MODULE_ENABLED
#include "stm32f4xx_hal_sd.h"
#endif /* HAL_SD_MODULE_ENABLED */
#ifdef HAL_SPI_MODULE_ENABLED
#include "stm32f4xx_hal_spi.h"
#endif /* HAL_SPI_MODULE_ENABLED */
#ifdef HAL_TIM_MODULE_ENABLED
#include "stm32f4xx_hal_tim.h"
#endif /* HAL_TIM_MODULE_ENABLED */
#ifdef HAL_UART_MODULE_ENABLED
#include "stm32f4xx_hal_uart.h"
#endif /* HAL_UART_MODULE_ENABLED */
#ifdef HAL_USART_MODULE_ENABLED
#include "stm32f4xx_hal_usart.h"
#endif /* HAL_USART_MODULE_ENABLED */
#ifdef HAL_IRDA_MODULE_ENABLED
#include "stm32f4xx_hal_irda.h"
#endif /* HAL_IRDA_MODULE_ENABLED */
#ifdef HAL_SMARTCARD_MODULE_ENABLED
#include "stm32f4xx_hal_smartcard.h"
#endif /* HAL_SMARTCARD_MODULE_ENABLED */
#ifdef HAL_WWDG_MODULE_ENABLED
#include "stm32f4xx_hal_wwdg.h"
#endif /* HAL_WWDG_MODULE_ENABLED */
#ifdef HAL_PCD_MODULE_ENABLED
#include "stm32f4xx_hal_pcd.h"
#endif /* HAL_PCD_MODULE_ENABLED */
#ifdef HAL_HCD_MODULE_ENABLED
#include "stm32f4xx_hal_hcd.h"
#endif /* HAL_HCD_MODULE_ENABLED */
/* Exported macro ------------------------------------------------------------*/
#ifdef USE_FULL_ASSERT
/**
* @brief The assert_param macro is used for function's parameters check.
* @param expr: If expr is false, it calls assert_failed function
* which reports the name of the source file and the source
* line number of the call that failed.
* If expr is true, it returns no value.
* @retval None
*/
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
void assert_failed(uint8_t* file, uint32_t line);
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_HAL_CONF_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -1,58 +0,0 @@
/**
******************************************************************************
* @file stm32f4xx_it.h
* @date 03/02/2015 20:27:00
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
*
* COPYRIGHT(c) 2015 STMicroelectronics
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions 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 its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 __STM32F4xx_IT_H
#define __STM32F4xx_IT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void OTG_FS_IRQHandler(void);
void SysTick_Handler(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_IT_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -46,7 +46,7 @@
extern USBD_HandleTypeDef hUsbDeviceFS; extern USBD_HandleTypeDef hUsbDeviceFS;
/* USB_Device init function */ /* USB_Device init function */
void MX_USB_DEVICE_Init(void); void USB_Device_Init(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -74,6 +74,7 @@
* @{ * @{
*/ */
extern USBD_DescriptorsTypeDef FS_Desc; extern USBD_DescriptorsTypeDef FS_Desc;
extern const int8_t STORAGE_Inquirydata_FS[];
/** /**
* @} * @}
*/ */

@ -1,101 +0,0 @@
/**
******************************************************************************
* @file : usbd_storage_if.h
* @author : MCD Application Team
* @version : V1.1.0
* @date : 19-March-2012
* @brief : header file for the usbd_storage_if.c file
******************************************************************************
* COPYRIGHT(c) 2015 STMicroelectronics
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions 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 its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_STORAGE_IF_H_
#define __USBD_STORAGE_IF_H_
/* Includes ------------------------------------------------------------------*/
#include "usbd_msc.h"
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
* @{
*/
/** @defgroup USBD_STORAGE
* @brief header file for the USBD_STORAGE.c file
* @{
*/
/** @defgroup USBD_STORAGE_Exported_Defines
* @{
*/
/**
* @}
*/
/** @defgroup USBD_STORAGE_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup USBD_STORAGE_Exported_Macros
* @{
*/
/**
* @}
*/
/** @defgroup USBD_STORAGE_Exported_Variables
* @{
*/
extern USBD_StorageTypeDef USBD_Storage_Interface_fops_FS;
/**
* @}
*/
/** @defgroup USBD_STORAGE_Exported_FunctionsPrototype
* @{
*/
/**
* @}
*/
#endif /* __USBD_STORAGE_IF_H_ */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -34,9 +34,10 @@
#endif #endif
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "usbd_msc_bot.h" #include "usbd_msc_bot.h"
#include "usbd_msc_scsi.h" #include "usbd_msc_scsi.h"
#include "usbd_ioreq.h" #include "usbd_ioreq.h"
#include "downstream_spi.h"
/** @addtogroup USBD_MSC_BOT /** @addtogroup USBD_MSC_BOT
* @{ * @{
@ -85,24 +86,26 @@ typedef struct _USBD_STORAGE
typedef struct typedef struct
{ {
uint32_t max_lun; uint32_t max_lun;
uint32_t interface; uint32_t interface;
uint8_t bot_state; uint8_t bot_state;
uint8_t bot_status; uint8_t bot_status;
uint16_t bot_data_length; uint16_t bot_data_length;
uint8_t bot_data[MSC_MEDIA_PACKET]; uint8_t* bot_data;
USBD_MSC_BOT_CBWTypeDef cbw; DownstreamPacketTypeDef* bot_packet; //Not NULL indicates we currently own a downstream packet buffer, and should free it when we are done.
USBD_MSC_BOT_CSWTypeDef csw; USBD_MSC_BOT_CBWTypeDef cbw;
USBD_MSC_BOT_CSWTypeDef csw;
USBD_SCSI_SenseTypeDef scsi_sense [SENSE_LIST_DEEPTH]; USBD_SCSI_SenseTypeDef scsi_sense [SENSE_LIST_DEPTH];
uint8_t scsi_sense_head; uint8_t scsi_sense_head;
uint8_t scsi_sense_tail; uint8_t scsi_sense_tail;
uint16_t scsi_blk_size; uint16_t scsi_blk_size; //LOGICAL BLOCK LENGTH IN BYTES: Number of bytes of user data in a logical block [SBC-4]
uint32_t scsi_blk_nbr; uint32_t scsi_blk_nbr; //This is total block count = LOGICAL BLOCK ADDRESS + 1. LOGICAL BLOCK ADDRESS: LBA of the last logical block on the direct access block device [SBC-4]
uint32_t scsi_blk_addr; uint32_t scsi_blk_addr; //LOGICAL BLOCK ADDRESS: Starting with the logical block referenced [SBC-4]
uint32_t scsi_blk_len; uint16_t scsi_blk_len; //TRANSFER LENGTH: Number of contiguous logical blocks of data that shall be read [SBC-4]
} }
USBD_MSC_BOT_HandleTypeDef; USBD_MSC_BOT_HandleTypeDef;

@ -113,7 +113,6 @@ USBD_MSC_BOT_CSWTypeDef;
/** @defgroup USBD_CORE_Exported_Types /** @defgroup USBD_CORE_Exported_Types
* @{ * @{
*/ */
/** /**
* @} * @}
*/ */
@ -125,10 +124,13 @@ void MSC_BOT_Reset (USBD_HandleTypeDef *pdev);
void MSC_BOT_DeInit (USBD_HandleTypeDef *pdev); void MSC_BOT_DeInit (USBD_HandleTypeDef *pdev);
void MSC_BOT_DataIn (USBD_HandleTypeDef *pdev, void MSC_BOT_DataIn (USBD_HandleTypeDef *pdev,
uint8_t epnum); uint8_t epnum);
void MSC_BOT_DataOut (USBD_HandleTypeDef *pdev, void MSC_BOT_DataOut (USBD_HandleTypeDef *pdev,
uint8_t epnum); uint8_t epnum);
void MSC_BOT_DataIn_Callback(int8_t result);
void MSC_BOT_DataOut_Callback(int8_t result);
void MSC_BOT_CBW_Decode_Callback(int8_t result);
void MSC_BOT_SendCSW (USBD_HandleTypeDef *pdev, void MSC_BOT_SendCSW (USBD_HandleTypeDef *pdev,
uint8_t CSW_Status); uint8_t CSW_Status);

@ -34,7 +34,7 @@
#endif #endif
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "usbd_conf.h" #include <usbd_config.h>
/** @addtogroup STM32_USB_DEVICE_LIBRARY /** @addtogroup STM32_USB_DEVICE_LIBRARY
* @{ * @{

@ -49,7 +49,7 @@
* @{ * @{
*/ */
#define SENSE_LIST_DEEPTH 4 #define SENSE_LIST_DEPTH 4
/* SCSI Commands */ /* SCSI Commands */
#define SCSI_FORMAT_UNIT 0x04 #define SCSI_FORMAT_UNIT 0x04
@ -99,15 +99,15 @@
#define INVALID_CDB 0x20 #define INVALID_CDB 0x20
#define INVALID_FIELED_IN_COMMAND 0x24 #define INVALID_FIELD_IN_COMMAND 0x24
#define PARAMETER_LIST_LENGTH_ERROR 0x1A #define PARAMETER_LIST_LENGTH_ERROR 0x1A
#define INVALID_FIELD_IN_PARAMETER_LIST 0x26 #define INVALID_FIELD_IN_PARAMETER_LIST 0x26
#define ADDRESS_OUT_OF_RANGE 0x21 #define ADDRESS_OUT_OF_RANGE 0x21
#define MEDIUM_NOT_PRESENT 0x3A #define MEDIUM_NOT_PRESENT 0x3A
#define MEDIUM_HAVE_CHANGED 0x28 #define MEDIUM_HAS_CHANGED 0x28
#define WRITE_PROTECTED 0x27 #define WRITE_PROTECTED 0x27
#define UNRECOVERED_READ_ERROR 0x11 #define UNRECOVERED_READ_ERROR 0x11
#define WRITE_FAULT 0x03 #define WRITE_FAULT 0x03
#define READ_FORMAT_CAPACITY_DATA_LEN 0x0C #define READ_FORMAT_CAPACITY_DATA_LEN 0x0C
#define READ_CAPACITY10_DATA_LEN 0x08 #define READ_CAPACITY10_DATA_LEN 0x08
@ -145,6 +145,10 @@ typedef struct _SENSE_ITEM {
char *pData; char *pData;
} w; } w;
} USBD_SCSI_SenseTypeDef; } USBD_SCSI_SenseTypeDef;
typedef void (*SCSI_ProcessCmdCallbackTypeDef)(int8_t result);
/** /**
* @} * @}
*/ */
@ -167,9 +171,10 @@ typedef struct _SENSE_ITEM {
/** @defgroup USBD_SCSI_Exported_FunctionsPrototype /** @defgroup USBD_SCSI_Exported_FunctionsPrototype
* @{ * @{
*/ */
int8_t SCSI_ProcessCmd(USBD_HandleTypeDef *pdev, void SCSI_ProcessCmd(USBD_HandleTypeDef *pdev,
uint8_t lun, uint8_t lun,
uint8_t *cmd); uint8_t *cmd,
SCSI_ProcessCmdCallbackTypeDef process_cmd_callback);
void SCSI_SenseCode(USBD_HandleTypeDef *pdev, void SCSI_SenseCode(USBD_HandleTypeDef *pdev,
uint8_t lun, uint8_t lun,

@ -42,7 +42,8 @@
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "usbd_msc.h" #include "usbd_msc.h"
#include "downstream_interface_def.h"
#include "downstream_spi.h"
/** @addtogroup STM32_USB_DEVICE_LIBRARY /** @addtogroup STM32_USB_DEVICE_LIBRARY
* @{ * @{
@ -106,6 +107,8 @@ uint8_t *USBD_MSC_GetOtherSpeedCfgDesc (uint16_t *length);
uint8_t *USBD_MSC_GetDeviceQualifierDescriptor (uint16_t *length); uint8_t *USBD_MSC_GetDeviceQualifierDescriptor (uint16_t *length);
uint8_t USBD_MSC_BufferFreed(USBD_HandleTypeDef *pdev);
/** /**
* @} * @}
@ -128,7 +131,8 @@ USBD_ClassTypeDef USBD_MSC =
USBD_MSC_DataOut, USBD_MSC_DataOut,
NULL, /*SOF */ NULL, /*SOF */
NULL, NULL,
NULL, NULL,
USBD_MSC_BufferFreed,
USBD_MSC_GetHSCfgDesc, USBD_MSC_GetHSCfgDesc,
USBD_MSC_GetFSCfgDesc, USBD_MSC_GetFSCfgDesc,
USBD_MSC_GetOtherSpeedCfgDesc, USBD_MSC_GetOtherSpeedCfgDesc,
@ -181,7 +185,7 @@ __ALIGN_BEGIN uint8_t USBD_MSC_CfgHSDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
/* USB Mass storage device Configuration Descriptor */ /* USB Mass storage device Configuration Descriptor */
/* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */ /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
uint8_t USBD_MSC_CfgFSDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END = __ALIGN_BEGIN uint8_t USBD_MSC_CfgFSDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
{ {
0x09, /* bLength: Configuation Descriptor size */ 0x09, /* bLength: Configuation Descriptor size */
@ -226,7 +230,7 @@ uint8_t USBD_MSC_CfgFSDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
__ALIGN_BEGIN uint8_t USBD_MSC_OtherSpeedCfgDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END = __ALIGN_BEGIN uint8_t USBD_MSC_OtherSpeedCfgDesc[USB_MSC_CONFIG_DESC_SIZ] __ALIGN_END =
{ {
0x09, /* bLength: Configuation Descriptor size */ 0x09, /* bLength: Configuration Descriptor size */
USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION, USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION,
USB_MSC_CONFIG_DESC_SIZ, USB_MSC_CONFIG_DESC_SIZ,
@ -337,7 +341,8 @@ uint8_t USBD_MSC_Init (USBD_HandleTypeDef *pdev,
else else
{ {
/* Init the BOT layer */ /* Init the BOT layer */
MSC_BOT_Init(pdev); MSC_BOT_Init(pdev);
((USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData)->bot_packet = NULL;
ret = 0; ret = 0;
} }
@ -398,7 +403,7 @@ uint8_t USBD_MSC_Setup (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
(req->wLength == 1) && (req->wLength == 1) &&
((req->bmRequest & 0x80) == 0x80)) ((req->bmRequest & 0x80) == 0x80))
{ {
hmsc->max_lun = ((USBD_StorageTypeDef *)pdev->pUserData)->GetMaxLun(); hmsc->max_lun = (UPSTREAM_LUN_NBR - 1);
USBD_CtlSendData (pdev, USBD_CtlSendData (pdev,
(uint8_t *)&hmsc->max_lun, (uint8_t *)&hmsc->max_lun,
1); 1);
@ -530,6 +535,18 @@ uint8_t USBD_MSC_DataOut (USBD_HandleTypeDef *pdev,
return 0; return 0;
} }
uint8_t USBD_MSC_BufferFreed(USBD_HandleTypeDef *pdev)
{
if (((USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData)->bot_packet != NULL)
{
Downstream_ReleasePacket(((USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData)->bot_packet);
((USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData)->bot_packet = NULL;
}
return 0;
}
/** /**
* @brief USBD_MSC_GetHSCfgDesc * @brief USBD_MSC_GetHSCfgDesc
* return configuration descriptor * return configuration descriptor
@ -577,20 +594,6 @@ uint8_t *USBD_MSC_GetDeviceQualifierDescriptor (uint16_t *length)
return USBD_MSC_DeviceQualifierDesc; return USBD_MSC_DeviceQualifierDesc;
} }
/**
* @brief USBD_MSC_RegisterStorage
* @param fops: storage callback
* @retval status
*/
uint8_t USBD_MSC_RegisterStorage (USBD_HandleTypeDef *pdev,
USBD_StorageTypeDef *fops)
{
if(fops != NULL)
{
pdev->pUserData= fops;
}
return 0;
}
/** /**
* @} * @}

@ -70,6 +70,9 @@
* @{ * @{
*/ */
USBD_HandleTypeDef *MSC_BOT_pdev;
USBD_MSC_BOT_HandleTypeDef *MSC_BOT_hmsc;
/** /**
* @} * @}
*/ */
@ -112,8 +115,6 @@ void MSC_BOT_Init (USBD_HandleTypeDef *pdev)
hmsc->scsi_sense_tail = 0; hmsc->scsi_sense_tail = 0;
hmsc->scsi_sense_head = 0; hmsc->scsi_sense_head = 0;
((USBD_StorageTypeDef *)pdev->pUserData)->Init(0);
USBD_LL_FlushEP(pdev, MSC_EPOUT_ADDR); USBD_LL_FlushEP(pdev, MSC_EPOUT_ADDR);
USBD_LL_FlushEP(pdev, MSC_EPIN_ADDR); USBD_LL_FlushEP(pdev, MSC_EPIN_ADDR);
@ -171,24 +172,32 @@ void MSC_BOT_DataIn (USBD_HandleTypeDef *pdev,
switch (hmsc->bot_state) switch (hmsc->bot_state)
{ {
case USBD_BOT_DATA_IN: case USBD_BOT_DATA_IN:
if(SCSI_ProcessCmd(pdev, MSC_BOT_pdev = pdev;
hmsc->cbw.bLUN, SCSI_ProcessCmd(pdev,
&hmsc->cbw.CB[0]) < 0) hmsc->cbw.bLUN,
{ &hmsc->cbw.CB[0],
MSC_BOT_SendCSW (pdev, USBD_CSW_CMD_FAILED); MSC_BOT_DataIn_Callback);
}
break; break;
case USBD_BOT_SEND_DATA: case USBD_BOT_SEND_DATA:
case USBD_BOT_LAST_DATA_IN: case USBD_BOT_LAST_DATA_IN:
MSC_BOT_SendCSW (pdev, USBD_CSW_CMD_PASSED); MSC_BOT_SendCSW (pdev, USBD_CSW_CMD_PASSED);
break; break;
default: default:
break; break;
} }
} }
void MSC_BOT_DataIn_Callback(int8_t result)
{
if (result < 0)
{
MSC_BOT_SendCSW (MSC_BOT_pdev, USBD_CSW_CMD_FAILED);
}
}
/** /**
* @brief MSC_BOT_DataOut * @brief MSC_BOT_DataOut
* Process MSC OUT data * Process MSC OUT data
@ -209,13 +218,11 @@ void MSC_BOT_DataOut (USBD_HandleTypeDef *pdev,
case USBD_BOT_DATA_OUT: case USBD_BOT_DATA_OUT:
if(SCSI_ProcessCmd(pdev, MSC_BOT_pdev = pdev;
hmsc->cbw.bLUN, SCSI_ProcessCmd(pdev,
&hmsc->cbw.CB[0]) < 0) hmsc->cbw.bLUN,
{ &hmsc->cbw.CB[0],
MSC_BOT_SendCSW (pdev, USBD_CSW_CMD_FAILED); MSC_BOT_DataOut_Callback);
}
break; break;
default: default:
@ -223,6 +230,15 @@ void MSC_BOT_DataOut (USBD_HandleTypeDef *pdev,
} }
} }
void MSC_BOT_DataOut_Callback(int8_t result)
{
if (result < 0)
{
MSC_BOT_SendCSW (MSC_BOT_pdev, USBD_CSW_CMD_FAILED);
}
}
/** /**
* @brief MSC_BOT_CBW_Decode * @brief MSC_BOT_CBW_Decode
* Decode the CBW command and set the BOT state machine accordingly * Decode the CBW command and set the BOT state machine accordingly
@ -254,40 +270,51 @@ static void MSC_BOT_CBW_Decode (USBD_HandleTypeDef *pdev)
} }
else else
{ {
if(SCSI_ProcessCmd(pdev, MSC_BOT_pdev = pdev;
hmsc->cbw.bLUN, MSC_BOT_hmsc = hmsc;
&hmsc->cbw.CB[0]) < 0) SCSI_ProcessCmd(pdev,
{ hmsc->cbw.bLUN,
if(hmsc->bot_state == USBD_BOT_NO_DATA) &hmsc->cbw.CB[0],
{ MSC_BOT_CBW_Decode_Callback);
MSC_BOT_SendCSW (pdev,
USBD_CSW_CMD_FAILED);
}
else
{
MSC_BOT_Abort(pdev);
}
}
/*Burst xfer handled internally*/
else if ((hmsc->bot_state != USBD_BOT_DATA_IN) &&
(hmsc->bot_state != USBD_BOT_DATA_OUT) &&
(hmsc->bot_state != USBD_BOT_LAST_DATA_IN))
{
if (hmsc->bot_data_length > 0)
{
MSC_BOT_SendData(pdev,
hmsc->bot_data,
hmsc->bot_data_length);
}
else if (hmsc->bot_data_length == 0)
{
MSC_BOT_SendCSW (pdev,
USBD_CSW_CMD_PASSED);
}
}
} }
} }
void MSC_BOT_CBW_Decode_Callback(int8_t result)
{
if (result < 0)
{
if(MSC_BOT_hmsc->bot_state == USBD_BOT_NO_DATA)
{
MSC_BOT_SendCSW (MSC_BOT_pdev,
USBD_CSW_CMD_FAILED);
}
else
{
MSC_BOT_Abort(MSC_BOT_pdev);
}
}
/*Burst xfer handled internally*/
else if ((MSC_BOT_hmsc->bot_state != USBD_BOT_DATA_IN) &&
(MSC_BOT_hmsc->bot_state != USBD_BOT_DATA_OUT) &&
(MSC_BOT_hmsc->bot_state != USBD_BOT_LAST_DATA_IN))
{
if (MSC_BOT_hmsc->bot_data_length > 0)
{
MSC_BOT_SendData(MSC_BOT_pdev,
MSC_BOT_hmsc->bot_data,
MSC_BOT_hmsc->bot_data_length);
}
else if (MSC_BOT_hmsc->bot_data_length == 0)
{
MSC_BOT_SendCSW (MSC_BOT_pdev,
USBD_CSW_CMD_PASSED);
}
}
}
/** /**
* @brief MSC_BOT_SendData * @brief MSC_BOT_SendData
* Send the requested data * Send the requested data

@ -30,7 +30,10 @@
#include "usbd_msc_scsi.h" #include "usbd_msc_scsi.h"
#include "usbd_msc.h" #include "usbd_msc.h"
#include "usbd_msc_data.h" #include "usbd_msc_data.h"
#include "usbd_descriptors.h"
#include "downstream_interface_def.h"
#include "downstream_interface_msc.h"
#include "downstream_spi.h"
/** @addtogroup STM32_USB_DEVICE_LIBRARY /** @addtogroup STM32_USB_DEVICE_LIBRARY
@ -72,6 +75,13 @@
* @{ * @{
*/ */
USBD_HandleTypeDef *SCSI_ProcessCmd_pdev;
uint8_t SCSI_ProcessCmd_lun;
uint8_t *SCSI_ProcessCmd_params;
SCSI_ProcessCmdCallbackTypeDef SCSI_ProcessCmd_callback;
USBD_MSC_BOT_HandleTypeDef *SCSI_ProcessCmd_hmsc;
/** /**
* @} * @}
*/ */
@ -80,26 +90,33 @@
/** @defgroup MSC_SCSI_Private_FunctionPrototypes /** @defgroup MSC_SCSI_Private_FunctionPrototypes
* @{ * @{
*/ */
static int8_t SCSI_TestUnitReady(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static void SCSI_TestUnitReady(void);
static int8_t SCSI_Inquiry(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static void SCSI_Inquiry(void);
static int8_t SCSI_ReadFormatCapacity(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static void SCSI_ReadFormatCapacity(void);
static int8_t SCSI_ReadCapacity10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static void SCSI_ReadCapacity10(void);
static int8_t SCSI_RequestSense (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static void SCSI_RequestSense (void);
static int8_t SCSI_StartStopUnit(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static void SCSI_StartStopUnit(void);
static int8_t SCSI_ModeSense6 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static void SCSI_ModeSense6 (void);
static int8_t SCSI_ModeSense10 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static void SCSI_ModeSense10 (void);
static int8_t SCSI_Write10(USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *params); static void SCSI_Write10(void);
static int8_t SCSI_Read10(USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *params); static void SCSI_Read10(void);
static int8_t SCSI_Verify10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params); static void SCSI_Verify10(void);
static int8_t SCSI_CheckAddressRange (USBD_HandleTypeDef *pdev, static int8_t SCSI_CheckAddressRange (uint32_t blk_offset , uint16_t blk_nbr);
uint8_t lun ,
uint32_t blk_offset , void SCSI_TestUnitReadyCallback(HAL_StatusTypeDef result);
uint16_t blk_nbr); void SCSI_ReadCapacity10Callback(HAL_StatusTypeDef result,
static int8_t SCSI_ProcessRead (USBD_HandleTypeDef *pdev, uint32_t result_uint[],
uint8_t lun); DownstreamPacketTypeDef* downstreamPacket);
void SCSI_ReadFormatCapacityCallback(HAL_StatusTypeDef result,
static int8_t SCSI_ProcessWrite (USBD_HandleTypeDef *pdev, uint32_t result_uint[],
uint8_t lun); DownstreamPacketTypeDef* packetToUse);
void SCSI_Read10BeginCallback(HAL_StatusTypeDef result);
void SCSI_Read10ReplyCallback(HAL_StatusTypeDef result,
DownstreamPacketTypeDef* downstreamPacket);
void SCSI_Write10BeginCallback(HAL_StatusTypeDef result);
void SCSI_Write10FreePacketCallback(DownstreamPacketTypeDef* freePacket);
/** /**
* @} * @}
*/ */
@ -118,54 +135,74 @@ static int8_t SCSI_ProcessWrite (USBD_HandleTypeDef *pdev,
* @param params: Command parameters * @param params: Command parameters
* @retval status * @retval status
*/ */
int8_t SCSI_ProcessCmd(USBD_HandleTypeDef *pdev, void SCSI_ProcessCmd(USBD_HandleTypeDef *pdev,
uint8_t lun, uint8_t lun,
uint8_t *params) uint8_t *params,
SCSI_ProcessCmdCallbackTypeDef callback)
{ {
//Save all our parameters for easy access in callback routines
SCSI_ProcessCmd_pdev = pdev;
SCSI_ProcessCmd_params = params;
SCSI_ProcessCmd_lun = lun;
SCSI_ProcessCmd_callback = callback;
SCSI_ProcessCmd_hmsc = (USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData;
switch (params[0]) switch (params[0])
{ {
case SCSI_TEST_UNIT_READY: case SCSI_TEST_UNIT_READY:
return SCSI_TestUnitReady(pdev, lun, params); SCSI_TestUnitReady();
return;
case SCSI_REQUEST_SENSE: case SCSI_REQUEST_SENSE:
return SCSI_RequestSense (pdev, lun, params); SCSI_RequestSense();
return;
case SCSI_INQUIRY: case SCSI_INQUIRY:
return SCSI_Inquiry(pdev, lun, params); SCSI_Inquiry();
return;
case SCSI_START_STOP_UNIT: case SCSI_START_STOP_UNIT:
return SCSI_StartStopUnit(pdev, lun, params); SCSI_StartStopUnit();
return;
case SCSI_ALLOW_MEDIUM_REMOVAL: case SCSI_ALLOW_MEDIUM_REMOVAL:
return SCSI_StartStopUnit(pdev, lun, params); SCSI_StartStopUnit();
return;
case SCSI_MODE_SENSE6: case SCSI_MODE_SENSE6:
return SCSI_ModeSense6 (pdev, lun, params); SCSI_ModeSense6();
return;
case SCSI_MODE_SENSE10: case SCSI_MODE_SENSE10:
return SCSI_ModeSense10 (pdev, lun, params); SCSI_ModeSense10();
return;
case SCSI_READ_FORMAT_CAPACITIES: case SCSI_READ_FORMAT_CAPACITIES:
return SCSI_ReadFormatCapacity(pdev, lun, params); SCSI_ReadFormatCapacity();
return;
case SCSI_READ_CAPACITY10: case SCSI_READ_CAPACITY10:
return SCSI_ReadCapacity10(pdev, lun, params); SCSI_ReadCapacity10();
return;
case SCSI_READ10: case SCSI_READ10:
return SCSI_Read10(pdev, lun, params); SCSI_Read10();
return;
case SCSI_WRITE10: case SCSI_WRITE10:
return SCSI_Write10(pdev, lun, params); SCSI_Write10();
return;
case SCSI_VERIFY10: case SCSI_VERIFY10:
return SCSI_Verify10(pdev, lun, params); SCSI_Verify10();
return;
default: default:
SCSI_SenseCode(pdev, SCSI_SenseCode(pdev,
lun, lun,
ILLEGAL_REQUEST, ILLEGAL_REQUEST,
INVALID_CDB); INVALID_CDB);
return -1; SCSI_ProcessCmd_callback(-1);
} }
} }
@ -177,34 +214,53 @@ int8_t SCSI_ProcessCmd(USBD_HandleTypeDef *pdev,
* @param params: Command parameters * @param params: Command parameters
* @retval status * @retval status
*/ */
static int8_t SCSI_TestUnitReady(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params) void SCSI_TestUnitReady(void)
{ {
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData;
/* case 9 : Hi > D0 */ /* case 9 : Hi > D0 */
if (hmsc->cbw.dDataLength != 0) if (SCSI_ProcessCmd_hmsc->cbw.dDataLength != 0)
{ {
SCSI_SenseCode(pdev, SCSI_SenseCode(SCSI_ProcessCmd_pdev,
hmsc->cbw.bLUN, SCSI_ProcessCmd_lun,
ILLEGAL_REQUEST, ILLEGAL_REQUEST,
INVALID_CDB); INVALID_CDB);
return -1; SCSI_ProcessCmd_callback(-1);
} return;
}
if(((USBD_StorageTypeDef *)pdev->pUserData)->IsReady(lun) !=0 ) if (SCSI_ProcessCmd_lun >= UPSTREAM_LUN_NBR)
{ {
SCSI_SenseCode(pdev, SCSI_TestUnitReadyCallback(HAL_ERROR);
lun, return;
NOT_READY, }
MEDIUM_NOT_PRESENT);
if (DownstreamInterface_TestReady(SCSI_TestUnitReadyCallback) != HAL_OK)
hmsc->bot_state = USBD_BOT_NO_DATA; {
return -1; SCSI_TestUnitReadyCallback(HAL_ERROR);
} }
hmsc->bot_data_length = 0;
return 0;
} }
void SCSI_TestUnitReadyCallback(HAL_StatusTypeDef result)
{
if (result != HAL_OK)
{
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
SCSI_ProcessCmd_lun,
NOT_READY,
MEDIUM_NOT_PRESENT);
SCSI_ProcessCmd_hmsc->bot_state = USBD_BOT_NO_DATA;
SCSI_ProcessCmd_callback(-1);
return;
}
//Success!
SCSI_ProcessCmd_hmsc->bot_data_length = 0;
SCSI_ProcessCmd_callback(0);
}
/** /**
* @brief SCSI_Inquiry * @brief SCSI_Inquiry
* Process Inquiry command * Process Inquiry command
@ -212,36 +268,40 @@ static int8_t SCSI_TestUnitReady(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
* @param params: Command parameters * @param params: Command parameters
* @retval status * @retval status
*/ */
static int8_t SCSI_Inquiry(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params) static void SCSI_Inquiry(void)
{ {
uint8_t* pPage; uint8_t* pPage;
uint16_t len; uint16_t len;
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData; DownstreamPacketTypeDef* freePacket;
if (params[1] & 0x01)/*Evpd is set*/ freePacket = Downstream_GetFreePacketImmediately();
{ SCSI_ProcessCmd_hmsc->bot_packet = freePacket;
pPage = (uint8_t *)MSC_Page00_Inquiry_Data; SCSI_ProcessCmd_hmsc->bot_data = freePacket->Data;
len = LENGTH_INQUIRY_PAGE00;
} if (SCSI_ProcessCmd_params[1] & 0x01)/*Evpd is set*/
else {
{ pPage = (uint8_t *)MSC_Page00_Inquiry_Data;
len = LENGTH_INQUIRY_PAGE00;
pPage = (uint8_t *)&((USBD_StorageTypeDef *)pdev->pUserData)->pInquiry[lun * STANDARD_INQUIRY_DATA_LEN]; }
len = pPage[4] + 5; else
{
if (params[4] <= len) //Return the same info for any LUN requested
{ pPage = (uint8_t *)&STORAGE_Inquirydata_FS;
len = params[4]; len = pPage[4] + 5;
}
} if (SCSI_ProcessCmd_params[4] <= len)
hmsc->bot_data_length = len; {
len = SCSI_ProcessCmd_params[4];
while (len) }
{ }
len--; SCSI_ProcessCmd_hmsc->bot_data_length = len;
hmsc->bot_data[len] = pPage[len];
} while (len)
return 0; {
len--;
SCSI_ProcessCmd_hmsc->bot_data[len] = pPage[len];
}
SCSI_ProcessCmd_callback(0);
} }
/** /**
@ -251,35 +311,49 @@ static int8_t SCSI_Inquiry(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *par
* @param params: Command parameters * @param params: Command parameters
* @retval status * @retval status
*/ */
static int8_t SCSI_ReadCapacity10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params) static void SCSI_ReadCapacity10(void)
{ {
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData; if (DownstreamInterface_GetCapacity(SCSI_ReadCapacity10Callback) != HAL_OK)
{
if(((USBD_StorageTypeDef *)pdev->pUserData)->GetCapacity(lun, &hmsc->scsi_blk_nbr, &hmsc->scsi_blk_size) != 0) SCSI_ReadCapacity10Callback(HAL_ERROR, NULL, NULL);
{ }
SCSI_SenseCode(pdev, }
lun,
NOT_READY,
MEDIUM_NOT_PRESENT); void SCSI_ReadCapacity10Callback(HAL_StatusTypeDef result,
return -1; uint32_t result_uint[],
} DownstreamPacketTypeDef* downstreamPacket)
else {
{ if (result != HAL_OK)
{
hmsc->bot_data[0] = (uint8_t)((hmsc->scsi_blk_nbr - 1) >> 24); SCSI_SenseCode(SCSI_ProcessCmd_pdev,
hmsc->bot_data[1] = (uint8_t)((hmsc->scsi_blk_nbr - 1) >> 16); SCSI_ProcessCmd_lun,
hmsc->bot_data[2] = (uint8_t)((hmsc->scsi_blk_nbr - 1) >> 8); NOT_READY,
hmsc->bot_data[3] = (uint8_t)(hmsc->scsi_blk_nbr - 1); MEDIUM_NOT_PRESENT);
SCSI_ProcessCmd_callback(-1);
hmsc->bot_data[4] = (uint8_t)(hmsc->scsi_blk_size >> 24); return;
hmsc->bot_data[5] = (uint8_t)(hmsc->scsi_blk_size >> 16); }
hmsc->bot_data[6] = (uint8_t)(hmsc->scsi_blk_size >> 8);
hmsc->bot_data[7] = (uint8_t)(hmsc->scsi_blk_size); SCSI_ProcessCmd_hmsc->bot_packet = downstreamPacket;
SCSI_ProcessCmd_hmsc->bot_data = downstreamPacket->Data;
hmsc->bot_data_length = 8;
return 0; SCSI_ProcessCmd_hmsc->scsi_blk_nbr = result_uint[0];
} SCSI_ProcessCmd_hmsc->scsi_blk_size = result_uint[1];
SCSI_ProcessCmd_hmsc->bot_data[0] = (uint8_t)((SCSI_ProcessCmd_hmsc->scsi_blk_nbr - 1) >> 24);
SCSI_ProcessCmd_hmsc->bot_data[1] = (uint8_t)((SCSI_ProcessCmd_hmsc->scsi_blk_nbr - 1) >> 16);
SCSI_ProcessCmd_hmsc->bot_data[2] = (uint8_t)((SCSI_ProcessCmd_hmsc->scsi_blk_nbr - 1) >> 8);
SCSI_ProcessCmd_hmsc->bot_data[3] = (uint8_t)(SCSI_ProcessCmd_hmsc->scsi_blk_nbr - 1);
SCSI_ProcessCmd_hmsc->bot_data[4] = (uint8_t)(SCSI_ProcessCmd_hmsc->scsi_blk_size >> 24);
SCSI_ProcessCmd_hmsc->bot_data[5] = (uint8_t)(SCSI_ProcessCmd_hmsc->scsi_blk_size >> 16);
SCSI_ProcessCmd_hmsc->bot_data[6] = (uint8_t)(SCSI_ProcessCmd_hmsc->scsi_blk_size >> 8);
SCSI_ProcessCmd_hmsc->bot_data[7] = (uint8_t)(SCSI_ProcessCmd_hmsc->scsi_blk_size);
SCSI_ProcessCmd_hmsc->bot_data_length = 8;
SCSI_ProcessCmd_callback(0);
} }
/** /**
* @brief SCSI_ReadFormatCapacity * @brief SCSI_ReadFormatCapacity
* Process Read Format Capacity command * Process Read Format Capacity command
@ -287,44 +361,50 @@ static int8_t SCSI_ReadCapacity10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_
* @param params: Command parameters * @param params: Command parameters
* @retval status * @retval status
*/ */
static int8_t SCSI_ReadFormatCapacity(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params) static void SCSI_ReadFormatCapacity(void)
{ {
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData; if (DownstreamInterface_GetCapacity(SCSI_ReadFormatCapacityCallback) != HAL_OK)
{
uint16_t blk_size; SCSI_ReadFormatCapacityCallback(HAL_ERROR, NULL, NULL);
uint32_t blk_nbr; }
uint16_t i; }
for(i=0 ; i < 12 ; i++)
{ void SCSI_ReadFormatCapacityCallback(HAL_StatusTypeDef result,
hmsc->bot_data[i] = 0; uint32_t result_uint[],
} DownstreamPacketTypeDef* packetToUse)
{
if(((USBD_StorageTypeDef *)pdev->pUserData)->GetCapacity(lun, &blk_nbr, &blk_size) != 0) if (result != HAL_OK)
{ {
SCSI_SenseCode(pdev, SCSI_SenseCode(SCSI_ProcessCmd_pdev,
lun, SCSI_ProcessCmd_lun,
NOT_READY, NOT_READY,
MEDIUM_NOT_PRESENT); MEDIUM_NOT_PRESENT);
return -1; SCSI_ProcessCmd_callback(-1);
} return;
else }
{
hmsc->bot_data[3] = 0x08; SCSI_ProcessCmd_hmsc->bot_packet = packetToUse;
hmsc->bot_data[4] = (uint8_t)((blk_nbr - 1) >> 24); SCSI_ProcessCmd_hmsc->bot_data = packetToUse->Data;
hmsc->bot_data[5] = (uint8_t)((blk_nbr - 1) >> 16);
hmsc->bot_data[6] = (uint8_t)((blk_nbr - 1) >> 8); SCSI_ProcessCmd_hmsc->bot_data[0] = 0;
hmsc->bot_data[7] = (uint8_t)(blk_nbr - 1); SCSI_ProcessCmd_hmsc->bot_data[1] = 0;
SCSI_ProcessCmd_hmsc->bot_data[2] = 0;
hmsc->bot_data[8] = 0x02; SCSI_ProcessCmd_hmsc->bot_data[3] = 0x08;
hmsc->bot_data[9] = (uint8_t)(blk_size >> 16); SCSI_ProcessCmd_hmsc->bot_data[4] = (uint8_t)((result_uint[0] - 1) >> 24);
hmsc->bot_data[10] = (uint8_t)(blk_size >> 8); SCSI_ProcessCmd_hmsc->bot_data[5] = (uint8_t)((result_uint[0] - 1) >> 16);
hmsc->bot_data[11] = (uint8_t)(blk_size); SCSI_ProcessCmd_hmsc->bot_data[6] = (uint8_t)((result_uint[0] - 1) >> 8);
SCSI_ProcessCmd_hmsc->bot_data[7] = (uint8_t)(result_uint[0] - 1);
hmsc->bot_data_length = 12;
return 0; SCSI_ProcessCmd_hmsc->bot_data[8] = 0x02;
} SCSI_ProcessCmd_hmsc->bot_data[9] = (uint8_t)(result_uint[1] >> 16);
SCSI_ProcessCmd_hmsc->bot_data[10] = (uint8_t)(result_uint[1] >> 8);
SCSI_ProcessCmd_hmsc->bot_data[11] = (uint8_t)(result_uint[1]);
SCSI_ProcessCmd_hmsc->bot_data_length = 12;
SCSI_ProcessCmd_callback(0);
} }
/** /**
* @brief SCSI_ModeSense6 * @brief SCSI_ModeSense6
* Process Mode Sense6 command * Process Mode Sense6 command
@ -332,18 +412,23 @@ static int8_t SCSI_ReadFormatCapacity(USBD_HandleTypeDef *pdev, uint8_t lun, ui
* @param params: Command parameters * @param params: Command parameters
* @retval status * @retval status
*/ */
static int8_t SCSI_ModeSense6 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params) static void SCSI_ModeSense6 (void)
{ {
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData; uint16_t len = 8;
uint16_t len = 8 ; DownstreamPacketTypeDef* freePacket;
hmsc->bot_data_length = len;
freePacket = Downstream_GetFreePacketImmediately();
while (len) SCSI_ProcessCmd_hmsc->bot_packet = freePacket;
{ SCSI_ProcessCmd_hmsc->bot_data = freePacket->Data;
len--;
hmsc->bot_data[len] = MSC_Mode_Sense6_data[len]; SCSI_ProcessCmd_hmsc->bot_data_length = len;
}
return 0; while (len)
{
len--;
SCSI_ProcessCmd_hmsc->bot_data[len] = MSC_Mode_Sense6_data[len];
}
SCSI_ProcessCmd_callback(0);
} }
/** /**
@ -353,19 +438,23 @@ static int8_t SCSI_ModeSense6 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *
* @param params: Command parameters * @param params: Command parameters
* @retval status * @retval status
*/ */
static int8_t SCSI_ModeSense10 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params) static void SCSI_ModeSense10(void)
{ {
uint16_t len = 8; uint16_t len = 8;
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData; DownstreamPacketTypeDef* freePacket;
hmsc->bot_data_length = len;
while (len) freePacket = Downstream_GetFreePacketImmediately();
{ SCSI_ProcessCmd_hmsc->bot_packet = freePacket;
len--; SCSI_ProcessCmd_hmsc->bot_data = freePacket->Data;
hmsc->bot_data[len] = MSC_Mode_Sense10_data[len];
} SCSI_ProcessCmd_hmsc->bot_data_length = len;
return 0;
while (len)
{
len--;
SCSI_ProcessCmd_hmsc->bot_data[len] = MSC_Mode_Sense10_data[len];
}
SCSI_ProcessCmd_callback(0);
} }
/** /**
@ -376,38 +465,41 @@ static int8_t SCSI_ModeSense10 (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
* @retval status * @retval status
*/ */
static int8_t SCSI_RequestSense (USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params) static void SCSI_RequestSense(void)
{ {
uint8_t i; uint8_t i;
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData; DownstreamPacketTypeDef* freePacket;
for(i=0 ; i < REQUEST_SENSE_DATA_LEN ; i++) freePacket = Downstream_GetFreePacketImmediately();
{ SCSI_ProcessCmd_hmsc->bot_packet = freePacket;
hmsc->bot_data[i] = 0; SCSI_ProcessCmd_hmsc->bot_data = freePacket->Data;
}
for (i=0 ; i < REQUEST_SENSE_DATA_LEN ; i++)
hmsc->bot_data[0] = 0x70; {
hmsc->bot_data[7] = REQUEST_SENSE_DATA_LEN - 6; SCSI_ProcessCmd_hmsc->bot_data[i] = 0;
}
if((hmsc->scsi_sense_head != hmsc->scsi_sense_tail)) {
SCSI_ProcessCmd_hmsc->bot_data[0] = 0x70;
hmsc->bot_data[2] = hmsc->scsi_sense[hmsc->scsi_sense_head].Skey; SCSI_ProcessCmd_hmsc->bot_data[7] = REQUEST_SENSE_DATA_LEN - 6;
hmsc->bot_data[12] = hmsc->scsi_sense[hmsc->scsi_sense_head].w.b.ASCQ;
hmsc->bot_data[13] = hmsc->scsi_sense[hmsc->scsi_sense_head].w.b.ASC; if((SCSI_ProcessCmd_hmsc->scsi_sense_head != SCSI_ProcessCmd_hmsc->scsi_sense_tail))
hmsc->scsi_sense_head++; {
SCSI_ProcessCmd_hmsc->bot_data[2] = SCSI_ProcessCmd_hmsc->scsi_sense[SCSI_ProcessCmd_hmsc->scsi_sense_head].Skey;
if (hmsc->scsi_sense_head == SENSE_LIST_DEEPTH) SCSI_ProcessCmd_hmsc->bot_data[12] = SCSI_ProcessCmd_hmsc->scsi_sense[SCSI_ProcessCmd_hmsc->scsi_sense_head].w.b.ASCQ;
{ SCSI_ProcessCmd_hmsc->bot_data[13] = SCSI_ProcessCmd_hmsc->scsi_sense[SCSI_ProcessCmd_hmsc->scsi_sense_head].w.b.ASC;
hmsc->scsi_sense_head = 0; SCSI_ProcessCmd_hmsc->scsi_sense_head++;
} if (SCSI_ProcessCmd_hmsc->scsi_sense_head == SENSE_LIST_DEPTH)
} {
hmsc->bot_data_length = REQUEST_SENSE_DATA_LEN; SCSI_ProcessCmd_hmsc->scsi_sense_head = 0;
}
if (params[4] <= REQUEST_SENSE_DATA_LEN) }
{ SCSI_ProcessCmd_hmsc->bot_data_length = REQUEST_SENSE_DATA_LEN;
hmsc->bot_data_length = params[4];
} if (SCSI_ProcessCmd_params[4] <= REQUEST_SENSE_DATA_LEN)
return 0; {
SCSI_ProcessCmd_hmsc->bot_data_length = SCSI_ProcessCmd_params[4];
}
SCSI_ProcessCmd_callback(0);
} }
/** /**
@ -426,7 +518,7 @@ void SCSI_SenseCode(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t sKey, uint8_
hmsc->scsi_sense[hmsc->scsi_sense_tail].Skey = sKey; hmsc->scsi_sense[hmsc->scsi_sense_tail].Skey = sKey;
hmsc->scsi_sense[hmsc->scsi_sense_tail].w.ASC = ASC << 8; hmsc->scsi_sense[hmsc->scsi_sense_tail].w.ASC = ASC << 8;
hmsc->scsi_sense_tail++; hmsc->scsi_sense_tail++;
if (hmsc->scsi_sense_tail == SENSE_LIST_DEEPTH) if (hmsc->scsi_sense_tail == SENSE_LIST_DEPTH)
{ {
hmsc->scsi_sense_tail = 0; hmsc->scsi_sense_tail = 0;
} }
@ -438,11 +530,10 @@ void SCSI_SenseCode(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t sKey, uint8_
* @param params: Command parameters * @param params: Command parameters
* @retval status * @retval status
*/ */
static int8_t SCSI_StartStopUnit(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params) static void SCSI_StartStopUnit(void)
{ {
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*) pdev->pClassData; SCSI_ProcessCmd_hmsc->bot_data_length = 0;
hmsc->bot_data_length = 0; SCSI_ProcessCmd_callback(0);
return 0;
} }
/** /**
@ -452,67 +543,121 @@ static int8_t SCSI_StartStopUnit(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t
* @param params: Command parameters * @param params: Command parameters
* @retval status * @retval status
*/ */
static int8_t SCSI_Read10(USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *params) static void SCSI_Read10(void)
{ {
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*) pdev->pClassData; if (SCSI_ProcessCmd_hmsc->bot_state == USBD_BOT_IDLE) /* Idle */
{
if(hmsc->bot_state == USBD_BOT_IDLE) /* Idle */ /* case 10 : Ho <> Di */
{ if ((SCSI_ProcessCmd_hmsc->cbw.bmFlags & 0x80) != 0x80)
{
/* case 10 : Ho <> Di */ SCSI_SenseCode(SCSI_ProcessCmd_pdev,
SCSI_ProcessCmd_hmsc->cbw.bLUN,
if ((hmsc->cbw.bmFlags & 0x80) != 0x80) ILLEGAL_REQUEST,
{ INVALID_CDB);
SCSI_SenseCode(pdev, SCSI_ProcessCmd_callback(-1);
hmsc->cbw.bLUN, return;
ILLEGAL_REQUEST, }
INVALID_CDB);
return -1; SCSI_ProcessCmd_hmsc->scsi_blk_addr = (SCSI_ProcessCmd_params[2] << 24) | \
} (SCSI_ProcessCmd_params[3] << 16) | \
(SCSI_ProcessCmd_params[4] << 8) | \
if(((USBD_StorageTypeDef *)pdev->pUserData)->IsReady(lun) !=0 ) SCSI_ProcessCmd_params[5];
{
SCSI_SenseCode(pdev, SCSI_ProcessCmd_hmsc->scsi_blk_len = (SCSI_ProcessCmd_params[7] << 8) | \
lun, SCSI_ProcessCmd_params[8];
NOT_READY,
MEDIUM_NOT_PRESENT); if (SCSI_CheckAddressRange(SCSI_ProcessCmd_hmsc->scsi_blk_addr,
return -1; SCSI_ProcessCmd_hmsc->scsi_blk_len) < 0)
} {
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
hmsc->scsi_blk_addr = (params[2] << 24) | \ SCSI_ProcessCmd_hmsc->cbw.bLUN,
(params[3] << 16) | \ ILLEGAL_REQUEST,
(params[4] << 8) | \ INVALID_CDB);
params[5]; SCSI_ProcessCmd_callback(-1); /* error */
return;
hmsc->scsi_blk_len = (params[7] << 8) | \ }
params[8];
/* cases 4,5 : Hi <> Dn */
if (SCSI_ProcessCmd_hmsc->cbw.dDataLength != (uint32_t)(SCSI_ProcessCmd_hmsc->scsi_blk_len * SCSI_ProcessCmd_hmsc->scsi_blk_size))
{
if( SCSI_CheckAddressRange(pdev, lun, hmsc->scsi_blk_addr, hmsc->scsi_blk_len) < 0) SCSI_SenseCode(SCSI_ProcessCmd_pdev,
{ SCSI_ProcessCmd_hmsc->cbw.bLUN,
return -1; /* error */ ILLEGAL_REQUEST,
} INVALID_CDB);
SCSI_ProcessCmd_callback(-1);
hmsc->bot_state = USBD_BOT_DATA_IN; return;
hmsc->scsi_blk_addr *= hmsc->scsi_blk_size; }
hmsc->scsi_blk_len *= hmsc->scsi_blk_size;
if (DownstreamInterface_BeginRead(SCSI_Read10BeginCallback,
/* cases 4,5 : Hi <> Dn */ SCSI_ProcessCmd_hmsc->scsi_blk_addr,
if (hmsc->cbw.dDataLength != hmsc->scsi_blk_len) SCSI_ProcessCmd_hmsc->scsi_blk_len,
{ SCSI_ProcessCmd_hmsc->cbw.dDataLength) != HAL_OK)
SCSI_SenseCode(pdev, {
hmsc->cbw.bLUN, SCSI_Read10BeginCallback(HAL_ERROR);
ILLEGAL_REQUEST, }
INVALID_CDB); return;
return -1; }
}
} //hmsc->bot_state is already USBD_BOT_DATA_IN
hmsc->bot_data_length = MSC_MEDIA_PACKET; DownstreamInterface_GetStreamDataPacket(SCSI_Read10ReplyCallback);
return SCSI_ProcessRead(pdev, lun);
} }
void SCSI_Read10BeginCallback(HAL_StatusTypeDef result)
{
if (result != HAL_OK)
{
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
SCSI_ProcessCmd_lun,
NOT_READY,
MEDIUM_NOT_PRESENT);
SCSI_ProcessCmd_callback(-1);
return;
}
SCSI_ProcessCmd_hmsc->bot_state = USBD_BOT_DATA_IN;
if (DownstreamInterface_GetStreamDataPacket(SCSI_Read10ReplyCallback) != HAL_OK)
{
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
SCSI_ProcessCmd_lun,
NOT_READY,
MEDIUM_NOT_PRESENT);
SCSI_ProcessCmd_callback(-1);
}
}
void SCSI_Read10ReplyCallback(HAL_StatusTypeDef result,
DownstreamPacketTypeDef* downstreamPacket)
{
if (result != HAL_OK)
{
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
SCSI_ProcessCmd_lun,
HARDWARE_ERROR,
UNRECOVERED_READ_ERROR);
SCSI_ProcessCmd_callback(-1);
return;
}
SCSI_ProcessCmd_hmsc->bot_packet = downstreamPacket;
SCSI_ProcessCmd_hmsc->bot_data = downstreamPacket->Data;
USBD_LL_Transmit (SCSI_ProcessCmd_pdev,
MSC_EPIN_ADDR,
SCSI_ProcessCmd_hmsc->bot_data,
downstreamPacket->Length);
/* case 6 : Hi = Di */
SCSI_ProcessCmd_hmsc->csw.dDataResidue -= downstreamPacket->Length;
if (SCSI_ProcessCmd_hmsc->csw.dDataResidue == 0)
{
SCSI_ProcessCmd_hmsc->bot_state = USBD_BOT_LAST_DATA_IN;
}
SCSI_ProcessCmd_callback(0);
}
/** /**
* @brief SCSI_Write10 * @brief SCSI_Write10
* Process Write10 command * Process Write10 command
@ -521,86 +666,139 @@ static int8_t SCSI_Read10(USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *para
* @retval status * @retval status
*/ */
static int8_t SCSI_Write10 (USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *params) static void SCSI_Write10(void)
{ {
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*) pdev->pClassData; uint32_t dataLength;
if (hmsc->bot_state == USBD_BOT_IDLE) /* Idle */ if (SCSI_ProcessCmd_hmsc->bot_state == USBD_BOT_IDLE) /* Idle */
{ {
/* case 8 : Hi <> Do */
/* case 8 : Hi <> Do */ if ((SCSI_ProcessCmd_hmsc->cbw.bmFlags & 0x80) == 0x80)
{
if ((hmsc->cbw.bmFlags & 0x80) == 0x80) SCSI_SenseCode(SCSI_ProcessCmd_pdev,
{ SCSI_ProcessCmd_hmsc->cbw.bLUN,
SCSI_SenseCode(pdev, ILLEGAL_REQUEST,
hmsc->cbw.bLUN, INVALID_CDB);
ILLEGAL_REQUEST, SCSI_ProcessCmd_callback(-1);
INVALID_CDB); return;
return -1; }
}
SCSI_ProcessCmd_hmsc->scsi_blk_addr = (SCSI_ProcessCmd_params[2] << 24) | \
/* Check whether Media is ready */ (SCSI_ProcessCmd_params[3] << 16) | \
if(((USBD_StorageTypeDef *)pdev->pUserData)->IsReady(lun) !=0 ) (SCSI_ProcessCmd_params[4] << 8) | \
{ SCSI_ProcessCmd_params[5];
SCSI_SenseCode(pdev, SCSI_ProcessCmd_hmsc->scsi_blk_len = (SCSI_ProcessCmd_params[7] << 8) | \
lun, SCSI_ProcessCmd_params[8];
NOT_READY,
MEDIUM_NOT_PRESENT); if (SCSI_CheckAddressRange(SCSI_ProcessCmd_hmsc->scsi_blk_addr,
return -1; SCSI_ProcessCmd_hmsc->scsi_blk_len) < 0)
} {
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
/* Check If media is write-protected */ SCSI_ProcessCmd_hmsc->cbw.bLUN,
if(((USBD_StorageTypeDef *)pdev->pUserData)->IsWriteProtected(lun) !=0 ) ILLEGAL_REQUEST,
{ INVALID_CDB);
SCSI_SenseCode(pdev, SCSI_ProcessCmd_callback(-1); /* error */
lun, return;
NOT_READY, }
WRITE_PROTECTED);
return -1; /* cases 3,11,13 : Hn,Ho <> D0 */
} if (SCSI_ProcessCmd_hmsc->cbw.dDataLength != (uint32_t)(SCSI_ProcessCmd_hmsc->scsi_blk_len * SCSI_ProcessCmd_hmsc->scsi_blk_size))
{
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
hmsc->scsi_blk_addr = (params[2] << 24) | \ SCSI_ProcessCmd_hmsc->cbw.bLUN,
(params[3] << 16) | \ ILLEGAL_REQUEST,
(params[4] << 8) | \ INVALID_CDB);
params[5]; SCSI_ProcessCmd_callback(-1);
hmsc->scsi_blk_len = (params[7] << 8) | \ return;
params[8]; }
/* check if LBA address is in the right range */ if (DownstreamInterface_BeginWrite(SCSI_Write10BeginCallback,
if(SCSI_CheckAddressRange(pdev, SCSI_ProcessCmd_hmsc->scsi_blk_addr,
lun, SCSI_ProcessCmd_hmsc->scsi_blk_len) != HAL_OK)
hmsc->scsi_blk_addr, {
hmsc->scsi_blk_len) < 0) SCSI_Write10BeginCallback(HAL_ERROR);
{ }
return -1; /* error */ return;
} }
hmsc->scsi_blk_addr *= hmsc->scsi_blk_size;
hmsc->scsi_blk_len *= hmsc->scsi_blk_size; //hmsc->bot_state is already USBD_BOT_DATA_OUT
dataLength = MIN(SCSI_ProcessCmd_hmsc->csw.dDataResidue, MSC_MEDIA_PACKET);
/* cases 3,11,13 : Hn,Ho <> D0 */ if (DownstreamInterface_PutStreamDataPacket(SCSI_ProcessCmd_hmsc->bot_packet,
if (hmsc->cbw.dDataLength != hmsc->scsi_blk_len) dataLength) != HAL_OK)
{ {
SCSI_SenseCode(pdev, SCSI_SenseCode(SCSI_ProcessCmd_pdev,
hmsc->cbw.bLUN, SCSI_ProcessCmd_lun,
ILLEGAL_REQUEST, HARDWARE_ERROR,
INVALID_CDB); WRITE_FAULT);
return -1; SCSI_ProcessCmd_callback(-1);
} return;
}
/* Prepare EP to receive first data packet */
hmsc->bot_state = USBD_BOT_DATA_OUT; SCSI_ProcessCmd_hmsc->csw.dDataResidue -= dataLength;
USBD_LL_PrepareReceive (pdev, if (SCSI_ProcessCmd_hmsc->csw.dDataResidue == 0)
MSC_EPOUT_ADDR, {
hmsc->bot_data, MSC_BOT_SendCSW (SCSI_ProcessCmd_pdev, USBD_CSW_CMD_PASSED);
MIN (hmsc->scsi_blk_len, MSC_MEDIA_PACKET)); SCSI_ProcessCmd_callback(0);
} return;
else /* Write Process ongoing */ }
{
return SCSI_ProcessWrite(pdev, lun); /* Prepare EP to Receive next packet */
} if (Downstream_GetFreePacket(SCSI_Write10FreePacketCallback) != HAL_OK)
return 0; {
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
SCSI_ProcessCmd_lun,
NOT_READY,
MEDIUM_NOT_PRESENT);
SCSI_ProcessCmd_callback(-1);
}
}
void SCSI_Write10BeginCallback(HAL_StatusTypeDef result)
{
if (result == HAL_BUSY)
{
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
SCSI_ProcessCmd_lun,
NOT_READY,
WRITE_PROTECTED);
SCSI_ProcessCmd_callback(-1);
return;
}
if (result != HAL_OK)
{
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
SCSI_ProcessCmd_lun,
NOT_READY,
MEDIUM_NOT_PRESENT);
SCSI_ProcessCmd_callback(-1);
return;
}
/* Prepare EP to receive first data packet */
SCSI_ProcessCmd_hmsc->bot_state = USBD_BOT_DATA_OUT;
if (Downstream_GetFreePacket(SCSI_Write10FreePacketCallback) != HAL_OK)
{
SCSI_SenseCode(SCSI_ProcessCmd_pdev,
SCSI_ProcessCmd_lun,
NOT_READY,
MEDIUM_NOT_PRESENT);
SCSI_ProcessCmd_callback(-1);
}
}
void SCSI_Write10FreePacketCallback(DownstreamPacketTypeDef* freePacket)
{
SCSI_ProcessCmd_hmsc->bot_packet = freePacket;
SCSI_ProcessCmd_hmsc->bot_data = freePacket->Data;
USBD_LL_PrepareReceive (SCSI_ProcessCmd_pdev,
MSC_EPOUT_ADDR,
SCSI_ProcessCmd_hmsc->bot_data,
MIN(SCSI_ProcessCmd_hmsc->csw.dDataResidue, MSC_MEDIA_PACKET));
SCSI_ProcessCmd_callback(0); //Report eventual success!
} }
@ -612,28 +810,26 @@ static int8_t SCSI_Write10 (USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *pa
* @retval status * @retval status
*/ */
static int8_t SCSI_Verify10(USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *params) static void SCSI_Verify10(void)
{ {
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*) pdev->pClassData; if ((SCSI_ProcessCmd_params[1]& 0x02) == 0x02)
if ((params[1]& 0x02) == 0x02)
{ {
SCSI_SenseCode (pdev, SCSI_SenseCode (SCSI_ProcessCmd_pdev,
lun, SCSI_ProcessCmd_lun,
ILLEGAL_REQUEST, ILLEGAL_REQUEST,
INVALID_FIELED_IN_COMMAND); INVALID_FIELD_IN_COMMAND);
return -1; /* Error, Verify Mode Not supported*/ SCSI_ProcessCmd_callback(-1); /* Error, Verify Mode Not supported*/
return;
} }
if(SCSI_CheckAddressRange(pdev, if(SCSI_CheckAddressRange(SCSI_ProcessCmd_hmsc->scsi_blk_addr,
lun, SCSI_ProcessCmd_hmsc->scsi_blk_len) < 0)
hmsc->scsi_blk_addr,
hmsc->scsi_blk_len) < 0)
{ {
return -1; /* error */ SCSI_ProcessCmd_callback(-1); /* error */
return;
} }
hmsc->bot_data_length = 0; SCSI_ProcessCmd_hmsc->bot_data_length = 0;
return 0; SCSI_ProcessCmd_callback(0);
} }
/** /**
@ -644,14 +840,12 @@ static int8_t SCSI_Verify10(USBD_HandleTypeDef *pdev, uint8_t lun , uint8_t *pa
* @param blk_nbr: number of block to be processed * @param blk_nbr: number of block to be processed
* @retval status * @retval status
*/ */
static int8_t SCSI_CheckAddressRange (USBD_HandleTypeDef *pdev, uint8_t lun , uint32_t blk_offset , uint16_t blk_nbr) static int8_t SCSI_CheckAddressRange (uint32_t blk_offset , uint16_t blk_nbr)
{ {
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*) pdev->pClassData; if ((blk_offset + blk_nbr) > SCSI_ProcessCmd_hmsc->scsi_blk_nbr )
if ((blk_offset + blk_nbr) > hmsc->scsi_blk_nbr )
{ {
SCSI_SenseCode(pdev, SCSI_SenseCode(SCSI_ProcessCmd_pdev,
lun, SCSI_ProcessCmd_lun,
ILLEGAL_REQUEST, ILLEGAL_REQUEST,
ADDRESS_OUT_OF_RANGE); ADDRESS_OUT_OF_RANGE);
return -1; return -1;
@ -659,110 +853,6 @@ static int8_t SCSI_CheckAddressRange (USBD_HandleTypeDef *pdev, uint8_t lun , u
return 0; return 0;
} }
/**
* @brief SCSI_ProcessRead
* Handle Read Process
* @param lun: Logical unit number
* @retval status
*/
static int8_t SCSI_ProcessRead (USBD_HandleTypeDef *pdev, uint8_t lun)
{
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*)pdev->pClassData;
uint32_t len;
len = MIN(hmsc->scsi_blk_len , MSC_MEDIA_PACKET);
if( ((USBD_StorageTypeDef *)pdev->pUserData)->Read(lun ,
hmsc->bot_data,
hmsc->scsi_blk_addr / hmsc->scsi_blk_size,
len / hmsc->scsi_blk_size) < 0)
{
SCSI_SenseCode(pdev,
lun,
HARDWARE_ERROR,
UNRECOVERED_READ_ERROR);
return -1;
}
USBD_LL_Transmit (pdev,
MSC_EPIN_ADDR,
hmsc->bot_data,
len);
hmsc->scsi_blk_addr += len;
hmsc->scsi_blk_len -= len;
/* case 6 : Hi = Di */
hmsc->csw.dDataResidue -= len;
if (hmsc->scsi_blk_len == 0)
{
hmsc->bot_state = USBD_BOT_LAST_DATA_IN;
}
return 0;
}
/**
* @brief SCSI_ProcessWrite
* Handle Write Process
* @param lun: Logical unit number
* @retval status
*/
static int8_t SCSI_ProcessWrite (USBD_HandleTypeDef *pdev, uint8_t lun)
{
uint32_t len;
USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef*) pdev->pClassData;
len = MIN(hmsc->scsi_blk_len , MSC_MEDIA_PACKET);
if(((USBD_StorageTypeDef *)pdev->pUserData)->Write(lun ,
hmsc->bot_data,
hmsc->scsi_blk_addr / hmsc->scsi_blk_size,
len / hmsc->scsi_blk_size) < 0)
{
SCSI_SenseCode(pdev,
lun,
HARDWARE_ERROR,
WRITE_FAULT);
return -1;
}
hmsc->scsi_blk_addr += len;
hmsc->scsi_blk_len -= len;
/* case 12 : Ho = Do */
hmsc->csw.dDataResidue -= len;
if (hmsc->scsi_blk_len == 0)
{
MSC_BOT_SendCSW (pdev, USBD_CSW_CMD_PASSED);
}
else
{
/* Prepare EP to Receive next packet */
USBD_LL_PrepareReceive (pdev,
MSC_EPOUT_ADDR,
hmsc->bot_data,
MIN (hmsc->scsi_blk_len, MSC_MEDIA_PACKET));
}
return 0;
}
/**
* @}
*/
/**
* @}
*/
/** /**
* @} * @}
*/ */

@ -34,7 +34,7 @@
#endif #endif
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "usbd_conf.h" #include <usbd_config.h>
#include "usbd_def.h" #include "usbd_def.h"
#include "usbd_ioreq.h" #include "usbd_ioreq.h"
#include "usbd_ctlreq.h" #include "usbd_ctlreq.h"
@ -80,7 +80,7 @@
/** @defgroup USBD_CORE_Exported_Variables /** @defgroup USBD_CORE_Exported_Variables
* @{ * @{
*/ */
#define USBD_SOF USBD_LL_SOF
/** /**
* @} * @}
*/ */
@ -98,21 +98,24 @@ USBD_StatusTypeDef USBD_RunTestMode (USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx); USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
USBD_StatusTypeDef USBD_ClrClassConfig(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_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup);
USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev , uint8_t epnum, uint8_t *pdata); USBD_StatusTypeDef USBD_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_DataInStage(USBD_HandleTypeDef *pdev , uint8_t epnum, uint8_t *pdata);
USBD_StatusTypeDef USBD_Reset(USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed);
USBD_StatusTypeDef USBD_Suspend(USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_Resume(USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_SOF(USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
USBD_StatusTypeDef USBD_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev); USBD_StatusTypeDef USBD_DevConnected(USBD_HandleTypeDef *pdev);
USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed); USBD_StatusTypeDef USBD_DevDisconnected(USBD_HandleTypeDef *pdev);
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_BufferFreed(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 Low Level Driver */
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev); USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev);

@ -34,7 +34,7 @@
#endif #endif
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "usbd_conf.h" #include <usbd_config.h>
/** @addtogroup STM32_USBD_DEVICE_LIBRARY /** @addtogroup STM32_USBD_DEVICE_LIBRARY
* @{ * @{
@ -169,7 +169,9 @@ typedef struct _Device_cb
uint8_t (*DataOut) (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 (*SOF) (struct _USBD_HandleTypeDef *pdev);
uint8_t (*IsoINIncomplete) (struct _USBD_HandleTypeDef *pdev , uint8_t epnum); uint8_t (*IsoINIncomplete) (struct _USBD_HandleTypeDef *pdev , uint8_t epnum);
uint8_t (*IsoOUTIncomplete) (struct _USBD_HandleTypeDef *pdev , uint8_t epnum); uint8_t (*IsoOUTIncomplete) (struct _USBD_HandleTypeDef *pdev , uint8_t epnum);
uint8_t (*FreeDataBuffer) (struct _USBD_HandleTypeDef *pdev);
uint8_t *(*GetHSConfigDescriptor)(uint16_t *length); uint8_t *(*GetHSConfigDescriptor)(uint16_t *length);
uint8_t *(*GetFSConfigDescriptor)(uint16_t *length); uint8_t *(*GetFSConfigDescriptor)(uint16_t *length);

@ -260,7 +260,7 @@ USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx
* @param pdev: device instance * @param pdev: device instance
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup) USBD_StatusTypeDef USBD_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup)
{ {
USBD_ParseSetupRequest(&pdev->request, psetup); USBD_ParseSetupRequest(&pdev->request, psetup);
@ -296,7 +296,7 @@ USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup)
* @param epnum: endpoint index * @param epnum: endpoint index
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev , uint8_t epnum, uint8_t *pdata) USBD_StatusTypeDef USBD_DataOutStage(USBD_HandleTypeDef *pdev , uint8_t epnum, uint8_t *pdata)
{ {
USBD_EndpointTypeDef *pep; USBD_EndpointTypeDef *pep;
@ -340,7 +340,7 @@ USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev , uint8_t epnum
* @param epnum: endpoint index * @param epnum: endpoint index
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev ,uint8_t epnum, uint8_t *pdata) USBD_StatusTypeDef USBD_DataInStage(USBD_HandleTypeDef *pdev ,uint8_t epnum, uint8_t *pdata)
{ {
USBD_EndpointTypeDef *pep; USBD_EndpointTypeDef *pep;
@ -394,13 +394,13 @@ USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev ,uint8_t epnum,
} }
/** /**
* @brief USBD_LL_Reset * @brief USBD_Reset
* Handle Reset event * Handle Reset event
* @param pdev: device instance * @param pdev: device instance
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev) USBD_StatusTypeDef USBD_Reset(USBD_HandleTypeDef *pdev)
{ {
/* Open EP0 OUT */ /* Open EP0 OUT */
USBD_LL_OpenEP(pdev, USBD_LL_OpenEP(pdev,
@ -431,12 +431,12 @@ USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev)
/** /**
* @brief USBD_LL_Reset * @brief USBD_SetSpeed
* Handle Reset event * Handle Reset event
* @param pdev: device instance * @param pdev: device instance
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed) USBD_StatusTypeDef USBD_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed)
{ {
pdev->dev_speed = speed; pdev->dev_speed = speed;
return USBD_OK; return USBD_OK;
@ -449,7 +449,7 @@ USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev) USBD_StatusTypeDef USBD_Suspend(USBD_HandleTypeDef *pdev)
{ {
pdev->dev_old_state = pdev->dev_state; pdev->dev_old_state = pdev->dev_state;
pdev->dev_state = USBD_STATE_SUSPENDED; pdev->dev_state = USBD_STATE_SUSPENDED;
@ -463,7 +463,7 @@ USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev)
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev) USBD_StatusTypeDef USBD_Resume(USBD_HandleTypeDef *pdev)
{ {
pdev->dev_state = pdev->dev_old_state; pdev->dev_state = pdev->dev_old_state;
return USBD_OK; return USBD_OK;
@ -476,7 +476,7 @@ USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev)
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev) USBD_StatusTypeDef USBD_SOF(USBD_HandleTypeDef *pdev)
{ {
if(pdev->dev_state == USBD_STATE_CONFIGURED) if(pdev->dev_state == USBD_STATE_CONFIGURED)
{ {
@ -494,7 +494,7 @@ USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
* @param pdev: device instance * @param pdev: device instance
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum) USBD_StatusTypeDef USBD_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
{ {
return USBD_OK; return USBD_OK;
} }
@ -505,7 +505,7 @@ USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t ep
* @param pdev: device instance * @param pdev: device instance
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum) USBD_StatusTypeDef USBD_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
{ {
return USBD_OK; return USBD_OK;
} }
@ -516,7 +516,7 @@ USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t e
* @param pdev: device instance * @param pdev: device instance
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev) USBD_StatusTypeDef USBD_DevConnected(USBD_HandleTypeDef *pdev)
{ {
return USBD_OK; return USBD_OK;
} }
@ -527,7 +527,7 @@ USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev)
* @param pdev: device instance * @param pdev: device instance
* @retval status * @retval status
*/ */
USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev) USBD_StatusTypeDef USBD_DevDisconnected(USBD_HandleTypeDef *pdev)
{ {
/* Free Class Resources */ /* Free Class Resources */
pdev->dev_state = USBD_STATE_DEFAULT; pdev->dev_state = USBD_STATE_DEFAULT;
@ -535,6 +535,12 @@ USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev)
return USBD_OK; return USBD_OK;
} }
USBD_StatusTypeDef USBD_BufferFreed(USBD_HandleTypeDef *pdev)
{
pdev->pClass->FreeDataBuffer(pdev);
return USBD_OK;
}
/** /**
* @} * @}
*/ */

@ -0,0 +1,228 @@
/*
* downstream_interface_msc.c
*
* Created on: 4/07/2015
* Author: Robert Fisk
*/
#include "stm32f4xx_hal.h"
#include "downstream_interface_msc.h"
#include "downstream_interface_def.h"
#include "downstream_spi.h"
//Stuff we need to save for our callbacks to use:
DownstreamInterfaceMSCCallbackTypeDef TestReadyCallback;
DownstreamInterfaceMSCCallbackUintPacketTypeDef GetCapacityCallback;
DownstreamInterfaceMSCCallbackPacketTypeDef GetStreamDataCallback;
uint64_t BlockStart;
uint32_t BlockCount;
uint32_t ByteCount;
DownstreamPacketTypeDef* ReadStreamPacket;
static void DownstreamInterface_TestReadyReplyCallback(DownstreamPacketTypeDef* replyPacket);
static void DownstreamInterface_GetCapacityReplyCallback(DownstreamPacketTypeDef* replyPacket);
static void DownstreamInterface_GetStreamDataPacketCallback(DownstreamPacketTypeDef* replyPacket);
static void DownstreamInterface_BeginWriteReplyCallback(DownstreamPacketTypeDef* replyPacket);
HAL_StatusTypeDef DownstreamInterface_TestReady(DownstreamInterfaceMSCCallbackTypeDef callback)
{
DownstreamPacketTypeDef* freePacket;
HAL_StatusTypeDef tempResult;
TestReadyCallback = callback;
freePacket = Downstream_GetFreePacketImmediately();
freePacket->Length = DOWNSTREAM_PACKET_HEADER_LEN;
freePacket->CommandClass = COMMAND_CLASS_MASS_STORAGE;
freePacket->Command = COMMAND_MSC_TEST_UNIT_READY;
tempResult = Downstream_SendPacket(freePacket);
if (tempResult != HAL_OK)
{
return tempResult;
}
return Downstream_GetPacket(DownstreamInterface_TestReadyReplyCallback);
}
void DownstreamInterface_TestReadyReplyCallback(DownstreamPacketTypeDef* replyPacket)
{
if ((replyPacket->Length != (DOWNSTREAM_PACKET_HEADER_LEN + 1)) ||
(replyPacket->CommandClass & COMMAND_CLASS_DATA_FLAG) ||
(replyPacket->Data[0] != HAL_OK))
{
Downstream_ReleasePacket(replyPacket);
TestReadyCallback(HAL_ERROR);
}
else
{
Downstream_ReleasePacket(replyPacket);
TestReadyCallback(HAL_OK);
}
}
HAL_StatusTypeDef DownstreamInterface_GetCapacity(DownstreamInterfaceMSCCallbackUintPacketTypeDef callback)
{
DownstreamPacketTypeDef* freePacket;
HAL_StatusTypeDef tempResult;
GetCapacityCallback = callback;
freePacket = Downstream_GetFreePacketImmediately();
freePacket->Length = DOWNSTREAM_PACKET_HEADER_LEN;
freePacket->CommandClass = COMMAND_CLASS_MASS_STORAGE;
freePacket->Command = COMMAND_MSC_GET_CAPACITY;
tempResult = Downstream_SendPacket(freePacket);
if (tempResult != HAL_OK)
{
return tempResult;
}
return Downstream_GetPacket(DownstreamInterface_GetCapacityReplyCallback);
}
void DownstreamInterface_GetCapacityReplyCallback(DownstreamPacketTypeDef* replyPacket)
{
uint32_t uint[2];
if ((replyPacket->Length != (DOWNSTREAM_PACKET_HEADER_LEN + 8) ||
(replyPacket->CommandClass & COMMAND_CLASS_DATA_FLAG)))
{
GetCapacityCallback(HAL_ERROR, NULL, NULL);
}
uint[0] = (uint32_t)(replyPacket->Data[0]);
uint[1] = (uint32_t)(replyPacket->Data[1]);
GetCapacityCallback(HAL_OK, uint, replyPacket); //usb_msc_scsi will use this packet, so don't release now
}
HAL_StatusTypeDef DownstreamInterface_BeginRead(DownstreamInterfaceMSCCallbackTypeDef callback,
uint64_t readBlockStart,
uint32_t readBlockCount,
uint32_t readByteCount)
{
DownstreamPacketTypeDef* freePacket;
HAL_StatusTypeDef tempResult;
uint64_t* workDammit;
uint32_t* prettyPlease;
ReadStreamPacket = NULL; //Prepare for GetStreamDataPacket's use
TestReadyCallback = callback;
BlockStart = readBlockStart;
BlockCount = readBlockCount;
ByteCount = readByteCount;
freePacket = Downstream_GetFreePacketImmediately();
freePacket->Length = DOWNSTREAM_PACKET_HEADER_LEN + (4 * 3);
freePacket->CommandClass = COMMAND_CLASS_MASS_STORAGE;
freePacket->Command = COMMAND_MSC_BEGIN_READ;
workDammit = (uint64_t*)&(freePacket->Data[0]);
*workDammit = BlockStart;
prettyPlease = (uint32_t*)&(freePacket->Data[8]);
*prettyPlease = BlockCount;
tempResult = Downstream_SendPacket(freePacket);
if (tempResult != HAL_OK)
{
TestReadyCallback(tempResult);
}
return Downstream_GetPacket(DownstreamInterface_TestReadyReplyCallback); //Re-use TestReadyReplyCallback because it does exactly what we want!
}
HAL_StatusTypeDef DownstreamInterface_GetStreamDataPacket(DownstreamInterfaceMSCCallbackPacketTypeDef callback)
{
GetStreamDataCallback = callback;
//We have a callback address. Do we have a stored packet?
if (ReadStreamPacket)
{
DownstreamInterface_GetStreamDataPacketCallback(ReadStreamPacket); //Send it now!
ReadStreamPacket = NULL;
GetStreamDataCallback = NULL; //We have used up our callback, so mark it empty.
}
return Downstream_GetPacket(DownstreamInterface_GetStreamDataPacketCallback);
}
void DownstreamInterface_GetStreamDataPacketCallback(DownstreamPacketTypeDef* replyPacket)
{
if (GetStreamDataCallback == NULL)
{
ReadStreamPacket = replyPacket; //We used up our callback already, so save this one for later.
return;
}
if (((replyPacket->CommandClass & COMMAND_CLASS_DATA_FLAG) == 0) || //Any 'command' reply (as opposed to 'data' reply) is an automatic fail here
(replyPacket->Length <= DOWNSTREAM_PACKET_HEADER_LEN) || //Should be at least one data byte in the reply.
(replyPacket->Length > ByteCount))
{
GetStreamDataCallback(HAL_ERROR, NULL);
}
else
{
ByteCount -= replyPacket->Length;
GetStreamDataCallback(HAL_OK, replyPacket); //usb_msc_scsi will use this packet, so don't release now
}
}
HAL_StatusTypeDef DownstreamInterface_BeginWrite(DownstreamInterfaceMSCCallbackTypeDef callback,
uint64_t readBlockStart,
uint32_t readBlockCount)
{
DownstreamPacketTypeDef* freePacket;
HAL_StatusTypeDef tempResult;
uint64_t* workDammit;
uint32_t* prettyPlease;
TestReadyCallback = callback;
BlockStart = readBlockStart;
BlockCount = readBlockCount;
freePacket = Downstream_GetFreePacketImmediately();
freePacket->Length = DOWNSTREAM_PACKET_HEADER_LEN + (4 * 3);
freePacket->CommandClass = COMMAND_CLASS_MASS_STORAGE;
freePacket->Command = COMMAND_MSC_BEGIN_WRITE;
workDammit = (uint64_t*)&(freePacket->Data[0]);
*workDammit = BlockStart;
prettyPlease = (uint32_t*)&(freePacket->Data[8]);
*prettyPlease = BlockCount;
tempResult = Downstream_SendPacket(freePacket);
if (tempResult != HAL_OK)
{
TestReadyCallback(tempResult);
}
return Downstream_GetPacket(DownstreamInterface_BeginWriteReplyCallback);
}
void DownstreamInterface_BeginWriteReplyCallback(DownstreamPacketTypeDef* replyPacket)
{
if ((replyPacket->Length != (DOWNSTREAM_PACKET_HEADER_LEN + 1)) ||
(replyPacket->CommandClass & COMMAND_CLASS_DATA_FLAG) ||
((replyPacket->Data[0] != HAL_OK) && (replyPacket->Data[0] != HAL_BUSY)))
{
Downstream_ReleasePacket(replyPacket);
TestReadyCallback(HAL_ERROR);
}
else
{
Downstream_ReleasePacket(replyPacket);
TestReadyCallback(replyPacket->Data[0]);
}
}
HAL_StatusTypeDef DownstreamInterface_PutStreamDataPacket(DownstreamPacketTypeDef* packetToSend,
uint32_t dataLength)
{
packetToSend->Length = dataLength + DOWNSTREAM_PACKET_HEADER_LEN;
packetToSend->CommandClass = COMMAND_CLASS_MASS_STORAGE | COMMAND_CLASS_DATA_FLAG;
packetToSend->Command = COMMAND_MSC_BEGIN_WRITE;
return Downstream_SendPacket(packetToSend);
}

@ -0,0 +1,429 @@
/*
* downstream_spi.c
*
* Created on: 21/06/2015
* Author: Robert Fisk
*/
#include <downstream_spi.h>
#include "downstream_interface_def.h"
#include "stm32f4xx_hal.h"
#include "usbd_def.h"
#include "board_config.h"
SPI_HandleTypeDef hspi1;
DownstreamPacketTypeDef DownstreamPacket0;
DownstreamPacketTypeDef DownstreamPacket1;
DownstreamPacketTypeDef* CurrentWorkingPacket;
DownstreamPacketTypeDef* NextTxPacket; //Indicates we have a pending TX packet
InterfaceStateTypeDef DownstreamInterfaceState;
FreePacketCallbackTypeDef PendingFreePacketCallback; //Indicates someone is waiting for a packet buffer to become available
SpiPacketReceivedCallbackTypeDef ReceivePacketCallback; //Indicates someone is waiting for a received packet
uint8_t SentCommandClass;
uint8_t SentCommand;
static void SPI1_Init(void);
static HAL_StatusTypeDef Downstream_CheckBeginPacketReception(void);
static void Downstream_BeginPacketReception(DownstreamPacketTypeDef* freePacket);
void Downstream_InitInterface(void)
{
DownstreamInterfaceState = INTERFACE_STATE_RESET;
SPI1_Init();
DownstreamPacket0.Busy = NOT_BUSY;
DownstreamPacket1.Busy = NOT_BUSY;
NextTxPacket = NULL;
PendingFreePacketCallback = NULL;
ReceivePacketCallback = NULL;
//Todo: check connection to downstream, await client USB insertion
while (!DOWNSTREAM_TX_OK_ACTIVE);
DownstreamInterfaceState = INTERFACE_STATE_IDLE;
}
void SPI1_Init(void)
{
hspi1.Instance = SPI1;
hspi1.State = HAL_SPI_STATE_RESET;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_SOFT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32; //42MHz APB2 / 32 = 1.3Mbaud
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLED;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_ENABLED;
hspi1.Init.CRCPolynomial = SPI_CRC_DEFAULTPOLYNOMIAL;
HAL_SPI_Init(&hspi1);
}
//Used by USB interface classes, and by our internal RX code.
HAL_StatusTypeDef Downstream_GetFreePacket(FreePacketCallbackTypeDef callback)
{
//Sanity checks
if ((DownstreamInterfaceState < INTERFACE_STATE_IDLE) ||
(DownstreamInterfaceState > INTERFACE_STATE_RX_PACKET))
{
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
}
//Do we already have a queued callback?
if (PendingFreePacketCallback != NULL)
{
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
}
//Check if there is a free buffer now
if (DownstreamPacket0.Busy == NOT_BUSY)
{
DownstreamPacket0.Busy = BUSY;
callback(&DownstreamPacket0);
return HAL_OK;
}
if (DownstreamPacket1.Busy == NOT_BUSY)
{
DownstreamPacket1.Busy = BUSY;
callback(&DownstreamPacket1);
return HAL_OK;
}
//Otherwise save requested address for when a buffer becomes free in the future
PendingFreePacketCallback = callback;
return HAL_OK;
}
DownstreamPacketTypeDef* Downstream_GetFreePacketImmediately(void)
{
//Sanity checks
if ((DownstreamInterfaceState < INTERFACE_STATE_IDLE) ||
(DownstreamInterfaceState > INTERFACE_STATE_RX_PACKET))
{
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
}
//We are expecting a free buffer now
if (DownstreamPacket0.Busy == NOT_BUSY)
{
DownstreamPacket0.Busy = BUSY;
return &DownstreamPacket0;
}
if (DownstreamPacket1.Busy == NOT_BUSY)
{
DownstreamPacket1.Busy = BUSY;
return &DownstreamPacket1;
}
//Should not happen:
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
}
//Used by USB interface classes, and by our internal RX code.
void Downstream_ReleasePacket(DownstreamPacketTypeDef* packetToRelease)
{
if (PendingFreePacketCallback != NULL)
{
PendingFreePacketCallback(packetToRelease);
PendingFreePacketCallback = NULL;
}
else
{
packetToRelease->Busy = NOT_BUSY;
}
}
//Used by USB interface classes only.
//OK to call when still transmitting another packet.
//Not OK to call when receiving or waiting for downstream reply.
HAL_StatusTypeDef Downstream_SendPacket(DownstreamPacketTypeDef* packetToWrite)
{
//Sanity checks
if ((packetToWrite != &DownstreamPacket0) &&
(packetToWrite != &DownstreamPacket1))
{
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
}
if ((packetToWrite->Busy != BUSY) ||
(packetToWrite->Length < DOWNSTREAM_PACKET_LEN_MIN) ||
(packetToWrite->Length > DOWNSTREAM_PACKET_LEN))
{
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
}
//Cancel any outstanding receive request
ReceivePacketCallback = NULL;
switch (DownstreamInterfaceState)
{
case INTERFACE_STATE_TX_SIZE_WAIT:
case INTERFACE_STATE_TX_SIZE:
case INTERFACE_STATE_TX_PACKET_WAIT:
case INTERFACE_STATE_TX_PACKET:
if (NextTxPacket != NULL)
{
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
}
NextTxPacket = packetToWrite;
break;
case INTERFACE_STATE_RX_SIZE_WAIT:
case INTERFACE_STATE_RX_SIZE:
case INTERFACE_STATE_RX_PACKET_WAIT:
case INTERFACE_STATE_RX_PACKET:
//We can't let the size/packet sequence get out of sync.
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
case INTERFACE_STATE_IDLE:
DownstreamInterfaceState = INTERFACE_STATE_TX_SIZE_WAIT;
CurrentWorkingPacket = packetToWrite;
SentCommandClass = CurrentWorkingPacket->CommandClass;
SentCommand = CurrentWorkingPacket->Command;
if (DOWNSTREAM_TX_OK_ACTIVE)
{
Downstream_TxOkInterrupt(); //Manually trigger edge interrupt processing if the line was already asserted
}
break;
default:
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
}
return HAL_OK;
}
//Called at the end of the SPI TX DMA transfer,
//at DMA2 interrupt priority. Assume *hspi points to our hspi1.
void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi)
{
SPI1_NSS_DEASSERT;
if ((DownstreamInterfaceState != INTERFACE_STATE_TX_SIZE) &&
(DownstreamInterfaceState != INTERFACE_STATE_TX_PACKET))
{
SPI_INTERFACE_FREAKOUT_VOID;
}
if (DownstreamInterfaceState == INTERFACE_STATE_TX_SIZE)
{
DownstreamInterfaceState = INTERFACE_STATE_TX_PACKET_WAIT;
if (DOWNSTREAM_TX_OK_ACTIVE)
{
Downstream_TxOkInterrupt();
}
return;
}
if (DownstreamInterfaceState == INTERFACE_STATE_TX_PACKET)
{
if ((PendingFreePacketCallback != NULL) && (NextTxPacket == NULL))
{
SPI_INTERFACE_FREAKOUT_VOID;
}
Downstream_ReleasePacket(CurrentWorkingPacket);
if (NextTxPacket != NULL)
{
//NextTxPacket has already passed the checks in SendDownstreamPacket.
//So we just need to pass it to HAL_SPI_Transmit_DMA.
DownstreamInterfaceState = INTERFACE_STATE_TX_SIZE_WAIT;
CurrentWorkingPacket = NextTxPacket;
NextTxPacket = NULL;
if (DOWNSTREAM_TX_OK_ACTIVE)
{
Downstream_TxOkInterrupt();
}
return;
}
DownstreamInterfaceState = INTERFACE_STATE_IDLE;
if (ReceivePacketCallback != NULL)
{
Downstream_CheckBeginPacketReception();
}
}
}
//Used by USB interface classes.
//Ok to call when transmitting, receiving, or waiting for downstream.
HAL_StatusTypeDef Downstream_GetPacket(SpiPacketReceivedCallbackTypeDef callback)
{
if (ReceivePacketCallback != NULL)
{
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
}
ReceivePacketCallback = callback;
return Downstream_CheckBeginPacketReception();
}
//Internal use only.
HAL_StatusTypeDef Downstream_CheckBeginPacketReception(void)
{
if ((DownstreamInterfaceState < INTERFACE_STATE_IDLE) ||
(DownstreamInterfaceState > INTERFACE_STATE_RX_PACKET))
{
SPI_INTERFACE_FREAKOUT_HAL_ERROR;
}
if (DownstreamInterfaceState == INTERFACE_STATE_IDLE)
{
DownstreamInterfaceState = INTERFACE_STATE_RX_SIZE_WAIT;
}
if (DownstreamInterfaceState == INTERFACE_STATE_RX_SIZE_WAIT)
{
if (DOWNSTREAM_TX_OK_ACTIVE)
{
//DownstreamTxOkInterrupt();
Downstream_GetFreePacket(Downstream_BeginPacketReception); //Take a shortcut here :)
}
}
return HAL_OK;
}
//This is called by EXTI3 falling edge interrupt,
//indicating that downstream is ready for next transaction.
void Downstream_TxOkInterrupt(void)
{
switch (DownstreamInterfaceState)
{
case INTERFACE_STATE_TX_SIZE_WAIT:
DownstreamInterfaceState = INTERFACE_STATE_TX_SIZE;
SPI1_NSS_ASSERT;
if (HAL_SPI_Transmit_DMA(&hspi1,
(uint8_t*)&CurrentWorkingPacket->Length,
2) != HAL_OK)
{
SPI_INTERFACE_FREAKOUT_VOID;
}
break;
case INTERFACE_STATE_TX_PACKET_WAIT:
DownstreamInterfaceState = INTERFACE_STATE_TX_PACKET;
SPI1_NSS_ASSERT;
if ((HAL_SPI_Transmit_DMA(&hspi1,
&CurrentWorkingPacket->CommandClass,
CurrentWorkingPacket->Length)) != HAL_OK)
{
SPI_INTERFACE_FREAKOUT_VOID;
}
break;
case INTERFACE_STATE_RX_SIZE_WAIT:
Downstream_GetFreePacket(Downstream_BeginPacketReception);
break;
case INTERFACE_STATE_RX_PACKET_WAIT:
DownstreamInterfaceState = INTERFACE_STATE_RX_PACKET;
SPI1_NSS_ASSERT;
if ((HAL_SPI_Receive_DMA(&hspi1,
&CurrentWorkingPacket->CommandClass,
(CurrentWorkingPacket->Length + 1))) != HAL_OK) //"When the CRC feature is enabled the pData Length must be Size + 1"
{
SPI_INTERFACE_FREAKOUT_VOID;
}
break;
default:
SPI_INTERFACE_FREAKOUT_VOID;
}
}
//Internal use only.
//Called when we want to receive downstream packet, and a packet buffer has become free.
void Downstream_BeginPacketReception(DownstreamPacketTypeDef* freePacket)
{
if (DownstreamInterfaceState != INTERFACE_STATE_RX_SIZE_WAIT)
{
SPI_INTERFACE_FREAKOUT_VOID;
}
DownstreamInterfaceState = INTERFACE_STATE_RX_SIZE;
CurrentWorkingPacket = freePacket;
CurrentWorkingPacket->Length = 0; //Our RX buffer is used by HAL_SPI_Receive_DMA as dummy TX data, we set Length to 0 so downstream will know this is a dummy packet.
SPI1_NSS_ASSERT;
if (HAL_SPI_Receive_DMA(&hspi1,
(uint8_t*)&CurrentWorkingPacket->Length,
(2 + 1)) != HAL_OK) //"When the CRC feature is enabled the pData Length must be Size + 1"
{
SPI_INTERFACE_FREAKOUT_VOID;
}
}
//Called at the end of the SPI TX DMA transfer,
//at DMA2 interrupt priority. Assume *hspi points to our hspi1.
void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi)
{
SpiPacketReceivedCallbackTypeDef tempPacketCallback;
SPI1_NSS_DEASSERT;
if ((DownstreamInterfaceState != INTERFACE_STATE_RX_SIZE) &&
(DownstreamInterfaceState != INTERFACE_STATE_RX_PACKET))
{
SPI_INTERFACE_FREAKOUT_VOID;
}
if (DownstreamInterfaceState == INTERFACE_STATE_RX_SIZE)
{
if ((CurrentWorkingPacket->Length < DOWNSTREAM_PACKET_LEN_MIN) ||
(CurrentWorkingPacket->Length > DOWNSTREAM_PACKET_LEN))
{
SPI_INTERFACE_FREAKOUT_VOID;
}
DownstreamInterfaceState = INTERFACE_STATE_RX_PACKET_WAIT;
if (DOWNSTREAM_TX_OK_ACTIVE)
{
Downstream_TxOkInterrupt();
}
return;
}
if (DownstreamInterfaceState == INTERFACE_STATE_RX_PACKET)
{
DownstreamInterfaceState = INTERFACE_STATE_IDLE;
if ((SentCommandClass != (CurrentWorkingPacket->CommandClass & COMMAND_CLASS_MASK)) ||
(SentCommand != CurrentWorkingPacket->Command))
{
SPI_INTERFACE_FREAKOUT_VOID;
}
if (ReceivePacketCallback == NULL)
{
SPI_INTERFACE_FREAKOUT_VOID;
}
//USB interface may want to receive another packet immediately,
//so clear ReceivePacketCallback before the call.
//It is the callback's responsibility to release the packet buffer we are passing to it!
tempPacketCallback = ReceivePacketCallback;
ReceivePacketCallback = NULL;
tempPacketCallback(CurrentWorkingPacket);
}
}
//Something bad happened! Possibly CRC error...
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi)
{
SPI_INTERFACE_FREAKOUT_VOID;
}

@ -35,64 +35,26 @@
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
#include "interrupts.h" #include "interrupts.h"
#include "board_config.h"
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */ DMA_HandleTypeDef spiTxDmaHandle;
DMA_HandleTypeDef spiRxDmaHandle;
/** /**
* Initializes the Global MSP. * Initializes the Global MSP.
*/ */
void HAL_MspInit(void) void HAL_MspInit(void)
{ {
/* USER CODE BEGIN MspInit 0 */
/* USER CODE END MspInit 0 */
// HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); // HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
// //
// /* System interrupt init*/ // /* System interrupt init*/
///* SysTick_IRQn interrupt configuration */ ///* SysTick_IRQn interrupt configuration */
HAL_NVIC_SetPriority(SysTick_IRQn, INT_PRIORITY_SYSTICK, 0); HAL_NVIC_SetPriority(SysTick_IRQn, INT_PRIORITY_SYSTICK, 0);
/* USER CODE BEGIN MspInit 1 */
/* USER CODE END MspInit 1 */
} }
void HAL_CRC_MspInit(CRC_HandleTypeDef* hcrc)
{
if(hcrc->Instance==CRC)
{
/* USER CODE BEGIN CRC_MspInit 0 */
/* USER CODE END CRC_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_CRC_CLK_ENABLE();
/* USER CODE BEGIN CRC_MspInit 1 */
/* USER CODE END CRC_MspInit 1 */
}
}
void HAL_CRC_MspDeInit(CRC_HandleTypeDef* hcrc)
{
if(hcrc->Instance==CRC)
{
/* USER CODE BEGIN CRC_MspDeInit 0 */
/* USER CODE END CRC_MspDeInit 0 */
/* Peripheral clock disable */
__CRC_CLK_DISABLE();
/* USER CODE BEGIN CRC_MspDeInit 1 */
/* USER CODE END CRC_MspDeInit 1 */
}
}
void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi) void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
{ {
@ -100,30 +62,69 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitTypeDef GPIO_InitStruct;
if(hspi->Instance==SPI1) if(hspi->Instance==SPI1)
{ {
/* USER CODE BEGIN SPI1_MspInit 0 */
/* USER CODE END SPI1_MspInit 0 */
/* Peripheral clock enable */ /* Peripheral clock enable */
__HAL_RCC_SPI1_CLK_ENABLE(); __HAL_RCC_SPI1_CLK_ENABLE();
__HAL_RCC_DMA2_CLK_ENABLE();
/**SPI1 GPIO Configuration /**SPI1 GPIO Configuration
PA4 ------> SPI1_NSS PA4 ------> GPIO manual slave select
PA5 ------> SPI1_SCK PA5 ------> SPI1_SCK
PA6 ------> SPI1_MISO PA6 ------> SPI1_MISO
PA7 ------> SPI1_MOSI PA7 ------> SPI1_MOSI
*/ */
GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7; GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLDOWN; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_MEDIUM; GPIO_InitStruct.Speed = GPIO_SPEED_MEDIUM;
GPIO_InitStruct.Alternate = GPIO_AF5_SPI1; GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = SPI1_NSS_PIN;
/* USER CODE BEGIN SPI1_MspInit 1 */ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USER CODE END SPI1_MspInit 1 */ SPI1_NSS_DEASSERT;
//Prepare Tx DMA stream
hspi->hdmatx = &spiTxDmaHandle;
spiTxDmaHandle.Instance = DMA2_Stream3;
spiTxDmaHandle.Parent = hspi;
spiTxDmaHandle.Init.Channel = DMA_CHANNEL_3;
spiTxDmaHandle.Init.Direction = DMA_MEMORY_TO_PERIPH;
spiTxDmaHandle.Init.PeriphInc = DMA_PINC_DISABLE;
spiTxDmaHandle.Init.MemInc = DMA_MINC_ENABLE;
spiTxDmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
spiTxDmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
spiTxDmaHandle.Init.Mode = DMA_NORMAL;
spiTxDmaHandle.Init.Priority = DMA_PRIORITY_MEDIUM;
spiTxDmaHandle.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
HAL_DMA_Init(&spiTxDmaHandle);
HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, INT_PRIORITY_SPI_DMA, 0);
HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
//Prepare Rx DMA stream
hspi->hdmarx = &spiRxDmaHandle;
spiRxDmaHandle.Instance = DMA2_Stream2;
spiRxDmaHandle.Parent = hspi;
spiRxDmaHandle.Init.Channel = DMA_CHANNEL_3;
spiRxDmaHandle.Init.Direction = DMA_PERIPH_TO_MEMORY;
spiRxDmaHandle.Init.PeriphInc = DMA_PINC_DISABLE;
spiRxDmaHandle.Init.MemInc = DMA_MINC_ENABLE;
spiRxDmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
spiRxDmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
spiRxDmaHandle.Init.Mode = DMA_NORMAL;
spiRxDmaHandle.Init.Priority = DMA_PRIORITY_MEDIUM;
spiRxDmaHandle.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
HAL_DMA_Init(&spiRxDmaHandle);
HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, INT_PRIORITY_SPI_DMA, 0);
HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
//Configure downstream request pin and interrupt
GPIO_InitStruct.Pin = DOWNSTREAM_TX_OK_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT | GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(DOWNSTREAM_TX_OK_PORT, &GPIO_InitStruct);
HAL_NVIC_SetPriority(EXTI3_IRQn, INT_PRIORITY_SPI_DMA, 0);
HAL_NVIC_EnableIRQ(EXTI3_IRQn);
} }
} }
void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi) void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
@ -131,11 +132,9 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
if(hspi->Instance==SPI1) if(hspi->Instance==SPI1)
{ {
/* USER CODE BEGIN SPI1_MspDeInit 0 */
/* USER CODE END SPI1_MspDeInit 0 */
/* Peripheral clock disable */ /* Peripheral clock disable */
__SPI1_CLK_DISABLE(); __HAL_RCC_SPI1_CLK_DISABLE();
__HAL_RCC_DMA2_CLK_DISABLE();
/**SPI1 GPIO Configuration /**SPI1 GPIO Configuration
PA4 ------> SPI1_NSS PA4 ------> SPI1_NSS
@ -144,24 +143,16 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
PA7 ------> SPI1_MOSI PA7 ------> SPI1_MOSI
*/ */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
HAL_DMA_DeInit(&spiTxDmaHandle);
HAL_DMA_DeInit(&spiRxDmaHandle);
/* USER CODE BEGIN SPI1_MspDeInit 1 */ HAL_NVIC_DisableIRQ(DMA2_Stream3_IRQn);
HAL_NVIC_DisableIRQ(DMA2_Stream2_IRQn);
/* USER CODE END SPI1_MspDeInit 1 */
} }
} }
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -41,38 +41,50 @@
/* USER CODE END 0 */ /* USER CODE END 0 */
/* External variables --------------------------------------------------------*/ /* External variables --------------------------------------------------------*/
extern PCD_HandleTypeDef hpcd_USB_OTG_FS; extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
extern DMA_HandleTypeDef spiTxDmaHandle;
extern DMA_HandleTypeDef spiRxDmaHandle;
/******************************************************************************/ /******************************************************************************/
/* Cortex-M4 Processor Interruption and Exception Handlers */ /* Cortex-M4 Processor Interruption and Exception Handlers */
/******************************************************************************/ /******************************************************************************/
/** void SysTick_Handler(void)
* @brief This function handles USB On The Go FS global interrupt. {
*/ HAL_IncTick();
}
/////////////////////////
//All interrupts in this section must be at the same priority.
//They interact with each other, and calls are not thread-safe
//when different interrupt priorities are used.
/////////////////////////
void OTG_FS_IRQHandler(void) void OTG_FS_IRQHandler(void)
{ {
STAT_LED_PORT->BSRR = STAT_LED_BSRR_ON; //blink STAT LED while processing interrupt STAT_LED_ON; //blink STAT LED while processing interrupt
HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS); HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
STAT_LED_PORT->BSRR = STAT_LED_BSRR_OFF; STAT_LED_OFF;
} }
/** void DMA2_Stream2_IRQHandler(void)
* @brief This function handles System tick timer.
*/
void SysTick_Handler(void)
{ {
/* USER CODE BEGIN SysTick_IRQn 0 */ HAL_DMA_IRQHandler(&spiRxDmaHandle);
}
/* USER CODE END SysTick_IRQn 0 */ void DMA2_Stream3_IRQHandler(void)
HAL_IncTick(); {
//HAL_SYSTICK_IRQHandler(); HAL_DMA_IRQHandler(&spiTxDmaHandle);
/* USER CODE BEGIN SysTick_IRQn 1 */ }
/* USER CODE END SysTick_IRQn 1 */ void EXTI3_IRQHandler(void)
{
__HAL_GPIO_EXTI_CLEAR_IT(3);
Downstream_TxOkInterrupt();
} }
/////////////////////////
/////////////////////////
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -33,6 +33,7 @@
*/ */
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include <downstream_spi.h>
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
#include "usb_device.h" #include "usb_device.h"
#include "board_config.h" #include "board_config.h"
@ -40,16 +41,13 @@
/* Private variables ---------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/
CRC_HandleTypeDef hcrc;
SPI_HandleTypeDef hspi1;
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void); void SystemClock_Config(void);
static void MX_GPIO_Init(void); static void GPIO_Init(void);
static void MX_CRC_Init(void);
static void MX_SPI1_Init(void);
int main(void) int main(void)
@ -63,10 +61,12 @@ int main(void)
SystemClock_Config(); SystemClock_Config();
/* Initialize all configured peripherals */ /* Initialize all configured peripherals */
MX_GPIO_Init(); GPIO_Init();
MX_CRC_Init(); USB_Device_Init();
MX_SPI1_Init();
MX_USB_DEVICE_Init(); Downstream_InitInterface();
while (1) while (1)
{ {
@ -107,33 +107,6 @@ void SystemClock_Config(void)
} }
/* CRC init function */
void MX_CRC_Init(void)
{
hcrc.Instance = CRC;
hcrc.State = HAL_CRC_STATE_RESET;
HAL_CRC_Init(&hcrc);
}
/* SPI1 init function */
void MX_SPI1_Init(void)
{
hspi1.Instance = SPI1;
hspi1.State = HAL_SPI_STATE_RESET;
hspi1.Init.Mode = SPI_MODE_MASTER;
hspi1.Init.Direction = SPI_DIRECTION_2LINES;
hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
hspi1.Init.NSS = SPI_NSS_HARD_OUTPUT;
hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
hspi1.Init.TIMode = SPI_TIMODE_DISABLED;
hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_ENABLED;
hspi1.Init.CRCPolynomial = SPI_CRC_DEFAULTPOLYNOMIAL;
HAL_SPI_Init(&hspi1);
}
/** Configure pins as /** Configure pins as
* Analog * Analog
@ -142,7 +115,7 @@ void MX_SPI1_Init(void)
* EVENT_OUT * EVENT_OUT
* EXTI * EXTI
*/ */
void MX_GPIO_Init(void) void GPIO_Init(void)
{ {
GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitTypeDef GPIO_InitStruct;
@ -177,7 +150,7 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(STAT_LED_PORT, &GPIO_InitStruct); HAL_GPIO_Init(STAT_LED_PORT, &GPIO_InitStruct);
STAT_LED_PORT->BSRR = STAT_LED_BSRR_OFF; STAT_LED_PORT->BSRR = STAT_LED_OFF;
} }
/* USER CODE BEGIN 4 */ /* USER CODE BEGIN 4 */

@ -35,25 +35,22 @@
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include <usbd_descriptors.h>
#include "usb_device.h" #include "usb_device.h"
#include "usbd_core.h" #include "usbd_core.h"
#include "usbd_desc.h"
#include "usbd_msc.h" #include "usbd_msc.h"
#include "usbd_storage_if.h"
/* USB Device Core handle declaration */ /* USB Device Core handle declaration */
USBD_HandleTypeDef hUsbDeviceFS; USBD_HandleTypeDef hUsbDeviceFS;
/* init function */ /* init function */
void MX_USB_DEVICE_Init(void) void USB_Device_Init(void)
{ {
/* Init Device Library,Add Supported Class and Start the library*/ /* Init Device Library,Add Supported Class and Start the library*/
USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS); USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS);
USBD_RegisterClass(&hUsbDeviceFS, &USBD_MSC); USBD_RegisterClass(&hUsbDeviceFS, &USBD_MSC);
USBD_MSC_RegisterStorage(&hUsbDeviceFS, &USBD_Storage_Interface_fops_FS);
USBD_Start(&hUsbDeviceFS); USBD_Start(&hUsbDeviceFS);
} }

@ -116,7 +116,7 @@ void HAL_PCD_MspDeInit(PCD_HandleTypeDef* hpcd)
*/ */
void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd) void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd)
{ {
USBD_LL_SetupStage(hpcd->pData, (uint8_t *)hpcd->Setup); USBD_SetupStage(hpcd->pData, (uint8_t *)hpcd->Setup);
} }
/** /**
@ -127,7 +127,7 @@ void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd)
*/ */
void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
{ {
USBD_LL_DataOutStage(hpcd->pData, epnum, hpcd->OUT_ep[epnum].xfer_buff); USBD_DataOutStage(hpcd->pData, epnum, hpcd->OUT_ep[epnum].xfer_buff);
} }
/** /**
@ -138,7 +138,7 @@ void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
*/ */
void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
{ {
USBD_LL_DataInStage(hpcd->pData, epnum, hpcd->IN_ep[epnum].xfer_buff); USBD_DataInStage(hpcd->pData, epnum, hpcd->IN_ep[epnum].xfer_buff);
} }
/** /**
@ -148,7 +148,7 @@ void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
*/ */
void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
{ {
USBD_LL_SOF(hpcd->pData); USBD_SOF(hpcd->pData);
} }
/** /**
@ -174,10 +174,10 @@ void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
speed = USBD_SPEED_FULL; speed = USBD_SPEED_FULL;
break; break;
} }
USBD_LL_SetSpeed(hpcd->pData, speed); USBD_SetSpeed(hpcd->pData, speed);
/*Reset Device*/ /*Reset Device*/
USBD_LL_Reset(hpcd->pData); USBD_Reset(hpcd->pData);
} }
/** /**
@ -189,7 +189,7 @@ void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd) void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
{ {
/* Inform USB library that core enters in suspend Mode */ /* Inform USB library that core enters in suspend Mode */
USBD_LL_Suspend(hpcd->pData); USBD_Suspend(hpcd->pData);
__HAL_PCD_GATE_PHYCLOCK(hpcd); __HAL_PCD_GATE_PHYCLOCK(hpcd);
/*Enter in STOP mode */ /*Enter in STOP mode */
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
@ -217,7 +217,7 @@ void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd)
} }
/* USER CODE END 3 */ /* USER CODE END 3 */
__HAL_PCD_UNGATE_PHYCLOCK(hpcd); __HAL_PCD_UNGATE_PHYCLOCK(hpcd);
USBD_LL_Resume(hpcd->pData); USBD_Resume(hpcd->pData);
} }
/** /**
@ -228,7 +228,7 @@ void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd)
*/ */
void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
{ {
USBD_LL_IsoOUTIncomplete(hpcd->pData, epnum); USBD_IsoOUTIncomplete(hpcd->pData, epnum);
} }
/** /**
@ -239,7 +239,7 @@ void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
*/ */
void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum) void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
{ {
USBD_LL_IsoINIncomplete(hpcd->pData, epnum); USBD_IsoINIncomplete(hpcd->pData, epnum);
} }
/** /**
@ -249,7 +249,7 @@ void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
*/ */
void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd) void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd)
{ {
USBD_LL_DevConnected(hpcd->pData); USBD_DevConnected(hpcd->pData);
} }
/** /**
@ -259,7 +259,12 @@ void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd)
*/ */
void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd) void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd)
{ {
USBD_LL_DevDisconnected(hpcd->pData); USBD_DevDisconnected(hpcd->pData);
}
void HAL_PCD_BufferFreedCallBack(PCD_HandleTypeDef *hpcd)
{
USBD_BufferFreed(hpcd->pData);
} }
/******************************************************************************* /*******************************************************************************

@ -34,9 +34,10 @@
*/ */
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "usbd_config.h"
#include "usbd_descriptors.h"
#include "usbd_core.h" #include "usbd_core.h"
#include "usbd_desc.h" #include "usbd_msc.h"
#include "usbd_conf.h"
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
* @{ * @{
*/ */
@ -145,6 +146,26 @@ __ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_LEN_LANGID_STR_DESC] __ALIGN_END =
#pragma data_alignment=4 #pragma data_alignment=4
#endif #endif
__ALIGN_BEGIN uint8_t USBD_StrDesc[USBD_MAX_STR_DESC_SIZ] __ALIGN_END; __ALIGN_BEGIN uint8_t USBD_StrDesc[USBD_MAX_STR_DESC_SIZ] __ALIGN_END;
/* USB Mass storage Standard Inquiry Data */
const int8_t STORAGE_Inquirydata_FS[] = { //36
/* LUN 0 */
0x00,
0x80,
0x02,
0x02,
(STANDARD_INQUIRY_DATA_LEN - 5),
0x00,
0x00,
0x00,
'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */
'P', 'r', 'o', 'd', 'u', 'c', 't', ' ', /* Product : 16 Bytes */
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'0', '.', '0' ,'1', /* Version : 4 Bytes */
};
/** /**
* @} * @}
*/ */
@ -195,14 +216,7 @@ uint8_t * USBD_FS_LangIDStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *leng
*/ */
uint8_t * USBD_FS_ProductStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length) uint8_t * USBD_FS_ProductStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
{ {
// if(speed == 0) USBD_GetString (USBD_PRODUCT_STRING_FS, USBD_StrDesc, length);
// {
// USBD_GetString (USBD_PRODUCT_STRING_FS, USBD_StrDesc, length);
// }
// else
// {
USBD_GetString (USBD_PRODUCT_STRING_FS, USBD_StrDesc, length);
// }
return USBD_StrDesc; return USBD_StrDesc;
} }
@ -228,14 +242,7 @@ uint8_t * USBD_FS_ManufacturerStrDescriptor( USBD_SpeedTypeDef speed , uint16_t
*/ */
uint8_t * USBD_FS_SerialStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length) uint8_t * USBD_FS_SerialStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
{ {
if(speed == USBD_SPEED_HIGH) USBD_GetString (USBD_SERIALNUMBER_STRING_FS, USBD_StrDesc, length);
{
USBD_GetString (USBD_SERIALNUMBER_STRING_FS, USBD_StrDesc, length);
}
else
{
USBD_GetString (USBD_SERIALNUMBER_STRING_FS, USBD_StrDesc, length);
}
return USBD_StrDesc; return USBD_StrDesc;
} }
@ -248,14 +255,7 @@ uint8_t * USBD_FS_SerialStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *leng
*/ */
uint8_t * USBD_FS_ConfigStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length) uint8_t * USBD_FS_ConfigStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
{ {
if(speed == USBD_SPEED_HIGH) USBD_GetString (USBD_CONFIGURATION_STRING_FS, USBD_StrDesc, length);
{
USBD_GetString (USBD_CONFIGURATION_STRING_FS, USBD_StrDesc, length);
}
else
{
USBD_GetString (USBD_CONFIGURATION_STRING_FS, USBD_StrDesc, length);
}
return USBD_StrDesc; return USBD_StrDesc;
} }
@ -268,14 +268,7 @@ uint8_t * USBD_FS_ConfigStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *leng
*/ */
uint8_t * USBD_FS_InterfaceStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length) uint8_t * USBD_FS_InterfaceStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
{ {
if(speed == 0) USBD_GetString (USBD_INTERFACE_STRING_FS, USBD_StrDesc, length);
{
USBD_GetString (USBD_INTERFACE_STRING_FS, USBD_StrDesc, length);
}
else
{
USBD_GetString (USBD_INTERFACE_STRING_FS, USBD_StrDesc, length);
}
return USBD_StrDesc; return USBD_StrDesc;
} }
/** /**

@ -1,251 +0,0 @@
/**
******************************************************************************
* @file : usbd_storage_if.c
* @author : MCD Application Team
* @version : V1.1.0
* @date : 19-March-2012
* @brief : Memory management layer
******************************************************************************
* COPYRIGHT(c) 2015 STMicroelectronics
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions 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 its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_storage_if.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* USB handler declaration */
/* Handle for USB Full Speed IP */
USBD_HandleTypeDef *hUsbDevice_0;
extern USBD_HandleTypeDef hUsbDeviceFS;
/* Private function prototypes -----------------------------------------------*/
/* Extern function prototypes ------------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
#define STORAGE_LUN_NBR 1
#define STORAGE_BLK_NBR 0x10000
#define STORAGE_BLK_SIZ 0x200
static int8_t STORAGE_Init_FS (uint8_t lun);
static int8_t STORAGE_GetCapacity_FS (uint8_t lun,
uint32_t *block_num,
uint16_t *block_size);
static int8_t STORAGE_IsReady_FS (uint8_t lun);
static int8_t STORAGE_IsWriteProtected_FS (uint8_t lun);
static int8_t STORAGE_Read_FS (uint8_t lun,
uint8_t *buf,
uint32_t blk_addr,
uint16_t blk_len);
static int8_t STORAGE_Write_FS (uint8_t lun,
uint8_t *buf,
uint32_t blk_addr,
uint16_t blk_len);
static int8_t STORAGE_GetMaxLun_FS (void);
/* USER CODE BEGIN 0 */
/* USB Mass storage Standard Inquiry Data */
const int8_t STORAGE_Inquirydata_FS[] = {//36
/* LUN 0 */
0x00,
0x80,
0x02,
0x02,
(STANDARD_INQUIRY_DATA_LEN - 5),
0x00,
0x00,
0x00,
'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */
'P', 'r', 'o', 'd', 'u', 'c', 't', ' ', /* Product : 16 Bytes */
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'0', '.', '0' ,'1', /* Version : 4 Bytes */
};
/* USER CODE END 0 */
USBD_StorageTypeDef USBD_Storage_Interface_fops_FS =
{
STORAGE_Init_FS,
STORAGE_GetCapacity_FS,
STORAGE_IsReady_FS,
STORAGE_IsWriteProtected_FS,
STORAGE_Read_FS,
STORAGE_Write_FS,
STORAGE_GetMaxLun_FS,
(int8_t *)STORAGE_Inquirydata_FS,
};
/*******************************************************************************
* Function Name : STORAGE_Init_FS
* Description :
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
int8_t
STORAGE_Init_FS (uint8_t lun)
{
/* USER CODE BEGIN 2 */
if (lun >= STORAGE_LUN_NBR)
{
return (USBD_FAIL);
}
return (USBD_OK);
/* USER CODE END 2 */
}
/*******************************************************************************
* Function Name : STORAGE_GetCapacity_FS
* Description :
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
int8_t STORAGE_GetCapacity_FS (uint8_t lun, uint32_t *block_num, uint16_t *block_size)
{
/* USER CODE BEGIN 3 */
if (lun >= STORAGE_LUN_NBR)
{
return (USBD_FAIL);
}
*block_num = STORAGE_BLK_NBR;
*block_size = STORAGE_BLK_SIZ;
return (USBD_OK);
/* USER CODE END 3 */
}
/*******************************************************************************
* Function Name : STORAGE_IsReady_FS
* Description :
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
int8_t STORAGE_IsReady_FS (uint8_t lun)
{
/* USER CODE BEGIN 4 */
if (lun >= STORAGE_LUN_NBR)
{
return (USBD_FAIL);
}
return (USBD_OK);
/* USER CODE END 4 */
}
/*******************************************************************************
* Function Name : STORAGE_IsWriteProtected_FS
* Description :
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
int8_t STORAGE_IsWriteProtected_FS (uint8_t lun)
{
/* USER CODE BEGIN 5 */
if (lun >= STORAGE_LUN_NBR)
{
return (USBD_FAIL);
}
return (USBD_OK);
/* USER CODE END 5 */
}
/*******************************************************************************
* Function Name : STORAGE_Read_FS
* Description :
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
int8_t STORAGE_Read_FS (uint8_t lun,
uint8_t *buf,
uint32_t blk_addr,
uint16_t blk_len)
{
/* USER CODE BEGIN 6 */
uint16_t blockLoop;
uint16_t byteLoop;
if (lun >= STORAGE_LUN_NBR)
{
return -1;
}
for (blockLoop = 0; blockLoop < blk_len; blockLoop++) //blk_len will be 1 when scsi_blk_size = 512 bytes
{
for (byteLoop = 0; byteLoop < STORAGE_BLK_SIZ; byteLoop += 4) //STORAGE_BLK_SIZ must be a multiple of 4
{
*((__packed uint32_t *)buf) = 0;
buf += 4;
}
}
return (USBD_OK);
/* USER CODE END 6 */
}
/*******************************************************************************
* Function Name : STORAGE_Write_FS
* Description :
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
int8_t STORAGE_Write_FS (uint8_t lun,
uint8_t *buf,
uint32_t blk_addr,
uint16_t blk_len)
{
/* USER CODE BEGIN 7 */
if (lun >= STORAGE_LUN_NBR)
{
return -1;
}
return (USBD_OK);
/* USER CODE END 7 */
}
/*******************************************************************************
* Function Name : STORAGE_GetMaxLun_FS
* Description :
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
int8_t STORAGE_GetMaxLun_FS (void)
{
/* USER CODE BEGIN 8 */
return (STORAGE_LUN_NBR - 1);
/* USER CODE END 8 */
}
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Loading…
Cancel
Save