Initialize other pheripherals
This commit is contained in:
parent
ec4df11c61
commit
ffec0e2b57
69 changed files with 25802 additions and 620 deletions
68
.cproject
68
.cproject
|
@ -13,34 +13,34 @@
|
||||||
</extensions>
|
</extensions>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1412811913" name="Debug" parent="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug">
|
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1412811913" name="Debug" parent="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug">
|
||||||
<folderInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1412811913." name="/" resourcePath="">
|
<folderInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1412811913." name="/" resourcePath="">
|
||||||
<toolChain id="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug.310773306" name="MCU ARM GCC" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug">
|
<toolChain id="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug.310773306" name="MCU ARM GCC" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug">
|
||||||
<option id="com.st.stm32cube.ide.mcu.option.internal.toolchain.type.1175929717" name="Internal Toolchain Type" superClass="com.st.stm32cube.ide.mcu.option.internal.toolchain.type" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.option.internal.toolchain.type.1175929717" name="Internal Toolchain Type" superClass="com.st.stm32cube.ide.mcu.option.internal.toolchain.type" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32" valueType="string"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.option.internal.toolchain.version.721928544" name="Internal Toolchain Version" superClass="com.st.stm32cube.ide.mcu.option.internal.toolchain.version" value="7-2018-q2-update" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.option.internal.toolchain.version.721928544" name="Internal Toolchain Version" superClass="com.st.stm32cube.ide.mcu.option.internal.toolchain.version" useByScannerDiscovery="false" value="7-2018-q2-update" valueType="string"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.1334435344" name="Mcu" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu" value="STM32F407VETx" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.1334435344" name="Mcu" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu" useByScannerDiscovery="false" value="STM32F407VETx" valueType="string"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.486609608" name="CpuId" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" value="0" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.486609608" name="CpuId" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" useByScannerDiscovery="false" value="0" valueType="string"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.1308812803" name="CpuCoreId" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" value="0" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.1308812803" name="CpuCoreId" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" useByScannerDiscovery="false" value="0" valueType="string"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.534142050" name="Floating-point unit" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv4-sp-d16" valueType="enumerated"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.534142050" name="Floating-point unit" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv4-sp-d16" valueType="enumerated"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.1723363245" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.1723363245" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.945653835" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.945653835" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.845175199" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.0 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32F407VETx || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Inc | ../Drivers/CMSIS/Include | ../Drivers/STM32F4xx_HAL_Driver/Inc | ../Drivers/CMSIS/Device/ST/STM32F4xx/Include | ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy || ../ || || USE_HAL_DRIVER | USE_FULL_LL_DRIVER | STM32F407xx || || Startup || Drivers | Src || || ${workspace_loc:/${ProjName}/STM32F407VETX_FLASH.ld} || true" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.845175199" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.0 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32F407VETx || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Inc | ../Drivers/CMSIS/Include | ../Drivers/STM32F4xx_HAL_Driver/Inc | ../Drivers/CMSIS/Device/ST/STM32F4xx/Include | ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy | ../Middlewares/Third_Party/FatFs/src || ../ || || USE_HAL_DRIVER | USE_FULL_LL_DRIVER | STM32F407xx || || Startup || Drivers | Src | Middlewares || || ${workspace_loc:/${ProjName}/STM32F407VETX_FLASH.ld} || true" valueType="string"/>
|
||||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1318619214" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1318619214" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||||
<builder buildPath="${workspace_loc:/f407ve_hs_uart}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1369652646" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
<builder buildPath="${workspace_loc:/f407ve_hs_uart}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1369652646" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.889348861" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.889348861" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.1058490840" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g3" valueType="enumerated"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.1058490840" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g3" valueType="enumerated"/>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths.1179828818" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths" valueType="includePath"/>
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths.1179828818" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths" useByScannerDiscovery="false" valueType="includePath"/>
|
||||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.1366894889" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/>
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.1366894889" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/>
|
||||||
</tool>
|
</tool>
|
||||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1692182572" name="MCU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler">
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1692182572" name="MCU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler">
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.1472098457" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g3" valueType="enumerated"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.1472098457" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g3" valueType="enumerated"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.1785945248" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.og" valueType="enumerated"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.1785945248" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.ofast" valueType="enumerated"/>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.1690646048" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.1690646048" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
||||||
|
<listOptionValue builtIn="false" value="_ENABLE_DIAG"/>
|
||||||
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
|
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
|
||||||
<listOptionValue builtIn="false" value="DEBUG"/>
|
<listOptionValue builtIn="false" value="DEBUG"/>
|
||||||
<listOptionValue builtIn="false" value="STM32F407xx"/>
|
<listOptionValue builtIn="false" value="STM32F407xx"/>
|
||||||
<listOptionValue builtIn="false" value="_ENABLE_DIAG"/>
|
|
||||||
</option>
|
</option>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.1034236165" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.1034236165" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value="../Inc"/>
|
<listOptionValue builtIn="false" value="../Inc"/>
|
||||||
|
@ -49,6 +49,7 @@
|
||||||
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F4xx/Include"/>
|
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F4xx/Include"/>
|
||||||
<listOptionValue builtIn="false" value="../lib"/>
|
<listOptionValue builtIn="false" value="../lib"/>
|
||||||
<listOptionValue builtIn="false" value="../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy"/>
|
<listOptionValue builtIn="false" value="../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/FatFs/src"/>
|
||||||
<listOptionValue builtIn="false" value="../app"/>
|
<listOptionValue builtIn="false" value="../app"/>
|
||||||
</option>
|
</option>
|
||||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.786533016" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.786533016" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
|
||||||
|
@ -58,7 +59,7 @@
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.189424749" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level" useByScannerDiscovery="false"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.189424749" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level" useByScannerDiscovery="false"/>
|
||||||
</tool>
|
</tool>
|
||||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.2056297644" name="MCU GCC Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker">
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.2056297644" name="MCU GCC Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker">
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script.1387406773" name="Linker Script (-T)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script" value="${workspace_loc:/${ProjName}/STM32F407VETX_FLASH.ld}" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script.1387406773" name="Linker Script (-T)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script" useByScannerDiscovery="false" value="${workspace_loc:/${ProjName}/STM32F407VETX_FLASH.ld}" valueType="string"/>
|
||||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.input.1802903771" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.input">
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.input.1802903771" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.input">
|
||||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
@ -77,11 +78,42 @@
|
||||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.253790796" name="MCU Output Converter Motorola S-rec with symbols" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec"/>
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.253790796" name="MCU Output Converter Motorola S-rec with symbols" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec"/>
|
||||||
</toolChain>
|
</toolChain>
|
||||||
</folderInfo>
|
</folderInfo>
|
||||||
|
<folderInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1412811913.228678687" name="/" resourcePath="lib">
|
||||||
|
<toolChain id="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug.1408406321" name="MCU ARM GCC" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug" unusedChildren="">
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1554480247" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.889348861">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.1000555262" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g" valueType="enumerated"/>
|
||||||
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.294148789" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.732313899" name="MCU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1692182572">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.2008019095" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g" valueType="enumerated"/>
|
||||||
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1984812248" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.1685064763" name="MCU G++ Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.601220304">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.1130023264" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.value.g" valueType="enumerated"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.1137686241" name="MCU GCC Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.2056297644">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script.429517529" name="Linker Script (-T)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script" value="${workspace_loc:/${ProjName}/LinkerScript.ld}" valueType="string"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.520098272" name="MCU G++ Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.153425861">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.option.script.1085805473" name="Linker Script (-T)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.option.script" value="${workspace_loc:/${ProjName}/LinkerScript.ld}" valueType="string"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver.1497781270" name="MCU GCC Archiver" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver.1832723048"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size.1421581552" name="MCU Size" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size.1035950509"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile.1065141722" name="MCU Output Converter list file" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile.1399725542"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex.1364530535" name="MCU Output Converter Hex" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex.1674274981"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary.1542350475" name="MCU Output Converter Binary" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary.1011539296"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog.973956245" name="MCU Output Converter Verilog" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog.1046006967"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec.306471464" name="MCU Output Converter Motorola S-rec" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec.651751425"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.530833402" name="MCU Output Converter Motorola S-rec with symbols" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.253790796"/>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
<sourceEntries>
|
<sourceEntries>
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="lib"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="lib"/>
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="app"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="app"/>
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares"/>
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
|
||||||
</sourceEntries>
|
</sourceEntries>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -111,7 +143,7 @@
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.1206433749" name="Floating-point unit" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv4-sp-d16" valueType="enumerated"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.1206433749" name="Floating-point unit" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.fpu.value.fpv4-sp-d16" valueType="enumerated"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.813319054" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.813319054" name="Floating-point ABI" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.floatabi.value.hard" valueType="enumerated"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.382543164" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.382543164" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" value="genericBoard" valueType="string"/>
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1348641535" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.0 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32F407VETx || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Inc | ../Drivers/CMSIS/Include | ../Drivers/STM32F4xx_HAL_Driver/Inc | ../Drivers/CMSIS/Device/ST/STM32F4xx/Include | ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy || ../ || || USE_HAL_DRIVER | USE_FULL_LL_DRIVER | STM32F407xx || || Startup || Drivers | Src || || ${workspace_loc:/${ProjName}/STM32F407VETX_FLASH.ld} || true" valueType="string"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1348641535" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.0 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.base.gnu-tools-for-stm32 || STM32F407VETx || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Inc | ../Drivers/CMSIS/Include | ../Drivers/STM32F4xx_HAL_Driver/Inc | ../Drivers/CMSIS/Device/ST/STM32F4xx/Include | ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy | ../Middlewares/Third_Party/FatFs/src || ../ || || USE_HAL_DRIVER | USE_FULL_LL_DRIVER | STM32F407xx || || Startup || Drivers | Src | Middlewares || || ${workspace_loc:/${ProjName}/STM32F407VETX_FLASH.ld} || true" valueType="string"/>
|
||||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1962314279" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1962314279" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||||
<builder buildPath="${workspace_loc:/f407ve_hs_uart}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.2118535984" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
<builder buildPath="${workspace_loc:/f407ve_hs_uart}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.2118535984" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1940236902" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1940236902" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
||||||
|
@ -124,9 +156,9 @@
|
||||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.2113508386" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.o3" valueType="enumerated"/>
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.2113508386" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.o3" valueType="enumerated"/>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.673633610" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.673633610" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
||||||
|
<listOptionValue builtIn="false" value="_ENABLE_DIAG"/>
|
||||||
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
|
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
|
||||||
<listOptionValue builtIn="false" value="STM32F407xx"/>
|
<listOptionValue builtIn="false" value="STM32F407xx"/>
|
||||||
<listOptionValue builtIn="false" value="_ENABLE_DIAG"/>
|
|
||||||
</option>
|
</option>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.333400604" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.333400604" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value="../Inc"/>
|
<listOptionValue builtIn="false" value="../Inc"/>
|
||||||
|
@ -135,6 +167,7 @@
|
||||||
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F4xx/Include"/>
|
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F4xx/Include"/>
|
||||||
<listOptionValue builtIn="false" value="../lib"/>
|
<listOptionValue builtIn="false" value="../lib"/>
|
||||||
<listOptionValue builtIn="false" value="../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy"/>
|
<listOptionValue builtIn="false" value="../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Middlewares/Third_Party/FatFs/src"/>
|
||||||
<listOptionValue builtIn="false" value="../app"/>
|
<listOptionValue builtIn="false" value="../app"/>
|
||||||
</option>
|
</option>
|
||||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1625409202" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1625409202" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
|
||||||
|
@ -168,6 +201,7 @@
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Startup"/>
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="app"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="app"/>
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Src"/>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Middlewares"/>
|
||||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
|
||||||
</sourceEntries>
|
</sourceEntries>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
10
.mxproject
10
.mxproject
File diff suppressed because one or more lines are too long
0
.sw4stm32.4822460615094152264.resolved.cfg
Normal file
0
.sw4stm32.4822460615094152264.resolved.cfg
Normal file
452
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd.h
Normal file
452
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd.h
Normal file
|
@ -0,0 +1,452 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32f4xx_hal_pcd.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file of PCD HAL module.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at:
|
||||||
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef STM32F4xx_HAL_PCD_H
|
||||||
|
#define STM32F4xx_HAL_PCD_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32f4xx_ll_usb.h"
|
||||||
|
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
|
||||||
|
/** @addtogroup STM32F4xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup PCD
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/** @defgroup PCD_Exported_Types PCD Exported Types
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief PCD State structure definition
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HAL_PCD_STATE_RESET = 0x00,
|
||||||
|
HAL_PCD_STATE_READY = 0x01,
|
||||||
|
HAL_PCD_STATE_ERROR = 0x02,
|
||||||
|
HAL_PCD_STATE_BUSY = 0x03,
|
||||||
|
HAL_PCD_STATE_TIMEOUT = 0x04
|
||||||
|
} PCD_StateTypeDef;
|
||||||
|
|
||||||
|
/* Device LPM suspend state */
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
LPM_L0 = 0x00, /* on */
|
||||||
|
LPM_L1 = 0x01, /* LPM L1 sleep */
|
||||||
|
LPM_L2 = 0x02, /* suspend */
|
||||||
|
LPM_L3 = 0x03, /* off */
|
||||||
|
} PCD_LPM_StateTypeDef;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
PCD_LPM_L0_ACTIVE = 0x00, /* on */
|
||||||
|
PCD_LPM_L1_ACTIVE = 0x01, /* LPM L1 sleep */
|
||||||
|
} PCD_LPM_MsgTypeDef;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
PCD_BCD_ERROR = 0xFF,
|
||||||
|
PCD_BCD_CONTACT_DETECTION = 0xFE,
|
||||||
|
PCD_BCD_STD_DOWNSTREAM_PORT = 0xFD,
|
||||||
|
PCD_BCD_CHARGING_DOWNSTREAM_PORT = 0xFC,
|
||||||
|
PCD_BCD_DEDICATED_CHARGING_PORT = 0xFB,
|
||||||
|
PCD_BCD_DISCOVERY_COMPLETED = 0x00,
|
||||||
|
|
||||||
|
} PCD_BCD_MsgTypeDef;
|
||||||
|
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
typedef USB_OTG_GlobalTypeDef PCD_TypeDef;
|
||||||
|
typedef USB_OTG_CfgTypeDef PCD_InitTypeDef;
|
||||||
|
typedef USB_OTG_EPTypeDef PCD_EPTypeDef;
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief PCD Handle Structure definition
|
||||||
|
*/
|
||||||
|
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||||
|
typedef struct __PCD_HandleTypeDef
|
||||||
|
#else
|
||||||
|
typedef struct
|
||||||
|
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||||
|
{
|
||||||
|
PCD_TypeDef *Instance; /*!< Register base address */
|
||||||
|
PCD_InitTypeDef Init; /*!< PCD required parameters */
|
||||||
|
__IO uint8_t USB_Address; /*!< USB Address */
|
||||||
|
PCD_EPTypeDef IN_ep[16]; /*!< IN endpoint parameters */
|
||||||
|
PCD_EPTypeDef OUT_ep[16]; /*!< OUT endpoint parameters */
|
||||||
|
HAL_LockTypeDef Lock; /*!< PCD peripheral status */
|
||||||
|
__IO PCD_StateTypeDef State; /*!< PCD communication state */
|
||||||
|
__IO uint32_t ErrorCode; /*!< PCD Error code */
|
||||||
|
uint32_t Setup[12]; /*!< Setup packet buffer */
|
||||||
|
PCD_LPM_StateTypeDef LPM_State; /*!< LPM State */
|
||||||
|
uint32_t BESL;
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t lpm_active; /*!< Enable or disable the Link Power Management .
|
||||||
|
This parameter can be set to ENABLE or DISABLE */
|
||||||
|
|
||||||
|
uint32_t battery_charging_active; /*!< Enable or disable Battery charging.
|
||||||
|
This parameter can be set to ENABLE or DISABLE */
|
||||||
|
void *pData; /*!< Pointer to upper stack Handler */
|
||||||
|
|
||||||
|
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||||
|
void (* SOFCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD SOF callback */
|
||||||
|
void (* SetupStageCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Setup Stage callback */
|
||||||
|
void (* ResetCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Reset callback */
|
||||||
|
void (* SuspendCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Suspend callback */
|
||||||
|
void (* ResumeCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Resume callback */
|
||||||
|
void (* ConnectCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Connect callback */
|
||||||
|
void (* DisconnectCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Disconnect callback */
|
||||||
|
|
||||||
|
void (* DataOutStageCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD Data OUT Stage callback */
|
||||||
|
void (* DataInStageCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD Data IN Stage callback */
|
||||||
|
void (* ISOOUTIncompleteCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD ISO OUT Incomplete callback */
|
||||||
|
void (* ISOINIncompleteCallback)(struct __PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< USB OTG PCD ISO IN Incomplete callback */
|
||||||
|
void (* BCDCallback)(struct __PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); /*!< USB OTG PCD BCD callback */
|
||||||
|
void (* LPMCallback)(struct __PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); /*!< USB OTG PCD LPM callback */
|
||||||
|
|
||||||
|
void (* MspInitCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Msp Init callback */
|
||||||
|
void (* MspDeInitCallback)(struct __PCD_HandleTypeDef *hpcd); /*!< USB OTG PCD Msp DeInit callback */
|
||||||
|
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||||
|
} PCD_HandleTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Include PCD HAL Extended module */
|
||||||
|
#include "stm32f4xx_hal_pcd_ex.h"
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/** @defgroup PCD_Exported_Constants PCD Exported Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup PCD_Speed PCD Speed
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define PCD_SPEED_HIGH USBD_HS_SPEED
|
||||||
|
#define PCD_SPEED_HIGH_IN_FULL USBD_HSINFS_SPEED
|
||||||
|
#define PCD_SPEED_FULL USBD_FS_SPEED
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup PCD_PHY_Module PCD PHY Module
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define PCD_PHY_ULPI 1U
|
||||||
|
#define PCD_PHY_EMBEDDED 2U
|
||||||
|
#define PCD_PHY_UTMI 3U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup PCD_Error_Code_definition PCD Error Code definition
|
||||||
|
* @brief PCD Error Code definition
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||||
|
#define HAL_PCD_ERROR_INVALID_CALLBACK (0x00000010U) /*!< Invalid Callback error */
|
||||||
|
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported macros -----------------------------------------------------------*/
|
||||||
|
/** @defgroup PCD_Exported_Macros PCD Exported Macros
|
||||||
|
* @brief macros to handle interrupts and specific clock configurations
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
#define __HAL_PCD_ENABLE(__HANDLE__) (void)USB_EnableGlobalInt ((__HANDLE__)->Instance)
|
||||||
|
#define __HAL_PCD_DISABLE(__HANDLE__) (void)USB_DisableGlobalInt ((__HANDLE__)->Instance)
|
||||||
|
|
||||||
|
#define __HAL_PCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__))
|
||||||
|
#define __HAL_PCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) &= (__INTERRUPT__))
|
||||||
|
#define __HAL_PCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0U)
|
||||||
|
|
||||||
|
|
||||||
|
#define __HAL_PCD_UNGATE_PHYCLOCK(__HANDLE__) *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) &= \
|
||||||
|
~(USB_OTG_PCGCCTL_STOPCLK)
|
||||||
|
|
||||||
|
#define __HAL_PCD_GATE_PHYCLOCK(__HANDLE__) *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) |= USB_OTG_PCGCCTL_STOPCLK
|
||||||
|
|
||||||
|
#define __HAL_PCD_IS_PHY_SUSPENDED(__HANDLE__) ((*(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE)) & 0x10U)
|
||||||
|
|
||||||
|
#define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_IT() EXTI->IMR |= (USB_OTG_HS_WAKEUP_EXTI_LINE)
|
||||||
|
#define __HAL_USB_OTG_HS_WAKEUP_EXTI_DISABLE_IT() EXTI->IMR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE)
|
||||||
|
#define __HAL_USB_OTG_HS_WAKEUP_EXTI_GET_FLAG() EXTI->PR & (USB_OTG_HS_WAKEUP_EXTI_LINE)
|
||||||
|
#define __HAL_USB_OTG_HS_WAKEUP_EXTI_CLEAR_FLAG() EXTI->PR = (USB_OTG_HS_WAKEUP_EXTI_LINE)
|
||||||
|
|
||||||
|
#define __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_RISING_EDGE() \
|
||||||
|
do { \
|
||||||
|
EXTI->FTSR &= ~(USB_OTG_HS_WAKEUP_EXTI_LINE); \
|
||||||
|
EXTI->RTSR |= USB_OTG_HS_WAKEUP_EXTI_LINE; \
|
||||||
|
} while(0U)
|
||||||
|
#define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_IT() EXTI->IMR |= USB_OTG_FS_WAKEUP_EXTI_LINE
|
||||||
|
#define __HAL_USB_OTG_FS_WAKEUP_EXTI_DISABLE_IT() EXTI->IMR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE)
|
||||||
|
#define __HAL_USB_OTG_FS_WAKEUP_EXTI_GET_FLAG() EXTI->PR & (USB_OTG_FS_WAKEUP_EXTI_LINE)
|
||||||
|
#define __HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG() EXTI->PR = USB_OTG_FS_WAKEUP_EXTI_LINE
|
||||||
|
|
||||||
|
#define __HAL_USB_OTG_FS_WAKEUP_EXTI_ENABLE_RISING_EDGE() \
|
||||||
|
do { \
|
||||||
|
EXTI->FTSR &= ~(USB_OTG_FS_WAKEUP_EXTI_LINE); \
|
||||||
|
EXTI->RTSR |= USB_OTG_FS_WAKEUP_EXTI_LINE; \
|
||||||
|
} while(0U)
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup PCD_Exported_Functions PCD Exported Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Initialization/de-initialization functions ********************************/
|
||||||
|
/** @addtogroup PCD_Exported_Functions_Group1 Initialization and de-initialization functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_DeInit(PCD_HandleTypeDef *hpcd);
|
||||||
|
void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd);
|
||||||
|
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd);
|
||||||
|
|
||||||
|
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||||
|
/** @defgroup HAL_PCD_Callback_ID_enumeration_definition HAL USB OTG PCD Callback ID enumeration definition
|
||||||
|
* @brief HAL USB OTG PCD Callback ID enumeration definition
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HAL_PCD_SOF_CB_ID = 0x01, /*!< USB PCD SOF callback ID */
|
||||||
|
HAL_PCD_SETUPSTAGE_CB_ID = 0x02, /*!< USB PCD Setup Stage callback ID */
|
||||||
|
HAL_PCD_RESET_CB_ID = 0x03, /*!< USB PCD Reset callback ID */
|
||||||
|
HAL_PCD_SUSPEND_CB_ID = 0x04, /*!< USB PCD Suspend callback ID */
|
||||||
|
HAL_PCD_RESUME_CB_ID = 0x05, /*!< USB PCD Resume callback ID */
|
||||||
|
HAL_PCD_CONNECT_CB_ID = 0x06, /*!< USB PCD Connect callback ID */
|
||||||
|
HAL_PCD_DISCONNECT_CB_ID = 0x07, /*!< USB PCD Disconnect callback ID */
|
||||||
|
|
||||||
|
HAL_PCD_MSPINIT_CB_ID = 0x08, /*!< USB PCD MspInit callback ID */
|
||||||
|
HAL_PCD_MSPDEINIT_CB_ID = 0x09 /*!< USB PCD MspDeInit callback ID */
|
||||||
|
|
||||||
|
} HAL_PCD_CallbackIDTypeDef;
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup HAL_PCD_Callback_pointer_definition HAL USB OTG PCD Callback pointer definition
|
||||||
|
* @brief HAL USB OTG PCD Callback pointer definition
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef void (*pPCD_CallbackTypeDef)(PCD_HandleTypeDef *hpcd); /*!< pointer to a common USB OTG PCD callback function */
|
||||||
|
typedef void (*pPCD_DataOutStageCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD Data OUT Stage callback */
|
||||||
|
typedef void (*pPCD_DataInStageCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD Data IN Stage callback */
|
||||||
|
typedef void (*pPCD_IsoOutIncpltCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD ISO OUT Incomplete callback */
|
||||||
|
typedef void (*pPCD_IsoInIncpltCallbackTypeDef)(PCD_HandleTypeDef *hpcd, uint8_t epnum); /*!< pointer to USB OTG PCD ISO IN Incomplete callback */
|
||||||
|
typedef void (*pPCD_LpmCallbackTypeDef)(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); /*!< pointer to USB OTG PCD LPM callback */
|
||||||
|
typedef void (*pPCD_BcdCallbackTypeDef)(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); /*!< pointer to USB OTG PCD BCD callback */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
HAL_StatusTypeDef HAL_PCD_RegisterCallback(PCD_HandleTypeDef *hpcd, HAL_PCD_CallbackIDTypeDef CallbackID, pPCD_CallbackTypeDef pCallback);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_UnRegisterCallback(PCD_HandleTypeDef *hpcd, HAL_PCD_CallbackIDTypeDef CallbackID);
|
||||||
|
|
||||||
|
HAL_StatusTypeDef HAL_PCD_RegisterDataOutStageCallback(PCD_HandleTypeDef *hpcd, pPCD_DataOutStageCallbackTypeDef pCallback);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_UnRegisterDataOutStageCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
|
||||||
|
HAL_StatusTypeDef HAL_PCD_RegisterDataInStageCallback(PCD_HandleTypeDef *hpcd, pPCD_DataInStageCallbackTypeDef pCallback);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_UnRegisterDataInStageCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
|
||||||
|
HAL_StatusTypeDef HAL_PCD_RegisterIsoOutIncpltCallback(PCD_HandleTypeDef *hpcd, pPCD_IsoOutIncpltCallbackTypeDef pCallback);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_UnRegisterIsoOutIncpltCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
|
||||||
|
HAL_StatusTypeDef HAL_PCD_RegisterIsoInIncpltCallback(PCD_HandleTypeDef *hpcd, pPCD_IsoInIncpltCallbackTypeDef pCallback);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_UnRegisterIsoInIncpltCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
|
||||||
|
HAL_StatusTypeDef HAL_PCD_RegisterBcdCallback(PCD_HandleTypeDef *hpcd, pPCD_BcdCallbackTypeDef pCallback);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_UnRegisterBcdCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
|
||||||
|
HAL_StatusTypeDef HAL_PCD_RegisterLpmCallback(PCD_HandleTypeDef *hpcd, pPCD_LpmCallbackTypeDef pCallback);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_UnRegisterLpmCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* I/O operation functions ***************************************************/
|
||||||
|
/* Non-Blocking mode: Interrupt */
|
||||||
|
/** @addtogroup PCD_Exported_Functions_Group2 Input and Output operation functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_Stop(PCD_HandleTypeDef *hpcd);
|
||||||
|
void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd);
|
||||||
|
|
||||||
|
void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd);
|
||||||
|
|
||||||
|
void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum);
|
||||||
|
void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum);
|
||||||
|
void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum);
|
||||||
|
void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Peripheral Control functions **********************************************/
|
||||||
|
/** @addtogroup PCD_Exported_Functions_Group3 Peripheral Control functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_PCD_DevConnect(PCD_HandleTypeDef *hpcd);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_DevDisconnect(PCD_HandleTypeDef *hpcd);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_SetAddress(PCD_HandleTypeDef *hpcd, uint8_t address);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_EP_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_EP_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len);
|
||||||
|
uint32_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_ActivateRemoteWakeup(PCD_HandleTypeDef *hpcd);
|
||||||
|
HAL_StatusTypeDef HAL_PCD_DeActivateRemoteWakeup(PCD_HandleTypeDef *hpcd);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Peripheral State functions ************************************************/
|
||||||
|
/** @addtogroup PCD_Exported_Functions_Group4 Peripheral State functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/** @defgroup PCD_Private_Constants PCD Private Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/** @defgroup USB_EXTI_Line_Interrupt USB EXTI line interrupt
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
#define USB_OTG_FS_WAKEUP_EXTI_RISING_EDGE 0x08U
|
||||||
|
#define USB_OTG_FS_WAKEUP_EXTI_FALLING_EDGE 0x0CU
|
||||||
|
#define USB_OTG_FS_WAKEUP_EXTI_RISING_FALLING_EDGE 0x10U
|
||||||
|
|
||||||
|
#define USB_OTG_HS_WAKEUP_EXTI_RISING_EDGE 0x08U
|
||||||
|
#define USB_OTG_HS_WAKEUP_EXTI_FALLING_EDGE 0x0CU
|
||||||
|
#define USB_OTG_HS_WAKEUP_EXTI_RISING_FALLING_EDGE 0x10U
|
||||||
|
|
||||||
|
#define USB_OTG_FS_WAKEUP_EXTI_LINE (0x1U << 18) /*!< USB FS EXTI Line WakeUp Interrupt */
|
||||||
|
#define USB_OTG_HS_WAKEUP_EXTI_LINE (0x1U << 20) /*!< USB HS EXTI Line WakeUp Interrupt */
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
#ifndef USB_OTG_DOEPINT_OTEPSPR
|
||||||
|
#define USB_OTG_DOEPINT_OTEPSPR (0x1UL << 5) /*!< Status Phase Received interrupt */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef USB_OTG_DOEPMSK_OTEPSPRM
|
||||||
|
#define USB_OTG_DOEPMSK_OTEPSPRM (0x1UL << 5) /*!< Setup Packet Received interrupt mask */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef USB_OTG_DOEPINT_NAK
|
||||||
|
#define USB_OTG_DOEPINT_NAK (0x1UL << 13) /*!< NAK interrupt */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef USB_OTG_DOEPMSK_NAKM
|
||||||
|
#define USB_OTG_DOEPMSK_NAKM (0x1UL << 13) /*!< OUT Packet NAK interrupt mask */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef USB_OTG_DOEPINT_STPKTRX
|
||||||
|
#define USB_OTG_DOEPINT_STPKTRX (0x1UL << 15) /*!< Setup Packet Received interrupt */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef USB_OTG_DOEPMSK_NYETM
|
||||||
|
#define USB_OTG_DOEPMSK_NYETM (0x1UL << 14) /*!< Setup Packet Received interrupt mask */
|
||||||
|
#endif
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/** @defgroup PCD_Private_Macros PCD Private Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* STM32F4xx_HAL_PCD_H */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
91
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd_ex.h
Normal file
91
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd_ex.h
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32f4xx_hal_pcd_ex.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file of PCD HAL Extension module.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at:
|
||||||
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef STM32F4xx_HAL_PCD_EX_H
|
||||||
|
#define STM32F4xx_HAL_PCD_EX_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32f4xx_hal_def.h"
|
||||||
|
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
/** @addtogroup STM32F4xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup PCDEx
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* Exported macros -----------------------------------------------------------*/
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size);
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size);
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
#if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd);
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd);
|
||||||
|
#endif /* defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) */
|
||||||
|
#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd);
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd);
|
||||||
|
void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd);
|
||||||
|
#endif /* defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) */
|
||||||
|
void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg);
|
||||||
|
void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* STM32F4xx_HAL_PCD_EX_H */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
765
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sd.h
Normal file
765
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sd.h
Normal file
|
@ -0,0 +1,765 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32f4xx_hal_sd.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file of SD HAL module.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at:
|
||||||
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __STM32F4xx_HAL_SD_H
|
||||||
|
#define __STM32F4xx_HAL_SD_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
|
||||||
|
defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
|
||||||
|
defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
|
||||||
|
defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
|
||||||
|
defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32f4xx_ll_sdmmc.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32F4xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD SD
|
||||||
|
* @brief SD HAL module driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/** @defgroup SD_Exported_Types SD Exported Types
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Types_Group1 SD State enumeration structure
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HAL_SD_STATE_RESET = 0x00000000U, /*!< SD not yet initialized or disabled */
|
||||||
|
HAL_SD_STATE_READY = 0x00000001U, /*!< SD initialized and ready for use */
|
||||||
|
HAL_SD_STATE_TIMEOUT = 0x00000002U, /*!< SD Timeout state */
|
||||||
|
HAL_SD_STATE_BUSY = 0x00000003U, /*!< SD process ongoing */
|
||||||
|
HAL_SD_STATE_PROGRAMMING = 0x00000004U, /*!< SD Programming State */
|
||||||
|
HAL_SD_STATE_RECEIVING = 0x00000005U, /*!< SD Receinving State */
|
||||||
|
HAL_SD_STATE_TRANSFER = 0x00000006U, /*!< SD Transfert State */
|
||||||
|
HAL_SD_STATE_ERROR = 0x0000000FU /*!< SD is in error state */
|
||||||
|
}HAL_SD_StateTypeDef;
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Types_Group2 SD Card State enumeration structure
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HAL_SD_CARD_READY = 0x00000001U, /*!< Card state is ready */
|
||||||
|
HAL_SD_CARD_IDENTIFICATION = 0x00000002U, /*!< Card is in identification state */
|
||||||
|
HAL_SD_CARD_STANDBY = 0x00000003U, /*!< Card is in standby state */
|
||||||
|
HAL_SD_CARD_TRANSFER = 0x00000004U, /*!< Card is in transfer state */
|
||||||
|
HAL_SD_CARD_SENDING = 0x00000005U, /*!< Card is sending an operation */
|
||||||
|
HAL_SD_CARD_RECEIVING = 0x00000006U, /*!< Card is receiving operation information */
|
||||||
|
HAL_SD_CARD_PROGRAMMING = 0x00000007U, /*!< Card is in programming state */
|
||||||
|
HAL_SD_CARD_DISCONNECTED = 0x00000008U, /*!< Card is disconnected */
|
||||||
|
HAL_SD_CARD_ERROR = 0x000000FFU /*!< Card response Error */
|
||||||
|
}HAL_SD_CardStateTypeDef;
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Types_Group3 SD Handle Structure definition
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define SD_InitTypeDef SDIO_InitTypeDef
|
||||||
|
#define SD_TypeDef SDIO_TypeDef
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SD Card Information Structure definition
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t CardType; /*!< Specifies the card Type */
|
||||||
|
|
||||||
|
uint32_t CardVersion; /*!< Specifies the card version */
|
||||||
|
|
||||||
|
uint32_t Class; /*!< Specifies the class of the card class */
|
||||||
|
|
||||||
|
uint32_t RelCardAdd; /*!< Specifies the Relative Card Address */
|
||||||
|
|
||||||
|
uint32_t BlockNbr; /*!< Specifies the Card Capacity in blocks */
|
||||||
|
|
||||||
|
uint32_t BlockSize; /*!< Specifies one block size in bytes */
|
||||||
|
|
||||||
|
uint32_t LogBlockNbr; /*!< Specifies the Card logical Capacity in blocks */
|
||||||
|
|
||||||
|
uint32_t LogBlockSize; /*!< Specifies logical block size in bytes */
|
||||||
|
|
||||||
|
}HAL_SD_CardInfoTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SD handle Structure definition
|
||||||
|
*/
|
||||||
|
typedef struct __SD_HandleTypeDef
|
||||||
|
{
|
||||||
|
SD_TypeDef *Instance; /*!< SD registers base address */
|
||||||
|
|
||||||
|
SD_InitTypeDef Init; /*!< SD required parameters */
|
||||||
|
|
||||||
|
HAL_LockTypeDef Lock; /*!< SD locking object */
|
||||||
|
|
||||||
|
uint32_t *pTxBuffPtr; /*!< Pointer to SD Tx transfer Buffer */
|
||||||
|
|
||||||
|
uint32_t TxXferSize; /*!< SD Tx Transfer size */
|
||||||
|
|
||||||
|
uint32_t *pRxBuffPtr; /*!< Pointer to SD Rx transfer Buffer */
|
||||||
|
|
||||||
|
uint32_t RxXferSize; /*!< SD Rx Transfer size */
|
||||||
|
|
||||||
|
__IO uint32_t Context; /*!< SD transfer context */
|
||||||
|
|
||||||
|
__IO HAL_SD_StateTypeDef State; /*!< SD card State */
|
||||||
|
|
||||||
|
__IO uint32_t ErrorCode; /*!< SD Card Error codes */
|
||||||
|
|
||||||
|
DMA_HandleTypeDef *hdmarx; /*!< SD Rx DMA handle parameters */
|
||||||
|
|
||||||
|
DMA_HandleTypeDef *hdmatx; /*!< SD Tx DMA handle parameters */
|
||||||
|
|
||||||
|
HAL_SD_CardInfoTypeDef SdCard; /*!< SD Card information */
|
||||||
|
|
||||||
|
uint32_t CSD[4]; /*!< SD card specific data table */
|
||||||
|
|
||||||
|
uint32_t CID[4]; /*!< SD card identification number table */
|
||||||
|
|
||||||
|
#if (USE_HAL_SD_REGISTER_CALLBACKS == 1)
|
||||||
|
void (* TxCpltCallback) (struct __SD_HandleTypeDef *hsd);
|
||||||
|
void (* RxCpltCallback) (struct __SD_HandleTypeDef *hsd);
|
||||||
|
void (* ErrorCallback) (struct __SD_HandleTypeDef *hsd);
|
||||||
|
void (* AbortCpltCallback) (struct __SD_HandleTypeDef *hsd);
|
||||||
|
|
||||||
|
void (* MspInitCallback) (struct __SD_HandleTypeDef *hsd);
|
||||||
|
void (* MspDeInitCallback) (struct __SD_HandleTypeDef *hsd);
|
||||||
|
#endif
|
||||||
|
}SD_HandleTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Types_Group4 Card Specific Data: CSD Register
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
__IO uint8_t CSDStruct; /*!< CSD structure */
|
||||||
|
__IO uint8_t SysSpecVersion; /*!< System specification version */
|
||||||
|
__IO uint8_t Reserved1; /*!< Reserved */
|
||||||
|
__IO uint8_t TAAC; /*!< Data read access time 1 */
|
||||||
|
__IO uint8_t NSAC; /*!< Data read access time 2 in CLK cycles */
|
||||||
|
__IO uint8_t MaxBusClkFrec; /*!< Max. bus clock frequency */
|
||||||
|
__IO uint16_t CardComdClasses; /*!< Card command classes */
|
||||||
|
__IO uint8_t RdBlockLen; /*!< Max. read data block length */
|
||||||
|
__IO uint8_t PartBlockRead; /*!< Partial blocks for read allowed */
|
||||||
|
__IO uint8_t WrBlockMisalign; /*!< Write block misalignment */
|
||||||
|
__IO uint8_t RdBlockMisalign; /*!< Read block misalignment */
|
||||||
|
__IO uint8_t DSRImpl; /*!< DSR implemented */
|
||||||
|
__IO uint8_t Reserved2; /*!< Reserved */
|
||||||
|
__IO uint32_t DeviceSize; /*!< Device Size */
|
||||||
|
__IO uint8_t MaxRdCurrentVDDMin; /*!< Max. read current @ VDD min */
|
||||||
|
__IO uint8_t MaxRdCurrentVDDMax; /*!< Max. read current @ VDD max */
|
||||||
|
__IO uint8_t MaxWrCurrentVDDMin; /*!< Max. write current @ VDD min */
|
||||||
|
__IO uint8_t MaxWrCurrentVDDMax; /*!< Max. write current @ VDD max */
|
||||||
|
__IO uint8_t DeviceSizeMul; /*!< Device size multiplier */
|
||||||
|
__IO uint8_t EraseGrSize; /*!< Erase group size */
|
||||||
|
__IO uint8_t EraseGrMul; /*!< Erase group size multiplier */
|
||||||
|
__IO uint8_t WrProtectGrSize; /*!< Write protect group size */
|
||||||
|
__IO uint8_t WrProtectGrEnable; /*!< Write protect group enable */
|
||||||
|
__IO uint8_t ManDeflECC; /*!< Manufacturer default ECC */
|
||||||
|
__IO uint8_t WrSpeedFact; /*!< Write speed factor */
|
||||||
|
__IO uint8_t MaxWrBlockLen; /*!< Max. write data block length */
|
||||||
|
__IO uint8_t WriteBlockPaPartial; /*!< Partial blocks for write allowed */
|
||||||
|
__IO uint8_t Reserved3; /*!< Reserved */
|
||||||
|
__IO uint8_t ContentProtectAppli; /*!< Content protection application */
|
||||||
|
__IO uint8_t FileFormatGrouop; /*!< File format group */
|
||||||
|
__IO uint8_t CopyFlag; /*!< Copy flag (OTP) */
|
||||||
|
__IO uint8_t PermWrProtect; /*!< Permanent write protection */
|
||||||
|
__IO uint8_t TempWrProtect; /*!< Temporary write protection */
|
||||||
|
__IO uint8_t FileFormat; /*!< File format */
|
||||||
|
__IO uint8_t ECC; /*!< ECC code */
|
||||||
|
__IO uint8_t CSD_CRC; /*!< CSD CRC */
|
||||||
|
__IO uint8_t Reserved4; /*!< Always 1 */
|
||||||
|
|
||||||
|
}HAL_SD_CardCSDTypeDef;
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Types_Group5 Card Identification Data: CID Register
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
__IO uint8_t ManufacturerID; /*!< Manufacturer ID */
|
||||||
|
__IO uint16_t OEM_AppliID; /*!< OEM/Application ID */
|
||||||
|
__IO uint32_t ProdName1; /*!< Product Name part1 */
|
||||||
|
__IO uint8_t ProdName2; /*!< Product Name part2 */
|
||||||
|
__IO uint8_t ProdRev; /*!< Product Revision */
|
||||||
|
__IO uint32_t ProdSN; /*!< Product Serial Number */
|
||||||
|
__IO uint8_t Reserved1; /*!< Reserved1 */
|
||||||
|
__IO uint16_t ManufactDate; /*!< Manufacturing Date */
|
||||||
|
__IO uint8_t CID_CRC; /*!< CID CRC */
|
||||||
|
__IO uint8_t Reserved2; /*!< Always 1 */
|
||||||
|
|
||||||
|
}HAL_SD_CardCIDTypeDef;
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Types_Group6 SD Card Status returned by ACMD13
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
__IO uint8_t DataBusWidth; /*!< Shows the currently defined data bus width */
|
||||||
|
__IO uint8_t SecuredMode; /*!< Card is in secured mode of operation */
|
||||||
|
__IO uint16_t CardType; /*!< Carries information about card type */
|
||||||
|
__IO uint32_t ProtectedAreaSize; /*!< Carries information about the capacity of protected area */
|
||||||
|
__IO uint8_t SpeedClass; /*!< Carries information about the speed class of the card */
|
||||||
|
__IO uint8_t PerformanceMove; /*!< Carries information about the card's performance move */
|
||||||
|
__IO uint8_t AllocationUnitSize; /*!< Carries information about the card's allocation unit size */
|
||||||
|
__IO uint16_t EraseSize; /*!< Determines the number of AUs to be erased in one operation */
|
||||||
|
__IO uint8_t EraseTimeout; /*!< Determines the timeout for any number of AU erase */
|
||||||
|
__IO uint8_t EraseOffset; /*!< Carries information about the erase offset */
|
||||||
|
|
||||||
|
}HAL_SD_CardStatusTypeDef;
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if (USE_HAL_SD_REGISTER_CALLBACKS == 1)
|
||||||
|
/** @defgroup SD_Exported_Types_Group7 SD Callback ID enumeration definition
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HAL_SD_TX_CPLT_CB_ID = 0x00U, /*!< SD Tx Complete Callback ID */
|
||||||
|
HAL_SD_RX_CPLT_CB_ID = 0x01U, /*!< SD Rx Complete Callback ID */
|
||||||
|
HAL_SD_ERROR_CB_ID = 0x02U, /*!< SD Error Callback ID */
|
||||||
|
HAL_SD_ABORT_CB_ID = 0x03U, /*!< SD Abort Callback ID */
|
||||||
|
|
||||||
|
HAL_SD_MSP_INIT_CB_ID = 0x10U, /*!< SD MspInit Callback ID */
|
||||||
|
HAL_SD_MSP_DEINIT_CB_ID = 0x11U /*!< SD MspDeInit Callback ID */
|
||||||
|
}HAL_SD_CallbackIDTypeDef;
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Types_Group8 SD Callback pointer definition
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
typedef void (*pSD_CallbackTypeDef) (SD_HandleTypeDef *hsd);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/** @defgroup SD_Exported_Constants Exported Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BLOCKSIZE 512U /*!< Block size is 512 bytes */
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Constansts_Group1 SD Error status enumeration Structure definition
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define HAL_SD_ERROR_NONE SDMMC_ERROR_NONE /*!< No error */
|
||||||
|
#define HAL_SD_ERROR_CMD_CRC_FAIL SDMMC_ERROR_CMD_CRC_FAIL /*!< Command response received (but CRC check failed) */
|
||||||
|
#define HAL_SD_ERROR_DATA_CRC_FAIL SDMMC_ERROR_DATA_CRC_FAIL /*!< Data block sent/received (CRC check failed) */
|
||||||
|
#define HAL_SD_ERROR_CMD_RSP_TIMEOUT SDMMC_ERROR_CMD_RSP_TIMEOUT /*!< Command response timeout */
|
||||||
|
#define HAL_SD_ERROR_DATA_TIMEOUT SDMMC_ERROR_DATA_TIMEOUT /*!< Data timeout */
|
||||||
|
#define HAL_SD_ERROR_TX_UNDERRUN SDMMC_ERROR_TX_UNDERRUN /*!< Transmit FIFO underrun */
|
||||||
|
#define HAL_SD_ERROR_RX_OVERRUN SDMMC_ERROR_RX_OVERRUN /*!< Receive FIFO overrun */
|
||||||
|
#define HAL_SD_ERROR_ADDR_MISALIGNED SDMMC_ERROR_ADDR_MISALIGNED /*!< Misaligned address */
|
||||||
|
#define HAL_SD_ERROR_BLOCK_LEN_ERR SDMMC_ERROR_BLOCK_LEN_ERR /*!< Transferred block length is not allowed for the card or the
|
||||||
|
number of transferred bytes does not match the block length */
|
||||||
|
#define HAL_SD_ERROR_ERASE_SEQ_ERR SDMMC_ERROR_ERASE_SEQ_ERR /*!< An error in the sequence of erase command occurs */
|
||||||
|
#define HAL_SD_ERROR_BAD_ERASE_PARAM SDMMC_ERROR_BAD_ERASE_PARAM /*!< An invalid selection for erase groups */
|
||||||
|
#define HAL_SD_ERROR_WRITE_PROT_VIOLATION SDMMC_ERROR_WRITE_PROT_VIOLATION /*!< Attempt to program a write protect block */
|
||||||
|
#define HAL_SD_ERROR_LOCK_UNLOCK_FAILED SDMMC_ERROR_LOCK_UNLOCK_FAILED /*!< Sequence or password error has been detected in unlock
|
||||||
|
command or if there was an attempt to access a locked card */
|
||||||
|
#define HAL_SD_ERROR_COM_CRC_FAILED SDMMC_ERROR_COM_CRC_FAILED /*!< CRC check of the previous command failed */
|
||||||
|
#define HAL_SD_ERROR_ILLEGAL_CMD SDMMC_ERROR_ILLEGAL_CMD /*!< Command is not legal for the card state */
|
||||||
|
#define HAL_SD_ERROR_CARD_ECC_FAILED SDMMC_ERROR_CARD_ECC_FAILED /*!< Card internal ECC was applied but failed to correct the data */
|
||||||
|
#define HAL_SD_ERROR_CC_ERR SDMMC_ERROR_CC_ERR /*!< Internal card controller error */
|
||||||
|
#define HAL_SD_ERROR_GENERAL_UNKNOWN_ERR SDMMC_ERROR_GENERAL_UNKNOWN_ERR /*!< General or unknown error */
|
||||||
|
#define HAL_SD_ERROR_STREAM_READ_UNDERRUN SDMMC_ERROR_STREAM_READ_UNDERRUN /*!< The card could not sustain data reading in stream rmode */
|
||||||
|
#define HAL_SD_ERROR_STREAM_WRITE_OVERRUN SDMMC_ERROR_STREAM_WRITE_OVERRUN /*!< The card could not sustain data programming in stream mode */
|
||||||
|
#define HAL_SD_ERROR_CID_CSD_OVERWRITE SDMMC_ERROR_CID_CSD_OVERWRITE /*!< CID/CSD overwrite error */
|
||||||
|
#define HAL_SD_ERROR_WP_ERASE_SKIP SDMMC_ERROR_WP_ERASE_SKIP /*!< Only partial address space was erased */
|
||||||
|
#define HAL_SD_ERROR_CARD_ECC_DISABLED SDMMC_ERROR_CARD_ECC_DISABLED /*!< Command has been executed without using internal ECC */
|
||||||
|
#define HAL_SD_ERROR_ERASE_RESET SDMMC_ERROR_ERASE_RESET /*!< Erase sequence was cleared before executing because an out
|
||||||
|
of erase sequence command was received */
|
||||||
|
#define HAL_SD_ERROR_AKE_SEQ_ERR SDMMC_ERROR_AKE_SEQ_ERR /*!< Error in sequence of authentication */
|
||||||
|
#define HAL_SD_ERROR_INVALID_VOLTRANGE SDMMC_ERROR_INVALID_VOLTRANGE /*!< Error in case of invalid voltage range */
|
||||||
|
#define HAL_SD_ERROR_ADDR_OUT_OF_RANGE SDMMC_ERROR_ADDR_OUT_OF_RANGE /*!< Error when addressed block is out of range */
|
||||||
|
#define HAL_SD_ERROR_REQUEST_NOT_APPLICABLE SDMMC_ERROR_REQUEST_NOT_APPLICABLE /*!< Error when command request is not applicable */
|
||||||
|
#define HAL_SD_ERROR_PARAM SDMMC_ERROR_INVALID_PARAMETER /*!< the used parameter is not valid */
|
||||||
|
#define HAL_SD_ERROR_UNSUPPORTED_FEATURE SDMMC_ERROR_UNSUPPORTED_FEATURE /*!< Error when feature is not insupported */
|
||||||
|
#define HAL_SD_ERROR_BUSY SDMMC_ERROR_BUSY /*!< Error when transfer process is busy */
|
||||||
|
#define HAL_SD_ERROR_DMA SDMMC_ERROR_DMA /*!< Error while DMA transfer */
|
||||||
|
#define HAL_SD_ERROR_TIMEOUT SDMMC_ERROR_TIMEOUT /*!< Timeout error */
|
||||||
|
|
||||||
|
#if (USE_HAL_SD_REGISTER_CALLBACKS == 1)
|
||||||
|
#define HAL_SD_ERROR_INVALID_CALLBACK SDMMC_ERROR_INVALID_PARAMETER /*!< Invalid callback error */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Constansts_Group2 SD context enumeration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define SD_CONTEXT_NONE 0x00000000U /*!< None */
|
||||||
|
#define SD_CONTEXT_READ_SINGLE_BLOCK 0x00000001U /*!< Read single block operation */
|
||||||
|
#define SD_CONTEXT_READ_MULTIPLE_BLOCK 0x00000002U /*!< Read multiple blocks operation */
|
||||||
|
#define SD_CONTEXT_WRITE_SINGLE_BLOCK 0x00000010U /*!< Write single block operation */
|
||||||
|
#define SD_CONTEXT_WRITE_MULTIPLE_BLOCK 0x00000020U /*!< Write multiple blocks operation */
|
||||||
|
#define SD_CONTEXT_IT 0x00000008U /*!< Process in Interrupt mode */
|
||||||
|
#define SD_CONTEXT_DMA 0x00000080U /*!< Process in DMA mode */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Constansts_Group3 SD Supported Memory Cards
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define CARD_SDSC 0x00000000U
|
||||||
|
#define CARD_SDHC_SDXC 0x00000001U
|
||||||
|
#define CARD_SECURED 0x00000003U
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Constansts_Group4 SD Supported Version
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define CARD_V1_X 0x00000000U
|
||||||
|
#define CARD_V2_X 0x00000001U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/** @defgroup SD_Exported_macros SD Exported Macros
|
||||||
|
* @brief macros to handle interrupts and specific clock configurations
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/** @brief Reset SD handle state.
|
||||||
|
* @param __HANDLE__ : SD handle.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#if (USE_HAL_SD_REGISTER_CALLBACKS == 1)
|
||||||
|
#define __HAL_SD_RESET_HANDLE_STATE(__HANDLE__) do { \
|
||||||
|
(__HANDLE__)->State = HAL_SD_STATE_RESET; \
|
||||||
|
(__HANDLE__)->MspInitCallback = NULL; \
|
||||||
|
(__HANDLE__)->MspDeInitCallback = NULL; \
|
||||||
|
} while(0)
|
||||||
|
#else
|
||||||
|
#define __HAL_SD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SD_STATE_RESET)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable the SD device.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_SD_ENABLE(__HANDLE__) __SDIO_ENABLE((__HANDLE__)->Instance)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable the SD device.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_SD_DISABLE(__HANDLE__) __SDIO_DISABLE((__HANDLE__)->Instance)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable the SDMMC DMA transfer.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_SD_DMA_ENABLE(__HANDLE__) __SDIO_DMA_ENABLE((__HANDLE__)->Instance)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable the SDMMC DMA transfer.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_SD_DMA_DISABLE(__HANDLE__) __SDIO_DMA_DISABLE((__HANDLE__)->Instance)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable the SD device interrupt.
|
||||||
|
* @param __HANDLE__ SD Handle
|
||||||
|
* @param __INTERRUPT__ specifies the SDMMC interrupt sources to be enabled.
|
||||||
|
* This parameter can be one or a combination of the following values:
|
||||||
|
* @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
|
||||||
|
* @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
|
||||||
|
* @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
|
||||||
|
* @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
|
||||||
|
* @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
|
||||||
|
* @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
|
||||||
|
* @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
|
||||||
|
* @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
|
||||||
|
* @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
|
||||||
|
* @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
|
||||||
|
* @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
|
||||||
|
* @arg SDIO_IT_TXACT: Data transmit in progress interrupt
|
||||||
|
* @arg SDIO_IT_RXACT: Data receive in progress interrupt
|
||||||
|
* @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
|
||||||
|
* @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
|
||||||
|
* @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
|
||||||
|
* @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
|
||||||
|
* @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
|
||||||
|
* @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
|
||||||
|
* @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
|
||||||
|
* @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
|
||||||
|
* @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_SD_ENABLE_IT(__HANDLE__, __INTERRUPT__) __SDIO_ENABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable the SD device interrupt.
|
||||||
|
* @param __HANDLE__ SD Handle
|
||||||
|
* @param __INTERRUPT__ specifies the SDMMC interrupt sources to be disabled.
|
||||||
|
* This parameter can be one or a combination of the following values:
|
||||||
|
* @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
|
||||||
|
* @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
|
||||||
|
* @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
|
||||||
|
* @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
|
||||||
|
* @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
|
||||||
|
* @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
|
||||||
|
* @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
|
||||||
|
* @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
|
||||||
|
* @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
|
||||||
|
* @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
|
||||||
|
* @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
|
||||||
|
* @arg SDIO_IT_TXACT: Data transmit in progress interrupt
|
||||||
|
* @arg SDIO_IT_RXACT: Data receive in progress interrupt
|
||||||
|
* @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
|
||||||
|
* @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
|
||||||
|
* @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
|
||||||
|
* @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
|
||||||
|
* @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
|
||||||
|
* @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
|
||||||
|
* @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
|
||||||
|
* @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
|
||||||
|
* @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_SD_DISABLE_IT(__HANDLE__, __INTERRUPT__) __SDIO_DISABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check whether the specified SD flag is set or not.
|
||||||
|
* @param __HANDLE__ SD Handle
|
||||||
|
* @param __FLAG__ specifies the flag to check.
|
||||||
|
* This parameter can be one of the following values:
|
||||||
|
* @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed)
|
||||||
|
* @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
|
||||||
|
* @arg SDIO_FLAG_CTIMEOUT: Command response timeout
|
||||||
|
* @arg SDIO_FLAG_DTIMEOUT: Data timeout
|
||||||
|
* @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error
|
||||||
|
* @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error
|
||||||
|
* @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed)
|
||||||
|
* @arg SDIO_FLAG_CMDSENT: Command sent (no response required)
|
||||||
|
* @arg SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero)
|
||||||
|
* @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed)
|
||||||
|
* @arg SDIO_FLAG_CMDACT: Command transfer in progress
|
||||||
|
* @arg SDIO_FLAG_TXACT: Data transmit in progress
|
||||||
|
* @arg SDIO_FLAG_RXACT: Data receive in progress
|
||||||
|
* @arg SDIO_FLAG_TXFIFOHE: Transmit FIFO Half Empty
|
||||||
|
* @arg SDIO_FLAG_RXFIFOHF: Receive FIFO Half Full
|
||||||
|
* @arg SDIO_FLAG_TXFIFOF: Transmit FIFO full
|
||||||
|
* @arg SDIO_FLAG_RXFIFOF: Receive FIFO full
|
||||||
|
* @arg SDIO_FLAG_TXFIFOE: Transmit FIFO empty
|
||||||
|
* @arg SDIO_FLAG_RXFIFOE: Receive FIFO empty
|
||||||
|
* @arg SDIO_FLAG_TXDAVL: Data available in transmit FIFO
|
||||||
|
* @arg SDIO_FLAG_RXDAVL: Data available in receive FIFO
|
||||||
|
* @arg SDIO_FLAG_SDIOIT: SD I/O interrupt received
|
||||||
|
* @retval The new state of SD FLAG (SET or RESET).
|
||||||
|
*/
|
||||||
|
#define __HAL_SD_GET_FLAG(__HANDLE__, __FLAG__) __SDIO_GET_FLAG((__HANDLE__)->Instance, (__FLAG__))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear the SD's pending flags.
|
||||||
|
* @param __HANDLE__ SD Handle
|
||||||
|
* @param __FLAG__ specifies the flag to clear.
|
||||||
|
* This parameter can be one or a combination of the following values:
|
||||||
|
* @arg SDIO_FLAG_CCRCFAIL: Command response received (CRC check failed)
|
||||||
|
* @arg SDIO_FLAG_DCRCFAIL: Data block sent/received (CRC check failed)
|
||||||
|
* @arg SDIO_FLAG_CTIMEOUT: Command response timeout
|
||||||
|
* @arg SDIO_FLAG_DTIMEOUT: Data timeout
|
||||||
|
* @arg SDIO_FLAG_TXUNDERR: Transmit FIFO underrun error
|
||||||
|
* @arg SDIO_FLAG_RXOVERR: Received FIFO overrun error
|
||||||
|
* @arg SDIO_FLAG_CMDREND: Command response received (CRC check passed)
|
||||||
|
* @arg SDIO_FLAG_CMDSENT: Command sent (no response required)
|
||||||
|
* @arg SDIO_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero)
|
||||||
|
* @arg SDIO_FLAG_DBCKEND: Data block sent/received (CRC check passed)
|
||||||
|
* @arg SDIO_FLAG_SDIOIT: SD I/O interrupt received
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_SD_CLEAR_FLAG(__HANDLE__, __FLAG__) __SDIO_CLEAR_FLAG((__HANDLE__)->Instance, (__FLAG__))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check whether the specified SD interrupt has occurred or not.
|
||||||
|
* @param __HANDLE__ SD Handle
|
||||||
|
* @param __INTERRUPT__ specifies the SDMMC interrupt source to check.
|
||||||
|
* This parameter can be one of the following values:
|
||||||
|
* @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
|
||||||
|
* @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
|
||||||
|
* @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
|
||||||
|
* @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
|
||||||
|
* @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
|
||||||
|
* @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
|
||||||
|
* @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
|
||||||
|
* @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
|
||||||
|
* @arg SDIO_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt
|
||||||
|
* @arg SDIO_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt
|
||||||
|
* @arg SDIO_IT_CMDACT: Command transfer in progress interrupt
|
||||||
|
* @arg SDIO_IT_TXACT: Data transmit in progress interrupt
|
||||||
|
* @arg SDIO_IT_RXACT: Data receive in progress interrupt
|
||||||
|
* @arg SDIO_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt
|
||||||
|
* @arg SDIO_IT_RXFIFOHF: Receive FIFO Half Full interrupt
|
||||||
|
* @arg SDIO_IT_TXFIFOF: Transmit FIFO full interrupt
|
||||||
|
* @arg SDIO_IT_RXFIFOF: Receive FIFO full interrupt
|
||||||
|
* @arg SDIO_IT_TXFIFOE: Transmit FIFO empty interrupt
|
||||||
|
* @arg SDIO_IT_RXFIFOE: Receive FIFO empty interrupt
|
||||||
|
* @arg SDIO_IT_TXDAVL: Data available in transmit FIFO interrupt
|
||||||
|
* @arg SDIO_IT_RXDAVL: Data available in receive FIFO interrupt
|
||||||
|
* @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
|
||||||
|
* @retval The new state of SD IT (SET or RESET).
|
||||||
|
*/
|
||||||
|
#define __HAL_SD_GET_IT(__HANDLE__, __INTERRUPT__) __SDIO_GET_IT((__HANDLE__)->Instance, (__INTERRUPT__))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clear the SD's interrupt pending bits.
|
||||||
|
* @param __HANDLE__ SD Handle
|
||||||
|
* @param __INTERRUPT__ specifies the interrupt pending bit to clear.
|
||||||
|
* This parameter can be one or a combination of the following values:
|
||||||
|
* @arg SDIO_IT_CCRCFAIL: Command response received (CRC check failed) interrupt
|
||||||
|
* @arg SDIO_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt
|
||||||
|
* @arg SDIO_IT_CTIMEOUT: Command response timeout interrupt
|
||||||
|
* @arg SDIO_IT_DTIMEOUT: Data timeout interrupt
|
||||||
|
* @arg SDIO_IT_TXUNDERR: Transmit FIFO underrun error interrupt
|
||||||
|
* @arg SDIO_IT_RXOVERR: Received FIFO overrun error interrupt
|
||||||
|
* @arg SDIO_IT_CMDREND: Command response received (CRC check passed) interrupt
|
||||||
|
* @arg SDIO_IT_CMDSENT: Command sent (no response required) interrupt
|
||||||
|
* @arg SDIO_IT_DATAEND: Data end (data counter, SDMMC_DCOUNT, is zero) interrupt
|
||||||
|
* @arg SDIO_IT_SDIOIT: SD I/O interrupt received interrupt
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define __HAL_SD_CLEAR_IT(__HANDLE__, __INTERRUPT__) __SDIO_CLEAR_IT((__HANDLE__)->Instance, (__INTERRUPT__))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @defgroup SD_Exported_Functions SD Exported Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Functions_Group1 Initialization and de-initialization functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SD_Init(SD_HandleTypeDef *hsd);
|
||||||
|
HAL_StatusTypeDef HAL_SD_InitCard(SD_HandleTypeDef *hsd);
|
||||||
|
HAL_StatusTypeDef HAL_SD_DeInit (SD_HandleTypeDef *hsd);
|
||||||
|
void HAL_SD_MspInit(SD_HandleTypeDef *hsd);
|
||||||
|
void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Functions_Group2 Input and Output operation functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* Blocking mode: Polling */
|
||||||
|
HAL_StatusTypeDef HAL_SD_ReadBlocks(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout);
|
||||||
|
HAL_StatusTypeDef HAL_SD_WriteBlocks(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks, uint32_t Timeout);
|
||||||
|
HAL_StatusTypeDef HAL_SD_Erase(SD_HandleTypeDef *hsd, uint32_t BlockStartAdd, uint32_t BlockEndAdd);
|
||||||
|
/* Non-Blocking mode: IT */
|
||||||
|
HAL_StatusTypeDef HAL_SD_ReadBlocks_IT(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
|
||||||
|
HAL_StatusTypeDef HAL_SD_WriteBlocks_IT(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
|
||||||
|
/* Non-Blocking mode: DMA */
|
||||||
|
HAL_StatusTypeDef HAL_SD_ReadBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
|
||||||
|
HAL_StatusTypeDef HAL_SD_WriteBlocks_DMA(SD_HandleTypeDef *hsd, uint8_t *pData, uint32_t BlockAdd, uint32_t NumberOfBlocks);
|
||||||
|
|
||||||
|
void HAL_SD_IRQHandler(SD_HandleTypeDef *hsd);
|
||||||
|
|
||||||
|
/* Callback in non blocking modes (DMA) */
|
||||||
|
void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd);
|
||||||
|
void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd);
|
||||||
|
void HAL_SD_ErrorCallback(SD_HandleTypeDef *hsd);
|
||||||
|
void HAL_SD_AbortCallback(SD_HandleTypeDef *hsd);
|
||||||
|
|
||||||
|
#if (USE_HAL_SD_REGISTER_CALLBACKS == 1)
|
||||||
|
/* SD callback registering/unregistering */
|
||||||
|
HAL_StatusTypeDef HAL_SD_RegisterCallback (SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackId, pSD_CallbackTypeDef pCallback);
|
||||||
|
HAL_StatusTypeDef HAL_SD_UnRegisterCallback(SD_HandleTypeDef *hsd, HAL_SD_CallbackIDTypeDef CallbackId);
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Functions_Group3 Peripheral Control functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SD_ConfigWideBusOperation(SD_HandleTypeDef *hsd, uint32_t WideMode);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Functions_Group4 SD card related functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SD_SendSDStatus(SD_HandleTypeDef *hsd, uint32_t *pSDstatus);
|
||||||
|
HAL_SD_CardStateTypeDef HAL_SD_GetCardState(SD_HandleTypeDef *hsd);
|
||||||
|
HAL_StatusTypeDef HAL_SD_GetCardCID(SD_HandleTypeDef *hsd, HAL_SD_CardCIDTypeDef *pCID);
|
||||||
|
HAL_StatusTypeDef HAL_SD_GetCardCSD(SD_HandleTypeDef *hsd, HAL_SD_CardCSDTypeDef *pCSD);
|
||||||
|
HAL_StatusTypeDef HAL_SD_GetCardStatus(SD_HandleTypeDef *hsd, HAL_SD_CardStatusTypeDef *pStatus);
|
||||||
|
HAL_StatusTypeDef HAL_SD_GetCardInfo(SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypeDef *pCardInfo);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Functions_Group5 Peripheral State and Errors functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_SD_StateTypeDef HAL_SD_GetState(SD_HandleTypeDef *hsd);
|
||||||
|
uint32_t HAL_SD_GetError(SD_HandleTypeDef *hsd);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SD_Exported_Functions_Group6 Perioheral Abort management
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SD_Abort(SD_HandleTypeDef *hsd);
|
||||||
|
HAL_StatusTypeDef HAL_SD_Abort_IT(SD_HandleTypeDef *hsd);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/** @defgroup SD_Private_Types SD Private Types
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private defines -----------------------------------------------------------*/
|
||||||
|
/** @defgroup SD_Private_Defines SD Private Defines
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/** @defgroup SD_Private_Variables SD Private Variables
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/** @defgroup SD_Private_Constants SD Private Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/** @defgroup SD_Private_Macros SD Private Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private functions prototypes ----------------------------------------------*/
|
||||||
|
/** @defgroup SD_Private_Functions_Prototypes SD Private Functions Prototypes
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
/** @defgroup SD_Private_Functions SD Private Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
|
||||||
|
STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx ||
|
||||||
|
STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __STM32F4xx_HAL_SD_H */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
232
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sram.h
Normal file
232
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sram.h
Normal file
|
@ -0,0 +1,232 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32f4xx_hal_sram.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file of SRAM HAL module.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at:
|
||||||
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __STM32F4xx_HAL_SRAM_H
|
||||||
|
#define __STM32F4xx_HAL_SRAM_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\
|
||||||
|
defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
|
||||||
|
#include "stm32f4xx_ll_fsmc.h"
|
||||||
|
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
|
||||||
|
|
||||||
|
#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
|
||||||
|
defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
|
||||||
|
#include "stm32f4xx_ll_fmc.h"
|
||||||
|
#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
|
||||||
|
|
||||||
|
|
||||||
|
/** @addtogroup STM32F4xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
|
||||||
|
defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
|
||||||
|
defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\
|
||||||
|
defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
|
||||||
|
|
||||||
|
/** @addtogroup SRAM
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported typedef ----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @defgroup SRAM_Exported_Types SRAM Exported Types
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief HAL SRAM State structures definition
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HAL_SRAM_STATE_RESET = 0x00U, /*!< SRAM not yet initialized or disabled */
|
||||||
|
HAL_SRAM_STATE_READY = 0x01U, /*!< SRAM initialized and ready for use */
|
||||||
|
HAL_SRAM_STATE_BUSY = 0x02U, /*!< SRAM internal process is ongoing */
|
||||||
|
HAL_SRAM_STATE_ERROR = 0x03U, /*!< SRAM error state */
|
||||||
|
HAL_SRAM_STATE_PROTECTED = 0x04U /*!< SRAM peripheral NORSRAM device write protected */
|
||||||
|
|
||||||
|
} HAL_SRAM_StateTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SRAM handle Structure definition
|
||||||
|
*/
|
||||||
|
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
|
||||||
|
typedef struct __SRAM_HandleTypeDef
|
||||||
|
#else
|
||||||
|
typedef struct
|
||||||
|
#endif /* USE_HAL_SRAM_REGISTER_CALLBACKS */
|
||||||
|
{
|
||||||
|
FMC_NORSRAM_TypeDef *Instance; /*!< Register base address */
|
||||||
|
|
||||||
|
FMC_NORSRAM_EXTENDED_TypeDef *Extended; /*!< Extended mode register base address */
|
||||||
|
|
||||||
|
FMC_NORSRAM_InitTypeDef Init; /*!< SRAM device control configuration parameters */
|
||||||
|
|
||||||
|
HAL_LockTypeDef Lock; /*!< SRAM locking object */
|
||||||
|
|
||||||
|
__IO HAL_SRAM_StateTypeDef State; /*!< SRAM device access state */
|
||||||
|
|
||||||
|
DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */
|
||||||
|
|
||||||
|
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
|
||||||
|
void (* MspInitCallback) ( struct __SRAM_HandleTypeDef * hsram); /*!< SRAM Msp Init callback */
|
||||||
|
void (* MspDeInitCallback) ( struct __SRAM_HandleTypeDef * hsram); /*!< SRAM Msp DeInit callback */
|
||||||
|
void (* DmaXferCpltCallback) ( DMA_HandleTypeDef * hdma); /*!< SRAM DMA Xfer Complete callback */
|
||||||
|
void (* DmaXferErrorCallback) ( DMA_HandleTypeDef * hdma); /*!< SRAM DMA Xfer Error callback */
|
||||||
|
#endif
|
||||||
|
} SRAM_HandleTypeDef;
|
||||||
|
|
||||||
|
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
|
||||||
|
/**
|
||||||
|
* @brief HAL SRAM Callback ID enumeration definition
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HAL_SRAM_MSP_INIT_CB_ID = 0x00U, /*!< SRAM MspInit Callback ID */
|
||||||
|
HAL_SRAM_MSP_DEINIT_CB_ID = 0x01U, /*!< SRAM MspDeInit Callback ID */
|
||||||
|
HAL_SRAM_DMA_XFER_CPLT_CB_ID = 0x02U, /*!< SRAM DMA Xfer Complete Callback ID */
|
||||||
|
HAL_SRAM_DMA_XFER_ERR_CB_ID = 0x03U /*!< SRAM DMA Xfer Complete Callback ID */
|
||||||
|
}HAL_SRAM_CallbackIDTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief HAL SRAM Callback pointer definition
|
||||||
|
*/
|
||||||
|
typedef void (*pSRAM_CallbackTypeDef)(SRAM_HandleTypeDef *hsram);
|
||||||
|
typedef void (*pSRAM_DmaCallbackTypeDef)(DMA_HandleTypeDef *hdma);
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @defgroup SRAM_Exported_Macros SRAM Exported Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/** @brief Reset SRAM handle state
|
||||||
|
* @param __HANDLE__ SRAM handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
|
||||||
|
#define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) do { \
|
||||||
|
(__HANDLE__)->State = HAL_SRAM_STATE_RESET; \
|
||||||
|
(__HANDLE__)->MspInitCallback = NULL; \
|
||||||
|
(__HANDLE__)->MspDeInitCallback = NULL; \
|
||||||
|
} while(0)
|
||||||
|
#else
|
||||||
|
#define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SRAM_STATE_RESET)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @addtogroup SRAM_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup SRAM_Exported_Functions_Group1
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* Initialization/de-initialization functions **********************************/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram);
|
||||||
|
void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram);
|
||||||
|
void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram);
|
||||||
|
|
||||||
|
void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma);
|
||||||
|
void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup SRAM_Exported_Functions_Group2
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* I/O operation functions *****************************************************/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize);
|
||||||
|
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
|
||||||
|
/* SRAM callback registering/unregistering */
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_RegisterCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, pSRAM_CallbackTypeDef pCallback);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_UnRegisterCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_RegisterDmaCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, pSRAM_DmaCallbackTypeDef pCallback);
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup SRAM_Exported_Functions_Group3
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* SRAM Control functions ******************************************************/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram);
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup SRAM_Exported_Functions_Group4
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* SRAM State functions *********************************************************/
|
||||||
|
HAL_SRAM_StateTypeDef HAL_SRAM_GetState(SRAM_HandleTypeDef *hsram);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\
|
||||||
|
STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\
|
||||||
|
STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __STM32F4xx_HAL_SRAM_H */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
1033
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_fsmc.h
Normal file
1033
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_fsmc.h
Normal file
File diff suppressed because it is too large
Load diff
1117
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_sdmmc.h
Normal file
1117
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_sdmmc.h
Normal file
File diff suppressed because it is too large
Load diff
511
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usb.h
Normal file
511
Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usb.h
Normal file
|
@ -0,0 +1,511 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32f4xx_ll_usb.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file of USB Low Layer HAL module.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at:
|
||||||
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef STM32F4xx_LL_USB_H
|
||||||
|
#define STM32F4xx_LL_USB_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32f4xx_hal_def.h"
|
||||||
|
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
/** @addtogroup STM32F4xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup USB_LL
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief USB Mode definition
|
||||||
|
*/
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
USB_DEVICE_MODE = 0,
|
||||||
|
USB_HOST_MODE = 1,
|
||||||
|
USB_DRD_MODE = 2
|
||||||
|
} USB_OTG_ModeTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief URB States definition
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
URB_IDLE = 0,
|
||||||
|
URB_DONE,
|
||||||
|
URB_NOTREADY,
|
||||||
|
URB_NYET,
|
||||||
|
URB_ERROR,
|
||||||
|
URB_STALL
|
||||||
|
} USB_OTG_URBStateTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Host channel States definition
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HC_IDLE = 0,
|
||||||
|
HC_XFRC,
|
||||||
|
HC_HALTED,
|
||||||
|
HC_NAK,
|
||||||
|
HC_NYET,
|
||||||
|
HC_STALL,
|
||||||
|
HC_XACTERR,
|
||||||
|
HC_BBLERR,
|
||||||
|
HC_DATATGLERR
|
||||||
|
} USB_OTG_HCStateTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief USB OTG Initialization Structure definition
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t dev_endpoints; /*!< Device Endpoints number.
|
||||||
|
This parameter depends on the used USB core.
|
||||||
|
This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
||||||
|
|
||||||
|
uint32_t Host_channels; /*!< Host Channels number.
|
||||||
|
This parameter Depends on the used USB core.
|
||||||
|
This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
||||||
|
|
||||||
|
uint32_t speed; /*!< USB Core speed.
|
||||||
|
This parameter can be any value of @ref USB_Core_Speed_ */
|
||||||
|
|
||||||
|
uint32_t dma_enable; /*!< Enable or disable of the USB embedded DMA used only for OTG HS. */
|
||||||
|
|
||||||
|
uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. */
|
||||||
|
|
||||||
|
uint32_t phy_itface; /*!< Select the used PHY interface.
|
||||||
|
This parameter can be any value of @ref USB_Core_PHY_ */
|
||||||
|
|
||||||
|
uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */
|
||||||
|
|
||||||
|
uint32_t low_power_enable; /*!< Enable or disable the low power mode. */
|
||||||
|
|
||||||
|
uint32_t lpm_enable; /*!< Enable or disable Link Power Management. */
|
||||||
|
|
||||||
|
uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */
|
||||||
|
|
||||||
|
uint32_t vbus_sensing_enable; /*!< Enable or disable the VBUS Sensing feature. */
|
||||||
|
|
||||||
|
uint32_t use_dedicated_ep1; /*!< Enable or disable the use of the dedicated EP1 interrupt. */
|
||||||
|
|
||||||
|
uint32_t use_external_vbus; /*!< Enable or disable the use of the external VBUS. */
|
||||||
|
} USB_OTG_CfgTypeDef;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t num; /*!< Endpoint number
|
||||||
|
This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
||||||
|
|
||||||
|
uint8_t is_in; /*!< Endpoint direction
|
||||||
|
This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
||||||
|
|
||||||
|
uint8_t is_stall; /*!< Endpoint stall condition
|
||||||
|
This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
||||||
|
|
||||||
|
uint8_t type; /*!< Endpoint type
|
||||||
|
This parameter can be any value of @ref USB_EP_Type_ */
|
||||||
|
|
||||||
|
uint8_t data_pid_start; /*!< Initial data PID
|
||||||
|
This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
||||||
|
|
||||||
|
uint8_t even_odd_frame; /*!< IFrame parity
|
||||||
|
This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
||||||
|
|
||||||
|
uint16_t tx_fifo_num; /*!< Transmission FIFO number
|
||||||
|
This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
||||||
|
|
||||||
|
uint32_t maxpacket; /*!< Endpoint Max packet size
|
||||||
|
This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
|
||||||
|
|
||||||
|
uint8_t *xfer_buff; /*!< Pointer to transfer buffer */
|
||||||
|
|
||||||
|
uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address */
|
||||||
|
|
||||||
|
uint32_t xfer_len; /*!< Current transfer length */
|
||||||
|
|
||||||
|
uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */
|
||||||
|
} USB_OTG_EPTypeDef;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t dev_addr ; /*!< USB device address.
|
||||||
|
This parameter must be a number between Min_Data = 1 and Max_Data = 255 */
|
||||||
|
|
||||||
|
uint8_t ch_num; /*!< Host channel number.
|
||||||
|
This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
||||||
|
|
||||||
|
uint8_t ep_num; /*!< Endpoint number.
|
||||||
|
This parameter must be a number between Min_Data = 1 and Max_Data = 15 */
|
||||||
|
|
||||||
|
uint8_t ep_is_in; /*!< Endpoint direction
|
||||||
|
This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
||||||
|
|
||||||
|
uint8_t speed; /*!< USB Host speed.
|
||||||
|
This parameter can be any value of @ref USB_Core_Speed_ */
|
||||||
|
|
||||||
|
uint8_t do_ping; /*!< Enable or disable the use of the PING protocol for HS mode. */
|
||||||
|
|
||||||
|
uint8_t process_ping; /*!< Execute the PING protocol for HS mode. */
|
||||||
|
|
||||||
|
uint8_t ep_type; /*!< Endpoint Type.
|
||||||
|
This parameter can be any value of @ref USB_EP_Type_ */
|
||||||
|
|
||||||
|
uint16_t max_packet; /*!< Endpoint Max packet size.
|
||||||
|
This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */
|
||||||
|
|
||||||
|
uint8_t data_pid; /*!< Initial data PID.
|
||||||
|
This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
||||||
|
|
||||||
|
uint8_t *xfer_buff; /*!< Pointer to transfer buffer. */
|
||||||
|
|
||||||
|
uint32_t xfer_len; /*!< Current transfer length. */
|
||||||
|
|
||||||
|
uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer. */
|
||||||
|
|
||||||
|
uint8_t toggle_in; /*!< IN transfer current toggle flag.
|
||||||
|
This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
||||||
|
|
||||||
|
uint8_t toggle_out; /*!< OUT transfer current toggle flag
|
||||||
|
This parameter must be a number between Min_Data = 0 and Max_Data = 1 */
|
||||||
|
|
||||||
|
uint32_t dma_addr; /*!< 32 bits aligned transfer buffer address. */
|
||||||
|
|
||||||
|
uint32_t ErrCnt; /*!< Host channel error count.*/
|
||||||
|
|
||||||
|
USB_OTG_URBStateTypeDef urb_state; /*!< URB state.
|
||||||
|
This parameter can be any value of @ref USB_OTG_URBStateTypeDef */
|
||||||
|
|
||||||
|
USB_OTG_HCStateTypeDef state; /*!< Host Channel state.
|
||||||
|
This parameter can be any value of @ref USB_OTG_HCStateTypeDef */
|
||||||
|
} USB_OTG_HCTypeDef;
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @defgroup PCD_Exported_Constants PCD Exported Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
/** @defgroup USB_OTG_CORE VERSION ID
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define USB_OTG_CORE_ID_300A 0x4F54300AU
|
||||||
|
#define USB_OTG_CORE_ID_310A 0x4F54310AU
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_Core_Mode_ USB Core Mode
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define USB_OTG_MODE_DEVICE 0U
|
||||||
|
#define USB_OTG_MODE_HOST 1U
|
||||||
|
#define USB_OTG_MODE_DRD 2U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL Device Speed
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define USBD_HS_SPEED 0U
|
||||||
|
#define USBD_HSINFS_SPEED 1U
|
||||||
|
#define USBH_HS_SPEED 0U
|
||||||
|
#define USBD_FS_SPEED 2U
|
||||||
|
#define USBH_FS_SPEED 1U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_Core_Speed USB Low Layer Core Speed
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define USB_OTG_SPEED_HIGH 0U
|
||||||
|
#define USB_OTG_SPEED_HIGH_IN_FULL 1U
|
||||||
|
#define USB_OTG_SPEED_FULL 3U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_Core_PHY USB Low Layer Core PHY
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define USB_OTG_ULPI_PHY 1U
|
||||||
|
#define USB_OTG_EMBEDDED_PHY 2U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_Turnaround_Timeout Turnaround Timeout Value
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#ifndef USBD_HS_TRDT_VALUE
|
||||||
|
#define USBD_HS_TRDT_VALUE 9U
|
||||||
|
#endif /* USBD_HS_TRDT_VALUE */
|
||||||
|
#ifndef USBD_FS_TRDT_VALUE
|
||||||
|
#define USBD_FS_TRDT_VALUE 5U
|
||||||
|
#define USBD_DEFAULT_TRDT_VALUE 9U
|
||||||
|
#endif /* USBD_HS_TRDT_VALUE */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_Core_MPS USB Low Layer Core MPS
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define USB_OTG_HS_MAX_PACKET_SIZE 512U
|
||||||
|
#define USB_OTG_FS_MAX_PACKET_SIZE 64U
|
||||||
|
#define USB_OTG_MAX_EP0_SIZE 64U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_Core_PHY_Frequency USB Low Layer Core PHY Frequency
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ (0U << 1)
|
||||||
|
#define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ (1U << 1)
|
||||||
|
#define DSTS_ENUMSPD_LS_PHY_6MHZ (2U << 1)
|
||||||
|
#define DSTS_ENUMSPD_FS_PHY_48MHZ (3U << 1)
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_CORE_Frame_Interval USB Low Layer Core Frame Interval
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define DCFG_FRAME_INTERVAL_80 0U
|
||||||
|
#define DCFG_FRAME_INTERVAL_85 1U
|
||||||
|
#define DCFG_FRAME_INTERVAL_90 2U
|
||||||
|
#define DCFG_FRAME_INTERVAL_95 3U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define DEP0CTL_MPS_64 0U
|
||||||
|
#define DEP0CTL_MPS_32 1U
|
||||||
|
#define DEP0CTL_MPS_16 2U
|
||||||
|
#define DEP0CTL_MPS_8 3U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_EP_Speed USB Low Layer EP Speed
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define EP_SPEED_LOW 0U
|
||||||
|
#define EP_SPEED_FULL 1U
|
||||||
|
#define EP_SPEED_HIGH 2U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_EP_Type USB Low Layer EP Type
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define EP_TYPE_CTRL 0U
|
||||||
|
#define EP_TYPE_ISOC 1U
|
||||||
|
#define EP_TYPE_BULK 2U
|
||||||
|
#define EP_TYPE_INTR 3U
|
||||||
|
#define EP_TYPE_MSK 3U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_STS_Defines USB Low Layer STS Defines
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define STS_GOUT_NAK 1U
|
||||||
|
#define STS_DATA_UPDT 2U
|
||||||
|
#define STS_XFER_COMP 3U
|
||||||
|
#define STS_SETUP_COMP 4U
|
||||||
|
#define STS_SETUP_UPDT 6U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_HCFG_SPEED_Defines USB Low Layer HCFG Speed Defines
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define HCFG_30_60_MHZ 0U
|
||||||
|
#define HCFG_48_MHZ 1U
|
||||||
|
#define HCFG_6_MHZ 2U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup USB_LL_HPRT0_PRTSPD_SPEED_Defines USB Low Layer HPRT0 PRTSPD Speed Defines
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define HPRT0_PRTSPD_HIGH_SPEED 0U
|
||||||
|
#define HPRT0_PRTSPD_FULL_SPEED 1U
|
||||||
|
#define HPRT0_PRTSPD_LOW_SPEED 2U
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define HCCHAR_CTRL 0U
|
||||||
|
#define HCCHAR_ISOC 1U
|
||||||
|
#define HCCHAR_BULK 2U
|
||||||
|
#define HCCHAR_INTR 3U
|
||||||
|
|
||||||
|
#define HC_PID_DATA0 0U
|
||||||
|
#define HC_PID_DATA2 1U
|
||||||
|
#define HC_PID_DATA1 2U
|
||||||
|
#define HC_PID_SETUP 3U
|
||||||
|
|
||||||
|
#define GRXSTS_PKTSTS_IN 2U
|
||||||
|
#define GRXSTS_PKTSTS_IN_XFER_COMP 3U
|
||||||
|
#define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5U
|
||||||
|
#define GRXSTS_PKTSTS_CH_HALTED 7U
|
||||||
|
|
||||||
|
#define USBx_PCGCCTL *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_PCGCCTL_BASE)
|
||||||
|
#define USBx_HPRT0 *(__IO uint32_t *)((uint32_t)USBx_BASE + USB_OTG_HOST_PORT_BASE)
|
||||||
|
|
||||||
|
#define USBx_DEVICE ((USB_OTG_DeviceTypeDef *)(USBx_BASE + USB_OTG_DEVICE_BASE))
|
||||||
|
#define USBx_INEP(i) ((USB_OTG_INEndpointTypeDef *)(USBx_BASE + USB_OTG_IN_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
|
||||||
|
#define USBx_OUTEP(i) ((USB_OTG_OUTEndpointTypeDef *)(USBx_BASE + USB_OTG_OUT_ENDPOINT_BASE + ((i) * USB_OTG_EP_REG_SIZE)))
|
||||||
|
#define USBx_DFIFO(i) *(__IO uint32_t *)(USBx_BASE + USB_OTG_FIFO_BASE + ((i) * USB_OTG_FIFO_SIZE))
|
||||||
|
|
||||||
|
#define USBx_HOST ((USB_OTG_HostTypeDef *)(USBx_BASE + USB_OTG_HOST_BASE))
|
||||||
|
#define USBx_HC(i) ((USB_OTG_HostChannelTypeDef *)(USBx_BASE + USB_OTG_HOST_CHANNEL_BASE + ((i) * USB_OTG_HOST_CHANNEL_SIZE)))
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
#define EP_ADDR_MSK 0xFU
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/** @defgroup USB_LL_Exported_Macros USB Low Layer Exported Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
#define USB_MASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK &= ~(__INTERRUPT__))
|
||||||
|
#define USB_UNMASK_INTERRUPT(__INSTANCE__, __INTERRUPT__) ((__INSTANCE__)->GINTMSK |= (__INTERRUPT__))
|
||||||
|
|
||||||
|
#define CLEAR_IN_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_INEP(__EPNUM__)->DIEPINT = (__INTERRUPT__))
|
||||||
|
#define CLEAR_OUT_EP_INTR(__EPNUM__, __INTERRUPT__) (USBx_OUTEP(__EPNUM__)->DOEPINT = (__INTERRUPT__))
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
HAL_StatusTypeDef USB_CoreInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
|
||||||
|
HAL_StatusTypeDef USB_DevInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
|
||||||
|
HAL_StatusTypeDef USB_EnableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_DisableGlobalInt(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_SetTurnaroundTime(USB_OTG_GlobalTypeDef *USBx, uint32_t hclk, uint8_t speed);
|
||||||
|
HAL_StatusTypeDef USB_SetCurrentMode(USB_OTG_GlobalTypeDef *USBx, USB_OTG_ModeTypeDef mode);
|
||||||
|
HAL_StatusTypeDef USB_SetDevSpeed(USB_OTG_GlobalTypeDef *USBx, uint8_t speed);
|
||||||
|
HAL_StatusTypeDef USB_FlushRxFifo(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_FlushTxFifo(USB_OTG_GlobalTypeDef *USBx, uint32_t num);
|
||||||
|
HAL_StatusTypeDef USB_ActivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
||||||
|
HAL_StatusTypeDef USB_DeactivateEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
||||||
|
HAL_StatusTypeDef USB_ActivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
||||||
|
HAL_StatusTypeDef USB_DeactivateDedicatedEndpoint(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
||||||
|
HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep, uint8_t dma);
|
||||||
|
HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep, uint8_t dma);
|
||||||
|
HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len, uint8_t dma);
|
||||||
|
void *USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len);
|
||||||
|
HAL_StatusTypeDef USB_EPSetStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
||||||
|
HAL_StatusTypeDef USB_EPClearStall(USB_OTG_GlobalTypeDef *USBx, USB_OTG_EPTypeDef *ep);
|
||||||
|
HAL_StatusTypeDef USB_SetDevAddress(USB_OTG_GlobalTypeDef *USBx, uint8_t address);
|
||||||
|
HAL_StatusTypeDef USB_DevConnect(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_DevDisconnect(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_StopDevice(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_ActivateSetup(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_EP0_OutStart(USB_OTG_GlobalTypeDef *USBx, uint8_t dma, uint8_t *psetup);
|
||||||
|
uint8_t USB_GetDevSpeed(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
uint32_t USB_GetMode(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
uint32_t USB_ReadInterrupts(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
uint32_t USB_ReadDevAllOutEpInterrupt(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
uint32_t USB_ReadDevOutEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
|
||||||
|
uint32_t USB_ReadDevAllInEpInterrupt(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
uint32_t USB_ReadDevInEPInterrupt(USB_OTG_GlobalTypeDef *USBx, uint8_t epnum);
|
||||||
|
void USB_ClearInterrupts(USB_OTG_GlobalTypeDef *USBx, uint32_t interrupt);
|
||||||
|
|
||||||
|
HAL_StatusTypeDef USB_HostInit(USB_OTG_GlobalTypeDef *USBx, USB_OTG_CfgTypeDef cfg);
|
||||||
|
HAL_StatusTypeDef USB_InitFSLSPClkSel(USB_OTG_GlobalTypeDef *USBx, uint8_t freq);
|
||||||
|
HAL_StatusTypeDef USB_ResetPort(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_DriveVbus(USB_OTG_GlobalTypeDef *USBx, uint8_t state);
|
||||||
|
uint32_t USB_GetHostSpeed(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
uint32_t USB_GetCurrentFrame(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_HC_Init(USB_OTG_GlobalTypeDef *USBx,
|
||||||
|
uint8_t ch_num,
|
||||||
|
uint8_t epnum,
|
||||||
|
uint8_t dev_address,
|
||||||
|
uint8_t speed,
|
||||||
|
uint8_t ep_type,
|
||||||
|
uint16_t mps);
|
||||||
|
HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDef *hc, uint8_t dma);
|
||||||
|
uint32_t USB_HC_ReadInterrupt(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_HC_Halt(USB_OTG_GlobalTypeDef *USBx, uint8_t hc_num);
|
||||||
|
HAL_StatusTypeDef USB_DoPing(USB_OTG_GlobalTypeDef *USBx, uint8_t ch_num);
|
||||||
|
HAL_StatusTypeDef USB_StopHost(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_OTG_GlobalTypeDef *USBx);
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* STM32F4xx_LL_USB_H */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
2223
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c
Normal file
2223
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd.c
Normal file
File diff suppressed because it is too large
Load diff
348
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c
Normal file
348
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pcd_ex.c
Normal file
|
@ -0,0 +1,348 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32f4xx_hal_pcd_ex.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief PCD Extended HAL module driver.
|
||||||
|
* This file provides firmware functions to manage the following
|
||||||
|
* functionalities of the USB Peripheral Controller:
|
||||||
|
* + Extended features functions
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at:
|
||||||
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32f4xx_hal.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32F4xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup PCDEx PCDEx
|
||||||
|
* @brief PCD Extended HAL module driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAL_PCD_MODULE_ENABLED
|
||||||
|
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @defgroup PCDEx_Exported_Functions PCDEx Exported Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
|
||||||
|
* @brief PCDEx control functions
|
||||||
|
*
|
||||||
|
@verbatim
|
||||||
|
===============================================================================
|
||||||
|
##### Extended features functions #####
|
||||||
|
===============================================================================
|
||||||
|
[..] This section provides functions allowing to:
|
||||||
|
(+) Update FIFO configuration
|
||||||
|
|
||||||
|
@endverbatim
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
|
||||||
|
/**
|
||||||
|
* @brief Set Tx FIFO
|
||||||
|
* @param hpcd PCD handle
|
||||||
|
* @param fifo The number of Tx fifo
|
||||||
|
* @param size Fifo size
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size)
|
||||||
|
{
|
||||||
|
uint8_t i;
|
||||||
|
uint32_t Tx_Offset;
|
||||||
|
|
||||||
|
/* TXn min size = 16 words. (n : Transmit FIFO index)
|
||||||
|
When a TxFIFO is not used, the Configuration should be as follows:
|
||||||
|
case 1 : n > m and Txn is not used (n,m : Transmit FIFO indexes)
|
||||||
|
--> Txm can use the space allocated for Txn.
|
||||||
|
case2 : n < m and Txn is not used (n,m : Transmit FIFO indexes)
|
||||||
|
--> Txn should be configured with the minimum space of 16 words
|
||||||
|
The FIFO is used optimally when used TxFIFOs are allocated in the top
|
||||||
|
of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones.
|
||||||
|
When DMA is used 3n * FIFO locations should be reserved for internal DMA registers */
|
||||||
|
|
||||||
|
Tx_Offset = hpcd->Instance->GRXFSIZ;
|
||||||
|
|
||||||
|
if (fifo == 0U)
|
||||||
|
{
|
||||||
|
hpcd->Instance->DIEPTXF0_HNPTXFSIZ = ((uint32_t)size << 16) | Tx_Offset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Tx_Offset += (hpcd->Instance->DIEPTXF0_HNPTXFSIZ) >> 16;
|
||||||
|
for (i = 0U; i < (fifo - 1U); i++)
|
||||||
|
{
|
||||||
|
Tx_Offset += (hpcd->Instance->DIEPTXF[i] >> 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Multiply Tx_Size by 2 to get higher performance */
|
||||||
|
hpcd->Instance->DIEPTXF[fifo - 1U] = ((uint32_t)size << 16) | Tx_Offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set Rx FIFO
|
||||||
|
* @param hpcd PCD handle
|
||||||
|
* @param size Size of Rx fifo
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size)
|
||||||
|
{
|
||||||
|
hpcd->Instance->GRXFSIZ = size;
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
#if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
|
||||||
|
/**
|
||||||
|
* @brief Activate LPM feature.
|
||||||
|
* @param hpcd PCD handle
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd)
|
||||||
|
{
|
||||||
|
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
|
||||||
|
|
||||||
|
hpcd->lpm_active = 1U;
|
||||||
|
hpcd->LPM_State = LPM_L0;
|
||||||
|
USBx->GINTMSK |= USB_OTG_GINTMSK_LPMINTM;
|
||||||
|
USBx->GLPMCFG |= (USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Deactivate LPM feature.
|
||||||
|
* @param hpcd PCD handle
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd)
|
||||||
|
{
|
||||||
|
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
|
||||||
|
|
||||||
|
hpcd->lpm_active = 0U;
|
||||||
|
USBx->GINTMSK &= ~USB_OTG_GINTMSK_LPMINTM;
|
||||||
|
USBx->GLPMCFG &= ~(USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
#endif /* defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) */
|
||||||
|
#if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
|
||||||
|
/**
|
||||||
|
* @brief Handle BatteryCharging Process.
|
||||||
|
* @param hpcd PCD handle
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd)
|
||||||
|
{
|
||||||
|
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
|
||||||
|
uint32_t tickstart = HAL_GetTick();
|
||||||
|
|
||||||
|
/* Enable DCD : Data Contact Detect */
|
||||||
|
USBx->GCCFG |= USB_OTG_GCCFG_DCDEN;
|
||||||
|
|
||||||
|
/* Wait Detect flag or a timeout is happen*/
|
||||||
|
while ((USBx->GCCFG & USB_OTG_GCCFG_DCDET) == 0U)
|
||||||
|
{
|
||||||
|
/* Check for the Timeout */
|
||||||
|
if ((HAL_GetTick() - tickstart) > 1000U)
|
||||||
|
{
|
||||||
|
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||||
|
hpcd->BCDCallback(hpcd, PCD_BCD_ERROR);
|
||||||
|
#else
|
||||||
|
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_ERROR);
|
||||||
|
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Right response got */
|
||||||
|
HAL_Delay(200U);
|
||||||
|
|
||||||
|
/* Check Detect flag*/
|
||||||
|
if ((USBx->GCCFG & USB_OTG_GCCFG_DCDET) == USB_OTG_GCCFG_DCDET)
|
||||||
|
{
|
||||||
|
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||||
|
hpcd->BCDCallback(hpcd, PCD_BCD_CONTACT_DETECTION);
|
||||||
|
#else
|
||||||
|
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CONTACT_DETECTION);
|
||||||
|
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Primary detection: checks if connected to Standard Downstream Port
|
||||||
|
(without charging capability) */
|
||||||
|
USBx->GCCFG &= ~ USB_OTG_GCCFG_DCDEN;
|
||||||
|
HAL_Delay(50U);
|
||||||
|
USBx->GCCFG |= USB_OTG_GCCFG_PDEN;
|
||||||
|
HAL_Delay(50U);
|
||||||
|
|
||||||
|
if ((USBx->GCCFG & USB_OTG_GCCFG_PDET) == 0U)
|
||||||
|
{
|
||||||
|
/* Case of Standard Downstream Port */
|
||||||
|
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||||
|
hpcd->BCDCallback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);
|
||||||
|
#else
|
||||||
|
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);
|
||||||
|
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* start secondary detection to check connection to Charging Downstream
|
||||||
|
Port or Dedicated Charging Port */
|
||||||
|
USBx->GCCFG &= ~ USB_OTG_GCCFG_PDEN;
|
||||||
|
HAL_Delay(50U);
|
||||||
|
USBx->GCCFG |= USB_OTG_GCCFG_SDEN;
|
||||||
|
HAL_Delay(50U);
|
||||||
|
|
||||||
|
if ((USBx->GCCFG & USB_OTG_GCCFG_SDET) == USB_OTG_GCCFG_SDET)
|
||||||
|
{
|
||||||
|
/* case Dedicated Charging Port */
|
||||||
|
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||||
|
hpcd->BCDCallback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);
|
||||||
|
#else
|
||||||
|
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);
|
||||||
|
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* case Charging Downstream Port */
|
||||||
|
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||||
|
hpcd->BCDCallback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);
|
||||||
|
#else
|
||||||
|
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);
|
||||||
|
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Battery Charging capability discovery finished */
|
||||||
|
(void)HAL_PCDEx_DeActivateBCD(hpcd);
|
||||||
|
|
||||||
|
#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
|
||||||
|
hpcd->BCDCallback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);
|
||||||
|
#else
|
||||||
|
HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);
|
||||||
|
#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Activate BatteryCharging feature.
|
||||||
|
* @param hpcd PCD handle
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd)
|
||||||
|
{
|
||||||
|
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
|
||||||
|
|
||||||
|
USBx->GCCFG &= ~(USB_OTG_GCCFG_PDEN);
|
||||||
|
USBx->GCCFG &= ~(USB_OTG_GCCFG_SDEN);
|
||||||
|
|
||||||
|
/* Power Down USB tranceiver */
|
||||||
|
USBx->GCCFG &= ~(USB_OTG_GCCFG_PWRDWN);
|
||||||
|
|
||||||
|
/* Enable Battery charging */
|
||||||
|
USBx->GCCFG |= USB_OTG_GCCFG_BCDEN;
|
||||||
|
|
||||||
|
hpcd->battery_charging_active = 1U;
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Deactivate BatteryCharging feature.
|
||||||
|
* @param hpcd PCD handle
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd)
|
||||||
|
{
|
||||||
|
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
|
||||||
|
|
||||||
|
USBx->GCCFG &= ~(USB_OTG_GCCFG_SDEN);
|
||||||
|
USBx->GCCFG &= ~(USB_OTG_GCCFG_PDEN);
|
||||||
|
|
||||||
|
/* Disable Battery charging */
|
||||||
|
USBx->GCCFG &= ~(USB_OTG_GCCFG_BCDEN);
|
||||||
|
|
||||||
|
hpcd->battery_charging_active = 0U;
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
#endif /* defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) */
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Send LPM message to user layer callback.
|
||||||
|
* @param hpcd PCD handle
|
||||||
|
* @param msg LPM message
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
__weak void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg)
|
||||||
|
{
|
||||||
|
/* Prevent unused argument(s) compilation warning */
|
||||||
|
UNUSED(hpcd);
|
||||||
|
UNUSED(msg);
|
||||||
|
|
||||||
|
/* NOTE : This function should not be modified, when the callback is needed,
|
||||||
|
the HAL_PCDEx_LPM_Callback could be implemented in the user file
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Send BatteryCharging message to user layer callback.
|
||||||
|
* @param hpcd PCD handle
|
||||||
|
* @param msg LPM message
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
__weak void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg)
|
||||||
|
{
|
||||||
|
/* Prevent unused argument(s) compilation warning */
|
||||||
|
UNUSED(hpcd);
|
||||||
|
UNUSED(msg);
|
||||||
|
|
||||||
|
/* NOTE : This function should not be modified, when the callback is needed,
|
||||||
|
the HAL_PCDEx_BCD_Callback could be implemented in the user file
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
|
||||||
|
#endif /* HAL_PCD_MODULE_ENABLED */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
3315
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c
Normal file
3315
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c
Normal file
File diff suppressed because it is too large
Load diff
912
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c
Normal file
912
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c
Normal file
|
@ -0,0 +1,912 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32f4xx_hal_sram.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief SRAM HAL module driver.
|
||||||
|
* This file provides a generic firmware to drive SRAM memories
|
||||||
|
* mounted as external device.
|
||||||
|
*
|
||||||
|
@verbatim
|
||||||
|
==============================================================================
|
||||||
|
##### How to use this driver #####
|
||||||
|
==============================================================================
|
||||||
|
[..]
|
||||||
|
This driver is a generic layered driver which contains a set of APIs used to
|
||||||
|
control SRAM memories. It uses the FMC layer functions to interface
|
||||||
|
with SRAM devices.
|
||||||
|
The following sequence should be followed to configure the FMC/FSMC to interface
|
||||||
|
with SRAM/PSRAM memories:
|
||||||
|
|
||||||
|
(#) Declare a SRAM_HandleTypeDef handle structure, for example:
|
||||||
|
SRAM_HandleTypeDef hsram; and:
|
||||||
|
|
||||||
|
(++) Fill the SRAM_HandleTypeDef handle "Init" field with the allowed
|
||||||
|
values of the structure member.
|
||||||
|
|
||||||
|
(++) Fill the SRAM_HandleTypeDef handle "Instance" field with a predefined
|
||||||
|
base register instance for NOR or SRAM device
|
||||||
|
|
||||||
|
(++) Fill the SRAM_HandleTypeDef handle "Extended" field with a predefined
|
||||||
|
base register instance for NOR or SRAM extended mode
|
||||||
|
|
||||||
|
(#) Declare two FMC_NORSRAM_TimingTypeDef structures, for both normal and extended
|
||||||
|
mode timings; for example:
|
||||||
|
FMC_NORSRAM_TimingTypeDef Timing and FMC_NORSRAM_TimingTypeDef ExTiming;
|
||||||
|
and fill its fields with the allowed values of the structure member.
|
||||||
|
|
||||||
|
(#) Initialize the SRAM Controller by calling the function HAL_SRAM_Init(). This function
|
||||||
|
performs the following sequence:
|
||||||
|
|
||||||
|
(##) MSP hardware layer configuration using the function HAL_SRAM_MspInit()
|
||||||
|
(##) Control register configuration using the FMC NORSRAM interface function
|
||||||
|
FMC_NORSRAM_Init()
|
||||||
|
(##) Timing register configuration using the FMC NORSRAM interface function
|
||||||
|
FMC_NORSRAM_Timing_Init()
|
||||||
|
(##) Extended mode Timing register configuration using the FMC NORSRAM interface function
|
||||||
|
FMC_NORSRAM_Extended_Timing_Init()
|
||||||
|
(##) Enable the SRAM device using the macro __FMC_NORSRAM_ENABLE()
|
||||||
|
|
||||||
|
(#) At this stage you can perform read/write accesses from/to the memory connected
|
||||||
|
to the NOR/SRAM Bank. You can perform either polling or DMA transfer using the
|
||||||
|
following APIs:
|
||||||
|
(++) HAL_SRAM_Read()/HAL_SRAM_Write() for polling read/write access
|
||||||
|
(++) HAL_SRAM_Read_DMA()/HAL_SRAM_Write_DMA() for DMA read/write transfer
|
||||||
|
|
||||||
|
(#) You can also control the SRAM device by calling the control APIs HAL_SRAM_WriteOperation_Enable()/
|
||||||
|
HAL_SRAM_WriteOperation_Disable() to respectively enable/disable the SRAM write operation
|
||||||
|
|
||||||
|
(#) You can continuously monitor the SRAM device HAL state by calling the function
|
||||||
|
HAL_SRAM_GetState()
|
||||||
|
|
||||||
|
*** Callback registration ***
|
||||||
|
=============================================
|
||||||
|
[..]
|
||||||
|
The compilation define USE_HAL_SRAM_REGISTER_CALLBACKS when set to 1
|
||||||
|
allows the user to configure dynamically the driver callbacks.
|
||||||
|
|
||||||
|
Use Functions @ref HAL_SRAM_RegisterCallback() to register a user callback,
|
||||||
|
it allows to register following callbacks:
|
||||||
|
(+) MspInitCallback : SRAM MspInit.
|
||||||
|
(+) MspDeInitCallback : SRAM MspDeInit.
|
||||||
|
This function takes as parameters the HAL peripheral handle, the Callback ID
|
||||||
|
and a pointer to the user callback function.
|
||||||
|
|
||||||
|
Use function @ref HAL_SRAM_UnRegisterCallback() to reset a callback to the default
|
||||||
|
weak (surcharged) function. It allows to reset following callbacks:
|
||||||
|
(+) MspInitCallback : SRAM MspInit.
|
||||||
|
(+) MspDeInitCallback : SRAM MspDeInit.
|
||||||
|
This function) takes as parameters the HAL peripheral handle and the Callback ID.
|
||||||
|
|
||||||
|
By default, after the @ref HAL_SRAM_Init and if the state is HAL_SRAM_STATE_RESET
|
||||||
|
all callbacks are reset to the corresponding legacy weak (surcharged) functions.
|
||||||
|
Exception done for MspInit and MspDeInit callbacks that are respectively
|
||||||
|
reset to the legacy weak (surcharged) functions in the @ref HAL_SRAM_Init
|
||||||
|
and @ref HAL_SRAM_DeInit only when these callbacks are null (not registered beforehand).
|
||||||
|
If not, MspInit or MspDeInit are not null, the @ref HAL_SRAM_Init and @ref HAL_SRAM_DeInit
|
||||||
|
keep and use the user MspInit/MspDeInit callbacks (registered beforehand)
|
||||||
|
|
||||||
|
Callbacks can be registered/unregistered in READY state only.
|
||||||
|
Exception done for MspInit/MspDeInit callbacks that can be registered/unregistered
|
||||||
|
in READY or RESET state, thus registered (user) MspInit/DeInit callbacks can be used
|
||||||
|
during the Init/DeInit.
|
||||||
|
In that case first register the MspInit/MspDeInit user callbacks
|
||||||
|
using @ref HAL_SRAM_RegisterCallback before calling @ref HAL_SRAM_DeInit
|
||||||
|
or @ref HAL_SRAM_Init function.
|
||||||
|
|
||||||
|
When The compilation define USE_HAL_SRAM_REGISTER_CALLBACKS is set to 0 or
|
||||||
|
not defined, the callback registering feature is not available
|
||||||
|
and weak (surcharged) callbacks are used.
|
||||||
|
|
||||||
|
@endverbatim
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under BSD 3-Clause license,
|
||||||
|
* the "License"; You may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at:
|
||||||
|
* opensource.org/licenses/BSD-3-Clause
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32f4xx_hal.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32F4xx_HAL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SRAM SRAM
|
||||||
|
* @brief SRAM driver modules
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#ifdef HAL_SRAM_MODULE_ENABLED
|
||||||
|
|
||||||
|
#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
|
||||||
|
defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
|
||||||
|
defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\
|
||||||
|
defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* Private macro -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @defgroup SRAM_Exported_Functions SRAM Exported Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/** @defgroup SRAM_Exported_Functions_Group1 Initialization and de-initialization functions
|
||||||
|
* @brief Initialization and Configuration functions
|
||||||
|
*
|
||||||
|
@verbatim
|
||||||
|
==============================================================================
|
||||||
|
##### SRAM Initialization and de_initialization functions #####
|
||||||
|
==============================================================================
|
||||||
|
[..] This section provides functions allowing to initialize/de-initialize
|
||||||
|
the SRAM memory
|
||||||
|
|
||||||
|
@endverbatim
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Performs the SRAM device initialization sequence
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @param Timing Pointer to SRAM control timing structure
|
||||||
|
* @param ExtTiming Pointer to SRAM extended mode timing structure
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming)
|
||||||
|
{
|
||||||
|
/* Check the SRAM handle parameter */
|
||||||
|
if(hsram == NULL)
|
||||||
|
{
|
||||||
|
return HAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hsram->State == HAL_SRAM_STATE_RESET)
|
||||||
|
{
|
||||||
|
/* Allocate lock resource and initialize it */
|
||||||
|
hsram->Lock = HAL_UNLOCKED;
|
||||||
|
|
||||||
|
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
|
||||||
|
if(hsram->MspInitCallback == NULL)
|
||||||
|
{
|
||||||
|
hsram->MspInitCallback = HAL_SRAM_MspInit;
|
||||||
|
}
|
||||||
|
hsram->DmaXferCpltCallback = HAL_SRAM_DMA_XferCpltCallback;
|
||||||
|
hsram->DmaXferErrorCallback = HAL_SRAM_DMA_XferErrorCallback;
|
||||||
|
|
||||||
|
/* Init the low level hardware */
|
||||||
|
hsram->MspInitCallback(hsram);
|
||||||
|
#else
|
||||||
|
/* Initialize the low level hardware (MSP) */
|
||||||
|
HAL_SRAM_MspInit(hsram);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize SRAM control Interface */
|
||||||
|
FMC_NORSRAM_Init(hsram->Instance, &(hsram->Init));
|
||||||
|
|
||||||
|
/* Initialize SRAM timing Interface */
|
||||||
|
FMC_NORSRAM_Timing_Init(hsram->Instance, Timing, hsram->Init.NSBank);
|
||||||
|
|
||||||
|
/* Initialize SRAM extended mode timing Interface */
|
||||||
|
FMC_NORSRAM_Extended_Timing_Init(hsram->Extended, ExtTiming, hsram->Init.NSBank, hsram->Init.ExtendedMode);
|
||||||
|
|
||||||
|
/* Enable the NORSRAM device */
|
||||||
|
__FMC_NORSRAM_ENABLE(hsram->Instance, hsram->Init.NSBank);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Performs the SRAM device De-initialization sequence.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram)
|
||||||
|
{
|
||||||
|
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
|
||||||
|
if(hsram->MspDeInitCallback == NULL)
|
||||||
|
{
|
||||||
|
hsram->MspDeInitCallback = HAL_SRAM_MspDeInit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DeInit the low level hardware */
|
||||||
|
hsram->MspDeInitCallback(hsram);
|
||||||
|
#else
|
||||||
|
/* De-Initialize the low level hardware (MSP) */
|
||||||
|
HAL_SRAM_MspDeInit(hsram);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Configure the SRAM registers with their reset values */
|
||||||
|
FMC_NORSRAM_DeInit(hsram->Instance, hsram->Extended, hsram->Init.NSBank);
|
||||||
|
|
||||||
|
hsram->State = HAL_SRAM_STATE_RESET;
|
||||||
|
|
||||||
|
/* Release Lock */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SRAM MSP Init.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__weak void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram)
|
||||||
|
{
|
||||||
|
/* Prevent unused argument(s) compilation warning */
|
||||||
|
UNUSED(hsram);
|
||||||
|
/* NOTE : This function Should not be modified, when the callback is needed,
|
||||||
|
the HAL_SRAM_MspInit could be implemented in the user file
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SRAM MSP DeInit.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__weak void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram)
|
||||||
|
{
|
||||||
|
/* Prevent unused argument(s) compilation warning */
|
||||||
|
UNUSED(hsram);
|
||||||
|
/* NOTE : This function Should not be modified, when the callback is needed,
|
||||||
|
the HAL_SRAM_MspDeInit could be implemented in the user file
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DMA transfer complete callback.
|
||||||
|
* @param hdma pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__weak void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma)
|
||||||
|
{
|
||||||
|
/* Prevent unused argument(s) compilation warning */
|
||||||
|
UNUSED(hdma);
|
||||||
|
/* NOTE : This function Should not be modified, when the callback is needed,
|
||||||
|
the HAL_SRAM_DMA_XferCpltCallback could be implemented in the user file
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DMA transfer complete error callback.
|
||||||
|
* @param hdma pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__weak void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma)
|
||||||
|
{
|
||||||
|
/* Prevent unused argument(s) compilation warning */
|
||||||
|
UNUSED(hdma);
|
||||||
|
/* NOTE : This function Should not be modified, when the callback is needed,
|
||||||
|
the HAL_SRAM_DMA_XferErrorCallback could be implemented in the user file
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SRAM_Exported_Functions_Group2 Input and Output functions
|
||||||
|
* @brief Input Output and memory control functions
|
||||||
|
*
|
||||||
|
@verbatim
|
||||||
|
==============================================================================
|
||||||
|
##### SRAM Input and Output functions #####
|
||||||
|
==============================================================================
|
||||||
|
[..]
|
||||||
|
This section provides functions allowing to use and control the SRAM memory
|
||||||
|
|
||||||
|
@endverbatim
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reads 8-bit buffer from SRAM memory.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @param pAddress Pointer to read start address
|
||||||
|
* @param pDstBuffer Pointer to destination buffer
|
||||||
|
* @param BufferSize Size of the buffer to read from memory
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize)
|
||||||
|
{
|
||||||
|
__IO uint8_t * pSramAddress = (uint8_t *)pAddress;
|
||||||
|
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_BUSY;
|
||||||
|
|
||||||
|
/* Read data from memory */
|
||||||
|
for(; BufferSize != 0U; BufferSize--)
|
||||||
|
{
|
||||||
|
*pDstBuffer = *(__IO uint8_t *)pSramAddress;
|
||||||
|
pDstBuffer++;
|
||||||
|
pSramAddress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_READY;
|
||||||
|
|
||||||
|
/* Process unlocked */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Writes 8-bit buffer to SRAM memory.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @param pAddress Pointer to write start address
|
||||||
|
* @param pSrcBuffer Pointer to source buffer to write
|
||||||
|
* @param BufferSize Size of the buffer to write to memory
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize)
|
||||||
|
{
|
||||||
|
__IO uint8_t * pSramAddress = (uint8_t *)pAddress;
|
||||||
|
|
||||||
|
/* Check the SRAM controller state */
|
||||||
|
if(hsram->State == HAL_SRAM_STATE_PROTECTED)
|
||||||
|
{
|
||||||
|
return HAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_BUSY;
|
||||||
|
|
||||||
|
/* Write data to memory */
|
||||||
|
for(; BufferSize != 0U; BufferSize--)
|
||||||
|
{
|
||||||
|
*(__IO uint8_t *)pSramAddress = *pSrcBuffer;
|
||||||
|
pSrcBuffer++;
|
||||||
|
pSramAddress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_READY;
|
||||||
|
|
||||||
|
/* Process unlocked */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reads 16-bit buffer from SRAM memory.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @param pAddress Pointer to read start address
|
||||||
|
* @param pDstBuffer Pointer to destination buffer
|
||||||
|
* @param BufferSize Size of the buffer to read from memory
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize)
|
||||||
|
{
|
||||||
|
__IO uint16_t * pSramAddress = (uint16_t *)pAddress;
|
||||||
|
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_BUSY;
|
||||||
|
|
||||||
|
/* Read data from memory */
|
||||||
|
for(; BufferSize != 0U; BufferSize--)
|
||||||
|
{
|
||||||
|
*pDstBuffer = *(__IO uint16_t *)pSramAddress;
|
||||||
|
pDstBuffer++;
|
||||||
|
pSramAddress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_READY;
|
||||||
|
|
||||||
|
/* Process unlocked */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Writes 16-bit buffer to SRAM memory.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @param pAddress Pointer to write start address
|
||||||
|
* @param pSrcBuffer Pointer to source buffer to write
|
||||||
|
* @param BufferSize Size of the buffer to write to memory
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize)
|
||||||
|
{
|
||||||
|
__IO uint16_t * pSramAddress = (uint16_t *)pAddress;
|
||||||
|
|
||||||
|
/* Check the SRAM controller state */
|
||||||
|
if(hsram->State == HAL_SRAM_STATE_PROTECTED)
|
||||||
|
{
|
||||||
|
return HAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_BUSY;
|
||||||
|
|
||||||
|
/* Write data to memory */
|
||||||
|
for(; BufferSize != 0U; BufferSize--)
|
||||||
|
{
|
||||||
|
*(__IO uint16_t *)pSramAddress = *pSrcBuffer;
|
||||||
|
pSrcBuffer++;
|
||||||
|
pSramAddress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_READY;
|
||||||
|
|
||||||
|
/* Process unlocked */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reads 32-bit buffer from SRAM memory.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @param pAddress Pointer to read start address
|
||||||
|
* @param pDstBuffer Pointer to destination buffer
|
||||||
|
* @param BufferSize Size of the buffer to read from memory
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize)
|
||||||
|
{
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_BUSY;
|
||||||
|
|
||||||
|
/* Read data from memory */
|
||||||
|
for(; BufferSize != 0U; BufferSize--)
|
||||||
|
{
|
||||||
|
*pDstBuffer = *(__IO uint32_t *)pAddress;
|
||||||
|
pDstBuffer++;
|
||||||
|
pAddress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_READY;
|
||||||
|
|
||||||
|
/* Process unlocked */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Writes 32-bit buffer to SRAM memory.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @param pAddress Pointer to write start address
|
||||||
|
* @param pSrcBuffer Pointer to source buffer to write
|
||||||
|
* @param BufferSize Size of the buffer to write to memory
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize)
|
||||||
|
{
|
||||||
|
/* Check the SRAM controller state */
|
||||||
|
if(hsram->State == HAL_SRAM_STATE_PROTECTED)
|
||||||
|
{
|
||||||
|
return HAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_BUSY;
|
||||||
|
|
||||||
|
/* Write data to memory */
|
||||||
|
for(; BufferSize != 0U; BufferSize--)
|
||||||
|
{
|
||||||
|
*(__IO uint32_t *)pAddress = *pSrcBuffer;
|
||||||
|
pSrcBuffer++;
|
||||||
|
pAddress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_READY;
|
||||||
|
|
||||||
|
/* Process unlocked */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reads a Words data from the SRAM memory using DMA transfer.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @param pAddress Pointer to read start address
|
||||||
|
* @param pDstBuffer Pointer to destination buffer
|
||||||
|
* @param BufferSize Size of the buffer to read from memory
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize)
|
||||||
|
{
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_BUSY;
|
||||||
|
|
||||||
|
/* Configure DMA user callbacks */
|
||||||
|
hsram->hdma->XferCpltCallback = HAL_SRAM_DMA_XferCpltCallback;
|
||||||
|
hsram->hdma->XferErrorCallback = HAL_SRAM_DMA_XferErrorCallback;
|
||||||
|
|
||||||
|
/* Enable the DMA Stream */
|
||||||
|
HAL_DMA_Start_IT(hsram->hdma, (uint32_t)pAddress, (uint32_t)pDstBuffer, (uint32_t)BufferSize);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_READY;
|
||||||
|
|
||||||
|
/* Process unlocked */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Writes a Words data buffer to SRAM memory using DMA transfer.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @param pAddress Pointer to write start address
|
||||||
|
* @param pSrcBuffer Pointer to source buffer to write
|
||||||
|
* @param BufferSize Size of the buffer to write to memory
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize)
|
||||||
|
{
|
||||||
|
/* Check the SRAM controller state */
|
||||||
|
if(hsram->State == HAL_SRAM_STATE_PROTECTED)
|
||||||
|
{
|
||||||
|
return HAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_BUSY;
|
||||||
|
|
||||||
|
/* Configure DMA user callbacks */
|
||||||
|
hsram->hdma->XferCpltCallback = HAL_SRAM_DMA_XferCpltCallback;
|
||||||
|
hsram->hdma->XferErrorCallback = HAL_SRAM_DMA_XferErrorCallback;
|
||||||
|
|
||||||
|
/* Enable the DMA Stream */
|
||||||
|
HAL_DMA_Start_IT(hsram->hdma, (uint32_t)pSrcBuffer, (uint32_t)pAddress, (uint32_t)BufferSize);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_READY;
|
||||||
|
|
||||||
|
/* Process unlocked */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
|
||||||
|
/**
|
||||||
|
* @brief Register a User SRAM Callback
|
||||||
|
* To be used instead of the weak (surcharged) predefined callback
|
||||||
|
* @param hsram : SRAM handle
|
||||||
|
* @param CallbackId : ID of the callback to be registered
|
||||||
|
* This parameter can be one of the following values:
|
||||||
|
* @arg @ref HAL_SRAM_MSP_INIT_CB_ID SRAM MspInit callback ID
|
||||||
|
* @arg @ref HAL_SRAM_MSP_DEINIT_CB_ID SRAM MspDeInit callback ID
|
||||||
|
* @param pCallback : pointer to the Callback function
|
||||||
|
* @retval status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_RegisterCallback (SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, pSRAM_CallbackTypeDef pCallback)
|
||||||
|
{
|
||||||
|
HAL_StatusTypeDef status = HAL_OK;
|
||||||
|
HAL_SRAM_StateTypeDef state;
|
||||||
|
|
||||||
|
if(pCallback == NULL)
|
||||||
|
{
|
||||||
|
return HAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
state = hsram->State;
|
||||||
|
if((state == HAL_SRAM_STATE_READY) || (state == HAL_SRAM_STATE_RESET) || (state == HAL_SRAM_STATE_PROTECTED))
|
||||||
|
{
|
||||||
|
switch (CallbackId)
|
||||||
|
{
|
||||||
|
case HAL_SRAM_MSP_INIT_CB_ID :
|
||||||
|
hsram->MspInitCallback = pCallback;
|
||||||
|
break;
|
||||||
|
case HAL_SRAM_MSP_DEINIT_CB_ID :
|
||||||
|
hsram->MspDeInitCallback = pCallback;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
/* update return status */
|
||||||
|
status = HAL_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* update return status */
|
||||||
|
status = HAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release Lock */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unregister a User SRAM Callback
|
||||||
|
* SRAM Callback is redirected to the weak (surcharged) predefined callback
|
||||||
|
* @param hsram : SRAM handle
|
||||||
|
* @param CallbackId : ID of the callback to be unregistered
|
||||||
|
* This parameter can be one of the following values:
|
||||||
|
* @arg @ref HAL_SRAM_MSP_INIT_CB_ID SRAM MspInit callback ID
|
||||||
|
* @arg @ref HAL_SRAM_MSP_DEINIT_CB_ID SRAM MspDeInit callback ID
|
||||||
|
* @arg @ref HAL_SRAM_DMA_XFER_CPLT_CB_ID SRAM DMA Xfer Complete callback ID
|
||||||
|
* @arg @ref HAL_SRAM_DMA_XFER_ERR_CB_ID SRAM DMA Xfer Error callback ID
|
||||||
|
* @retval status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_UnRegisterCallback (SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId)
|
||||||
|
{
|
||||||
|
HAL_StatusTypeDef status = HAL_OK;
|
||||||
|
HAL_SRAM_StateTypeDef state;
|
||||||
|
|
||||||
|
/* Process locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
state = hsram->State;
|
||||||
|
if((state == HAL_SRAM_STATE_READY) || (state == HAL_SRAM_STATE_PROTECTED))
|
||||||
|
{
|
||||||
|
switch (CallbackId)
|
||||||
|
{
|
||||||
|
case HAL_SRAM_MSP_INIT_CB_ID :
|
||||||
|
hsram->MspInitCallback = HAL_SRAM_MspInit;
|
||||||
|
break;
|
||||||
|
case HAL_SRAM_MSP_DEINIT_CB_ID :
|
||||||
|
hsram->MspDeInitCallback = HAL_SRAM_MspDeInit;
|
||||||
|
break;
|
||||||
|
case HAL_SRAM_DMA_XFER_CPLT_CB_ID :
|
||||||
|
hsram->DmaXferCpltCallback = HAL_SRAM_DMA_XferCpltCallback;
|
||||||
|
break;
|
||||||
|
case HAL_SRAM_DMA_XFER_ERR_CB_ID :
|
||||||
|
hsram->DmaXferErrorCallback = HAL_SRAM_DMA_XferErrorCallback;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
/* update return status */
|
||||||
|
status = HAL_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(state == HAL_SRAM_STATE_RESET)
|
||||||
|
{
|
||||||
|
switch (CallbackId)
|
||||||
|
{
|
||||||
|
case HAL_SRAM_MSP_INIT_CB_ID :
|
||||||
|
hsram->MspInitCallback = HAL_SRAM_MspInit;
|
||||||
|
break;
|
||||||
|
case HAL_SRAM_MSP_DEINIT_CB_ID :
|
||||||
|
hsram->MspDeInitCallback = HAL_SRAM_MspDeInit;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
/* update return status */
|
||||||
|
status = HAL_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* update return status */
|
||||||
|
status = HAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release Lock */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Register a User SRAM Callback for DMA transfers
|
||||||
|
* To be used instead of the weak (surcharged) predefined callback
|
||||||
|
* @param hsram : SRAM handle
|
||||||
|
* @param CallbackId : ID of the callback to be registered
|
||||||
|
* This parameter can be one of the following values:
|
||||||
|
* @arg @ref HAL_SRAM_DMA_XFER_CPLT_CB_ID SRAM DMA Xfer Complete callback ID
|
||||||
|
* @arg @ref HAL_SRAM_DMA_XFER_ERR_CB_ID SRAM DMA Xfer Error callback ID
|
||||||
|
* @param pCallback : pointer to the Callback function
|
||||||
|
* @retval status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_RegisterDmaCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, pSRAM_DmaCallbackTypeDef pCallback)
|
||||||
|
{
|
||||||
|
HAL_StatusTypeDef status = HAL_OK;
|
||||||
|
HAL_SRAM_StateTypeDef state;
|
||||||
|
|
||||||
|
if(pCallback == NULL)
|
||||||
|
{
|
||||||
|
return HAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Process locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
state = hsram->State;
|
||||||
|
if((state == HAL_SRAM_STATE_READY) || (state == HAL_SRAM_STATE_PROTECTED))
|
||||||
|
{
|
||||||
|
switch (CallbackId)
|
||||||
|
{
|
||||||
|
case HAL_SRAM_DMA_XFER_CPLT_CB_ID :
|
||||||
|
hsram->DmaXferCpltCallback = pCallback;
|
||||||
|
break;
|
||||||
|
case HAL_SRAM_DMA_XFER_ERR_CB_ID :
|
||||||
|
hsram->DmaXferErrorCallback = pCallback;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
/* update return status */
|
||||||
|
status = HAL_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* update return status */
|
||||||
|
status = HAL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release Lock */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SRAM_Exported_Functions_Group3 Control functions
|
||||||
|
* @brief management functions
|
||||||
|
*
|
||||||
|
@verbatim
|
||||||
|
==============================================================================
|
||||||
|
##### SRAM Control functions #####
|
||||||
|
==============================================================================
|
||||||
|
[..]
|
||||||
|
This subsection provides a set of functions allowing to control dynamically
|
||||||
|
the SRAM interface.
|
||||||
|
|
||||||
|
@endverbatim
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables dynamically SRAM write operation.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram)
|
||||||
|
{
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
/* Enable write operation */
|
||||||
|
FMC_NORSRAM_WriteOperation_Enable(hsram->Instance, hsram->Init.NSBank);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_READY;
|
||||||
|
|
||||||
|
/* Process unlocked */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disables dynamically SRAM write operation.
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @retval HAL status
|
||||||
|
*/
|
||||||
|
HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram)
|
||||||
|
{
|
||||||
|
/* Process Locked */
|
||||||
|
__HAL_LOCK(hsram);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_BUSY;
|
||||||
|
|
||||||
|
/* Disable write operation */
|
||||||
|
FMC_NORSRAM_WriteOperation_Disable(hsram->Instance, hsram->Init.NSBank);
|
||||||
|
|
||||||
|
/* Update the SRAM controller state */
|
||||||
|
hsram->State = HAL_SRAM_STATE_PROTECTED;
|
||||||
|
|
||||||
|
/* Process unlocked */
|
||||||
|
__HAL_UNLOCK(hsram);
|
||||||
|
|
||||||
|
return HAL_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup SRAM_Exported_Functions_Group4 State functions
|
||||||
|
* @brief Peripheral State functions
|
||||||
|
*
|
||||||
|
@verbatim
|
||||||
|
==============================================================================
|
||||||
|
##### SRAM State functions #####
|
||||||
|
==============================================================================
|
||||||
|
[..]
|
||||||
|
This subsection permits to get in run-time the status of the SRAM controller
|
||||||
|
and the data flow.
|
||||||
|
|
||||||
|
@endverbatim
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns the SRAM controller state
|
||||||
|
* @param hsram pointer to a SRAM_HandleTypeDef structure that contains
|
||||||
|
* the configuration information for SRAM module.
|
||||||
|
* @retval HAL state
|
||||||
|
*/
|
||||||
|
HAL_SRAM_StateTypeDef HAL_SRAM_GetState(SRAM_HandleTypeDef *hsram)
|
||||||
|
{
|
||||||
|
return hsram->State;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\
|
||||||
|
STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\
|
||||||
|
STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
|
||||||
|
#endif /* HAL_SRAM_MODULE_ENABLED */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
1009
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c
Normal file
1009
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c
Normal file
File diff suppressed because it is too large
Load diff
1491
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c
Normal file
1491
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c
Normal file
File diff suppressed because it is too large
Load diff
2032
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c
Normal file
2032
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c
Normal file
File diff suppressed because it is too large
Load diff
92
Inc/bsp_driver_sd.h
Normal file
92
Inc/bsp_driver_sd.h
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file bsp_driver_sd.h for F4 (based on stm324x9i_eval_sd.h)
|
||||||
|
* @brief This file contains the common defines and functions prototypes for
|
||||||
|
* the bsp_driver_sd.c driver.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __STM32F4_SD_H
|
||||||
|
#define __STM32F4_SD_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32f4xx_hal.h"
|
||||||
|
|
||||||
|
/* Exported types --------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @brief SD Card information structure
|
||||||
|
*/
|
||||||
|
#define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* @brief SD status structure definition
|
||||||
|
*/
|
||||||
|
#define MSD_OK ((uint8_t)0x00)
|
||||||
|
#define MSD_ERROR ((uint8_t)0x01)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SD transfer state definition
|
||||||
|
*/
|
||||||
|
#define SD_TRANSFER_OK ((uint8_t)0x00)
|
||||||
|
#define SD_TRANSFER_BUSY ((uint8_t)0x01)
|
||||||
|
|
||||||
|
#define SD_PRESENT ((uint8_t)0x01)
|
||||||
|
#define SD_NOT_PRESENT ((uint8_t)0x00)
|
||||||
|
#define SD_DATATIMEOUT ((uint32_t)100000000)
|
||||||
|
|
||||||
|
#ifdef OLD_API
|
||||||
|
/* kept to avoid issue when migrating old projects. */
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
#else
|
||||||
|
/* USER CODE BEGIN BSP_H_CODE */
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
uint8_t BSP_SD_Init(void);
|
||||||
|
uint8_t BSP_SD_ITConfig(void);
|
||||||
|
void BSP_SD_DetectIT(void);
|
||||||
|
void BSP_SD_DetectCallback(void);
|
||||||
|
uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
|
||||||
|
uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
|
||||||
|
uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
|
||||||
|
uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks);
|
||||||
|
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
|
||||||
|
void BSP_SD_IRQHandler(void);
|
||||||
|
void BSP_SD_DMA_Tx_IRQHandler(void);
|
||||||
|
void BSP_SD_DMA_Rx_IRQHandler(void);
|
||||||
|
uint8_t BSP_SD_GetCardState(void);
|
||||||
|
void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
|
||||||
|
uint8_t BSP_SD_IsDetected(void);
|
||||||
|
|
||||||
|
/* These functions can be modified in case the current settings (e.g. DMA stream)
|
||||||
|
need to be changed for specific application needs */
|
||||||
|
void BSP_SD_AbortCallback(void);
|
||||||
|
void BSP_SD_WriteCpltCallback(void);
|
||||||
|
void BSP_SD_ReadCpltCallback(void);
|
||||||
|
/* USER CODE END BSP_H_CODE */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __STM32F4_SD_H */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -9,10 +9,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
49
Inc/fatfs.h
Normal file
49
Inc/fatfs.h
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file fatfs.h
|
||||||
|
* @brief Header for fatfs applications
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __fatfs_H
|
||||||
|
#define __fatfs_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "ff.h"
|
||||||
|
#include "ff_gen_drv.h"
|
||||||
|
#include "sd_diskio.h" /* defines SD_Driver as external */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern uint8_t retSD; /* Return value for SD */
|
||||||
|
extern char SDPath[4]; /* SD logical drive path */
|
||||||
|
extern FATFS SDFatFS; /* File system object for SD logical drive */
|
||||||
|
extern FIL SDFile; /* File object for SD */
|
||||||
|
|
||||||
|
void MX_FATFS_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /*__fatfs_H */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
270
Inc/ffconf.h
Normal file
270
Inc/ffconf.h
Normal file
|
@ -0,0 +1,270 @@
|
||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* FatFs - Generic FAT file system module R0.12c (C)ChaN, 2017
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
#ifndef _FFCONF
|
||||||
|
#define _FFCONF 68300 /* Revision ID */
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------/
|
||||||
|
/ Additional user header to be used
|
||||||
|
/-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
#include "stm32f4xx_hal.h"
|
||||||
|
#include "bsp_driver_sd.h"
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------/
|
||||||
|
/ Function Configurations
|
||||||
|
/-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */
|
||||||
|
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
||||||
|
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
|
||||||
|
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
|
||||||
|
/ and optional writing functions as well. */
|
||||||
|
|
||||||
|
#define _FS_MINIMIZE 0 /* 0 to 3 */
|
||||||
|
/* This option defines minimization level to remove some basic API functions.
|
||||||
|
/
|
||||||
|
/ 0: All basic functions are enabled.
|
||||||
|
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
|
||||||
|
/ are removed.
|
||||||
|
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
|
||||||
|
/ 3: f_lseek() function is removed in addition to 2. */
|
||||||
|
|
||||||
|
#define _USE_STRFUNC 2 /* 0:Disable or 1-2:Enable */
|
||||||
|
/* This option switches string functions, f_gets(), f_putc(), f_puts() and
|
||||||
|
/ f_printf().
|
||||||
|
/
|
||||||
|
/ 0: Disable string functions.
|
||||||
|
/ 1: Enable without LF-CRLF conversion.
|
||||||
|
/ 2: Enable with LF-CRLF conversion. */
|
||||||
|
|
||||||
|
#define _USE_FIND 0
|
||||||
|
/* This option switches filtered directory read functions, f_findfirst() and
|
||||||
|
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
||||||
|
|
||||||
|
#define _USE_MKFS 0
|
||||||
|
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
|
||||||
|
|
||||||
|
#define _USE_FASTSEEK 1
|
||||||
|
/* This option switches fast seek feature. (0:Disable or 1:Enable) */
|
||||||
|
|
||||||
|
#define _USE_EXPAND 0
|
||||||
|
/* This option switches f_expand function. (0:Disable or 1:Enable) */
|
||||||
|
|
||||||
|
#define _USE_CHMOD 0
|
||||||
|
/* This option switches attribute manipulation functions, f_chmod() and f_utime().
|
||||||
|
/ (0:Disable or 1:Enable) Also _FS_READONLY needs to be 0 to enable this option. */
|
||||||
|
|
||||||
|
#define _USE_LABEL 0
|
||||||
|
/* This option switches volume label functions, f_getlabel() and f_setlabel().
|
||||||
|
/ (0:Disable or 1:Enable) */
|
||||||
|
|
||||||
|
#define _USE_FORWARD 0
|
||||||
|
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------/
|
||||||
|
/ Locale and Namespace Configurations
|
||||||
|
/-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _CODE_PAGE 850
|
||||||
|
/* This option specifies the OEM code page to be used on the target system.
|
||||||
|
/ Incorrect setting of the code page can cause a file open failure.
|
||||||
|
/
|
||||||
|
/ 1 - ASCII (No extended character. Non-LFN cfg. only)
|
||||||
|
/ 437 - U.S.
|
||||||
|
/ 720 - Arabic
|
||||||
|
/ 737 - Greek
|
||||||
|
/ 771 - KBL
|
||||||
|
/ 775 - Baltic
|
||||||
|
/ 850 - Latin 1
|
||||||
|
/ 852 - Latin 2
|
||||||
|
/ 855 - Cyrillic
|
||||||
|
/ 857 - Turkish
|
||||||
|
/ 860 - Portuguese
|
||||||
|
/ 861 - Icelandic
|
||||||
|
/ 862 - Hebrew
|
||||||
|
/ 863 - Canadian French
|
||||||
|
/ 864 - Arabic
|
||||||
|
/ 865 - Nordic
|
||||||
|
/ 866 - Russian
|
||||||
|
/ 869 - Greek 2
|
||||||
|
/ 932 - Japanese (DBCS)
|
||||||
|
/ 936 - Simplified Chinese (DBCS)
|
||||||
|
/ 949 - Korean (DBCS)
|
||||||
|
/ 950 - Traditional Chinese (DBCS)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _USE_LFN 1 /* 0 to 3 */
|
||||||
|
#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
|
||||||
|
/* The _USE_LFN switches the support of long file name (LFN).
|
||||||
|
/
|
||||||
|
/ 0: Disable support of LFN. _MAX_LFN has no effect.
|
||||||
|
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
|
||||||
|
/ 2: Enable LFN with dynamic working buffer on the STACK.
|
||||||
|
/ 3: Enable LFN with dynamic working buffer on the HEAP.
|
||||||
|
/
|
||||||
|
/ To enable the LFN, Unicode handling functions (option/unicode.c) must be added
|
||||||
|
/ to the project. The working buffer occupies (_MAX_LFN + 1) * 2 bytes and
|
||||||
|
/ additional 608 bytes at exFAT enabled. _MAX_LFN can be in range from 12 to 255.
|
||||||
|
/ It should be set 255 to support full featured LFN operations.
|
||||||
|
/ When use stack for the working buffer, take care on stack overflow. When use heap
|
||||||
|
/ memory for the working buffer, memory management functions, ff_memalloc() and
|
||||||
|
/ ff_memfree(), must be added to the project. */
|
||||||
|
|
||||||
|
#define _LFN_UNICODE 1 /* 0:ANSI/OEM or 1:Unicode */
|
||||||
|
/* This option switches character encoding on the API. (0:ANSI/OEM or 1:UTF-16)
|
||||||
|
/ To use Unicode string for the path name, enable LFN and set _LFN_UNICODE = 1.
|
||||||
|
/ This option also affects behavior of string I/O functions. */
|
||||||
|
|
||||||
|
#define _STRF_ENCODE 3
|
||||||
|
/* When _LFN_UNICODE == 1, this option selects the character encoding ON THE FILE to
|
||||||
|
/ be read/written via string I/O functions, f_gets(), f_putc(), f_puts and f_printf().
|
||||||
|
/
|
||||||
|
/ 0: ANSI/OEM
|
||||||
|
/ 1: UTF-16LE
|
||||||
|
/ 2: UTF-16BE
|
||||||
|
/ 3: UTF-8
|
||||||
|
/
|
||||||
|
/ This option has no effect when _LFN_UNICODE == 0. */
|
||||||
|
|
||||||
|
#define _FS_RPATH 0 /* 0 to 2 */
|
||||||
|
/* This option configures support of relative path.
|
||||||
|
/
|
||||||
|
/ 0: Disable relative path and remove related functions.
|
||||||
|
/ 1: Enable relative path. f_chdir() and f_chdrive() are available.
|
||||||
|
/ 2: f_getcwd() function is available in addition to 1.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------/
|
||||||
|
/ Drive/Volume Configurations
|
||||||
|
/----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _VOLUMES 1
|
||||||
|
/* Number of volumes (logical drives) to be used. */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Volumes */
|
||||||
|
#define _STR_VOLUME_ID 0 /* 0:Use only 0-9 for drive ID, 1:Use strings for drive ID */
|
||||||
|
#define _VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3"
|
||||||
|
/* _STR_VOLUME_ID switches string support of volume ID.
|
||||||
|
/ When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
|
||||||
|
/ number in the path name. _VOLUME_STRS defines the drive ID strings for each
|
||||||
|
/ logical drives. Number of items must be equal to _VOLUMES. Valid characters for
|
||||||
|
/ the drive ID strings are: A-Z and 0-9. */
|
||||||
|
/* USER CODE END Volumes */
|
||||||
|
|
||||||
|
#define _MULTI_PARTITION 0 /* 0:Single partition, 1:Multiple partition */
|
||||||
|
/* This option switches support of multi-partition on a physical drive.
|
||||||
|
/ By default (0), each logical drive number is bound to the same physical drive
|
||||||
|
/ number and only an FAT volume found on the physical drive will be mounted.
|
||||||
|
/ When multi-partition is enabled (1), each logical drive number can be bound to
|
||||||
|
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
|
||||||
|
/ funciton will be available. */
|
||||||
|
#define _MIN_SS 512 /* 512, 1024, 2048 or 4096 */
|
||||||
|
#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
|
||||||
|
/* These options configure the range of sector size to be supported. (512, 1024,
|
||||||
|
/ 2048 or 4096) Always set both 512 for most systems, all type of memory cards and
|
||||||
|
/ harddisk. But a larger value may be required for on-board flash memory and some
|
||||||
|
/ type of optical media. When _MAX_SS is larger than _MIN_SS, FatFs is configured
|
||||||
|
/ to variable sector size and GET_SECTOR_SIZE command must be implemented to the
|
||||||
|
/ disk_ioctl() function. */
|
||||||
|
|
||||||
|
#define _USE_TRIM 0
|
||||||
|
/* This option switches support of ATA-TRIM. (0:Disable or 1:Enable)
|
||||||
|
/ To enable Trim function, also CTRL_TRIM command should be implemented to the
|
||||||
|
/ disk_ioctl() function. */
|
||||||
|
|
||||||
|
#define _FS_NOFSINFO 0 /* 0,1,2 or 3 */
|
||||||
|
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
||||||
|
/ option, and f_getfree() function at first time after volume mount will force
|
||||||
|
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
||||||
|
/
|
||||||
|
/ bit0=0: Use free cluster count in the FSINFO if available.
|
||||||
|
/ bit0=1: Do not trust free cluster count in the FSINFO.
|
||||||
|
/ bit1=0: Use last allocated cluster number in the FSINFO if available.
|
||||||
|
/ bit1=1: Do not trust last allocated cluster number in the FSINFO.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------/
|
||||||
|
/ System Configurations
|
||||||
|
/----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _FS_TINY 0 /* 0:Normal or 1:Tiny */
|
||||||
|
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
|
||||||
|
/ At the tiny configuration, size of file object (FIL) is reduced _MAX_SS bytes.
|
||||||
|
/ Instead of private sector buffer eliminated from the file object, common sector
|
||||||
|
/ buffer in the file system object (FATFS) is used for the file data transfer. */
|
||||||
|
|
||||||
|
#define _FS_EXFAT 0
|
||||||
|
/* This option switches support of exFAT file system. (0:Disable or 1:Enable)
|
||||||
|
/ When enable exFAT, also LFN needs to be enabled. (_USE_LFN >= 1)
|
||||||
|
/ Note that enabling exFAT discards C89 compatibility. */
|
||||||
|
|
||||||
|
#define _FS_NORTC 0
|
||||||
|
#define _NORTC_MON 6
|
||||||
|
#define _NORTC_MDAY 4
|
||||||
|
#define _NORTC_YEAR 2015
|
||||||
|
/* The option _FS_NORTC switches timestamp functiton. If the system does not have
|
||||||
|
/ any RTC function or valid timestamp is not needed, set _FS_NORTC = 1 to disable
|
||||||
|
/ the timestamp function. All objects modified by FatFs will have a fixed timestamp
|
||||||
|
/ defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR in local time.
|
||||||
|
/ To enable timestamp function (_FS_NORTC = 0), get_fattime() function need to be
|
||||||
|
/ added to the project to get current time form real-time clock. _NORTC_MON,
|
||||||
|
/ _NORTC_MDAY and _NORTC_YEAR have no effect.
|
||||||
|
/ These options have no effect at read-only configuration (_FS_READONLY = 1). */
|
||||||
|
|
||||||
|
#define _FS_LOCK 3 /* 0:Disable or >=1:Enable */
|
||||||
|
/* The option _FS_LOCK switches file lock function to control duplicated file open
|
||||||
|
/ and illegal operation to open objects. This option must be 0 when _FS_READONLY
|
||||||
|
/ is 1.
|
||||||
|
/
|
||||||
|
/ 0: Disable file lock function. To avoid volume corruption, application program
|
||||||
|
/ should avoid illegal open, remove and rename to the open objects.
|
||||||
|
/ >0: Enable file lock function. The value defines how many files/sub-directories
|
||||||
|
/ can be opened simultaneously under file lock control. Note that the file
|
||||||
|
/ lock control is independent of re-entrancy. */
|
||||||
|
|
||||||
|
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
||||||
|
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
|
||||||
|
#define _SYNC_t osSemaphoreId
|
||||||
|
/* The option _FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
||||||
|
/ module itself. Note that regardless of this option, file access to different
|
||||||
|
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
||||||
|
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
|
||||||
|
/ to the same volume is under control of this function.
|
||||||
|
/
|
||||||
|
/ 0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect.
|
||||||
|
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
|
||||||
|
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
|
||||||
|
/ function, must be added to the project. Samples are available in
|
||||||
|
/ option/syscall.c.
|
||||||
|
/
|
||||||
|
/ The _FS_TIMEOUT defines timeout period in unit of time tick.
|
||||||
|
/ The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
|
||||||
|
/ SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be
|
||||||
|
/ included somewhere in the scope of ff.h. */
|
||||||
|
|
||||||
|
/* define the ff_malloc ff_free macros as standard malloc free */
|
||||||
|
#if !defined(ff_malloc) && !defined(ff_free)
|
||||||
|
#include <stdlib.h>
|
||||||
|
#define ff_malloc malloc
|
||||||
|
#define ff_free free
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _FFCONF */
|
60
Inc/fsmc.h
Normal file
60
Inc/fsmc.h
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* File Name : FSMC.h
|
||||||
|
* Description : This file provides code for the configuration
|
||||||
|
* of the FSMC peripheral.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __FSMC_H
|
||||||
|
#define __FSMC_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern SRAM_HandleTypeDef hsram1;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_FSMC_Init(void);
|
||||||
|
void HAL_SRAM_MspInit(SRAM_HandleTypeDef* hsram);
|
||||||
|
void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef* hsram);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /*__FSMC_H */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -9,10 +9,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
29
Inc/main.h
29
Inc/main.h
|
@ -31,6 +31,7 @@ extern "C" {
|
||||||
#include "stm32f4xx_hal.h"
|
#include "stm32f4xx_hal.h"
|
||||||
#include "stm32f4xx_ll_crc.h"
|
#include "stm32f4xx_ll_crc.h"
|
||||||
#include "stm32f4xx_ll_dma.h"
|
#include "stm32f4xx_ll_dma.h"
|
||||||
|
#include "stm32f4xx_hal.h"
|
||||||
#include "stm32f4xx_ll_spi.h"
|
#include "stm32f4xx_ll_spi.h"
|
||||||
#include "stm32f4xx_ll_usart.h"
|
#include "stm32f4xx_ll_usart.h"
|
||||||
#include "stm32f4xx_ll_rcc.h"
|
#include "stm32f4xx_ll_rcc.h"
|
||||||
|
@ -71,20 +72,32 @@ void Error_Handler(void);
|
||||||
/* USER CODE END EFP */
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
|
#define KEY1_Pin LL_GPIO_PIN_3
|
||||||
|
#define KEY1_GPIO_Port GPIOE
|
||||||
|
#define KEY0_Pin LL_GPIO_PIN_4
|
||||||
|
#define KEY0_GPIO_Port GPIOE
|
||||||
|
#define DEBUG0_Pin LL_GPIO_PIN_0
|
||||||
|
#define DEBUG0_GPIO_Port GPIOC
|
||||||
|
#define DEBUG1_Pin LL_GPIO_PIN_1
|
||||||
|
#define DEBUG1_GPIO_Port GPIOC
|
||||||
|
#define DEBUG2_Pin LL_GPIO_PIN_2
|
||||||
|
#define DEBUG2_GPIO_Port GPIOC
|
||||||
|
#define DEBUG3_Pin LL_GPIO_PIN_3
|
||||||
|
#define DEBUG3_GPIO_Port GPIOC
|
||||||
#define LED0_Pin LL_GPIO_PIN_6
|
#define LED0_Pin LL_GPIO_PIN_6
|
||||||
#define LED0_GPIO_Port GPIOA
|
#define LED0_GPIO_Port GPIOA
|
||||||
#define LED1_Pin LL_GPIO_PIN_7
|
#define LED1_Pin LL_GPIO_PIN_7
|
||||||
#define LED1_GPIO_Port GPIOA
|
#define LED1_GPIO_Port GPIOA
|
||||||
#define F_CS_Pin LL_GPIO_PIN_0
|
#define F_CS_Pin LL_GPIO_PIN_0
|
||||||
#define F_CS_GPIO_Port GPIOB
|
#define F_CS_GPIO_Port GPIOB
|
||||||
#define DIAG0_Pin LL_GPIO_PIN_4
|
#define T_CS_Pin LL_GPIO_PIN_12
|
||||||
#define DIAG0_GPIO_Port GPIOD
|
#define T_CS_GPIO_Port GPIOB
|
||||||
#define DIAG1_Pin LL_GPIO_PIN_5
|
#define NRF_CE_Pin LL_GPIO_PIN_6
|
||||||
#define DIAG1_GPIO_Port GPIOD
|
#define NRF_CE_GPIO_Port GPIOB
|
||||||
#define DIAG2_Pin LL_GPIO_PIN_6
|
#define NRF_CS_Pin LL_GPIO_PIN_7
|
||||||
#define DIAG2_GPIO_Port GPIOD
|
#define NRF_CS_GPIO_Port GPIOB
|
||||||
#define DIAG3_Pin LL_GPIO_PIN_7
|
#define NRF_IRQ_Pin LL_GPIO_PIN_8
|
||||||
#define DIAG3_GPIO_Port GPIOD
|
#define NRF_IRQ_GPIO_Port GPIOB
|
||||||
/* USER CODE BEGIN Private defines */
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
/* USER CODE END Private defines */
|
/* USER CODE END Private defines */
|
||||||
|
|
45
Inc/sd_diskio.h
Normal file
45
Inc/sd_diskio.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file sd_diskio.h
|
||||||
|
* @brief Header for sd_diskio.c module
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Note: code generation based on sd_diskio_template.h */
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __SD_DISKIO_H
|
||||||
|
#define __SD_DISKIO_H
|
||||||
|
|
||||||
|
/* USER CODE BEGIN firstSection */
|
||||||
|
/* can be used to modify / undefine following code or add new definitions */
|
||||||
|
/* USER CODE END firstSection */
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "bsp_driver_sd.h"
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* Exported functions ------------------------------------------------------- */
|
||||||
|
extern const Diskio_drvTypeDef SD_Driver;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN lastSection */
|
||||||
|
/* can be used to modify / undefine previous code or add new definitions */
|
||||||
|
/* USER CODE END lastSection */
|
||||||
|
|
||||||
|
#endif /* __SD_DISKIO_H */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
|
58
Inc/sdio.h
Normal file
58
Inc/sdio.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* File Name : SDIO.h
|
||||||
|
* Description : This file provides code for the configuration
|
||||||
|
* of the SDIO instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __sdio_H
|
||||||
|
#define __sdio_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern SD_HandleTypeDef hsd;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_SDIO_SD_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /*__ sdio_H */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -9,10 +9,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -35,6 +35,7 @@
|
||||||
/* USER CODE END Private defines */
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
void MX_SPI1_Init(void);
|
void MX_SPI1_Init(void);
|
||||||
|
void MX_SPI2_Init(void);
|
||||||
|
|
||||||
/* USER CODE BEGIN Prototypes */
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
/* #define HAL_NAND_MODULE_ENABLED */
|
/* #define HAL_NAND_MODULE_ENABLED */
|
||||||
/* #define HAL_NOR_MODULE_ENABLED */
|
/* #define HAL_NOR_MODULE_ENABLED */
|
||||||
/* #define HAL_PCCARD_MODULE_ENABLED */
|
/* #define HAL_PCCARD_MODULE_ENABLED */
|
||||||
/* #define HAL_SRAM_MODULE_ENABLED */
|
#define HAL_SRAM_MODULE_ENABLED
|
||||||
/* #define HAL_SDRAM_MODULE_ENABLED */
|
/* #define HAL_SDRAM_MODULE_ENABLED */
|
||||||
/* #define HAL_HASH_MODULE_ENABLED */
|
/* #define HAL_HASH_MODULE_ENABLED */
|
||||||
/* #define HAL_I2C_MODULE_ENABLED */
|
/* #define HAL_I2C_MODULE_ENABLED */
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
/* #define HAL_RNG_MODULE_ENABLED */
|
/* #define HAL_RNG_MODULE_ENABLED */
|
||||||
/* #define HAL_RTC_MODULE_ENABLED */
|
/* #define HAL_RTC_MODULE_ENABLED */
|
||||||
/* #define HAL_SAI_MODULE_ENABLED */
|
/* #define HAL_SAI_MODULE_ENABLED */
|
||||||
/* #define HAL_SD_MODULE_ENABLED */
|
#define HAL_SD_MODULE_ENABLED
|
||||||
/* #define HAL_MMC_MODULE_ENABLED */
|
/* #define HAL_MMC_MODULE_ENABLED */
|
||||||
/* #define HAL_SPI_MODULE_ENABLED */
|
/* #define HAL_SPI_MODULE_ENABLED */
|
||||||
/* #define HAL_TIM_MODULE_ENABLED */
|
/* #define HAL_TIM_MODULE_ENABLED */
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
/* #define HAL_IRDA_MODULE_ENABLED */
|
/* #define HAL_IRDA_MODULE_ENABLED */
|
||||||
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
/* #define HAL_SMARTCARD_MODULE_ENABLED */
|
||||||
/* #define HAL_WWDG_MODULE_ENABLED */
|
/* #define HAL_WWDG_MODULE_ENABLED */
|
||||||
/* #define HAL_PCD_MODULE_ENABLED */
|
#define HAL_PCD_MODULE_ENABLED
|
||||||
/* #define HAL_HCD_MODULE_ENABLED */
|
/* #define HAL_HCD_MODULE_ENABLED */
|
||||||
/* #define HAL_DSI_MODULE_ENABLED */
|
/* #define HAL_DSI_MODULE_ENABLED */
|
||||||
/* #define HAL_QSPI_MODULE_ENABLED */
|
/* #define HAL_QSPI_MODULE_ENABLED */
|
||||||
|
|
|
@ -56,23 +56,24 @@ void SVC_Handler(void);
|
||||||
void DebugMon_Handler(void);
|
void DebugMon_Handler(void);
|
||||||
void PendSV_Handler(void);
|
void PendSV_Handler(void);
|
||||||
void SysTick_Handler(void);
|
void SysTick_Handler(void);
|
||||||
void DMA1_Stream0_IRQHandler(void);
|
|
||||||
void DMA1_Stream1_IRQHandler(void);
|
void DMA1_Stream1_IRQHandler(void);
|
||||||
void DMA1_Stream2_IRQHandler(void);
|
void DMA1_Stream2_IRQHandler(void);
|
||||||
void DMA1_Stream3_IRQHandler(void);
|
void DMA1_Stream3_IRQHandler(void);
|
||||||
void DMA1_Stream4_IRQHandler(void);
|
void DMA1_Stream4_IRQHandler(void);
|
||||||
void DMA1_Stream5_IRQHandler(void);
|
void DMA1_Stream5_IRQHandler(void);
|
||||||
void DMA1_Stream6_IRQHandler(void);
|
void DMA1_Stream6_IRQHandler(void);
|
||||||
|
void SPI1_IRQHandler(void);
|
||||||
|
void SPI2_IRQHandler(void);
|
||||||
void USART1_IRQHandler(void);
|
void USART1_IRQHandler(void);
|
||||||
void USART2_IRQHandler(void);
|
void USART2_IRQHandler(void);
|
||||||
void USART3_IRQHandler(void);
|
void USART3_IRQHandler(void);
|
||||||
void DMA1_Stream7_IRQHandler(void);
|
|
||||||
void UART4_IRQHandler(void);
|
void UART4_IRQHandler(void);
|
||||||
void UART5_IRQHandler(void);
|
|
||||||
void DMA2_Stream0_IRQHandler(void);
|
void DMA2_Stream0_IRQHandler(void);
|
||||||
void DMA2_Stream1_IRQHandler(void);
|
void DMA2_Stream1_IRQHandler(void);
|
||||||
void DMA2_Stream2_IRQHandler(void);
|
void DMA2_Stream2_IRQHandler(void);
|
||||||
|
void DMA2_Stream3_IRQHandler(void);
|
||||||
void DMA2_Stream4_IRQHandler(void);
|
void DMA2_Stream4_IRQHandler(void);
|
||||||
|
void DMA2_Stream5_IRQHandler(void);
|
||||||
void DMA2_Stream6_IRQHandler(void);
|
void DMA2_Stream6_IRQHandler(void);
|
||||||
void DMA2_Stream7_IRQHandler(void);
|
void DMA2_Stream7_IRQHandler(void);
|
||||||
void USART6_IRQHandler(void);
|
void USART6_IRQHandler(void);
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +35,6 @@
|
||||||
/* USER CODE END Private defines */
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
void MX_UART4_Init(void);
|
void MX_UART4_Init(void);
|
||||||
void MX_UART5_Init(void);
|
|
||||||
void MX_USART1_UART_Init(void);
|
void MX_USART1_UART_Init(void);
|
||||||
void MX_USART2_UART_Init(void);
|
void MX_USART2_UART_Init(void);
|
||||||
void MX_USART3_UART_Init(void);
|
void MX_USART3_UART_Init(void);
|
||||||
|
|
58
Inc/usb_otg.h
Normal file
58
Inc/usb_otg.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* File Name : USB_OTG.h
|
||||||
|
* Description : This file provides code for the configuration
|
||||||
|
* of the USB_OTG instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __usb_otg_H
|
||||||
|
#define __usb_otg_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern PCD_HandleTypeDef hpcd_USB_OTG_FS;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_USB_OTG_FS_PCD_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /*__ usb_otg_H */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
181
Middlewares/Third_Party/FatFs/src/diskio.c
vendored
Normal file
181
Middlewares/Third_Party/FatFs/src/diskio.c
vendored
Normal file
|
@ -0,0 +1,181 @@
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
/* Low level disk I/O module skeleton for FatFs (C)ChaN, 2017 */
|
||||||
|
/* */
|
||||||
|
/* Portions COPYRIGHT 2017 STMicroelectronics */
|
||||||
|
/* Portions Copyright (C) 2017, ChaN, all right reserved */
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
/* If a working storage control module is available, it should be */
|
||||||
|
/* attached to the FatFs via a glue function rather than modifying it. */
|
||||||
|
/* This is an example of glue functions to attach various existing */
|
||||||
|
/* storage control modules to the FatFs module with a defined API. */
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted, provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistribution of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of STMicroelectronics nor the names of other
|
||||||
|
* contributors to this software may be used to endorse or promote products
|
||||||
|
* derived from this software without specific written permission.
|
||||||
|
* 4. This software, including modifications and/or derivative works of this
|
||||||
|
* software, must execute solely and exclusively on microcontroller or
|
||||||
|
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||||
|
* 5. Redistribution and use of this software other than as permitted under
|
||||||
|
* this license is void and will automatically terminate your rights under
|
||||||
|
* this license.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||||
|
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||||
|
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||||
|
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "diskio.h"
|
||||||
|
#include "ff_gen_drv.h"
|
||||||
|
|
||||||
|
#if defined ( __GNUC__ )
|
||||||
|
#ifndef __weak
|
||||||
|
#define __weak __attribute__((weak))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
extern Disk_drvTypeDef disk;
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets Disk Status
|
||||||
|
* @param pdrv: Physical drive number (0..)
|
||||||
|
* @retval DSTATUS: Operation status
|
||||||
|
*/
|
||||||
|
DSTATUS disk_status (
|
||||||
|
BYTE pdrv /* Physical drive number to identify the drive */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DSTATUS stat;
|
||||||
|
|
||||||
|
stat = disk.drv[pdrv]->disk_status(disk.lun[pdrv]);
|
||||||
|
return stat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes a Drive
|
||||||
|
* @param pdrv: Physical drive number (0..)
|
||||||
|
* @retval DSTATUS: Operation status
|
||||||
|
*/
|
||||||
|
DSTATUS disk_initialize (
|
||||||
|
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DSTATUS stat = RES_OK;
|
||||||
|
|
||||||
|
if(disk.is_initialized[pdrv] == 0)
|
||||||
|
{
|
||||||
|
disk.is_initialized[pdrv] = 1;
|
||||||
|
stat = disk.drv[pdrv]->disk_initialize(disk.lun[pdrv]);
|
||||||
|
}
|
||||||
|
return stat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reads Sector(s)
|
||||||
|
* @param pdrv: Physical drive number (0..)
|
||||||
|
* @param *buff: Data buffer to store read data
|
||||||
|
* @param sector: Sector address (LBA)
|
||||||
|
* @param count: Number of sectors to read (1..128)
|
||||||
|
* @retval DRESULT: Operation result
|
||||||
|
*/
|
||||||
|
DRESULT disk_read (
|
||||||
|
BYTE pdrv, /* Physical drive nmuber to identify the drive */
|
||||||
|
BYTE *buff, /* Data buffer to store read data */
|
||||||
|
DWORD sector, /* Sector address in LBA */
|
||||||
|
UINT count /* Number of sectors to read */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DRESULT res;
|
||||||
|
|
||||||
|
res = disk.drv[pdrv]->disk_read(disk.lun[pdrv], buff, sector, count);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Writes Sector(s)
|
||||||
|
* @param pdrv: Physical drive number (0..)
|
||||||
|
* @param *buff: Data to be written
|
||||||
|
* @param sector: Sector address (LBA)
|
||||||
|
* @param count: Number of sectors to write (1..128)
|
||||||
|
* @retval DRESULT: Operation result
|
||||||
|
*/
|
||||||
|
#if _USE_WRITE == 1
|
||||||
|
DRESULT disk_write (
|
||||||
|
BYTE pdrv, /* Physical drive nmuber to identify the drive */
|
||||||
|
const BYTE *buff, /* Data to be written */
|
||||||
|
DWORD sector, /* Sector address in LBA */
|
||||||
|
UINT count /* Number of sectors to write */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DRESULT res;
|
||||||
|
|
||||||
|
res = disk.drv[pdrv]->disk_write(disk.lun[pdrv], buff, sector, count);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif /* _USE_WRITE == 1 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief I/O control operation
|
||||||
|
* @param pdrv: Physical drive number (0..)
|
||||||
|
* @param cmd: Control code
|
||||||
|
* @param *buff: Buffer to send/receive control data
|
||||||
|
* @retval DRESULT: Operation result
|
||||||
|
*/
|
||||||
|
#if _USE_IOCTL == 1
|
||||||
|
DRESULT disk_ioctl (
|
||||||
|
BYTE pdrv, /* Physical drive nmuber (0..) */
|
||||||
|
BYTE cmd, /* Control code */
|
||||||
|
void *buff /* Buffer to send/receive control data */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DRESULT res;
|
||||||
|
|
||||||
|
res = disk.drv[pdrv]->disk_ioctl(disk.lun[pdrv], cmd, buff);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif /* _USE_IOCTL == 1 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets Time from RTC
|
||||||
|
* @param None
|
||||||
|
* @retval Time in DWORD
|
||||||
|
*/
|
||||||
|
__weak DWORD get_fattime (void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
|
80
Middlewares/Third_Party/FatFs/src/diskio.h
vendored
Normal file
80
Middlewares/Third_Party/FatFs/src/diskio.h
vendored
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/*-----------------------------------------------------------------------/
|
||||||
|
/ Low level disk interface modlue include file (C)ChaN, 2014 /
|
||||||
|
/-----------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _DISKIO_DEFINED
|
||||||
|
#define _DISKIO_DEFINED
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _USE_WRITE 1 /* 1: Enable disk_write function */
|
||||||
|
#define _USE_IOCTL 1 /* 1: Enable disk_ioctl function */
|
||||||
|
|
||||||
|
#include "integer.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Status of Disk Functions */
|
||||||
|
typedef BYTE DSTATUS;
|
||||||
|
|
||||||
|
/* Results of Disk Functions */
|
||||||
|
typedef enum {
|
||||||
|
RES_OK = 0, /* 0: Successful */
|
||||||
|
RES_ERROR, /* 1: R/W Error */
|
||||||
|
RES_WRPRT, /* 2: Write Protected */
|
||||||
|
RES_NOTRDY, /* 3: Not Ready */
|
||||||
|
RES_PARERR /* 4: Invalid Parameter */
|
||||||
|
} DRESULT;
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------*/
|
||||||
|
/* Prototypes for disk control functions */
|
||||||
|
|
||||||
|
|
||||||
|
DSTATUS disk_initialize (BYTE pdrv);
|
||||||
|
DSTATUS disk_status (BYTE pdrv);
|
||||||
|
DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
|
||||||
|
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
|
||||||
|
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||||
|
DWORD get_fattime (void);
|
||||||
|
|
||||||
|
/* Disk Status Bits (DSTATUS) */
|
||||||
|
|
||||||
|
#define STA_NOINIT 0x01 /* Drive not initialized */
|
||||||
|
#define STA_NODISK 0x02 /* No medium in the drive */
|
||||||
|
#define STA_PROTECT 0x04 /* Write protected */
|
||||||
|
|
||||||
|
|
||||||
|
/* Command code for disk_ioctrl fucntion */
|
||||||
|
|
||||||
|
/* Generic command (Used by FatFs) */
|
||||||
|
#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
|
||||||
|
#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
|
||||||
|
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
|
||||||
|
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
|
||||||
|
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
|
||||||
|
|
||||||
|
/* Generic command (Not used by FatFs) */
|
||||||
|
#define CTRL_POWER 5 /* Get/Set power status */
|
||||||
|
#define CTRL_LOCK 6 /* Lock/Unlock media removal */
|
||||||
|
#define CTRL_EJECT 7 /* Eject media */
|
||||||
|
#define CTRL_FORMAT 8 /* Create physical format on the media */
|
||||||
|
|
||||||
|
/* MMC/SDC specific ioctl command */
|
||||||
|
#define MMC_GET_TYPE 10 /* Get card type */
|
||||||
|
#define MMC_GET_CSD 11 /* Get CSD */
|
||||||
|
#define MMC_GET_CID 12 /* Get CID */
|
||||||
|
#define MMC_GET_OCR 13 /* Get OCR */
|
||||||
|
#define MMC_GET_SDSTAT 14 /* Get SD status */
|
||||||
|
|
||||||
|
/* ATA/CF specific ioctl command */
|
||||||
|
#define ATA_GET_REV 20 /* Get F/W revision */
|
||||||
|
#define ATA_GET_MODEL 21 /* Get model name */
|
||||||
|
#define ATA_GET_SN 22 /* Get serial number */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
6140
Middlewares/Third_Party/FatFs/src/ff.c
vendored
Normal file
6140
Middlewares/Third_Party/FatFs/src/ff.c
vendored
Normal file
File diff suppressed because it is too large
Load diff
361
Middlewares/Third_Party/FatFs/src/ff.h
vendored
Normal file
361
Middlewares/Third_Party/FatFs/src/ff.h
vendored
Normal file
|
@ -0,0 +1,361 @@
|
||||||
|
/*----------------------------------------------------------------------------/
|
||||||
|
/ FatFs - Generic FAT file system module R0.12c /
|
||||||
|
/-----------------------------------------------------------------------------/
|
||||||
|
/
|
||||||
|
/ Copyright (C) 2017, ChaN, all right reserved.
|
||||||
|
/
|
||||||
|
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
||||||
|
/ source and binary forms, with or without modification, are permitted provided
|
||||||
|
/ that the following condition is met:
|
||||||
|
|
||||||
|
/ 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
/ this condition and the following disclaimer.
|
||||||
|
/
|
||||||
|
/ This software is provided by the copyright holder and contributors "AS IS"
|
||||||
|
/ and any warranties related to this software are DISCLAIMED.
|
||||||
|
/ The copyright owner or contributors be NOT LIABLE for any damages caused
|
||||||
|
/ by use of this software.
|
||||||
|
/----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _FATFS
|
||||||
|
#define _FATFS 68300 /* Revision ID */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "integer.h" /* Basic integer types */
|
||||||
|
#include "ffconf.h" /* FatFs configuration options */
|
||||||
|
|
||||||
|
#if _FATFS != _FFCONF
|
||||||
|
#error Wrong configuration file (ffconf.h).
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Definitions of volume management */
|
||||||
|
|
||||||
|
#if _MULTI_PARTITION /* Multiple partition configuration */
|
||||||
|
typedef struct {
|
||||||
|
BYTE pd; /* Physical drive number */
|
||||||
|
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
|
||||||
|
} PARTITION;
|
||||||
|
extern PARTITION VolToPart[]; /* Volume - Partition resolution table */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Type of path name strings on FatFs API */
|
||||||
|
|
||||||
|
#if _LFN_UNICODE /* Unicode (UTF-16) string */
|
||||||
|
#if _USE_LFN == 0
|
||||||
|
#error _LFN_UNICODE must be 0 at non-LFN cfg.
|
||||||
|
#endif
|
||||||
|
#ifndef _INC_TCHAR
|
||||||
|
typedef WCHAR TCHAR;
|
||||||
|
#define _T(x) L ## x
|
||||||
|
#define _TEXT(x) L ## x
|
||||||
|
#endif
|
||||||
|
#else /* ANSI/OEM string */
|
||||||
|
#ifndef _INC_TCHAR
|
||||||
|
typedef char TCHAR;
|
||||||
|
#define _T(x) x
|
||||||
|
#define _TEXT(x) x
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Type of file size variables */
|
||||||
|
|
||||||
|
#if _FS_EXFAT
|
||||||
|
#if _USE_LFN == 0
|
||||||
|
#error LFN must be enabled when enable exFAT
|
||||||
|
#endif
|
||||||
|
typedef QWORD FSIZE_t;
|
||||||
|
#else
|
||||||
|
typedef DWORD FSIZE_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* File system object structure (FATFS) */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
BYTE fs_type; /* File system type (0:N/A) */
|
||||||
|
BYTE drv; /* Physical drive number */
|
||||||
|
BYTE n_fats; /* Number of FATs (1 or 2) */
|
||||||
|
BYTE wflag; /* win[] flag (b0:dirty) */
|
||||||
|
BYTE fsi_flag; /* FSINFO flags (b7:disabled, b0:dirty) */
|
||||||
|
WORD id; /* File system mount ID */
|
||||||
|
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
|
||||||
|
WORD csize; /* Cluster size [sectors] */
|
||||||
|
#if _MAX_SS != _MIN_SS
|
||||||
|
WORD ssize; /* Sector size (512, 1024, 2048 or 4096) */
|
||||||
|
#endif
|
||||||
|
#if _USE_LFN != 0
|
||||||
|
WCHAR* lfnbuf; /* LFN working buffer */
|
||||||
|
#endif
|
||||||
|
#if _FS_EXFAT
|
||||||
|
BYTE* dirbuf; /* Directory entry block scratchpad buffer */
|
||||||
|
#endif
|
||||||
|
#if _FS_REENTRANT
|
||||||
|
_SYNC_t sobj; /* Identifier of sync object */
|
||||||
|
#endif
|
||||||
|
#if !_FS_READONLY
|
||||||
|
DWORD last_clst; /* Last allocated cluster */
|
||||||
|
DWORD free_clst; /* Number of free clusters */
|
||||||
|
#endif
|
||||||
|
#if _FS_RPATH != 0
|
||||||
|
DWORD cdir; /* Current directory start cluster (0:root) */
|
||||||
|
#if _FS_EXFAT
|
||||||
|
DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */
|
||||||
|
DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */
|
||||||
|
DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
DWORD n_fatent; /* Number of FAT entries (number of clusters + 2) */
|
||||||
|
DWORD fsize; /* Size of an FAT [sectors] */
|
||||||
|
DWORD volbase; /* Volume base sector */
|
||||||
|
DWORD fatbase; /* FAT base sector */
|
||||||
|
DWORD dirbase; /* Root directory base sector/cluster */
|
||||||
|
DWORD database; /* Data base sector */
|
||||||
|
DWORD winsect; /* Current sector appearing in the win[] */
|
||||||
|
BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
|
||||||
|
} FATFS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Object ID and allocation information (_FDID) */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
FATFS* fs; /* Pointer to the owner file system object */
|
||||||
|
WORD id; /* Owner file system mount ID */
|
||||||
|
BYTE attr; /* Object attribute */
|
||||||
|
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous (no data on FAT), =3:flagmented in this session, b2:sub-directory stretched) */
|
||||||
|
DWORD sclust; /* Object start cluster (0:no cluster or root directory) */
|
||||||
|
FSIZE_t objsize; /* Object size (valid when sclust != 0) */
|
||||||
|
#if _FS_EXFAT
|
||||||
|
DWORD n_cont; /* Size of first fragment, clusters - 1 (valid when stat == 3) */
|
||||||
|
DWORD n_frag; /* Size of last fragment needs to be written (valid when not zero) */
|
||||||
|
DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */
|
||||||
|
DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
|
||||||
|
DWORD c_ofs; /* Offset in the containing directory (valid when sclust != 0 and non-directory object) */
|
||||||
|
#endif
|
||||||
|
#if _FS_LOCK != 0
|
||||||
|
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
|
||||||
|
#endif
|
||||||
|
} _FDID;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* File object structure (FIL) */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
_FDID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */
|
||||||
|
BYTE flag; /* File status flags */
|
||||||
|
BYTE err; /* Abort flag (error code) */
|
||||||
|
FSIZE_t fptr; /* File read/write pointer (Zeroed on file open) */
|
||||||
|
DWORD clust; /* Current cluster of fpter (invalid when fptr is 0) */
|
||||||
|
DWORD sect; /* Sector number appearing in buf[] (0:invalid) */
|
||||||
|
#if !_FS_READONLY
|
||||||
|
DWORD dir_sect; /* Sector number containing the directory entry */
|
||||||
|
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] */
|
||||||
|
#endif
|
||||||
|
#if _USE_FASTSEEK
|
||||||
|
DWORD* cltbl; /* Pointer to the cluster link map table (nulled on open, set by application) */
|
||||||
|
#endif
|
||||||
|
#if !_FS_TINY
|
||||||
|
BYTE buf[_MAX_SS]; /* File private data read/write window */
|
||||||
|
#endif
|
||||||
|
} FIL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Directory object structure (DIR) */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
_FDID obj; /* Object identifier */
|
||||||
|
DWORD dptr; /* Current read/write offset */
|
||||||
|
DWORD clust; /* Current cluster */
|
||||||
|
DWORD sect; /* Current sector (0:Read operation has terminated) */
|
||||||
|
BYTE* dir; /* Pointer to the directory item in the win[] */
|
||||||
|
BYTE fn[12]; /* SFN (in/out) {body[8],ext[3],status[1]} */
|
||||||
|
#if _USE_LFN != 0
|
||||||
|
DWORD blk_ofs; /* Offset of current entry block being processed (0xFFFFFFFF:Invalid) */
|
||||||
|
#endif
|
||||||
|
#if _USE_FIND
|
||||||
|
const TCHAR* pat; /* Pointer to the name matching pattern */
|
||||||
|
#endif
|
||||||
|
} DIR;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* File information structure (FILINFO) */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
FSIZE_t fsize; /* File size */
|
||||||
|
WORD fdate; /* Modified date */
|
||||||
|
WORD ftime; /* Modified time */
|
||||||
|
BYTE fattrib; /* File attribute */
|
||||||
|
#if _USE_LFN != 0
|
||||||
|
TCHAR altname[13]; /* Alternative file name */
|
||||||
|
TCHAR fname[_MAX_LFN + 1]; /* Primary file name */
|
||||||
|
#else
|
||||||
|
TCHAR fname[13]; /* File name */
|
||||||
|
#endif
|
||||||
|
} FILINFO;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* File function return code (FRESULT) */
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FR_OK = 0, /* (0) Succeeded */
|
||||||
|
FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
|
||||||
|
FR_INT_ERR, /* (2) Assertion failed */
|
||||||
|
FR_NOT_READY, /* (3) The physical drive cannot work */
|
||||||
|
FR_NO_FILE, /* (4) Could not find the file */
|
||||||
|
FR_NO_PATH, /* (5) Could not find the path */
|
||||||
|
FR_INVALID_NAME, /* (6) The path name format is invalid */
|
||||||
|
FR_DENIED, /* (7) Access denied due to prohibited access or directory full */
|
||||||
|
FR_EXIST, /* (8) Access denied due to prohibited access */
|
||||||
|
FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
|
||||||
|
FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
|
||||||
|
FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
|
||||||
|
FR_NOT_ENABLED, /* (12) The volume has no work area */
|
||||||
|
FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
|
||||||
|
FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any problem */
|
||||||
|
FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
|
||||||
|
FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
|
||||||
|
FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
|
||||||
|
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_LOCK */
|
||||||
|
FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
|
||||||
|
} FRESULT;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------*/
|
||||||
|
/* FatFs module application interface */
|
||||||
|
|
||||||
|
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
|
||||||
|
FRESULT f_close (FIL* fp); /* Close an open file object */
|
||||||
|
FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */
|
||||||
|
FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */
|
||||||
|
FRESULT f_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */
|
||||||
|
FRESULT f_truncate (FIL* fp); /* Truncate the file */
|
||||||
|
FRESULT f_sync (FIL* fp); /* Flush cached data of the writing file */
|
||||||
|
FRESULT f_opendir (DIR* dp, const TCHAR* path); /* Open a directory */
|
||||||
|
FRESULT f_closedir (DIR* dp); /* Close an open directory */
|
||||||
|
FRESULT f_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */
|
||||||
|
FRESULT f_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */
|
||||||
|
FRESULT f_findnext (DIR* dp, FILINFO* fno); /* Find next file */
|
||||||
|
FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */
|
||||||
|
FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */
|
||||||
|
FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
|
||||||
|
FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */
|
||||||
|
FRESULT f_chmod (const TCHAR* path, BYTE attr, BYTE mask); /* Change attribute of a file/dir */
|
||||||
|
FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change timestamp of a file/dir */
|
||||||
|
FRESULT f_chdir (const TCHAR* path); /* Change current directory */
|
||||||
|
FRESULT f_chdrive (const TCHAR* path); /* Change current drive */
|
||||||
|
FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */
|
||||||
|
FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
|
||||||
|
FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */
|
||||||
|
FRESULT f_setlabel (const TCHAR* label); /* Set volume label */
|
||||||
|
FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */
|
||||||
|
FRESULT f_expand (FIL* fp, FSIZE_t szf, BYTE opt); /* Allocate a contiguous block to the file */
|
||||||
|
FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */
|
||||||
|
FRESULT f_mkfs (const TCHAR* path, BYTE opt, DWORD au, void* work, UINT len); /* Create a FAT volume */
|
||||||
|
FRESULT f_fdisk (BYTE pdrv, const DWORD* szt, void* work); /* Divide a physical drive into some partitions */
|
||||||
|
int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */
|
||||||
|
int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */
|
||||||
|
int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
|
||||||
|
TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
|
||||||
|
|
||||||
|
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
|
||||||
|
#define f_error(fp) ((fp)->err)
|
||||||
|
#define f_tell(fp) ((fp)->fptr)
|
||||||
|
#define f_size(fp) ((fp)->obj.objsize)
|
||||||
|
#define f_rewind(fp) f_lseek((fp), 0)
|
||||||
|
#define f_rewinddir(dp) f_readdir((dp), 0)
|
||||||
|
#define f_rmdir(path) f_unlink(path)
|
||||||
|
|
||||||
|
#ifndef EOF
|
||||||
|
#define EOF (-1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------*/
|
||||||
|
/* Additional user defined functions */
|
||||||
|
|
||||||
|
/* RTC function */
|
||||||
|
#if !_FS_READONLY && !_FS_NORTC
|
||||||
|
DWORD get_fattime (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Unicode support functions */
|
||||||
|
#if _USE_LFN != 0 /* Unicode - OEM code conversion */
|
||||||
|
WCHAR ff_convert (WCHAR chr, UINT dir); /* OEM-Unicode bidirectional conversion */
|
||||||
|
WCHAR ff_wtoupper (WCHAR chr); /* Unicode upper-case conversion */
|
||||||
|
#if _USE_LFN == 3 /* Memory functions */
|
||||||
|
void* ff_memalloc (UINT msize); /* Allocate memory block */
|
||||||
|
void ff_memfree (void* mblock); /* Free memory block */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Sync functions */
|
||||||
|
#if _FS_REENTRANT
|
||||||
|
int ff_cre_syncobj (BYTE vol, _SYNC_t* sobj); /* Create a sync object */
|
||||||
|
int ff_req_grant (_SYNC_t sobj); /* Lock sync object */
|
||||||
|
void ff_rel_grant (_SYNC_t sobj); /* Unlock sync object */
|
||||||
|
int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------*/
|
||||||
|
/* Flags and offset address */
|
||||||
|
|
||||||
|
|
||||||
|
/* File access mode and open method flags (3rd argument of f_open) */
|
||||||
|
#define FA_READ 0x01
|
||||||
|
#define FA_WRITE 0x02
|
||||||
|
#define FA_OPEN_EXISTING 0x00
|
||||||
|
#define FA_CREATE_NEW 0x04
|
||||||
|
#define FA_CREATE_ALWAYS 0x08
|
||||||
|
#define FA_OPEN_ALWAYS 0x10
|
||||||
|
#define FA_OPEN_APPEND 0x30
|
||||||
|
|
||||||
|
/* Fast seek controls (2nd argument of f_lseek) */
|
||||||
|
#define CREATE_LINKMAP ((FSIZE_t)0 - 1)
|
||||||
|
|
||||||
|
/* Format options (2nd argument of f_mkfs) */
|
||||||
|
#define FM_FAT 0x01
|
||||||
|
#define FM_FAT32 0x02
|
||||||
|
#define FM_EXFAT 0x04
|
||||||
|
#define FM_ANY 0x07
|
||||||
|
#define FM_SFD 0x08
|
||||||
|
|
||||||
|
/* Filesystem type (FATFS.fs_type) */
|
||||||
|
#define FS_FAT12 1
|
||||||
|
#define FS_FAT16 2
|
||||||
|
#define FS_FAT32 3
|
||||||
|
#define FS_EXFAT 4
|
||||||
|
|
||||||
|
/* File attribute bits for directory entry (FILINFO.fattrib) */
|
||||||
|
#define AM_RDO 0x01 /* Read only */
|
||||||
|
#define AM_HID 0x02 /* Hidden */
|
||||||
|
#define AM_SYS 0x04 /* System */
|
||||||
|
#define AM_DIR 0x10 /* Directory */
|
||||||
|
#define AM_ARC 0x20 /* Archive */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _FATFS */
|
124
Middlewares/Third_Party/FatFs/src/ff_gen_drv.c
vendored
Normal file
124
Middlewares/Third_Party/FatFs/src/ff_gen_drv.c
vendored
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file ff_gen_drv.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief FatFs generic low level driver.
|
||||||
|
*****************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "ff_gen_drv.h"
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
Disk_drvTypeDef disk = {{0},{0},{0},0};
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Links a compatible diskio driver/lun id and increments the number of active
|
||||||
|
* linked drivers.
|
||||||
|
* @note The number of linked drivers (volumes) is up to 10 due to FatFs limits.
|
||||||
|
* @param drv: pointer to the disk IO Driver structure
|
||||||
|
* @param path: pointer to the logical drive path
|
||||||
|
* @param lun : only used for USB Key Disk to add multi-lun management
|
||||||
|
else the parameter must be equal to 0
|
||||||
|
* @retval Returns 0 in case of success, otherwise 1.
|
||||||
|
*/
|
||||||
|
uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, uint8_t lun)
|
||||||
|
{
|
||||||
|
uint8_t ret = 1;
|
||||||
|
uint8_t DiskNum = 0;
|
||||||
|
|
||||||
|
if(disk.nbr < _VOLUMES)
|
||||||
|
{
|
||||||
|
disk.is_initialized[disk.nbr] = 0;
|
||||||
|
disk.drv[disk.nbr] = drv;
|
||||||
|
disk.lun[disk.nbr] = lun;
|
||||||
|
DiskNum = disk.nbr++;
|
||||||
|
path[0] = DiskNum + '0';
|
||||||
|
path[1] = ':';
|
||||||
|
path[2] = '/';
|
||||||
|
path[3] = 0;
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Links a compatible diskio driver and increments the number of active
|
||||||
|
* linked drivers.
|
||||||
|
* @note The number of linked drivers (volumes) is up to 10 due to FatFs limits
|
||||||
|
* @param drv: pointer to the disk IO Driver structure
|
||||||
|
* @param path: pointer to the logical drive path
|
||||||
|
* @retval Returns 0 in case of success, otherwise 1.
|
||||||
|
*/
|
||||||
|
uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path)
|
||||||
|
{
|
||||||
|
return FATFS_LinkDriverEx(drv, path, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unlinks a diskio driver and decrements the number of active linked
|
||||||
|
* drivers.
|
||||||
|
* @param path: pointer to the logical drive path
|
||||||
|
* @param lun : not used
|
||||||
|
* @retval Returns 0 in case of success, otherwise 1.
|
||||||
|
*/
|
||||||
|
uint8_t FATFS_UnLinkDriverEx(char *path, uint8_t lun)
|
||||||
|
{
|
||||||
|
uint8_t DiskNum = 0;
|
||||||
|
uint8_t ret = 1;
|
||||||
|
|
||||||
|
if(disk.nbr >= 1)
|
||||||
|
{
|
||||||
|
DiskNum = path[0] - '0';
|
||||||
|
if(disk.drv[DiskNum] != 0)
|
||||||
|
{
|
||||||
|
disk.drv[DiskNum] = 0;
|
||||||
|
disk.lun[DiskNum] = 0;
|
||||||
|
disk.nbr--;
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unlinks a diskio driver and decrements the number of active linked
|
||||||
|
* drivers.
|
||||||
|
* @param path: pointer to the logical drive path
|
||||||
|
* @retval Returns 0 in case of success, otherwise 1.
|
||||||
|
*/
|
||||||
|
uint8_t FATFS_UnLinkDriver(char *path)
|
||||||
|
{
|
||||||
|
return FATFS_UnLinkDriverEx(path, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets number of linked drivers to the FatFs module.
|
||||||
|
* @param None
|
||||||
|
* @retval Number of attached drivers.
|
||||||
|
*/
|
||||||
|
uint8_t FATFS_GetAttachedDriversNbr(void)
|
||||||
|
{
|
||||||
|
return disk.nbr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
|
82
Middlewares/Third_Party/FatFs/src/ff_gen_drv.h
vendored
Normal file
82
Middlewares/Third_Party/FatFs/src/ff_gen_drv.h
vendored
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file ff_gen_drv.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header for ff_gen_drv.c module.
|
||||||
|
*****************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __FF_GEN_DRV_H
|
||||||
|
#define __FF_GEN_DRV_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "diskio.h"
|
||||||
|
#include "ff.h"
|
||||||
|
#include "stdint.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disk IO Driver structure definition
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
DSTATUS (*disk_initialize) (BYTE); /*!< Initialize Disk Drive */
|
||||||
|
DSTATUS (*disk_status) (BYTE); /*!< Get Disk Status */
|
||||||
|
DRESULT (*disk_read) (BYTE, BYTE*, DWORD, UINT); /*!< Read Sector(s) */
|
||||||
|
#if _USE_WRITE == 1
|
||||||
|
DRESULT (*disk_write) (BYTE, const BYTE*, DWORD, UINT); /*!< Write Sector(s) when _USE_WRITE = 0 */
|
||||||
|
#endif /* _USE_WRITE == 1 */
|
||||||
|
#if _USE_IOCTL == 1
|
||||||
|
DRESULT (*disk_ioctl) (BYTE, BYTE, void*); /*!< I/O control operation when _USE_IOCTL = 1 */
|
||||||
|
#endif /* _USE_IOCTL == 1 */
|
||||||
|
|
||||||
|
}Diskio_drvTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Global Disk IO Drivers structure definition
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t is_initialized[_VOLUMES];
|
||||||
|
const Diskio_drvTypeDef *drv[_VOLUMES];
|
||||||
|
uint8_t lun[_VOLUMES];
|
||||||
|
volatile uint8_t nbr;
|
||||||
|
|
||||||
|
}Disk_drvTypeDef;
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* Exported functions ------------------------------------------------------- */
|
||||||
|
uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path);
|
||||||
|
uint8_t FATFS_UnLinkDriver(char *path);
|
||||||
|
uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, BYTE lun);
|
||||||
|
uint8_t FATFS_UnLinkDriverEx(char *path, BYTE lun);
|
||||||
|
uint8_t FATFS_GetAttachedDriversNbr(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __FF_GEN_DRV_H */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
|
38
Middlewares/Third_Party/FatFs/src/integer.h
vendored
Normal file
38
Middlewares/Third_Party/FatFs/src/integer.h
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*-------------------------------------------*/
|
||||||
|
/* Integer type definitions for FatFs module */
|
||||||
|
/*-------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _FF_INTEGER
|
||||||
|
#define _FF_INTEGER
|
||||||
|
|
||||||
|
#ifdef _WIN32 /* FatFs development platform */
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
typedef unsigned __int64 QWORD;
|
||||||
|
|
||||||
|
|
||||||
|
#else /* Embedded platform */
|
||||||
|
|
||||||
|
/* These types MUST be 16-bit or 32-bit */
|
||||||
|
typedef int INT;
|
||||||
|
typedef unsigned int UINT;
|
||||||
|
|
||||||
|
/* This type MUST be 8-bit */
|
||||||
|
typedef unsigned char BYTE;
|
||||||
|
|
||||||
|
/* These types MUST be 16-bit */
|
||||||
|
typedef short SHORT;
|
||||||
|
typedef unsigned short WORD;
|
||||||
|
typedef unsigned short WCHAR;
|
||||||
|
|
||||||
|
/* These types MUST be 32-bit */
|
||||||
|
typedef long LONG;
|
||||||
|
typedef unsigned long DWORD;
|
||||||
|
|
||||||
|
/* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */
|
||||||
|
typedef unsigned long long QWORD;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
388
Middlewares/Third_Party/FatFs/src/option/ccsbcs.c
vendored
Normal file
388
Middlewares/Third_Party/FatFs/src/option/ccsbcs.c
vendored
Normal file
|
@ -0,0 +1,388 @@
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* Unicode - Local code bidirectional converter (C)ChaN, 2015 */
|
||||||
|
/* (SBCS code pages) */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* 437 U.S.
|
||||||
|
/ 720 Arabic
|
||||||
|
/ 737 Greek
|
||||||
|
/ 771 KBL
|
||||||
|
/ 775 Baltic
|
||||||
|
/ 850 Latin 1
|
||||||
|
/ 852 Latin 2
|
||||||
|
/ 855 Cyrillic
|
||||||
|
/ 857 Turkish
|
||||||
|
/ 860 Portuguese
|
||||||
|
/ 861 Icelandic
|
||||||
|
/ 862 Hebrew
|
||||||
|
/ 863 Canadian French
|
||||||
|
/ 864 Arabic
|
||||||
|
/ 865 Nordic
|
||||||
|
/ 866 Russian
|
||||||
|
/ 869 Greek 2
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../ff.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if _CODE_PAGE == 437
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP437(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
|
||||||
|
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
|
||||||
|
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||||
|
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||||
|
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
|
||||||
|
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 720
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP720(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x0000, 0x0000, 0x00E9, 0x00E2, 0x0000, 0x00E0, 0x0000, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0000, 0x0000, 0x0000,
|
||||||
|
0x0000, 0x0651, 0x0652, 0x00F4, 0x00A4, 0x0640, 0x00FB, 0x00F9, 0x0621, 0x0622, 0x0623, 0x0624, 0x00A3, 0x0625, 0x0626, 0x0627,
|
||||||
|
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||||
|
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||||
|
0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x0641, 0x00B5, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A,
|
||||||
|
0x2261, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0x0650, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 737
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP737(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0,
|
||||||
|
0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8,
|
||||||
|
0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||||
|
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||||
|
0x03C9, 0x03AC, 0x03AD, 0x03AE, 0x03CA, 0x03AF, 0x03CC, 0x03CD, 0x03CB, 0x03CE, 0x0386, 0x0388, 0x0389, 0x038A, 0x038C, 0x038E,
|
||||||
|
0x038F, 0x00B1, 0x2265, 0x2264, 0x03AA, 0x03AB, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 771
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP771(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
|
||||||
|
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
|
||||||
|
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x2558, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||||
|
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x0104, 0x0105, 0x010C, 0x010D,
|
||||||
|
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
|
||||||
|
0x0118, 0x0119, 0x0116, 0x0117, 0x012E, 0x012F, 0x0160, 0x0161, 0x0172, 0x0173, 0x016A, 0x016B, 0x017D, 0x017E, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 775
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP775(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x0106, 0x00FC, 0x00E9, 0x0101, 0x00E4, 0x0123, 0x00E5, 0x0107, 0x0142, 0x0113, 0x0156, 0x0157, 0x012B, 0x0179, 0x00C4, 0x00C5,
|
||||||
|
0x00C9, 0x00E6, 0x00C6, 0x014D, 0x00F6, 0x0122, 0x00A2, 0x015A, 0x015B, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x00A4,
|
||||||
|
0x0100, 0x012A, 0x00F3, 0x017B, 0x017C, 0x017A, 0x201D, 0x00A6, 0x00A9, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x0141, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0104, 0x010C, 0x0118, 0x0116, 0x2563, 0x2551, 0x2557, 0x255D, 0x012E, 0x0160, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0172, 0x016A, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x017D,
|
||||||
|
0x0105, 0x010D, 0x0119, 0x0117, 0x012F, 0x0161, 0x0173, 0x016B, 0x017E, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||||
|
0x00D3, 0x00DF, 0x014C, 0x0143, 0x00F5, 0x00D5, 0x00B5, 0x0144, 0x0136, 0x0137, 0x013B, 0x013C, 0x0146, 0x0112, 0x0145, 0x2019,
|
||||||
|
0x00AD, 0x00B1, 0x201C, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x201E, 0x00B0, 0x2219, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 850
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP850(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
|
||||||
|
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
|
||||||
|
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||||
|
0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
|
||||||
|
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
|
||||||
|
0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 852
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP852(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x016F, 0x0107, 0x00E7, 0x0142, 0x00EB, 0x0150, 0x0151, 0x00EE, 0x0179, 0x00C4, 0x0106,
|
||||||
|
0x00C9, 0x0139, 0x013A, 0x00F4, 0x00F6, 0x013D, 0x013E, 0x015A, 0x015B, 0x00D6, 0x00DC, 0x0164, 0x0165, 0x0141, 0x00D7, 0x010D,
|
||||||
|
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x0104, 0x0105, 0x017D, 0x017E, 0x0118, 0x0119, 0x00AC, 0x017A, 0x010C, 0x015F, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x011A, 0x015E, 0x2563, 0x2551, 0x2557, 0x255D, 0x017B, 0x017C, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0102, 0x0103, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||||
|
0x0111, 0x0110, 0x010E, 0x00CB, 0x010F, 0x0147, 0x00CD, 0x00CE, 0x011B, 0x2518, 0x250C, 0x2588, 0x2584, 0x0162, 0x016E, 0x2580,
|
||||||
|
0x00D3, 0x00DF, 0x00D4, 0x0143, 0x0144, 0x0148, 0x0160, 0x0161, 0x0154, 0x00DA, 0x0155, 0x0170, 0x00FD, 0x00DD, 0x0163, 0x00B4,
|
||||||
|
0x00AD, 0x02DD, 0x02DB, 0x02C7, 0x02D8, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x02D9, 0x0171, 0x0158, 0x0159, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 855
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP855(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x0452, 0x0402, 0x0453, 0x0403, 0x0451, 0x0401, 0x0454, 0x0404, 0x0455, 0x0405, 0x0456, 0x0406, 0x0457, 0x0407, 0x0458, 0x0408,
|
||||||
|
0x0459, 0x0409, 0x045A, 0x040A, 0x045B, 0x040B, 0x045C, 0x040C, 0x045E, 0x040E, 0x045F, 0x040F, 0x044E, 0x042E, 0x044A, 0x042A,
|
||||||
|
0x0430, 0x0410, 0x0431, 0x0411, 0x0446, 0x0426, 0x0434, 0x0414, 0x0435, 0x0415, 0x0444, 0x0424, 0x0433, 0x0413, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0445, 0x0425, 0x0438, 0x0418, 0x2563, 0x2551, 0x2557, 0x255D, 0x0439, 0x0419, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x043A, 0x041A, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||||
|
0x043B, 0x041B, 0x043C, 0x041C, 0x043D, 0x041D, 0x043E, 0x041E, 0x043F, 0x2518, 0x250C, 0x2588, 0x2584, 0x041F, 0x044F, 0x2580,
|
||||||
|
0x042F, 0x0440, 0x0420, 0x0441, 0x0421, 0x0442, 0x0422, 0x0443, 0x0423, 0x0436, 0x0416, 0x0432, 0x0412, 0x044C, 0x042C, 0x2116,
|
||||||
|
0x00AD, 0x044B, 0x042B, 0x0437, 0x0417, 0x0448, 0x0428, 0x044D, 0x042D, 0x0449, 0x0429, 0x0447, 0x0427, 0x00A7, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 857
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP857(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0131, 0x00C4, 0x00C5,
|
||||||
|
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x0130, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x015E, 0x015F,
|
||||||
|
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x011E, 0x011F, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||||
|
0x00BA, 0x00AA, 0x00CA, 0x00CB, 0x00C8, 0x0000, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
|
||||||
|
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x0000, 0x00D7, 0x00DA, 0x00DB, 0x00D9, 0x00EC, 0x00FF, 0x00AF, 0x00B4,
|
||||||
|
0x00AD, 0x00B1, 0x0000, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 860
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP860(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E3, 0x00E0, 0x00C1, 0x00E7, 0x00EA, 0x00CA, 0x00E8, 0x00CD, 0x00D4, 0x00EC, 0x00C3, 0x00C2,
|
||||||
|
0x00C9, 0x00C0, 0x00C8, 0x00F4, 0x00F5, 0x00F2, 0x00DA, 0x00F9, 0x00CC, 0x00D5, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x20A7, 0x00D3,
|
||||||
|
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00D2, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x2558, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||||
|
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||||
|
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
|
||||||
|
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 861
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP861(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00D0, 0x00F0, 0x00DE, 0x00C4, 0x00C5,
|
||||||
|
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00FE, 0x00FB, 0x00DD, 0x00FD, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
|
||||||
|
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00C1, 0x00CD, 0x00D3, 0x00DA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||||
|
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||||
|
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
|
||||||
|
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 862
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP862(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
|
||||||
|
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
|
||||||
|
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||||
|
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||||
|
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
|
||||||
|
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 863
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP863(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00C2, 0x00E0, 0x00B6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x2017, 0x00C0,
|
||||||
|
0x00C9, 0x00C8, 0x00CA, 0x00F4, 0x00CB, 0x00CF, 0x00FB, 0x00F9, 0x00A4, 0x00D4, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x00DB, 0x0192,
|
||||||
|
0x00A6, 0x00B4, 0x00F3, 0x00FA, 0x00A8, 0x00BB, 0x00B3, 0x00AF, 0x00CE, 0x3210, 0x00AC, 0x00BD, 0x00BC, 0x00BE, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||||
|
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||||
|
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2219,
|
||||||
|
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 864
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP864(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x00B0, 0x00B7, 0x2219, 0x221A, 0x2592, 0x2500, 0x2502, 0x253C, 0x2524, 0x252C, 0x251C, 0x2534, 0x2510, 0x250C, 0x2514, 0x2518,
|
||||||
|
0x03B2, 0x221E, 0x03C6, 0x00B1, 0x00BD, 0x00BC, 0x2248, 0x00AB, 0x00BB, 0xFEF7, 0xFEF8, 0x0000, 0x0000, 0xFEFB, 0xFEFC, 0x0000,
|
||||||
|
0x00A0, 0x00AD, 0xFE82, 0x00A3, 0x00A4, 0xFE84, 0x0000, 0x20AC, 0xFE8E, 0xFE8F, 0xFE95, 0xFE99, 0x060C, 0xFE9D, 0xFEA1, 0xFEA5,
|
||||||
|
0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669, 0xFED1, 0x061B, 0xFEB1, 0xFEB5, 0xFEB9, 0x061F,
|
||||||
|
0x00A2, 0xFE80, 0xFE81, 0xFE83, 0xFE85, 0xFECA, 0xFE8B, 0xFE8D, 0xFE91, 0xFE93, 0xFE97, 0xFE9B, 0xFE9F, 0xFEA3, 0xFEA7, 0xFEA9,
|
||||||
|
0xFEAB, 0xFEAD, 0xFEAF, 0xFEB3, 0xFEB7, 0xFEBB, 0xFEBF, 0xFEC1, 0xFEC5, 0xFECB, 0xFECF, 0x00A6, 0x00AC, 0x00F7, 0x00D7, 0xFEC9,
|
||||||
|
0x0640, 0xFED3, 0xFED7, 0xFEDB, 0xFEDF, 0xFEE3, 0xFEE7, 0xFEEB, 0xFEED, 0xFEEF, 0xFEF3, 0xFEBD, 0xFECC, 0xFECE, 0xFECD, 0xFEE1,
|
||||||
|
0xFE7D, 0x0651, 0xFEE5, 0xFEE9, 0xFEEC, 0xFEF0, 0xFEF2, 0xFED0, 0xFED5, 0xFEF5, 0xFEF6, 0xFEDD, 0xFED9, 0xFEF1, 0x25A0, 0x0000
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 865
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP865(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
|
||||||
|
0x00C5, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
|
||||||
|
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00A4,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x2558, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||||
|
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||||
|
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
|
||||||
|
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 866
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP866(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
|
||||||
|
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
|
||||||
|
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||||
|
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||||
|
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
|
||||||
|
0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#elif _CODE_PAGE == 869
|
||||||
|
#define _TBLDEF 1
|
||||||
|
static
|
||||||
|
const WCHAR Tbl[] = { /* CP869(0x80-0xFF) to Unicode conversion table */
|
||||||
|
0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x0386, 0x00B7, 0x00B7, 0x00AC, 0x00A6, 0x2018, 0x2019, 0x0388, 0x2015, 0x0389,
|
||||||
|
0x038A, 0x03AA, 0x038C, 0x00B7, 0x00B7, 0x038E, 0x03AB, 0x00A9, 0x038F, 0x00B2, 0x00B3, 0x03AC, 0x00A3, 0x03AD, 0x03AE, 0x03AF,
|
||||||
|
0x03CA, 0x0390, 0x03CC, 0x03CD, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x00BD, 0x0398, 0x0399, 0x00AB, 0x00BB,
|
||||||
|
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x039A, 0x039B, 0x039C, 0x039D, 0x2563, 0x2551, 0x2557, 0x255D, 0x039E, 0x039F, 0x2510,
|
||||||
|
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0A30, 0x03A1, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x03A3,
|
||||||
|
0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03B1, 0x03B2, 0x03B3, 0x2518, 0x250C, 0x2588, 0x2584, 0x03B4, 0x03B5, 0x2580,
|
||||||
|
0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x0384,
|
||||||
|
0x00AD, 0x00B1, 0x03C5, 0x03C6, 0x03C7, 0x00A7, 0x03C8, 0x0385, 0x00B0, 0x00A8, 0x03C9, 0x03CB, 0x03B0, 0x03CE, 0x25A0, 0x00A0
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if !_TBLDEF || !_USE_LFN
|
||||||
|
#error This file is not needed at current configuration. Remove from the project.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WCHAR ff_convert ( /* Converted character, Returns zero on error */
|
||||||
|
WCHAR chr, /* Character code to be converted */
|
||||||
|
UINT dir /* 0: Unicode to OEM code, 1: OEM code to Unicode */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
WCHAR c;
|
||||||
|
|
||||||
|
|
||||||
|
if (chr < 0x80) { /* ASCII */
|
||||||
|
c = chr;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (dir) { /* OEM code to Unicode */
|
||||||
|
c = (chr >= 0x100) ? 0 : Tbl[chr - 0x80];
|
||||||
|
|
||||||
|
} else { /* Unicode to OEM code */
|
||||||
|
for (c = 0; c < 0x80; c++) {
|
||||||
|
if (chr == Tbl[c]) break;
|
||||||
|
}
|
||||||
|
c = (c + 0x80) & 0xFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WCHAR ff_wtoupper ( /* Returns upper converted character */
|
||||||
|
WCHAR chr /* Unicode character to be upper converted (BMP only) */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
/* Compressed upper conversion table */
|
||||||
|
static const WCHAR cvt1[] = { /* U+0000 - U+0FFF */
|
||||||
|
/* Basic Latin */
|
||||||
|
0x0061,0x031A,
|
||||||
|
/* Latin-1 Supplement */
|
||||||
|
0x00E0,0x0317, 0x00F8,0x0307, 0x00FF,0x0001,0x0178,
|
||||||
|
/* Latin Extended-A */
|
||||||
|
0x0100,0x0130, 0x0132,0x0106, 0x0139,0x0110, 0x014A,0x012E, 0x0179,0x0106,
|
||||||
|
/* Latin Extended-B */
|
||||||
|
0x0180,0x004D,0x0243,0x0181,0x0182,0x0182,0x0184,0x0184,0x0186,0x0187,0x0187,0x0189,0x018A,0x018B,0x018B,0x018D,0x018E,0x018F,0x0190,0x0191,0x0191,0x0193,0x0194,0x01F6,0x0196,0x0197,0x0198,0x0198,0x023D,0x019B,0x019C,0x019D,0x0220,0x019F,0x01A0,0x01A0,0x01A2,0x01A2,0x01A4,0x01A4,0x01A6,0x01A7,0x01A7,0x01A9,0x01AA,0x01AB,0x01AC,0x01AC,0x01AE,0x01AF,0x01AF,0x01B1,0x01B2,0x01B3,0x01B3,0x01B5,0x01B5,0x01B7,0x01B8,0x01B8,0x01BA,0x01BB,0x01BC,0x01BC,0x01BE,0x01F7,0x01C0,0x01C1,0x01C2,0x01C3,0x01C4,0x01C5,0x01C4,0x01C7,0x01C8,0x01C7,0x01CA,0x01CB,0x01CA,
|
||||||
|
0x01CD,0x0110, 0x01DD,0x0001,0x018E, 0x01DE,0x0112, 0x01F3,0x0003,0x01F1,0x01F4,0x01F4, 0x01F8,0x0128,
|
||||||
|
0x0222,0x0112, 0x023A,0x0009,0x2C65,0x023B,0x023B,0x023D,0x2C66,0x023F,0x0240,0x0241,0x0241, 0x0246,0x010A,
|
||||||
|
/* IPA Extensions */
|
||||||
|
0x0253,0x0040,0x0181,0x0186,0x0255,0x0189,0x018A,0x0258,0x018F,0x025A,0x0190,0x025C,0x025D,0x025E,0x025F,0x0193,0x0261,0x0262,0x0194,0x0264,0x0265,0x0266,0x0267,0x0197,0x0196,0x026A,0x2C62,0x026C,0x026D,0x026E,0x019C,0x0270,0x0271,0x019D,0x0273,0x0274,0x019F,0x0276,0x0277,0x0278,0x0279,0x027A,0x027B,0x027C,0x2C64,0x027E,0x027F,0x01A6,0x0281,0x0282,0x01A9,0x0284,0x0285,0x0286,0x0287,0x01AE,0x0244,0x01B1,0x01B2,0x0245,0x028D,0x028E,0x028F,0x0290,0x0291,0x01B7,
|
||||||
|
/* Greek, Coptic */
|
||||||
|
0x037B,0x0003,0x03FD,0x03FE,0x03FF, 0x03AC,0x0004,0x0386,0x0388,0x0389,0x038A, 0x03B1,0x0311,
|
||||||
|
0x03C2,0x0002,0x03A3,0x03A3, 0x03C4,0x0308, 0x03CC,0x0003,0x038C,0x038E,0x038F, 0x03D8,0x0118,
|
||||||
|
0x03F2,0x000A,0x03F9,0x03F3,0x03F4,0x03F5,0x03F6,0x03F7,0x03F7,0x03F9,0x03FA,0x03FA,
|
||||||
|
/* Cyrillic */
|
||||||
|
0x0430,0x0320, 0x0450,0x0710, 0x0460,0x0122, 0x048A,0x0136, 0x04C1,0x010E, 0x04CF,0x0001,0x04C0, 0x04D0,0x0144,
|
||||||
|
/* Armenian */
|
||||||
|
0x0561,0x0426,
|
||||||
|
|
||||||
|
0x0000
|
||||||
|
};
|
||||||
|
static const WCHAR cvt2[] = { /* U+1000 - U+FFFF */
|
||||||
|
/* Phonetic Extensions */
|
||||||
|
0x1D7D,0x0001,0x2C63,
|
||||||
|
/* Latin Extended Additional */
|
||||||
|
0x1E00,0x0196, 0x1EA0,0x015A,
|
||||||
|
/* Greek Extended */
|
||||||
|
0x1F00,0x0608, 0x1F10,0x0606, 0x1F20,0x0608, 0x1F30,0x0608, 0x1F40,0x0606,
|
||||||
|
0x1F51,0x0007,0x1F59,0x1F52,0x1F5B,0x1F54,0x1F5D,0x1F56,0x1F5F, 0x1F60,0x0608,
|
||||||
|
0x1F70,0x000E,0x1FBA,0x1FBB,0x1FC8,0x1FC9,0x1FCA,0x1FCB,0x1FDA,0x1FDB,0x1FF8,0x1FF9,0x1FEA,0x1FEB,0x1FFA,0x1FFB,
|
||||||
|
0x1F80,0x0608, 0x1F90,0x0608, 0x1FA0,0x0608, 0x1FB0,0x0004,0x1FB8,0x1FB9,0x1FB2,0x1FBC,
|
||||||
|
0x1FCC,0x0001,0x1FC3, 0x1FD0,0x0602, 0x1FE0,0x0602, 0x1FE5,0x0001,0x1FEC, 0x1FF2,0x0001,0x1FFC,
|
||||||
|
/* Letterlike Symbols */
|
||||||
|
0x214E,0x0001,0x2132,
|
||||||
|
/* Number forms */
|
||||||
|
0x2170,0x0210, 0x2184,0x0001,0x2183,
|
||||||
|
/* Enclosed Alphanumerics */
|
||||||
|
0x24D0,0x051A, 0x2C30,0x042F,
|
||||||
|
/* Latin Extended-C */
|
||||||
|
0x2C60,0x0102, 0x2C67,0x0106, 0x2C75,0x0102,
|
||||||
|
/* Coptic */
|
||||||
|
0x2C80,0x0164,
|
||||||
|
/* Georgian Supplement */
|
||||||
|
0x2D00,0x0826,
|
||||||
|
/* Full-width */
|
||||||
|
0xFF41,0x031A,
|
||||||
|
|
||||||
|
0x0000
|
||||||
|
};
|
||||||
|
const WCHAR *p;
|
||||||
|
WCHAR bc, nc, cmd;
|
||||||
|
|
||||||
|
|
||||||
|
p = chr < 0x1000 ? cvt1 : cvt2;
|
||||||
|
for (;;) {
|
||||||
|
bc = *p++; /* Get block base */
|
||||||
|
if (!bc || chr < bc) break;
|
||||||
|
nc = *p++; cmd = nc >> 8; nc &= 0xFF; /* Get processing command and block size */
|
||||||
|
if (chr < bc + nc) { /* In the block? */
|
||||||
|
switch (cmd) {
|
||||||
|
case 0: chr = p[chr - bc]; break; /* Table conversion */
|
||||||
|
case 1: chr -= (chr - bc) & 1; break; /* Case pairs */
|
||||||
|
case 2: chr -= 16; break; /* Shift -16 */
|
||||||
|
case 3: chr -= 32; break; /* Shift -32 */
|
||||||
|
case 4: chr -= 48; break; /* Shift -48 */
|
||||||
|
case 5: chr -= 26; break; /* Shift -26 */
|
||||||
|
case 6: chr += 8; break; /* Shift +8 */
|
||||||
|
case 7: chr -= 80; break; /* Shift -80 */
|
||||||
|
case 8: chr -= 0x1C60; break; /* Shift -0x1C60 */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!cmd) p += nc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return chr;
|
||||||
|
}
|
||||||
|
|
164
Middlewares/Third_Party/FatFs/src/option/syscall.c
vendored
Normal file
164
Middlewares/Third_Party/FatFs/src/option/syscall.c
vendored
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* Sample code of OS dependent controls for FatFs */
|
||||||
|
/* (C)ChaN, 2014 */
|
||||||
|
/* Portions COPYRIGHT 2017 STMicroelectronics */
|
||||||
|
/* Portions Copyright (C) 2014, ChaN, all right reserved */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted, provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistribution of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of STMicroelectronics nor the names of other
|
||||||
|
* contributors to this software may be used to endorse or promote products
|
||||||
|
* derived from this software without specific written permission.
|
||||||
|
* 4. This software, including modifications and/or derivative works of this
|
||||||
|
* software, must execute solely and exclusively on microcontroller or
|
||||||
|
* microprocessor devices manufactured by or for STMicroelectronics.
|
||||||
|
* 5. Redistribution and use of this software other than as permitted under
|
||||||
|
* this license is void and will automatically terminate your rights under
|
||||||
|
* this license.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||||
|
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||||
|
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||||
|
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||||
|
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "../ff.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if _FS_REENTRANT
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* Create a Synchronization Object */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* This function is called in f_mount() function to create a new
|
||||||
|
/ synchronization object, such as semaphore and mutex. When a 0 is returned,
|
||||||
|
/ the f_mount() function fails with FR_INT_ERR.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create the sync object */
|
||||||
|
BYTE vol, /* Corresponding volume (logical drive number) */
|
||||||
|
_SYNC_t *sobj /* Pointer to return the created sync object */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
osSemaphoreDef(SEM);
|
||||||
|
*sobj = osSemaphoreCreate(osSemaphore(SEM), 1);
|
||||||
|
ret = (*sobj != NULL);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* Delete a Synchronization Object */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* This function is called in f_mount() function to delete a synchronization
|
||||||
|
/ object that created with ff_cre_syncobj() function. When a 0 is returned,
|
||||||
|
/ the f_mount() function fails with FR_INT_ERR.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any error */
|
||||||
|
_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
osSemaphoreDelete (sobj);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* Request Grant to Access the Volume */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* This function is called on entering file functions to lock the volume.
|
||||||
|
/ When a 0 is returned, the file function fails with FR_TIMEOUT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */
|
||||||
|
_SYNC_t sobj /* Sync object to wait */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if(osSemaphoreWait(sobj, _FS_TIMEOUT) == osOK)
|
||||||
|
{
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* Release Grant to Access the Volume */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* This function is called on leaving file functions to unlock the volume.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void ff_rel_grant (
|
||||||
|
_SYNC_t sobj /* Sync object to be signaled */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
osSemaphoreRelease(sobj);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if _USE_LFN == 3 /* LFN with a working buffer on the heap */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* Allocate a memory block */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* If a NULL is returned, the file function fails with FR_NOT_ENOUGH_CORE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void* ff_memalloc ( /* Returns pointer to the allocated memory block */
|
||||||
|
UINT msize /* Number of bytes to allocate */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return ff_malloc(msize); /* Allocate a new memory block with POSIX API */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* Free a memory block */
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void ff_memfree (
|
||||||
|
void* mblock /* Pointer to the memory block to free */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ff_free(mblock); /* Discard the memory block with POSIX API */
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
342
Src/bsp_driver_sd.c
Normal file
342
Src/bsp_driver_sd.c
Normal file
|
@ -0,0 +1,342 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file bsp_driver_sd.c for F4 (based on stm324x9i_eval_sd.c)
|
||||||
|
* @brief This file includes a generic uSD card driver.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef OLD_API
|
||||||
|
/* kept to avoid issue when migrating old projects. */
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
#else
|
||||||
|
/* USER CODE BEGIN FirstSection */
|
||||||
|
/* can be used to modify / undefine following code or add new definitions */
|
||||||
|
/* USER CODE END FirstSection */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "bsp_driver_sd.h"
|
||||||
|
|
||||||
|
/* Extern variables ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern SD_HandleTypeDef hsd;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN BeforeInitSection */
|
||||||
|
/* can be used to modify / undefine following code or add code */
|
||||||
|
/* USER CODE END BeforeInitSection */
|
||||||
|
/**
|
||||||
|
* @brief Initializes the SD card device.
|
||||||
|
* @retval SD status
|
||||||
|
*/
|
||||||
|
uint8_t BSP_SD_Init(void)
|
||||||
|
{
|
||||||
|
uint8_t sd_state = MSD_OK;
|
||||||
|
/* Check if the SD card is plugged in the slot */
|
||||||
|
if (BSP_SD_IsDetected() != SD_PRESENT)
|
||||||
|
{
|
||||||
|
return MSD_ERROR;
|
||||||
|
}
|
||||||
|
/* HAL SD initialization */
|
||||||
|
sd_state = HAL_SD_Init(&hsd);
|
||||||
|
/* Configure SD Bus width (4 bits mode selected) */
|
||||||
|
if (sd_state == MSD_OK)
|
||||||
|
{
|
||||||
|
/* Enable wide operation */
|
||||||
|
if (HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) != HAL_OK)
|
||||||
|
{
|
||||||
|
sd_state = MSD_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sd_state;
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN AfterInitSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add code */
|
||||||
|
/* USER CODE END AfterInitSection */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configures Interrupt mode for SD detection pin.
|
||||||
|
* @retval Returns 0 in success otherwise 1.
|
||||||
|
*/
|
||||||
|
uint8_t BSP_SD_ITConfig(void)
|
||||||
|
{
|
||||||
|
/* TBI: add user code here depending on the hardware configuration used */
|
||||||
|
|
||||||
|
return (uint8_t)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @brief SD detect IT treatment
|
||||||
|
*/
|
||||||
|
void BSP_SD_DetectIT(void)
|
||||||
|
{
|
||||||
|
/* TBI: add user code here depending on the hardware configuration used */
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @brief SD detect IT detection callback
|
||||||
|
*/
|
||||||
|
__weak void BSP_SD_DetectCallback(void)
|
||||||
|
{
|
||||||
|
/* NOTE: This function Should not be modified, when the callback is needed,
|
||||||
|
the BSP_SD_DetectCallback could be implemented in the user file
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN BeforeReadBlocksSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add code */
|
||||||
|
/* USER CODE END BeforeReadBlocksSection */
|
||||||
|
/**
|
||||||
|
* @brief Reads block(s) from a specified address in an SD card, in polling mode.
|
||||||
|
* @param pData: Pointer to the buffer that will contain the data to transmit
|
||||||
|
* @param ReadAddr: Address from where data is to be read
|
||||||
|
* @param NumOfBlocks: Number of SD blocks to read
|
||||||
|
* @param Timeout: Timeout for read operation
|
||||||
|
* @retval SD status
|
||||||
|
*/
|
||||||
|
uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)
|
||||||
|
{
|
||||||
|
uint8_t sd_state = MSD_OK;
|
||||||
|
|
||||||
|
if (HAL_SD_ReadBlocks(&hsd, (uint8_t *)pData, ReadAddr, NumOfBlocks, Timeout) != HAL_OK)
|
||||||
|
{
|
||||||
|
sd_state = MSD_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sd_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN BeforeWriteBlocksSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add code */
|
||||||
|
/* USER CODE END BeforeWriteBlocksSection */
|
||||||
|
/**
|
||||||
|
* @brief Writes block(s) to a specified address in an SD card, in polling mode.
|
||||||
|
* @param pData: Pointer to the buffer that will contain the data to transmit
|
||||||
|
* @param WriteAddr: Address from where data is to be written
|
||||||
|
* @param NumOfBlocks: Number of SD blocks to write
|
||||||
|
* @param Timeout: Timeout for write operation
|
||||||
|
* @retval SD status
|
||||||
|
*/
|
||||||
|
uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)
|
||||||
|
{
|
||||||
|
uint8_t sd_state = MSD_OK;
|
||||||
|
|
||||||
|
if (HAL_SD_WriteBlocks(&hsd, (uint8_t *)pData, WriteAddr, NumOfBlocks, Timeout) != HAL_OK)
|
||||||
|
{
|
||||||
|
sd_state = MSD_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sd_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN BeforeReadDMABlocksSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add code */
|
||||||
|
/* USER CODE END BeforeReadDMABlocksSection */
|
||||||
|
/**
|
||||||
|
* @brief Reads block(s) from a specified address in an SD card, in DMA mode.
|
||||||
|
* @param pData: Pointer to the buffer that will contain the data to transmit
|
||||||
|
* @param ReadAddr: Address from where data is to be read
|
||||||
|
* @param NumOfBlocks: Number of SD blocks to read
|
||||||
|
* @retval SD status
|
||||||
|
*/
|
||||||
|
uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)
|
||||||
|
{
|
||||||
|
uint8_t sd_state = MSD_OK;
|
||||||
|
|
||||||
|
/* Read block(s) in DMA transfer mode */
|
||||||
|
if (HAL_SD_ReadBlocks_DMA(&hsd, (uint8_t *)pData, ReadAddr, NumOfBlocks) != HAL_OK)
|
||||||
|
{
|
||||||
|
sd_state = MSD_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sd_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN BeforeWriteDMABlocksSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add code */
|
||||||
|
/* USER CODE END BeforeWriteDMABlocksSection */
|
||||||
|
/**
|
||||||
|
* @brief Writes block(s) to a specified address in an SD card, in DMA mode.
|
||||||
|
* @param pData: Pointer to the buffer that will contain the data to transmit
|
||||||
|
* @param WriteAddr: Address from where data is to be written
|
||||||
|
* @param NumOfBlocks: Number of SD blocks to write
|
||||||
|
* @retval SD status
|
||||||
|
*/
|
||||||
|
uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks)
|
||||||
|
{
|
||||||
|
uint8_t sd_state = MSD_OK;
|
||||||
|
|
||||||
|
/* Write block(s) in DMA transfer mode */
|
||||||
|
if (HAL_SD_WriteBlocks_DMA(&hsd, (uint8_t *)pData, WriteAddr, NumOfBlocks) != HAL_OK)
|
||||||
|
{
|
||||||
|
sd_state = MSD_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sd_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN BeforeEraseSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add code */
|
||||||
|
/* USER CODE END BeforeEraseSection */
|
||||||
|
/**
|
||||||
|
* @brief Erases the specified memory area of the given SD card.
|
||||||
|
* @param StartAddr: Start byte address
|
||||||
|
* @param EndAddr: End byte address
|
||||||
|
* @retval SD status
|
||||||
|
*/
|
||||||
|
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr)
|
||||||
|
{
|
||||||
|
uint8_t sd_state = MSD_OK;
|
||||||
|
|
||||||
|
if (HAL_SD_Erase(&hsd, StartAddr, EndAddr) != HAL_OK)
|
||||||
|
{
|
||||||
|
sd_state = MSD_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sd_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN BeforeHandlersSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add code */
|
||||||
|
/* USER CODE END BeforeHandlersSection */
|
||||||
|
/**
|
||||||
|
* @brief Handles SD card interrupt request.
|
||||||
|
*/
|
||||||
|
void BSP_SD_IRQHandler(void)
|
||||||
|
{
|
||||||
|
HAL_SD_IRQHandler(&hsd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles SD DMA Tx transfer interrupt request.
|
||||||
|
*/
|
||||||
|
void BSP_SD_DMA_Tx_IRQHandler(void)
|
||||||
|
{
|
||||||
|
HAL_DMA_IRQHandler(hsd.hdmatx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles SD DMA Rx transfer interrupt request.
|
||||||
|
*/
|
||||||
|
void BSP_SD_DMA_Rx_IRQHandler(void)
|
||||||
|
{
|
||||||
|
HAL_DMA_IRQHandler(hsd.hdmarx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the current SD card data status.
|
||||||
|
* @param None
|
||||||
|
* @retval Data transfer state.
|
||||||
|
* This value can be one of the following values:
|
||||||
|
* @arg SD_TRANSFER_OK: No data transfer is acting
|
||||||
|
* @arg SD_TRANSFER_BUSY: Data transfer is acting
|
||||||
|
*/
|
||||||
|
uint8_t BSP_SD_GetCardState(void)
|
||||||
|
{
|
||||||
|
return ((HAL_SD_GetCardState(&hsd) == HAL_SD_CARD_TRANSFER ) ? SD_TRANSFER_OK : SD_TRANSFER_BUSY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get SD information about specific SD card.
|
||||||
|
* @param CardInfo: Pointer to HAL_SD_CardInfoTypedef structure
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo)
|
||||||
|
{
|
||||||
|
/* Get SD card Information */
|
||||||
|
HAL_SD_GetCardInfo(&hsd, CardInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN BeforeCallBacksSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add code */
|
||||||
|
/* USER CODE END BeforeCallBacksSection */
|
||||||
|
/**
|
||||||
|
* @brief SD Abort callbacks
|
||||||
|
* @param hsd: SD handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_SD_AbortCallback(SD_HandleTypeDef *hsd)
|
||||||
|
{
|
||||||
|
BSP_SD_AbortCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Tx Transfer completed callback
|
||||||
|
* @param hsd: SD handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
|
||||||
|
{
|
||||||
|
BSP_SD_WriteCpltCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Rx Transfer completed callback
|
||||||
|
* @param hsd: SD handle
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)
|
||||||
|
{
|
||||||
|
BSP_SD_ReadCpltCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN CallBacksSection_C */
|
||||||
|
/**
|
||||||
|
* @brief BSP SD Abort callback
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__weak void BSP_SD_AbortCallback(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BSP Tx Transfer completed callback
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__weak void BSP_SD_WriteCpltCallback(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BSP Rx Transfer completed callback
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__weak void BSP_SD_ReadCpltCallback(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
/* USER CODE END CallBacksSection_C */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Detects if SD card is correctly plugged in the memory slot or not.
|
||||||
|
* @param None
|
||||||
|
* @retval Returns if SD is detected or not
|
||||||
|
*/
|
||||||
|
uint8_t BSP_SD_IsDetected(void)
|
||||||
|
{
|
||||||
|
__IO uint8_t status = SD_PRESENT;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
/* user code can be inserted here */
|
||||||
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN AdditionalCode */
|
||||||
|
/* user code can be inserted here */
|
||||||
|
/* USER CODE END AdditionalCode */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -9,10 +9,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
46
Src/dma.c
46
Src/dma.c
|
@ -9,10 +9,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -81,48 +81,45 @@ void MX_DMA_Init(void)
|
||||||
/* Set peripheral burst size */
|
/* Set peripheral burst size */
|
||||||
LL_DMA_SetPeriphBurstxfer(DMA2, LL_DMA_STREAM_4, LL_DMA_PBURST_SINGLE);
|
LL_DMA_SetPeriphBurstxfer(DMA2, LL_DMA_STREAM_4, LL_DMA_PBURST_SINGLE);
|
||||||
|
|
||||||
/* Configure DMA request MEMTOMEM_DMA2_Stream0 */
|
/* Configure DMA request MEMTOMEM_DMA2_Stream3 */
|
||||||
|
|
||||||
/* Select channel */
|
/* Select channel */
|
||||||
LL_DMA_SetChannelSelection(DMA2, LL_DMA_STREAM_0, LL_DMA_CHANNEL_0);
|
LL_DMA_SetChannelSelection(DMA2, LL_DMA_STREAM_3, LL_DMA_CHANNEL_0);
|
||||||
|
|
||||||
/* Set transfer direction */
|
/* Set transfer direction */
|
||||||
LL_DMA_SetDataTransferDirection(DMA2, LL_DMA_STREAM_0, LL_DMA_DIRECTION_MEMORY_TO_MEMORY);
|
LL_DMA_SetDataTransferDirection(DMA2, LL_DMA_STREAM_3, LL_DMA_DIRECTION_MEMORY_TO_MEMORY);
|
||||||
|
|
||||||
/* Set priority level */
|
/* Set priority level */
|
||||||
LL_DMA_SetStreamPriorityLevel(DMA2, LL_DMA_STREAM_0, LL_DMA_PRIORITY_LOW);
|
LL_DMA_SetStreamPriorityLevel(DMA2, LL_DMA_STREAM_3, LL_DMA_PRIORITY_LOW);
|
||||||
|
|
||||||
/* Set DMA mode */
|
/* Set DMA mode */
|
||||||
LL_DMA_SetMode(DMA2, LL_DMA_STREAM_0, LL_DMA_MODE_NORMAL);
|
LL_DMA_SetMode(DMA2, LL_DMA_STREAM_3, LL_DMA_MODE_NORMAL);
|
||||||
|
|
||||||
/* Set peripheral increment mode */
|
/* Set peripheral increment mode */
|
||||||
LL_DMA_SetPeriphIncMode(DMA2, LL_DMA_STREAM_0, LL_DMA_PERIPH_INCREMENT);
|
LL_DMA_SetPeriphIncMode(DMA2, LL_DMA_STREAM_3, LL_DMA_PERIPH_INCREMENT);
|
||||||
|
|
||||||
/* Set memory increment mode */
|
/* Set memory increment mode */
|
||||||
LL_DMA_SetMemoryIncMode(DMA2, LL_DMA_STREAM_0, LL_DMA_MEMORY_INCREMENT);
|
LL_DMA_SetMemoryIncMode(DMA2, LL_DMA_STREAM_3, LL_DMA_MEMORY_INCREMENT);
|
||||||
|
|
||||||
/* Set peripheral data width */
|
/* Set peripheral data width */
|
||||||
LL_DMA_SetPeriphSize(DMA2, LL_DMA_STREAM_0, LL_DMA_PDATAALIGN_WORD);
|
LL_DMA_SetPeriphSize(DMA2, LL_DMA_STREAM_3, LL_DMA_PDATAALIGN_WORD);
|
||||||
|
|
||||||
/* Set memory data width */
|
/* Set memory data width */
|
||||||
LL_DMA_SetMemorySize(DMA2, LL_DMA_STREAM_0, LL_DMA_MDATAALIGN_WORD);
|
LL_DMA_SetMemorySize(DMA2, LL_DMA_STREAM_3, LL_DMA_MDATAALIGN_WORD);
|
||||||
|
|
||||||
/* Enable FIFO mode */
|
/* Enable FIFO mode */
|
||||||
LL_DMA_EnableFifoMode(DMA2, LL_DMA_STREAM_0);
|
LL_DMA_EnableFifoMode(DMA2, LL_DMA_STREAM_3);
|
||||||
|
|
||||||
/* Set FIFO threshold */
|
/* Set FIFO threshold */
|
||||||
LL_DMA_SetFIFOThreshold(DMA2, LL_DMA_STREAM_0, LL_DMA_FIFOTHRESHOLD_FULL);
|
LL_DMA_SetFIFOThreshold(DMA2, LL_DMA_STREAM_3, LL_DMA_FIFOTHRESHOLD_FULL);
|
||||||
|
|
||||||
/* Set memory burst size */
|
/* Set memory burst size */
|
||||||
LL_DMA_SetMemoryBurstxfer(DMA2, LL_DMA_STREAM_0, LL_DMA_MBURST_SINGLE);
|
LL_DMA_SetMemoryBurstxfer(DMA2, LL_DMA_STREAM_3, LL_DMA_MBURST_SINGLE);
|
||||||
|
|
||||||
/* Set peripheral burst size */
|
/* Set peripheral burst size */
|
||||||
LL_DMA_SetPeriphBurstxfer(DMA2, LL_DMA_STREAM_0, LL_DMA_PBURST_SINGLE);
|
LL_DMA_SetPeriphBurstxfer(DMA2, LL_DMA_STREAM_3, LL_DMA_PBURST_SINGLE);
|
||||||
|
|
||||||
/* DMA interrupt init */
|
/* DMA interrupt init */
|
||||||
/* DMA1_Stream0_IRQn interrupt configuration */
|
|
||||||
NVIC_SetPriority(DMA1_Stream0_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
|
||||||
NVIC_EnableIRQ(DMA1_Stream0_IRQn);
|
|
||||||
/* DMA1_Stream1_IRQn interrupt configuration */
|
/* DMA1_Stream1_IRQn interrupt configuration */
|
||||||
NVIC_SetPriority(DMA1_Stream1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
NVIC_SetPriority(DMA1_Stream1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
NVIC_EnableIRQ(DMA1_Stream1_IRQn);
|
NVIC_EnableIRQ(DMA1_Stream1_IRQn);
|
||||||
|
@ -141,9 +138,6 @@ void MX_DMA_Init(void)
|
||||||
/* DMA1_Stream6_IRQn interrupt configuration */
|
/* DMA1_Stream6_IRQn interrupt configuration */
|
||||||
NVIC_SetPriority(DMA1_Stream6_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
NVIC_SetPriority(DMA1_Stream6_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
NVIC_EnableIRQ(DMA1_Stream6_IRQn);
|
NVIC_EnableIRQ(DMA1_Stream6_IRQn);
|
||||||
/* DMA1_Stream7_IRQn interrupt configuration */
|
|
||||||
NVIC_SetPriority(DMA1_Stream7_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
|
||||||
NVIC_EnableIRQ(DMA1_Stream7_IRQn);
|
|
||||||
/* DMA2_Stream0_IRQn interrupt configuration */
|
/* DMA2_Stream0_IRQn interrupt configuration */
|
||||||
NVIC_SetPriority(DMA2_Stream0_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
NVIC_SetPriority(DMA2_Stream0_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
NVIC_EnableIRQ(DMA2_Stream0_IRQn);
|
NVIC_EnableIRQ(DMA2_Stream0_IRQn);
|
||||||
|
@ -153,9 +147,15 @@ void MX_DMA_Init(void)
|
||||||
/* DMA2_Stream2_IRQn interrupt configuration */
|
/* DMA2_Stream2_IRQn interrupt configuration */
|
||||||
NVIC_SetPriority(DMA2_Stream2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
NVIC_SetPriority(DMA2_Stream2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
NVIC_EnableIRQ(DMA2_Stream2_IRQn);
|
NVIC_EnableIRQ(DMA2_Stream2_IRQn);
|
||||||
|
/* DMA2_Stream3_IRQn interrupt configuration */
|
||||||
|
NVIC_SetPriority(DMA2_Stream3_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(DMA2_Stream3_IRQn);
|
||||||
/* DMA2_Stream4_IRQn interrupt configuration */
|
/* DMA2_Stream4_IRQn interrupt configuration */
|
||||||
NVIC_SetPriority(DMA2_Stream4_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
NVIC_SetPriority(DMA2_Stream4_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
NVIC_EnableIRQ(DMA2_Stream4_IRQn);
|
NVIC_EnableIRQ(DMA2_Stream4_IRQn);
|
||||||
|
/* DMA2_Stream5_IRQn interrupt configuration */
|
||||||
|
NVIC_SetPriority(DMA2_Stream5_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(DMA2_Stream5_IRQn);
|
||||||
/* DMA2_Stream6_IRQn interrupt configuration */
|
/* DMA2_Stream6_IRQn interrupt configuration */
|
||||||
NVIC_SetPriority(DMA2_Stream6_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
NVIC_SetPriority(DMA2_Stream6_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
NVIC_EnableIRQ(DMA2_Stream6_IRQn);
|
NVIC_EnableIRQ(DMA2_Stream6_IRQn);
|
||||||
|
|
56
Src/fatfs.c
Normal file
56
Src/fatfs.c
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file fatfs.c
|
||||||
|
* @brief Code for fatfs applications
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "fatfs.h"
|
||||||
|
|
||||||
|
uint8_t retSD; /* Return value for SD */
|
||||||
|
char SDPath[4]; /* SD logical drive path */
|
||||||
|
FATFS SDFatFS; /* File system object for SD logical drive */
|
||||||
|
FIL SDFile; /* File object for SD */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Variables */
|
||||||
|
|
||||||
|
/* USER CODE END Variables */
|
||||||
|
|
||||||
|
void MX_FATFS_Init(void)
|
||||||
|
{
|
||||||
|
/*## FatFS: Link the SD driver ###########################*/
|
||||||
|
retSD = FATFS_LinkDriver(&SD_Driver, SDPath);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Init */
|
||||||
|
/* additional user code for init */
|
||||||
|
/* USER CODE END Init */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets Time from RTC
|
||||||
|
* @param None
|
||||||
|
* @retval Time in DWORD
|
||||||
|
*/
|
||||||
|
DWORD get_fattime(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN get_fattime */
|
||||||
|
return 0;
|
||||||
|
/* USER CODE END get_fattime */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Application */
|
||||||
|
|
||||||
|
/* USER CODE END Application */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
209
Src/fsmc.c
Normal file
209
Src/fsmc.c
Normal file
|
@ -0,0 +1,209 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* File Name : FSMC.c
|
||||||
|
* Description : This file provides code for the configuration
|
||||||
|
* of the FSMC peripheral.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "fsmc.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
SRAM_HandleTypeDef hsram1;
|
||||||
|
|
||||||
|
/* FSMC initialization function */
|
||||||
|
void MX_FSMC_Init(void)
|
||||||
|
{
|
||||||
|
FSMC_NORSRAM_TimingTypeDef Timing = {0};
|
||||||
|
|
||||||
|
/** Perform the SRAM1 memory initialization sequence
|
||||||
|
*/
|
||||||
|
hsram1.Instance = FSMC_NORSRAM_DEVICE;
|
||||||
|
hsram1.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
|
||||||
|
/* hsram1.Init */
|
||||||
|
hsram1.Init.NSBank = FSMC_NORSRAM_BANK1;
|
||||||
|
hsram1.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
|
||||||
|
hsram1.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM;
|
||||||
|
hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16;
|
||||||
|
hsram1.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE;
|
||||||
|
hsram1.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
|
||||||
|
hsram1.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
|
||||||
|
hsram1.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS;
|
||||||
|
hsram1.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE;
|
||||||
|
hsram1.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE;
|
||||||
|
hsram1.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE;
|
||||||
|
hsram1.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
|
||||||
|
hsram1.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE;
|
||||||
|
hsram1.Init.PageSize = FSMC_PAGE_SIZE_NONE;
|
||||||
|
/* Timing */
|
||||||
|
Timing.AddressSetupTime = 15;
|
||||||
|
Timing.AddressHoldTime = 15;
|
||||||
|
Timing.DataSetupTime = 255;
|
||||||
|
Timing.BusTurnAroundDuration = 15;
|
||||||
|
Timing.CLKDivision = 16;
|
||||||
|
Timing.DataLatency = 17;
|
||||||
|
Timing.AccessMode = FSMC_ACCESS_MODE_A;
|
||||||
|
/* ExtTiming */
|
||||||
|
|
||||||
|
if (HAL_SRAM_Init(&hsram1, &Timing, NULL) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler( );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t FSMC_Initialized = 0;
|
||||||
|
|
||||||
|
static void HAL_FSMC_MspInit(void){
|
||||||
|
/* USER CODE BEGIN FSMC_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FSMC_MspInit 0 */
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
if (FSMC_Initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FSMC_Initialized = 1;
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_FSMC_CLK_ENABLE();
|
||||||
|
|
||||||
|
/** FSMC GPIO Configuration
|
||||||
|
PE7 ------> FSMC_D4
|
||||||
|
PE8 ------> FSMC_D5
|
||||||
|
PE9 ------> FSMC_D6
|
||||||
|
PE10 ------> FSMC_D7
|
||||||
|
PE11 ------> FSMC_D8
|
||||||
|
PE12 ------> FSMC_D9
|
||||||
|
PE13 ------> FSMC_D10
|
||||||
|
PE14 ------> FSMC_D11
|
||||||
|
PE15 ------> FSMC_D12
|
||||||
|
PD8 ------> FSMC_D13
|
||||||
|
PD9 ------> FSMC_D14
|
||||||
|
PD10 ------> FSMC_D15
|
||||||
|
PD13 ------> FSMC_A18
|
||||||
|
PD14 ------> FSMC_D0
|
||||||
|
PD15 ------> FSMC_D1
|
||||||
|
PD0 ------> FSMC_D2
|
||||||
|
PD1 ------> FSMC_D3
|
||||||
|
PD4 ------> FSMC_NOE
|
||||||
|
PD5 ------> FSMC_NWE
|
||||||
|
PD7 ------> FSMC_NE1
|
||||||
|
*/
|
||||||
|
/* GPIO_InitStruct */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10
|
||||||
|
|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_15;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
|
||||||
|
|
||||||
|
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* GPIO_InitStruct */
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_13
|
||||||
|
|GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1
|
||||||
|
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_7;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
|
||||||
|
|
||||||
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN FSMC_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FSMC_MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_SRAM_MspInit(SRAM_HandleTypeDef* sramHandle){
|
||||||
|
/* USER CODE BEGIN SRAM_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SRAM_MspInit 0 */
|
||||||
|
HAL_FSMC_MspInit();
|
||||||
|
/* USER CODE BEGIN SRAM_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SRAM_MspInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t FSMC_DeInitialized = 0;
|
||||||
|
|
||||||
|
static void HAL_FSMC_MspDeInit(void){
|
||||||
|
/* USER CODE BEGIN FSMC_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END FSMC_MspDeInit 0 */
|
||||||
|
if (FSMC_DeInitialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FSMC_DeInitialized = 1;
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
__HAL_RCC_FSMC_CLK_DISABLE();
|
||||||
|
|
||||||
|
/** FSMC GPIO Configuration
|
||||||
|
PE7 ------> FSMC_D4
|
||||||
|
PE8 ------> FSMC_D5
|
||||||
|
PE9 ------> FSMC_D6
|
||||||
|
PE10 ------> FSMC_D7
|
||||||
|
PE11 ------> FSMC_D8
|
||||||
|
PE12 ------> FSMC_D9
|
||||||
|
PE13 ------> FSMC_D10
|
||||||
|
PE14 ------> FSMC_D11
|
||||||
|
PE15 ------> FSMC_D12
|
||||||
|
PD8 ------> FSMC_D13
|
||||||
|
PD9 ------> FSMC_D14
|
||||||
|
PD10 ------> FSMC_D15
|
||||||
|
PD13 ------> FSMC_A18
|
||||||
|
PD14 ------> FSMC_D0
|
||||||
|
PD15 ------> FSMC_D1
|
||||||
|
PD0 ------> FSMC_D2
|
||||||
|
PD1 ------> FSMC_D3
|
||||||
|
PD4 ------> FSMC_NOE
|
||||||
|
PD5 ------> FSMC_NWE
|
||||||
|
PD7 ------> FSMC_NE1
|
||||||
|
*/
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOE, GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10
|
||||||
|
|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14
|
||||||
|
|GPIO_PIN_15);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_13
|
||||||
|
|GPIO_PIN_14|GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1
|
||||||
|
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_7);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN FSMC_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END FSMC_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef* sramHandle){
|
||||||
|
/* USER CODE BEGIN SRAM_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SRAM_MspDeInit 0 */
|
||||||
|
HAL_FSMC_MspDeInit();
|
||||||
|
/* USER CODE BEGIN SRAM_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SRAM_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
36
Src/gpio.c
36
Src/gpio.c
|
@ -9,10 +9,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -43,17 +43,35 @@ void MX_GPIO_Init(void)
|
||||||
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
|
||||||
/* GPIO Ports Clock Enable */
|
/* GPIO Ports Clock Enable */
|
||||||
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOE);
|
||||||
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
|
||||||
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOH);
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOH);
|
||||||
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
|
||||||
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
|
||||||
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOD);
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOD);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
LL_GPIO_ResetOutputPin(GPIOC, DEBUG0_Pin|DEBUG1_Pin|DEBUG2_Pin|DEBUG3_Pin);
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
LL_GPIO_ResetOutputPin(GPIOA, LED0_Pin|LED1_Pin);
|
LL_GPIO_ResetOutputPin(GPIOA, LED0_Pin|LED1_Pin);
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
LL_GPIO_ResetOutputPin(GPIOD, DIAG0_Pin|DIAG1_Pin|DIAG2_Pin|DIAG3_Pin);
|
LL_GPIO_ResetOutputPin(GPIOB, T_CS_Pin|NRF_CE_Pin|NRF_CS_Pin);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = KEY1_Pin|KEY0_Pin;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
||||||
|
LL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**/
|
||||||
|
GPIO_InitStruct.Pin = DEBUG0_Pin|DEBUG1_Pin|DEBUG2_Pin|DEBUG3_Pin;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
GPIO_InitStruct.Pin = LED0_Pin|LED1_Pin;
|
GPIO_InitStruct.Pin = LED0_Pin|LED1_Pin;
|
||||||
|
@ -64,18 +82,18 @@ void MX_GPIO_Init(void)
|
||||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
GPIO_InitStruct.Pin = F_CS_Pin;
|
GPIO_InitStruct.Pin = F_CS_Pin|NRF_IRQ_Pin;
|
||||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
||||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
LL_GPIO_Init(F_CS_GPIO_Port, &GPIO_InitStruct);
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
GPIO_InitStruct.Pin = DIAG0_Pin|DIAG1_Pin|DIAG2_Pin|DIAG3_Pin;
|
GPIO_InitStruct.Pin = T_CS_Pin|NRF_CE_Pin|NRF_CS_Pin;
|
||||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
||||||
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,13 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
#include "dma.h"
|
#include "dma.h"
|
||||||
|
#include "fatfs.h"
|
||||||
|
#include "sdio.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
#include "usart.h"
|
#include "usart.h"
|
||||||
|
#include "usb_otg.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
#include "fsmc.h"
|
||||||
|
|
||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
|
@ -94,9 +98,7 @@ int main(void)
|
||||||
/* Initialize all configured peripherals */
|
/* Initialize all configured peripherals */
|
||||||
MX_GPIO_Init();
|
MX_GPIO_Init();
|
||||||
MX_DMA_Init();
|
MX_DMA_Init();
|
||||||
MX_SPI1_Init();
|
|
||||||
MX_UART4_Init();
|
MX_UART4_Init();
|
||||||
MX_UART5_Init();
|
|
||||||
MX_USART1_UART_Init();
|
MX_USART1_UART_Init();
|
||||||
MX_USART2_UART_Init();
|
MX_USART2_UART_Init();
|
||||||
MX_USART3_UART_Init();
|
MX_USART3_UART_Init();
|
||||||
|
@ -139,7 +141,7 @@ void SystemClock_Config(void)
|
||||||
RCC_OscInitStruct.PLL.PLLM = 4;
|
RCC_OscInitStruct.PLL.PLLM = 4;
|
||||||
RCC_OscInitStruct.PLL.PLLN = 168;
|
RCC_OscInitStruct.PLL.PLLN = 168;
|
||||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||||
RCC_OscInitStruct.PLL.PLLQ = 4;
|
RCC_OscInitStruct.PLL.PLLQ = 7;
|
||||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||||
{
|
{
|
||||||
Error_Handler();
|
Error_Handler();
|
||||||
|
|
259
Src/sd_diskio.c
Normal file
259
Src/sd_diskio.c
Normal file
|
@ -0,0 +1,259 @@
|
||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file sd_diskio.c
|
||||||
|
* @brief SD Disk I/O driver
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Note: code generation based on sd_diskio_template.c v2.1.1 as "Use dma template" is disabled. */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN firstSection */
|
||||||
|
/* can be used to modify / undefine following code or add new definitions */
|
||||||
|
/* USER CODE END firstSection*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ff_gen_drv.h"
|
||||||
|
#include "sd_diskio.h"
|
||||||
|
|
||||||
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
|
/* Private define ------------------------------------------------------------*/
|
||||||
|
/* use the default SD timout as defined in the platform BSP driver*/
|
||||||
|
#if defined(SDMMC_DATATIMEOUT)
|
||||||
|
#define SD_TIMEOUT SDMMC_DATATIMEOUT
|
||||||
|
#elif defined(SD_DATATIMEOUT)
|
||||||
|
#define SD_TIMEOUT SD_DATATIMEOUT
|
||||||
|
#else
|
||||||
|
#define SD_TIMEOUT 30 * 1000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SD_DEFAULT_BLOCK_SIZE 512
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Depending on the use case, the SD card initialization could be done at the
|
||||||
|
* application level: if it is the case define the flag below to disable
|
||||||
|
* the BSP_SD_Init() call in the SD_Initialize() and add a call to
|
||||||
|
* BSP_SD_Init() elsewhere in the application.
|
||||||
|
*/
|
||||||
|
/* USER CODE BEGIN disableSDInit */
|
||||||
|
/* #define DISABLE_SD_INIT */
|
||||||
|
/* USER CODE END disableSDInit */
|
||||||
|
|
||||||
|
/* Disk status */
|
||||||
|
static volatile DSTATUS Stat = STA_NOINIT;
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
static DSTATUS SD_CheckStatus(BYTE lun);
|
||||||
|
DSTATUS SD_initialize (BYTE);
|
||||||
|
DSTATUS SD_status (BYTE);
|
||||||
|
DRESULT SD_read (BYTE, BYTE*, DWORD, UINT);
|
||||||
|
#if _USE_WRITE == 1
|
||||||
|
DRESULT SD_write (BYTE, const BYTE*, DWORD, UINT);
|
||||||
|
#endif /* _USE_WRITE == 1 */
|
||||||
|
#if _USE_IOCTL == 1
|
||||||
|
DRESULT SD_ioctl (BYTE, BYTE, void*);
|
||||||
|
#endif /* _USE_IOCTL == 1 */
|
||||||
|
|
||||||
|
const Diskio_drvTypeDef SD_Driver =
|
||||||
|
{
|
||||||
|
SD_initialize,
|
||||||
|
SD_status,
|
||||||
|
SD_read,
|
||||||
|
#if _USE_WRITE == 1
|
||||||
|
SD_write,
|
||||||
|
#endif /* _USE_WRITE == 1 */
|
||||||
|
|
||||||
|
#if _USE_IOCTL == 1
|
||||||
|
SD_ioctl,
|
||||||
|
#endif /* _USE_IOCTL == 1 */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* USER CODE BEGIN beforeFunctionSection */
|
||||||
|
/* can be used to modify / undefine following code or add new code */
|
||||||
|
/* USER CODE END beforeFunctionSection */
|
||||||
|
|
||||||
|
/* Private functions ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
static DSTATUS SD_CheckStatus(BYTE lun)
|
||||||
|
{
|
||||||
|
Stat = STA_NOINIT;
|
||||||
|
|
||||||
|
if(BSP_SD_GetCardState() == MSD_OK)
|
||||||
|
{
|
||||||
|
Stat &= ~STA_NOINIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Stat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes a Drive
|
||||||
|
* @param lun : not used
|
||||||
|
* @retval DSTATUS: Operation status
|
||||||
|
*/
|
||||||
|
DSTATUS SD_initialize(BYTE lun)
|
||||||
|
{
|
||||||
|
Stat = STA_NOINIT;
|
||||||
|
|
||||||
|
#if !defined(DISABLE_SD_INIT)
|
||||||
|
|
||||||
|
if(BSP_SD_Init() == MSD_OK)
|
||||||
|
{
|
||||||
|
Stat = SD_CheckStatus(lun);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
Stat = SD_CheckStatus(lun);
|
||||||
|
#endif
|
||||||
|
return Stat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets Disk Status
|
||||||
|
* @param lun : not used
|
||||||
|
* @retval DSTATUS: Operation status
|
||||||
|
*/
|
||||||
|
DSTATUS SD_status(BYTE lun)
|
||||||
|
{
|
||||||
|
return SD_CheckStatus(lun);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN beforeReadSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add new code */
|
||||||
|
/* USER CODE END beforeReadSection */
|
||||||
|
/**
|
||||||
|
* @brief Reads Sector(s)
|
||||||
|
* @param lun : not used
|
||||||
|
* @param *buff: Data buffer to store read data
|
||||||
|
* @param sector: Sector address (LBA)
|
||||||
|
* @param count: Number of sectors to read (1..128)
|
||||||
|
* @retval DRESULT: Operation result
|
||||||
|
*/
|
||||||
|
|
||||||
|
DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count)
|
||||||
|
{
|
||||||
|
DRESULT res = RES_ERROR;
|
||||||
|
|
||||||
|
if(BSP_SD_ReadBlocks((uint32_t*)buff,
|
||||||
|
(uint32_t) (sector),
|
||||||
|
count, SD_TIMEOUT) == MSD_OK)
|
||||||
|
{
|
||||||
|
/* wait until the read operation is finished */
|
||||||
|
while(BSP_SD_GetCardState()!= MSD_OK)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
res = RES_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN beforeWriteSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add new code */
|
||||||
|
/* USER CODE END beforeWriteSection */
|
||||||
|
/**
|
||||||
|
* @brief Writes Sector(s)
|
||||||
|
* @param lun : not used
|
||||||
|
* @param *buff: Data to be written
|
||||||
|
* @param sector: Sector address (LBA)
|
||||||
|
* @param count: Number of sectors to write (1..128)
|
||||||
|
* @retval DRESULT: Operation result
|
||||||
|
*/
|
||||||
|
#if _USE_WRITE == 1
|
||||||
|
|
||||||
|
DRESULT SD_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count)
|
||||||
|
{
|
||||||
|
DRESULT res = RES_ERROR;
|
||||||
|
|
||||||
|
if(BSP_SD_WriteBlocks((uint32_t*)buff,
|
||||||
|
(uint32_t)(sector),
|
||||||
|
count, SD_TIMEOUT) == MSD_OK)
|
||||||
|
{
|
||||||
|
/* wait until the Write operation is finished */
|
||||||
|
while(BSP_SD_GetCardState() != MSD_OK)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
res = RES_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif /* _USE_WRITE == 1 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN beforeIoctlSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add new code */
|
||||||
|
/* USER CODE END beforeIoctlSection */
|
||||||
|
/**
|
||||||
|
* @brief I/O control operation
|
||||||
|
* @param lun : not used
|
||||||
|
* @param cmd: Control code
|
||||||
|
* @param *buff: Buffer to send/receive control data
|
||||||
|
* @retval DRESULT: Operation result
|
||||||
|
*/
|
||||||
|
#if _USE_IOCTL == 1
|
||||||
|
DRESULT SD_ioctl(BYTE lun, BYTE cmd, void *buff)
|
||||||
|
{
|
||||||
|
DRESULT res = RES_ERROR;
|
||||||
|
BSP_SD_CardInfo CardInfo;
|
||||||
|
|
||||||
|
if (Stat & STA_NOINIT) return RES_NOTRDY;
|
||||||
|
|
||||||
|
switch (cmd)
|
||||||
|
{
|
||||||
|
/* Make sure that no pending write process */
|
||||||
|
case CTRL_SYNC :
|
||||||
|
res = RES_OK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Get number of sectors on the disk (DWORD) */
|
||||||
|
case GET_SECTOR_COUNT :
|
||||||
|
BSP_SD_GetCardInfo(&CardInfo);
|
||||||
|
*(DWORD*)buff = CardInfo.LogBlockNbr;
|
||||||
|
res = RES_OK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Get R/W sector size (WORD) */
|
||||||
|
case GET_SECTOR_SIZE :
|
||||||
|
BSP_SD_GetCardInfo(&CardInfo);
|
||||||
|
*(WORD*)buff = CardInfo.LogBlockSize;
|
||||||
|
res = RES_OK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Get erase block size in unit of sector (DWORD) */
|
||||||
|
case GET_BLOCK_SIZE :
|
||||||
|
BSP_SD_GetCardInfo(&CardInfo);
|
||||||
|
*(DWORD*)buff = CardInfo.LogBlockSize / SD_DEFAULT_BLOCK_SIZE;
|
||||||
|
res = RES_OK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
res = RES_PARERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif /* _USE_IOCTL == 1 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN afterIoctlSection */
|
||||||
|
/* can be used to modify previous code / undefine following code / add new code */
|
||||||
|
/* USER CODE END afterIoctlSection */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN lastSection */
|
||||||
|
/* can be used to modify / undefine previous code or add new code */
|
||||||
|
/* USER CODE END lastSection */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||||
|
|
121
Src/sdio.c
Normal file
121
Src/sdio.c
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* File Name : SDIO.c
|
||||||
|
* Description : This file provides code for the configuration
|
||||||
|
* of the SDIO instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "sdio.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
SD_HandleTypeDef hsd;
|
||||||
|
|
||||||
|
/* SDIO init function */
|
||||||
|
|
||||||
|
void MX_SDIO_SD_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
hsd.Instance = SDIO;
|
||||||
|
hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
|
||||||
|
hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
|
||||||
|
hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;
|
||||||
|
hsd.Init.BusWide = SDIO_BUS_WIDE_1B;
|
||||||
|
hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE;
|
||||||
|
hsd.Init.ClockDiv = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_SD_MspInit(SD_HandleTypeDef* sdHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
if(sdHandle->Instance==SDIO)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN SDIO_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SDIO_MspInit 0 */
|
||||||
|
/* SDIO clock enable */
|
||||||
|
__HAL_RCC_SDIO_CLK_ENABLE();
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||||
|
/**SDIO GPIO Configuration
|
||||||
|
PC8 ------> SDIO_D0
|
||||||
|
PC9 ------> SDIO_D1
|
||||||
|
PC10 ------> SDIO_D2
|
||||||
|
PC11 ------> SDIO_D3
|
||||||
|
PC12 ------> SDIO_CK
|
||||||
|
PD2 ------> SDIO_CMD
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
|
||||||
|
|GPIO_PIN_12;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
|
||||||
|
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
|
||||||
|
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SDIO_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SDIO_MspInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_SD_MspDeInit(SD_HandleTypeDef* sdHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(sdHandle->Instance==SDIO)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN SDIO_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SDIO_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_SDIO_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**SDIO GPIO Configuration
|
||||||
|
PC8 ------> SDIO_D0
|
||||||
|
PC9 ------> SDIO_D1
|
||||||
|
PC10 ------> SDIO_D2
|
||||||
|
PC11 ------> SDIO_D3
|
||||||
|
PC12 ------> SDIO_CK
|
||||||
|
PD2 ------> SDIO_CMD
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
|
||||||
|
|GPIO_PIN_12);
|
||||||
|
|
||||||
|
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN SDIO_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SDIO_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
93
Src/spi.c
93
Src/spi.c
|
@ -9,10 +9,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -47,6 +47,50 @@ void MX_SPI1_Init(void)
|
||||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
|
||||||
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* SPI1 DMA Init */
|
||||||
|
|
||||||
|
/* SPI1_RX Init */
|
||||||
|
LL_DMA_SetChannelSelection(DMA2, LL_DMA_STREAM_0, LL_DMA_CHANNEL_3);
|
||||||
|
|
||||||
|
LL_DMA_SetDataTransferDirection(DMA2, LL_DMA_STREAM_0, LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
|
||||||
|
|
||||||
|
LL_DMA_SetStreamPriorityLevel(DMA2, LL_DMA_STREAM_0, LL_DMA_PRIORITY_LOW);
|
||||||
|
|
||||||
|
LL_DMA_SetMode(DMA2, LL_DMA_STREAM_0, LL_DMA_MODE_NORMAL);
|
||||||
|
|
||||||
|
LL_DMA_SetPeriphIncMode(DMA2, LL_DMA_STREAM_0, LL_DMA_PERIPH_NOINCREMENT);
|
||||||
|
|
||||||
|
LL_DMA_SetMemoryIncMode(DMA2, LL_DMA_STREAM_0, LL_DMA_MEMORY_INCREMENT);
|
||||||
|
|
||||||
|
LL_DMA_SetPeriphSize(DMA2, LL_DMA_STREAM_0, LL_DMA_PDATAALIGN_BYTE);
|
||||||
|
|
||||||
|
LL_DMA_SetMemorySize(DMA2, LL_DMA_STREAM_0, LL_DMA_MDATAALIGN_BYTE);
|
||||||
|
|
||||||
|
LL_DMA_DisableFifoMode(DMA2, LL_DMA_STREAM_0);
|
||||||
|
|
||||||
|
/* SPI1_TX Init */
|
||||||
|
LL_DMA_SetChannelSelection(DMA2, LL_DMA_STREAM_5, LL_DMA_CHANNEL_3);
|
||||||
|
|
||||||
|
LL_DMA_SetDataTransferDirection(DMA2, LL_DMA_STREAM_5, LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
|
||||||
|
|
||||||
|
LL_DMA_SetStreamPriorityLevel(DMA2, LL_DMA_STREAM_5, LL_DMA_PRIORITY_LOW);
|
||||||
|
|
||||||
|
LL_DMA_SetMode(DMA2, LL_DMA_STREAM_5, LL_DMA_MODE_NORMAL);
|
||||||
|
|
||||||
|
LL_DMA_SetPeriphIncMode(DMA2, LL_DMA_STREAM_5, LL_DMA_PERIPH_NOINCREMENT);
|
||||||
|
|
||||||
|
LL_DMA_SetMemoryIncMode(DMA2, LL_DMA_STREAM_5, LL_DMA_MEMORY_INCREMENT);
|
||||||
|
|
||||||
|
LL_DMA_SetPeriphSize(DMA2, LL_DMA_STREAM_5, LL_DMA_PDATAALIGN_BYTE);
|
||||||
|
|
||||||
|
LL_DMA_SetMemorySize(DMA2, LL_DMA_STREAM_5, LL_DMA_MDATAALIGN_BYTE);
|
||||||
|
|
||||||
|
LL_DMA_DisableFifoMode(DMA2, LL_DMA_STREAM_5);
|
||||||
|
|
||||||
|
/* SPI1 interrupt Init */
|
||||||
|
NVIC_SetPriority(SPI1_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(SPI1_IRQn);
|
||||||
|
|
||||||
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
||||||
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
|
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
|
||||||
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
||||||
|
@ -60,6 +104,47 @@ void MX_SPI1_Init(void)
|
||||||
LL_SPI_Init(SPI1, &SPI_InitStruct);
|
LL_SPI_Init(SPI1, &SPI_InitStruct);
|
||||||
LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA);
|
LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA);
|
||||||
|
|
||||||
|
}
|
||||||
|
/* SPI2 init function */
|
||||||
|
void MX_SPI2_Init(void)
|
||||||
|
{
|
||||||
|
LL_SPI_InitTypeDef SPI_InitStruct = {0};
|
||||||
|
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
/* Peripheral clock enable */
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_SPI2);
|
||||||
|
|
||||||
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOB);
|
||||||
|
/**SPI2 GPIO Configuration
|
||||||
|
PB13 ------> SPI2_SCK
|
||||||
|
PB14 ------> SPI2_MISO
|
||||||
|
PB15 ------> SPI2_MOSI
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_13|LL_GPIO_PIN_14|LL_GPIO_PIN_15;
|
||||||
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_5;
|
||||||
|
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* SPI2 interrupt Init */
|
||||||
|
NVIC_SetPriority(SPI2_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
||||||
|
NVIC_EnableIRQ(SPI2_IRQn);
|
||||||
|
|
||||||
|
SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
||||||
|
SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
|
||||||
|
SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
||||||
|
SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW;
|
||||||
|
SPI_InitStruct.ClockPhase = LL_SPI_PHASE_1EDGE;
|
||||||
|
SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
|
||||||
|
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2;
|
||||||
|
SPI_InitStruct.BitOrder = LL_SPI_MSB_FIRST;
|
||||||
|
SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
|
||||||
|
SPI_InitStruct.CRCPoly = 10;
|
||||||
|
LL_SPI_Init(SPI2, &SPI_InitStruct);
|
||||||
|
LL_SPI_SetStandard(SPI2, LL_SPI_PROTOCOL_MOTOROLA);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN 1 */
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
|
@ -208,20 +208,6 @@ void SysTick_Handler(void)
|
||||||
/* please refer to the startup file (startup_stm32f4xx.s). */
|
/* please refer to the startup file (startup_stm32f4xx.s). */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function handles DMA1 stream0 global interrupt.
|
|
||||||
*/
|
|
||||||
void DMA1_Stream0_IRQHandler(void)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN DMA1_Stream0_IRQn 0 */
|
|
||||||
HandleUsartRxDmaIrq(&g_uartStatuses[USART5_OFFSET]);
|
|
||||||
/* USER CODE END DMA1_Stream0_IRQn 0 */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN DMA1_Stream0_IRQn 1 */
|
|
||||||
|
|
||||||
/* USER CODE END DMA1_Stream0_IRQn 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles DMA1 stream1 global interrupt.
|
* @brief This function handles DMA1 stream1 global interrupt.
|
||||||
*/
|
*/
|
||||||
|
@ -306,6 +292,32 @@ void DMA1_Stream6_IRQHandler(void)
|
||||||
/* USER CODE END DMA1_Stream6_IRQn 1 */
|
/* USER CODE END DMA1_Stream6_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles SPI1 global interrupt.
|
||||||
|
*/
|
||||||
|
void SPI1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN SPI1_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI1_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN SPI1_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI1_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles SPI2 global interrupt.
|
||||||
|
*/
|
||||||
|
void SPI2_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN SPI2_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI2_IRQn 0 */
|
||||||
|
/* USER CODE BEGIN SPI2_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END SPI2_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles USART1 global interrupt.
|
* @brief This function handles USART1 global interrupt.
|
||||||
*/
|
*/
|
||||||
|
@ -345,20 +357,6 @@ void USART3_IRQHandler(void)
|
||||||
/* USER CODE END USART3_IRQn 1 */
|
/* USER CODE END USART3_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function handles DMA1 stream7 global interrupt.
|
|
||||||
*/
|
|
||||||
void DMA1_Stream7_IRQHandler(void)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN DMA1_Stream7_IRQn 0 */
|
|
||||||
HandleUsartTxDmaIrq(&g_uartStatuses[USART5_OFFSET]);
|
|
||||||
/* USER CODE END DMA1_Stream7_IRQn 0 */
|
|
||||||
|
|
||||||
/* USER CODE BEGIN DMA1_Stream7_IRQn 1 */
|
|
||||||
|
|
||||||
/* USER CODE END DMA1_Stream7_IRQn 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles UART4 global interrupt.
|
* @brief This function handles UART4 global interrupt.
|
||||||
*/
|
*/
|
||||||
|
@ -372,26 +370,13 @@ void UART4_IRQHandler(void)
|
||||||
/* USER CODE END UART4_IRQn 1 */
|
/* USER CODE END UART4_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function handles UART5 global interrupt.
|
|
||||||
*/
|
|
||||||
void UART5_IRQHandler(void)
|
|
||||||
{
|
|
||||||
/* USER CODE BEGIN UART5_IRQn 0 */
|
|
||||||
HandleUsartIrq(&g_uartStatuses[USART5_OFFSET]);
|
|
||||||
/* USER CODE END UART5_IRQn 0 */
|
|
||||||
/* USER CODE BEGIN UART5_IRQn 1 */
|
|
||||||
|
|
||||||
/* USER CODE END UART5_IRQn 1 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles DMA2 stream0 global interrupt.
|
* @brief This function handles DMA2 stream0 global interrupt.
|
||||||
*/
|
*/
|
||||||
void DMA2_Stream0_IRQHandler(void)
|
void DMA2_Stream0_IRQHandler(void)
|
||||||
{
|
{
|
||||||
/* USER CODE BEGIN DMA2_Stream0_IRQn 0 */
|
/* USER CODE BEGIN DMA2_Stream0_IRQn 0 */
|
||||||
HandleMemcpyDmaIrq();
|
|
||||||
/* USER CODE END DMA2_Stream0_IRQn 0 */
|
/* USER CODE END DMA2_Stream0_IRQn 0 */
|
||||||
|
|
||||||
/* USER CODE BEGIN DMA2_Stream0_IRQn 1 */
|
/* USER CODE BEGIN DMA2_Stream0_IRQn 1 */
|
||||||
|
@ -427,6 +412,21 @@ void DMA2_Stream2_IRQHandler(void)
|
||||||
/* USER CODE END DMA2_Stream2_IRQn 1 */
|
/* USER CODE END DMA2_Stream2_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles DMA2 stream3 global interrupt.
|
||||||
|
*/
|
||||||
|
void DMA2_Stream3_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN DMA2_Stream3_IRQn 0 */
|
||||||
|
HandleMemcpyDmaIrq();
|
||||||
|
|
||||||
|
/* USER CODE END DMA2_Stream3_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN DMA2_Stream3_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2_Stream3_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles DMA2 stream4 global interrupt.
|
* @brief This function handles DMA2 stream4 global interrupt.
|
||||||
*/
|
*/
|
||||||
|
@ -441,6 +441,20 @@ void DMA2_Stream4_IRQHandler(void)
|
||||||
/* USER CODE END DMA2_Stream4_IRQn 1 */
|
/* USER CODE END DMA2_Stream4_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles DMA2 stream5 global interrupt.
|
||||||
|
*/
|
||||||
|
void DMA2_Stream5_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN DMA2_Stream5_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2_Stream5_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE BEGIN DMA2_Stream5_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END DMA2_Stream5_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles DMA2 stream6 global interrupt.
|
* @brief This function handles DMA2 stream6 global interrupt.
|
||||||
*/
|
*/
|
||||||
|
|
105
Src/usart.c
105
Src/usart.c
|
@ -9,10 +9,10 @@
|
||||||
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
* All rights reserved.</center></h2>
|
* All rights reserved.</center></h2>
|
||||||
*
|
*
|
||||||
* This software component is licensed by ST under BSD 3-Clause license,
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
* the "License"; You may not use this file except in compliance with the
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
* License. You may obtain a copy of the License at:
|
* the License. You may obtain a copy of the License at:
|
||||||
* opensource.org/licenses/BSD-3-Clause
|
* www.st.com/SLA0044
|
||||||
*
|
*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -33,18 +33,18 @@ void MX_UART4_Init(void)
|
||||||
/* Peripheral clock enable */
|
/* Peripheral clock enable */
|
||||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_UART4);
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_UART4);
|
||||||
|
|
||||||
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
|
||||||
/**UART4 GPIO Configuration
|
/**UART4 GPIO Configuration
|
||||||
PC10 ------> UART4_TX
|
PA0-WKUP ------> UART4_TX
|
||||||
PC11 ------> UART4_RX
|
PA1 ------> UART4_RX
|
||||||
*/
|
*/
|
||||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_10|LL_GPIO_PIN_11;
|
GPIO_InitStruct.Pin = LL_GPIO_PIN_0|LL_GPIO_PIN_1;
|
||||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||||
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
|
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
||||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_8;
|
GPIO_InitStruct.Alternate = LL_GPIO_AF_8;
|
||||||
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
/* UART4 DMA Init */
|
/* UART4 DMA Init */
|
||||||
|
|
||||||
|
@ -101,93 +101,6 @@ void MX_UART4_Init(void)
|
||||||
LL_USART_ConfigAsyncMode(UART4);
|
LL_USART_ConfigAsyncMode(UART4);
|
||||||
LL_USART_Enable(UART4);
|
LL_USART_Enable(UART4);
|
||||||
|
|
||||||
}
|
|
||||||
/* UART5 init function */
|
|
||||||
void MX_UART5_Init(void)
|
|
||||||
{
|
|
||||||
LL_USART_InitTypeDef USART_InitStruct = {0};
|
|
||||||
|
|
||||||
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
||||||
/* Peripheral clock enable */
|
|
||||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_UART5);
|
|
||||||
|
|
||||||
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOC);
|
|
||||||
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOD);
|
|
||||||
/**UART5 GPIO Configuration
|
|
||||||
PC12 ------> UART5_TX
|
|
||||||
PD2 ------> UART5_RX
|
|
||||||
*/
|
|
||||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_12;
|
|
||||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
|
||||||
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
|
|
||||||
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
|
||||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
|
||||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_8;
|
|
||||||
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_2;
|
|
||||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
|
||||||
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
|
|
||||||
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
|
||||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
|
||||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_8;
|
|
||||||
LL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
|
||||||
|
|
||||||
/* UART5 DMA Init */
|
|
||||||
|
|
||||||
/* UART5_RX Init */
|
|
||||||
LL_DMA_SetChannelSelection(DMA1, LL_DMA_STREAM_0, LL_DMA_CHANNEL_4);
|
|
||||||
|
|
||||||
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_STREAM_0, LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
|
|
||||||
|
|
||||||
LL_DMA_SetStreamPriorityLevel(DMA1, LL_DMA_STREAM_0, LL_DMA_PRIORITY_MEDIUM);
|
|
||||||
|
|
||||||
LL_DMA_SetMode(DMA1, LL_DMA_STREAM_0, LL_DMA_MODE_NORMAL);
|
|
||||||
|
|
||||||
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_STREAM_0, LL_DMA_PERIPH_NOINCREMENT);
|
|
||||||
|
|
||||||
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_STREAM_0, LL_DMA_MEMORY_INCREMENT);
|
|
||||||
|
|
||||||
LL_DMA_SetPeriphSize(DMA1, LL_DMA_STREAM_0, LL_DMA_PDATAALIGN_BYTE);
|
|
||||||
|
|
||||||
LL_DMA_SetMemorySize(DMA1, LL_DMA_STREAM_0, LL_DMA_MDATAALIGN_BYTE);
|
|
||||||
|
|
||||||
LL_DMA_DisableFifoMode(DMA1, LL_DMA_STREAM_0);
|
|
||||||
|
|
||||||
/* UART5_TX Init */
|
|
||||||
LL_DMA_SetChannelSelection(DMA1, LL_DMA_STREAM_7, LL_DMA_CHANNEL_4);
|
|
||||||
|
|
||||||
LL_DMA_SetDataTransferDirection(DMA1, LL_DMA_STREAM_7, LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
|
|
||||||
|
|
||||||
LL_DMA_SetStreamPriorityLevel(DMA1, LL_DMA_STREAM_7, LL_DMA_PRIORITY_MEDIUM);
|
|
||||||
|
|
||||||
LL_DMA_SetMode(DMA1, LL_DMA_STREAM_7, LL_DMA_MODE_NORMAL);
|
|
||||||
|
|
||||||
LL_DMA_SetPeriphIncMode(DMA1, LL_DMA_STREAM_7, LL_DMA_PERIPH_NOINCREMENT);
|
|
||||||
|
|
||||||
LL_DMA_SetMemoryIncMode(DMA1, LL_DMA_STREAM_7, LL_DMA_MEMORY_INCREMENT);
|
|
||||||
|
|
||||||
LL_DMA_SetPeriphSize(DMA1, LL_DMA_STREAM_7, LL_DMA_PDATAALIGN_BYTE);
|
|
||||||
|
|
||||||
LL_DMA_SetMemorySize(DMA1, LL_DMA_STREAM_7, LL_DMA_MDATAALIGN_BYTE);
|
|
||||||
|
|
||||||
LL_DMA_DisableFifoMode(DMA1, LL_DMA_STREAM_7);
|
|
||||||
|
|
||||||
/* UART5 interrupt Init */
|
|
||||||
NVIC_SetPriority(UART5_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
|
|
||||||
NVIC_EnableIRQ(UART5_IRQn);
|
|
||||||
|
|
||||||
USART_InitStruct.BaudRate = 5250000;
|
|
||||||
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
|
||||||
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
|
||||||
USART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
|
||||||
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
|
||||||
USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
|
||||||
USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_8;
|
|
||||||
LL_USART_Init(UART5, &USART_InitStruct);
|
|
||||||
LL_USART_ConfigAsyncMode(UART5);
|
|
||||||
LL_USART_Enable(UART5);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/* USART1 init function */
|
/* USART1 init function */
|
||||||
|
|
||||||
|
|
108
Src/usb_otg.c
Normal file
108
Src/usb_otg.c
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* File Name : USB_OTG.c
|
||||||
|
* Description : This file provides code for the configuration
|
||||||
|
* of the USB_OTG instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
||||||
|
* All rights reserved.</center></h2>
|
||||||
|
*
|
||||||
|
* This software component is licensed by ST under Ultimate Liberty license
|
||||||
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at:
|
||||||
|
* www.st.com/SLA0044
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "usb_otg.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
PCD_HandleTypeDef hpcd_USB_OTG_FS;
|
||||||
|
|
||||||
|
/* USB_OTG_FS init function */
|
||||||
|
|
||||||
|
void MX_USB_OTG_FS_PCD_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
hpcd_USB_OTG_FS.Instance = USB_OTG_FS;
|
||||||
|
hpcd_USB_OTG_FS.Init.dev_endpoints = 4;
|
||||||
|
hpcd_USB_OTG_FS.Init.speed = PCD_SPEED_FULL;
|
||||||
|
hpcd_USB_OTG_FS.Init.dma_enable = DISABLE;
|
||||||
|
hpcd_USB_OTG_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
|
||||||
|
hpcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
|
||||||
|
hpcd_USB_OTG_FS.Init.low_power_enable = DISABLE;
|
||||||
|
hpcd_USB_OTG_FS.Init.lpm_enable = DISABLE;
|
||||||
|
hpcd_USB_OTG_FS.Init.vbus_sensing_enable = DISABLE;
|
||||||
|
hpcd_USB_OTG_FS.Init.use_dedicated_ep1 = DISABLE;
|
||||||
|
if (HAL_PCD_Init(&hpcd_USB_OTG_FS) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_PCD_MspInit(PCD_HandleTypeDef* pcdHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
if(pcdHandle->Instance==USB_OTG_FS)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USB_OTG_FS_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USB_OTG_FS_MspInit 0 */
|
||||||
|
|
||||||
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
/**USB_OTG_FS GPIO Configuration
|
||||||
|
PA11 ------> USB_OTG_FS_DM
|
||||||
|
PA12 ------> USB_OTG_FS_DP
|
||||||
|
*/
|
||||||
|
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||||
|
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
|
||||||
|
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
/* USB_OTG_FS clock enable */
|
||||||
|
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
|
||||||
|
/* USER CODE BEGIN USB_OTG_FS_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USB_OTG_FS_MspInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_PCD_MspDeInit(PCD_HandleTypeDef* pcdHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(pcdHandle->Instance==USB_OTG_FS)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN USB_OTG_FS_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END USB_OTG_FS_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
|
||||||
|
|
||||||
|
/**USB_OTG_FS GPIO Configuration
|
||||||
|
PA11 ------> USB_OTG_FS_DM
|
||||||
|
PA12 ------> USB_OTG_FS_DP
|
||||||
|
*/
|
||||||
|
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN USB_OTG_FS_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END USB_OTG_FS_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
@ -16,7 +16,6 @@
|
||||||
// 1 2 2 7
|
// 1 2 2 7
|
||||||
// 2 1 5 6
|
// 2 1 5 6
|
||||||
// 3 1 1 3
|
// 3 1 1 3
|
||||||
// 5 1 0 7
|
|
||||||
// 6 2 1 6
|
// 6 2 1 6
|
||||||
// console UART
|
// console UART
|
||||||
// 4 1 2 4
|
// 4 1 2 4
|
||||||
|
@ -36,7 +35,6 @@ void MainLoop()
|
||||||
{ USART1, DMA2, LL_DMA_STREAM_2, LL_DMA_STREAM_7 },
|
{ USART1, DMA2, LL_DMA_STREAM_2, LL_DMA_STREAM_7 },
|
||||||
{ USART2, DMA1, LL_DMA_STREAM_5, LL_DMA_STREAM_6 },
|
{ USART2, DMA1, LL_DMA_STREAM_5, LL_DMA_STREAM_6 },
|
||||||
{ USART3, DMA1, LL_DMA_STREAM_1, LL_DMA_STREAM_3 },
|
{ USART3, DMA1, LL_DMA_STREAM_1, LL_DMA_STREAM_3 },
|
||||||
{ UART5, DMA1, LL_DMA_STREAM_0, LL_DMA_STREAM_7 },
|
|
||||||
{ USART6, DMA2, LL_DMA_STREAM_1, LL_DMA_STREAM_6 },
|
{ USART6, DMA2, LL_DMA_STREAM_1, LL_DMA_STREAM_6 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,12 +77,16 @@ void MainLoop()
|
||||||
|
|
||||||
for(uint16_t idx = 0; idx < sizeof(g_uartStatuses) / sizeof(g_uartStatuses[0]); ++idx) {
|
for(uint16_t idx = 0; idx < sizeof(g_uartStatuses) / sizeof(g_uartStatuses[0]); ++idx) {
|
||||||
if(!g_uartStatuses[idx].txBuffer.busy && send) {
|
if(!g_uartStatuses[idx].txBuffer.busy && send) {
|
||||||
|
DIAG_ENTER_BUSY();
|
||||||
PostPacket(&g_uartStatuses[idx], text2Send, sizeof(text2Send) - 1 - (rand() & randmask), &g_crcStatus);
|
PostPacket(&g_uartStatuses[idx], text2Send, sizeof(text2Send) - 1 - (rand() & randmask), &g_crcStatus);
|
||||||
|
DIAG_EXIT_BUSY();
|
||||||
}
|
}
|
||||||
for(uint16_t rIdx = 0; rIdx < 2; ++rIdx)
|
for(uint16_t rIdx = 0; rIdx < 2; ++rIdx)
|
||||||
if(g_uartStatuses[idx].rxBuffers[rIdx].busy || g_uartStatuses[idx].rxBuffers[rIdx].error)
|
if(g_uartStatuses[idx].rxBuffers[rIdx].busy || g_uartStatuses[idx].rxBuffers[rIdx].error) {
|
||||||
|
DIAG_ENTER_BUSY();
|
||||||
ConsumePacket(&g_uartStatuses[idx], rIdx, &g_crcStatus);
|
ConsumePacket(&g_uartStatuses[idx], rIdx, &g_crcStatus);
|
||||||
|
DIAG_EXIT_BUSY();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(tick - lastStatsTick > STATS_DELAY_MS) {
|
if(tick - lastStatsTick > STATS_DELAY_MS) {
|
||||||
PrintStats((char*)g_statsBuf, statId, &g_uartStatuses[statId].stats, UART4, &g_ConsoleTxDmaInfo);
|
PrintStats((char*)g_statsBuf, statId, &g_uartStatuses[statId].stats, UART4, &g_ConsoleTxDmaInfo);
|
||||||
|
@ -93,5 +95,10 @@ void MainLoop()
|
||||||
if(statId >= UARTCOUNT)
|
if(statId >= UARTCOUNT)
|
||||||
statId = 0;
|
statId = 0;
|
||||||
}
|
}
|
||||||
|
uint32_t ein = LL_GPIO_ReadInputPort(KEY1_GPIO_Port);
|
||||||
|
if(!(ein & KEY1_Pin)) {
|
||||||
|
void (*fptr)(void) = (void*)0xa0000000;
|
||||||
|
fptr();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,12 @@
|
||||||
#ifndef CONFIG_H_
|
#ifndef CONFIG_H_
|
||||||
#define CONFIG_H_
|
#define CONFIG_H_
|
||||||
|
|
||||||
#define UARTCOUNT 5
|
#define UARTCOUNT 4
|
||||||
#define CRCTASKCOUNT (UARTCOUNT * 2)
|
#define CRCTASKCOUNT (UARTCOUNT * 2)
|
||||||
#define USART1_OFFSET 0
|
#define USART1_OFFSET 0
|
||||||
#define USART2_OFFSET 1
|
#define USART2_OFFSET 1
|
||||||
#define USART3_OFFSET 2
|
#define USART3_OFFSET 2
|
||||||
#define USART5_OFFSET 3
|
#define USART6_OFFSET 3
|
||||||
#define USART6_OFFSET 4
|
|
||||||
|
|
||||||
#define CONSOLE_DMA_ENGINE DMA1
|
#define CONSOLE_DMA_ENGINE DMA1
|
||||||
#define CONSOLE_TX_DMA_STREAM LL_DMA_STREAM_4
|
#define CONSOLE_TX_DMA_STREAM LL_DMA_STREAM_4
|
||||||
|
@ -23,6 +22,6 @@
|
||||||
#define CRC_DMA_STREAM LL_DMA_STREAM_4
|
#define CRC_DMA_STREAM LL_DMA_STREAM_4
|
||||||
|
|
||||||
#define MEMCPY_DMA_ENGINE DMA2
|
#define MEMCPY_DMA_ENGINE DMA2
|
||||||
#define MEMCPY_DMA_STREAM LL_DMA_STREAM_0
|
#define MEMCPY_DMA_STREAM LL_DMA_STREAM_3
|
||||||
|
|
||||||
#endif /* CONFIG_H_ */
|
#endif /* CONFIG_H_ */
|
||||||
|
|
23
app/diag.h
23
app/diag.h
|
@ -17,13 +17,16 @@ if(x) { \
|
||||||
LL_GPIO_ResetOutputPin(LED0_GPIO_Port, LED0_Pin); \
|
LL_GPIO_ResetOutputPin(LED0_GPIO_Port, LED0_Pin); \
|
||||||
LL_GPIO_SetOutputPin(LED1_GPIO_Port, LED1_Pin); \
|
LL_GPIO_SetOutputPin(LED1_GPIO_Port, LED1_Pin); \
|
||||||
}
|
}
|
||||||
#define DIAG_CRC_CALC_START() LL_GPIO_SetOutputPin(DIAG0_GPIO_Port, DIAG0_Pin)
|
|
||||||
#define DIAG_CRC_CALC_END() LL_GPIO_ResetOutputPin(DIAG0_GPIO_Port, DIAG0_Pin)//; LL_GPIO_TogglePin(DIAG3_GPIO_Port, DIAG3_Pin)
|
|
||||||
#define DIAG_INTERRUPT_IN() LL_GPIO_SetOutputPin(DIAG1_GPIO_Port, DIAG1_Pin)
|
|
||||||
#define DIAG_INTERRUPT_OUT() LL_GPIO_ResetOutputPin(DIAG1_GPIO_Port, DIAG1_Pin)
|
|
||||||
#define DIAG_ERROR_EVENT() LL_GPIO_TogglePin(DIAG2_GPIO_Port, DIAG2_Pin)
|
|
||||||
|
|
||||||
#else // _ENABLE_DIAG
|
#define DIAG_INTERRUPT_IN() LL_GPIO_SetOutputPin(DEBUG0_GPIO_Port, DEBUG0_Pin)
|
||||||
|
#define DIAG_INTERRUPT_OUT() LL_GPIO_ResetOutputPin(DEBUG0_GPIO_Port, DEBUG0_Pin)
|
||||||
|
#define DIAG_CRC_CALC_START() LL_GPIO_SetOutputPin(DEBUG1_GPIO_Port, DEBUG1_Pin)
|
||||||
|
#define DIAG_CRC_CALC_END() LL_GPIO_ResetOutputPin(DEBUG1_GPIO_Port, DEBUG1_Pin)
|
||||||
|
//#define DIAG_ERROR_EVENT() LL_GPIO_TogglePin(DEBUG2_GPIO_Port, DEBUG2_Pin)
|
||||||
|
#define DIAG_ENTER_BUSY() LL_GPIO_SetOutputPin(DEBUG2_GPIO_Port, DEBUG2_Pin)
|
||||||
|
#define DIAG_EXIT_BUSY() LL_GPIO_ResetOutputPin(DEBUG2_GPIO_Port, DEBUG2_Pin)
|
||||||
|
|
||||||
|
#endif // _ENABLE_DIAG
|
||||||
|
|
||||||
#ifndef DIAG_RX_BUFFER_SWITCH
|
#ifndef DIAG_RX_BUFFER_SWITCH
|
||||||
# define DIAG_RX_BUFFER_SWITCH(x)
|
# define DIAG_RX_BUFFER_SWITCH(x)
|
||||||
|
@ -49,6 +52,12 @@ if(x) { \
|
||||||
# define DIAG_ERROR_EVENT()
|
# define DIAG_ERROR_EVENT()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _ENABLE_DIAG
|
#ifndef DIAG_ENTER_BUSY
|
||||||
|
# define DIAG_ENTER_BUSY()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DIAG_EXIT_BUSY
|
||||||
|
# define DIAG_EXIT_BUSY()
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* DIAG_H_ */
|
#endif /* DIAG_H_ */
|
||||||
|
|
31
f407ve_hs_uart (OpenOCD).cfg
Normal file
31
f407ve_hs_uart (OpenOCD).cfg
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# This is an genericBoard board with a single STM32F407VETx chip
|
||||||
|
#
|
||||||
|
# Generated by STM32CubeIDE
|
||||||
|
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
|
||||||
|
|
||||||
|
source [find interface/stlink.cfg]
|
||||||
|
|
||||||
|
set WORKAREASIZE 0x8000
|
||||||
|
|
||||||
|
transport select "hla_swd"
|
||||||
|
|
||||||
|
set CHIPNAME STM32F407VETx
|
||||||
|
set BOARDNAME genericBoard
|
||||||
|
|
||||||
|
# Enable debug when in low power modes
|
||||||
|
set ENABLE_LOW_POWER 1
|
||||||
|
|
||||||
|
# Stop Watchdog counters when halt
|
||||||
|
set STOP_WATCHDOG 1
|
||||||
|
|
||||||
|
# STlink Debug clock frequency
|
||||||
|
set CLOCK_FREQ 8000
|
||||||
|
|
||||||
|
# use hardware reset, connect under reset
|
||||||
|
# connect_assert_srst needed if low power mode application running (WFI...)
|
||||||
|
reset_config srst_only srst_nogate connect_assert_srst
|
||||||
|
set CONNECT_UNDER_RESET 1
|
||||||
|
|
||||||
|
# BCTM CPU variables
|
||||||
|
|
||||||
|
source [find target/stm32f4x.cfg]
|
31
f407ve_hs_uart Debug (1).cfg
Normal file
31
f407ve_hs_uart Debug (1).cfg
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# This is an genericBoard board with a single STM32F407VETx chip
|
||||||
|
#
|
||||||
|
# Generated by STM32CubeIDE
|
||||||
|
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
|
||||||
|
|
||||||
|
source [find interface/stlink.cfg]
|
||||||
|
|
||||||
|
set WORKAREASIZE 0x8000
|
||||||
|
|
||||||
|
transport select "hla_swd"
|
||||||
|
|
||||||
|
set CHIPNAME STM32F407VETx
|
||||||
|
set BOARDNAME genericBoard
|
||||||
|
|
||||||
|
# Enable debug when in low power modes
|
||||||
|
set ENABLE_LOW_POWER 1
|
||||||
|
|
||||||
|
# Stop Watchdog counters when halt
|
||||||
|
set STOP_WATCHDOG 1
|
||||||
|
|
||||||
|
# STlink Debug clock frequency
|
||||||
|
set CLOCK_FREQ 8000
|
||||||
|
|
||||||
|
# use hardware reset, connect under reset
|
||||||
|
# connect_assert_srst needed if low power mode application running (WFI...)
|
||||||
|
reset_config srst_only srst_nogate connect_assert_srst
|
||||||
|
set CONNECT_UNDER_RESET 1
|
||||||
|
|
||||||
|
# BCTM CPU variables
|
||||||
|
|
||||||
|
source [find target/stm32f4x.cfg]
|
31
f407ve_hs_uart OpenOCD.cfg
Normal file
31
f407ve_hs_uart OpenOCD.cfg
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
# This is an genericBoard board with a single STM32F407VETx chip
|
||||||
|
#
|
||||||
|
# Generated by STM32CubeIDE
|
||||||
|
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
|
||||||
|
|
||||||
|
source [find interface/stlink.cfg]
|
||||||
|
|
||||||
|
set WORKAREASIZE 0x8000
|
||||||
|
|
||||||
|
transport select "hla_swd"
|
||||||
|
|
||||||
|
set CHIPNAME STM32F407VETx
|
||||||
|
set BOARDNAME genericBoard
|
||||||
|
|
||||||
|
# Enable debug when in low power modes
|
||||||
|
set ENABLE_LOW_POWER 1
|
||||||
|
|
||||||
|
# Stop Watchdog counters when halt
|
||||||
|
set STOP_WATCHDOG 1
|
||||||
|
|
||||||
|
# STlink Debug clock frequency
|
||||||
|
set CLOCK_FREQ 8000
|
||||||
|
|
||||||
|
# use hardware reset, connect under reset
|
||||||
|
# connect_assert_srst needed if low power mode application running (WFI...)
|
||||||
|
reset_config srst_only srst_nogate connect_assert_srst
|
||||||
|
set CONNECT_UNDER_RESET 1
|
||||||
|
|
||||||
|
# BCTM CPU variables
|
||||||
|
|
||||||
|
source [find target/stm32f4x.cfg]
|
|
@ -1,232 +1,279 @@
|
||||||
#MicroXplorer Configuration settings - do not modify
|
#MicroXplorer Configuration settings - do not modify
|
||||||
Dma.MEMTOMEM.12.Direction=DMA_MEMORY_TO_MEMORY
|
Dma.MEMTOMEM.8.Direction=DMA_MEMORY_TO_MEMORY
|
||||||
Dma.MEMTOMEM.12.FIFOMode=DMA_FIFOMODE_ENABLE
|
Dma.MEMTOMEM.8.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||||
Dma.MEMTOMEM.12.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
Dma.MEMTOMEM.8.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||||
Dma.MEMTOMEM.12.Instance=DMA2_Stream4
|
Dma.MEMTOMEM.8.Instance=DMA2_Stream4
|
||||||
Dma.MEMTOMEM.12.MemBurst=DMA_MBURST_SINGLE
|
Dma.MEMTOMEM.8.MemBurst=DMA_MBURST_SINGLE
|
||||||
Dma.MEMTOMEM.12.MemDataAlignment=DMA_MDATAALIGN_WORD
|
Dma.MEMTOMEM.8.MemDataAlignment=DMA_MDATAALIGN_WORD
|
||||||
Dma.MEMTOMEM.12.MemInc=DMA_MINC_DISABLE
|
Dma.MEMTOMEM.8.MemInc=DMA_MINC_DISABLE
|
||||||
Dma.MEMTOMEM.12.Mode=DMA_NORMAL
|
Dma.MEMTOMEM.8.Mode=DMA_NORMAL
|
||||||
Dma.MEMTOMEM.12.PeriphBurst=DMA_PBURST_SINGLE
|
Dma.MEMTOMEM.8.PeriphBurst=DMA_PBURST_SINGLE
|
||||||
Dma.MEMTOMEM.12.PeriphDataAlignment=DMA_PDATAALIGN_WORD
|
Dma.MEMTOMEM.8.PeriphDataAlignment=DMA_PDATAALIGN_WORD
|
||||||
Dma.MEMTOMEM.12.PeriphInc=DMA_PINC_ENABLE
|
Dma.MEMTOMEM.8.PeriphInc=DMA_PINC_ENABLE
|
||||||
Dma.MEMTOMEM.12.Priority=DMA_PRIORITY_LOW
|
Dma.MEMTOMEM.8.Priority=DMA_PRIORITY_LOW
|
||||||
Dma.MEMTOMEM.12.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
Dma.MEMTOMEM.8.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||||
Dma.MEMTOMEM.13.Direction=DMA_MEMORY_TO_MEMORY
|
Dma.MEMTOMEM.9.Direction=DMA_MEMORY_TO_MEMORY
|
||||||
Dma.MEMTOMEM.13.FIFOMode=DMA_FIFOMODE_ENABLE
|
Dma.MEMTOMEM.9.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||||
Dma.MEMTOMEM.13.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
Dma.MEMTOMEM.9.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||||
Dma.MEMTOMEM.13.Instance=DMA2_Stream0
|
Dma.MEMTOMEM.9.Instance=DMA2_Stream3
|
||||||
Dma.MEMTOMEM.13.MemBurst=DMA_MBURST_SINGLE
|
Dma.MEMTOMEM.9.MemBurst=DMA_MBURST_SINGLE
|
||||||
Dma.MEMTOMEM.13.MemDataAlignment=DMA_MDATAALIGN_WORD
|
Dma.MEMTOMEM.9.MemDataAlignment=DMA_MDATAALIGN_WORD
|
||||||
Dma.MEMTOMEM.13.MemInc=DMA_MINC_ENABLE
|
Dma.MEMTOMEM.9.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.MEMTOMEM.13.Mode=DMA_NORMAL
|
Dma.MEMTOMEM.9.Mode=DMA_NORMAL
|
||||||
Dma.MEMTOMEM.13.PeriphBurst=DMA_PBURST_SINGLE
|
Dma.MEMTOMEM.9.PeriphBurst=DMA_PBURST_SINGLE
|
||||||
Dma.MEMTOMEM.13.PeriphDataAlignment=DMA_PDATAALIGN_WORD
|
Dma.MEMTOMEM.9.PeriphDataAlignment=DMA_PDATAALIGN_WORD
|
||||||
Dma.MEMTOMEM.13.PeriphInc=DMA_PINC_ENABLE
|
Dma.MEMTOMEM.9.PeriphInc=DMA_PINC_ENABLE
|
||||||
Dma.MEMTOMEM.13.Priority=DMA_PRIORITY_LOW
|
Dma.MEMTOMEM.9.Priority=DMA_PRIORITY_LOW
|
||||||
Dma.MEMTOMEM.13.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
Dma.MEMTOMEM.9.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||||
Dma.Request0=UART4_RX
|
Dma.Request0=USART3_RX
|
||||||
Dma.Request1=UART4_TX
|
Dma.Request1=USART3_TX
|
||||||
Dma.Request10=USART6_RX
|
Dma.Request10=UART4_RX
|
||||||
Dma.Request11=USART6_TX
|
Dma.Request11=UART4_TX
|
||||||
Dma.Request12=MEMTOMEM
|
Dma.Request12=SPI1_RX
|
||||||
Dma.Request13=MEMTOMEM
|
Dma.Request13=SPI1_TX
|
||||||
Dma.Request2=USART3_RX
|
Dma.Request2=USART2_RX
|
||||||
Dma.Request3=USART3_TX
|
Dma.Request3=USART2_TX
|
||||||
Dma.Request4=UART5_RX
|
Dma.Request4=USART1_RX
|
||||||
Dma.Request5=UART5_TX
|
Dma.Request5=USART1_TX
|
||||||
Dma.Request6=USART2_RX
|
Dma.Request6=USART6_RX
|
||||||
Dma.Request7=USART2_TX
|
Dma.Request7=USART6_TX
|
||||||
Dma.Request8=USART1_RX
|
Dma.Request8=MEMTOMEM
|
||||||
Dma.Request9=USART1_TX
|
Dma.Request9=MEMTOMEM
|
||||||
Dma.RequestsNb=14
|
Dma.RequestsNb=14
|
||||||
Dma.UART4_RX.0.Direction=DMA_PERIPH_TO_MEMORY
|
Dma.SPI1_RX.12.Direction=DMA_PERIPH_TO_MEMORY
|
||||||
Dma.UART4_RX.0.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.SPI1_RX.12.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.UART4_RX.0.Instance=DMA1_Stream2
|
Dma.SPI1_RX.12.Instance=DMA2_Stream0
|
||||||
Dma.UART4_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.SPI1_RX.12.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.UART4_RX.0.MemInc=DMA_MINC_ENABLE
|
Dma.SPI1_RX.12.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.UART4_RX.0.Mode=DMA_NORMAL
|
Dma.SPI1_RX.12.Mode=DMA_NORMAL
|
||||||
Dma.UART4_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.SPI1_RX.12.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.UART4_RX.0.PeriphInc=DMA_PINC_DISABLE
|
Dma.SPI1_RX.12.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.UART4_RX.0.Priority=DMA_PRIORITY_LOW
|
Dma.SPI1_RX.12.Priority=DMA_PRIORITY_LOW
|
||||||
Dma.UART4_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.SPI1_RX.12.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.UART4_TX.1.Direction=DMA_MEMORY_TO_PERIPH
|
Dma.SPI1_TX.13.Direction=DMA_MEMORY_TO_PERIPH
|
||||||
Dma.UART4_TX.1.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.SPI1_TX.13.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.UART4_TX.1.Instance=DMA1_Stream4
|
Dma.SPI1_TX.13.Instance=DMA2_Stream5
|
||||||
Dma.UART4_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.SPI1_TX.13.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.UART4_TX.1.MemInc=DMA_MINC_ENABLE
|
Dma.SPI1_TX.13.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.UART4_TX.1.Mode=DMA_NORMAL
|
Dma.SPI1_TX.13.Mode=DMA_NORMAL
|
||||||
Dma.UART4_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.SPI1_TX.13.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.UART4_TX.1.PeriphInc=DMA_PINC_DISABLE
|
Dma.SPI1_TX.13.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.UART4_TX.1.Priority=DMA_PRIORITY_LOW
|
Dma.SPI1_TX.13.Priority=DMA_PRIORITY_LOW
|
||||||
Dma.UART4_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.SPI1_TX.13.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.UART5_RX.4.Direction=DMA_PERIPH_TO_MEMORY
|
Dma.UART4_RX.10.Direction=DMA_PERIPH_TO_MEMORY
|
||||||
Dma.UART5_RX.4.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.UART4_RX.10.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.UART5_RX.4.Instance=DMA1_Stream0
|
Dma.UART4_RX.10.Instance=DMA1_Stream2
|
||||||
Dma.UART5_RX.4.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.UART4_RX.10.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.UART5_RX.4.MemInc=DMA_MINC_ENABLE
|
Dma.UART4_RX.10.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.UART5_RX.4.Mode=DMA_NORMAL
|
Dma.UART4_RX.10.Mode=DMA_NORMAL
|
||||||
Dma.UART5_RX.4.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.UART4_RX.10.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.UART5_RX.4.PeriphInc=DMA_PINC_DISABLE
|
Dma.UART4_RX.10.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.UART5_RX.4.Priority=DMA_PRIORITY_MEDIUM
|
Dma.UART4_RX.10.Priority=DMA_PRIORITY_LOW
|
||||||
Dma.UART5_RX.4.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.UART4_RX.10.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.UART5_TX.5.Direction=DMA_MEMORY_TO_PERIPH
|
Dma.UART4_TX.11.Direction=DMA_MEMORY_TO_PERIPH
|
||||||
Dma.UART5_TX.5.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.UART4_TX.11.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.UART5_TX.5.Instance=DMA1_Stream7
|
Dma.UART4_TX.11.Instance=DMA1_Stream4
|
||||||
Dma.UART5_TX.5.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.UART4_TX.11.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.UART5_TX.5.MemInc=DMA_MINC_ENABLE
|
Dma.UART4_TX.11.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.UART5_TX.5.Mode=DMA_NORMAL
|
Dma.UART4_TX.11.Mode=DMA_NORMAL
|
||||||
Dma.UART5_TX.5.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.UART4_TX.11.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.UART5_TX.5.PeriphInc=DMA_PINC_DISABLE
|
Dma.UART4_TX.11.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.UART5_TX.5.Priority=DMA_PRIORITY_MEDIUM
|
Dma.UART4_TX.11.Priority=DMA_PRIORITY_LOW
|
||||||
Dma.UART5_TX.5.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.UART4_TX.11.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.USART1_RX.8.Direction=DMA_PERIPH_TO_MEMORY
|
Dma.USART1_RX.4.Direction=DMA_PERIPH_TO_MEMORY
|
||||||
Dma.USART1_RX.8.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.USART1_RX.4.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.USART1_RX.8.Instance=DMA2_Stream2
|
Dma.USART1_RX.4.Instance=DMA2_Stream2
|
||||||
Dma.USART1_RX.8.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.USART1_RX.4.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.USART1_RX.8.MemInc=DMA_MINC_ENABLE
|
Dma.USART1_RX.4.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.USART1_RX.8.Mode=DMA_NORMAL
|
Dma.USART1_RX.4.Mode=DMA_NORMAL
|
||||||
Dma.USART1_RX.8.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.USART1_RX.4.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.USART1_RX.8.PeriphInc=DMA_PINC_DISABLE
|
Dma.USART1_RX.4.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.USART1_RX.8.Priority=DMA_PRIORITY_MEDIUM
|
Dma.USART1_RX.4.Priority=DMA_PRIORITY_MEDIUM
|
||||||
Dma.USART1_RX.8.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.USART1_RX.4.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.USART1_TX.9.Direction=DMA_MEMORY_TO_PERIPH
|
Dma.USART1_TX.5.Direction=DMA_MEMORY_TO_PERIPH
|
||||||
Dma.USART1_TX.9.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.USART1_TX.5.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.USART1_TX.9.Instance=DMA2_Stream7
|
Dma.USART1_TX.5.Instance=DMA2_Stream7
|
||||||
Dma.USART1_TX.9.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.USART1_TX.5.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.USART1_TX.9.MemInc=DMA_MINC_ENABLE
|
Dma.USART1_TX.5.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.USART1_TX.9.Mode=DMA_NORMAL
|
Dma.USART1_TX.5.Mode=DMA_NORMAL
|
||||||
Dma.USART1_TX.9.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.USART1_TX.5.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.USART1_TX.9.PeriphInc=DMA_PINC_DISABLE
|
Dma.USART1_TX.5.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.USART1_TX.9.Priority=DMA_PRIORITY_MEDIUM
|
Dma.USART1_TX.5.Priority=DMA_PRIORITY_MEDIUM
|
||||||
Dma.USART1_TX.9.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.USART1_TX.5.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.USART2_RX.6.Direction=DMA_PERIPH_TO_MEMORY
|
Dma.USART2_RX.2.Direction=DMA_PERIPH_TO_MEMORY
|
||||||
Dma.USART2_RX.6.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.USART2_RX.2.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.USART2_RX.6.Instance=DMA1_Stream5
|
Dma.USART2_RX.2.Instance=DMA1_Stream5
|
||||||
Dma.USART2_RX.6.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.USART2_RX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.USART2_RX.6.MemInc=DMA_MINC_ENABLE
|
Dma.USART2_RX.2.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.USART2_RX.6.Mode=DMA_NORMAL
|
Dma.USART2_RX.2.Mode=DMA_NORMAL
|
||||||
Dma.USART2_RX.6.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.USART2_RX.2.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.USART2_RX.6.PeriphInc=DMA_PINC_DISABLE
|
Dma.USART2_RX.2.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.USART2_RX.6.Priority=DMA_PRIORITY_MEDIUM
|
Dma.USART2_RX.2.Priority=DMA_PRIORITY_MEDIUM
|
||||||
Dma.USART2_RX.6.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.USART2_RX.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.USART2_TX.7.Direction=DMA_MEMORY_TO_PERIPH
|
Dma.USART2_TX.3.Direction=DMA_MEMORY_TO_PERIPH
|
||||||
Dma.USART2_TX.7.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.USART2_TX.3.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.USART2_TX.7.Instance=DMA1_Stream6
|
Dma.USART2_TX.3.Instance=DMA1_Stream6
|
||||||
Dma.USART2_TX.7.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.USART2_TX.3.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.USART2_TX.7.MemInc=DMA_MINC_ENABLE
|
Dma.USART2_TX.3.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.USART2_TX.7.Mode=DMA_NORMAL
|
Dma.USART2_TX.3.Mode=DMA_NORMAL
|
||||||
Dma.USART2_TX.7.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.USART2_TX.3.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.USART2_TX.7.PeriphInc=DMA_PINC_DISABLE
|
Dma.USART2_TX.3.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.USART2_TX.7.Priority=DMA_PRIORITY_MEDIUM
|
Dma.USART2_TX.3.Priority=DMA_PRIORITY_MEDIUM
|
||||||
Dma.USART2_TX.7.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.USART2_TX.3.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.USART3_RX.2.Direction=DMA_PERIPH_TO_MEMORY
|
Dma.USART3_RX.0.Direction=DMA_PERIPH_TO_MEMORY
|
||||||
Dma.USART3_RX.2.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.USART3_RX.0.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.USART3_RX.2.Instance=DMA1_Stream1
|
Dma.USART3_RX.0.Instance=DMA1_Stream1
|
||||||
Dma.USART3_RX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.USART3_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.USART3_RX.2.MemInc=DMA_MINC_ENABLE
|
Dma.USART3_RX.0.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.USART3_RX.2.Mode=DMA_NORMAL
|
Dma.USART3_RX.0.Mode=DMA_NORMAL
|
||||||
Dma.USART3_RX.2.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.USART3_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.USART3_RX.2.PeriphInc=DMA_PINC_DISABLE
|
Dma.USART3_RX.0.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.USART3_RX.2.Priority=DMA_PRIORITY_MEDIUM
|
Dma.USART3_RX.0.Priority=DMA_PRIORITY_MEDIUM
|
||||||
Dma.USART3_RX.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.USART3_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.USART3_TX.3.Direction=DMA_MEMORY_TO_PERIPH
|
Dma.USART3_TX.1.Direction=DMA_MEMORY_TO_PERIPH
|
||||||
Dma.USART3_TX.3.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.USART3_TX.1.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.USART3_TX.3.Instance=DMA1_Stream3
|
Dma.USART3_TX.1.Instance=DMA1_Stream3
|
||||||
Dma.USART3_TX.3.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.USART3_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.USART3_TX.3.MemInc=DMA_MINC_ENABLE
|
Dma.USART3_TX.1.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.USART3_TX.3.Mode=DMA_NORMAL
|
Dma.USART3_TX.1.Mode=DMA_NORMAL
|
||||||
Dma.USART3_TX.3.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.USART3_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.USART3_TX.3.PeriphInc=DMA_PINC_DISABLE
|
Dma.USART3_TX.1.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.USART3_TX.3.Priority=DMA_PRIORITY_MEDIUM
|
Dma.USART3_TX.1.Priority=DMA_PRIORITY_MEDIUM
|
||||||
Dma.USART3_TX.3.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.USART3_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.USART6_RX.10.Direction=DMA_PERIPH_TO_MEMORY
|
Dma.USART6_RX.6.Direction=DMA_PERIPH_TO_MEMORY
|
||||||
Dma.USART6_RX.10.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.USART6_RX.6.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.USART6_RX.10.Instance=DMA2_Stream1
|
Dma.USART6_RX.6.Instance=DMA2_Stream1
|
||||||
Dma.USART6_RX.10.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.USART6_RX.6.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.USART6_RX.10.MemInc=DMA_MINC_ENABLE
|
Dma.USART6_RX.6.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.USART6_RX.10.Mode=DMA_NORMAL
|
Dma.USART6_RX.6.Mode=DMA_NORMAL
|
||||||
Dma.USART6_RX.10.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.USART6_RX.6.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.USART6_RX.10.PeriphInc=DMA_PINC_DISABLE
|
Dma.USART6_RX.6.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.USART6_RX.10.Priority=DMA_PRIORITY_MEDIUM
|
Dma.USART6_RX.6.Priority=DMA_PRIORITY_MEDIUM
|
||||||
Dma.USART6_RX.10.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.USART6_RX.6.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
Dma.USART6_TX.11.Direction=DMA_MEMORY_TO_PERIPH
|
Dma.USART6_TX.7.Direction=DMA_MEMORY_TO_PERIPH
|
||||||
Dma.USART6_TX.11.FIFOMode=DMA_FIFOMODE_DISABLE
|
Dma.USART6_TX.7.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||||
Dma.USART6_TX.11.Instance=DMA2_Stream6
|
Dma.USART6_TX.7.Instance=DMA2_Stream6
|
||||||
Dma.USART6_TX.11.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
Dma.USART6_TX.7.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||||
Dma.USART6_TX.11.MemInc=DMA_MINC_ENABLE
|
Dma.USART6_TX.7.MemInc=DMA_MINC_ENABLE
|
||||||
Dma.USART6_TX.11.Mode=DMA_NORMAL
|
Dma.USART6_TX.7.Mode=DMA_NORMAL
|
||||||
Dma.USART6_TX.11.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
Dma.USART6_TX.7.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||||
Dma.USART6_TX.11.PeriphInc=DMA_PINC_DISABLE
|
Dma.USART6_TX.7.PeriphInc=DMA_PINC_DISABLE
|
||||||
Dma.USART6_TX.11.Priority=DMA_PRIORITY_MEDIUM
|
Dma.USART6_TX.7.Priority=DMA_PRIORITY_MEDIUM
|
||||||
Dma.USART6_TX.11.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
Dma.USART6_TX.7.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||||
|
FATFS.IPParameters=_USE_MKFS,_USE_LFN,_LFN_UNICODE,_FS_TINY,_FS_LOCK,USE_DMA_CODE_SD
|
||||||
|
FATFS.USE_DMA_CODE_SD=0
|
||||||
|
FATFS._FS_LOCK=3
|
||||||
|
FATFS._FS_TINY=0
|
||||||
|
FATFS._LFN_UNICODE=1
|
||||||
|
FATFS._USE_LFN=1
|
||||||
|
FATFS._USE_MKFS=0
|
||||||
File.Version=6
|
File.Version=6
|
||||||
KeepUserPlacement=false
|
KeepUserPlacement=false
|
||||||
Mcu.Family=STM32F4
|
Mcu.Family=STM32F4
|
||||||
Mcu.IP0=CRC
|
Mcu.IP0=CRC
|
||||||
Mcu.IP1=DMA
|
Mcu.IP1=DMA
|
||||||
Mcu.IP10=USART3
|
Mcu.IP10=UART4
|
||||||
Mcu.IP11=USART6
|
Mcu.IP11=USART1
|
||||||
Mcu.IP2=NVIC
|
Mcu.IP12=USART2
|
||||||
Mcu.IP3=RCC
|
Mcu.IP13=USART3
|
||||||
Mcu.IP4=SPI1
|
Mcu.IP14=USART6
|
||||||
Mcu.IP5=SYS
|
Mcu.IP15=USB_OTG_FS
|
||||||
Mcu.IP6=UART4
|
Mcu.IP2=FATFS
|
||||||
Mcu.IP7=UART5
|
Mcu.IP3=FSMC
|
||||||
Mcu.IP8=USART1
|
Mcu.IP4=NVIC
|
||||||
Mcu.IP9=USART2
|
Mcu.IP5=RCC
|
||||||
Mcu.IPNb=12
|
Mcu.IP6=SDIO
|
||||||
|
Mcu.IP7=SPI1
|
||||||
|
Mcu.IP8=SPI2
|
||||||
|
Mcu.IP9=SYS
|
||||||
|
Mcu.IPNb=16
|
||||||
Mcu.Name=STM32F407V(E-G)Tx
|
Mcu.Name=STM32F407V(E-G)Tx
|
||||||
Mcu.Package=LQFP100
|
Mcu.Package=LQFP100
|
||||||
Mcu.Pin0=PC14-OSC32_IN
|
Mcu.Pin0=PE3
|
||||||
Mcu.Pin1=PC15-OSC32_OUT
|
Mcu.Pin1=PE4
|
||||||
Mcu.Pin10=PB11
|
Mcu.Pin10=PA0-WKUP
|
||||||
Mcu.Pin11=PC6
|
Mcu.Pin11=PA1
|
||||||
Mcu.Pin12=PC7
|
Mcu.Pin12=PA2
|
||||||
Mcu.Pin13=PA9
|
Mcu.Pin13=PA3
|
||||||
Mcu.Pin14=PA10
|
Mcu.Pin14=PA6
|
||||||
Mcu.Pin15=PA13
|
Mcu.Pin15=PA7
|
||||||
Mcu.Pin16=PA14
|
Mcu.Pin16=PB0
|
||||||
Mcu.Pin17=PC10
|
Mcu.Pin17=PE7
|
||||||
Mcu.Pin18=PC11
|
Mcu.Pin18=PE8
|
||||||
Mcu.Pin19=PC12
|
Mcu.Pin19=PE9
|
||||||
Mcu.Pin2=PH0-OSC_IN
|
Mcu.Pin2=PC14-OSC32_IN
|
||||||
Mcu.Pin20=PD2
|
Mcu.Pin20=PE10
|
||||||
Mcu.Pin21=PD4
|
Mcu.Pin21=PE11
|
||||||
Mcu.Pin22=PD5
|
Mcu.Pin22=PE12
|
||||||
Mcu.Pin23=PD6
|
Mcu.Pin23=PE13
|
||||||
Mcu.Pin24=PD7
|
Mcu.Pin24=PE14
|
||||||
Mcu.Pin25=PB3
|
Mcu.Pin25=PE15
|
||||||
Mcu.Pin26=PB4
|
Mcu.Pin26=PB10
|
||||||
Mcu.Pin27=PB5
|
Mcu.Pin27=PB11
|
||||||
Mcu.Pin28=VP_CRC_VS_CRC
|
Mcu.Pin28=PB12
|
||||||
Mcu.Pin29=VP_SYS_VS_Systick
|
Mcu.Pin29=PB13
|
||||||
Mcu.Pin3=PH1-OSC_OUT
|
Mcu.Pin3=PC15-OSC32_OUT
|
||||||
Mcu.Pin4=PA2
|
Mcu.Pin30=PB14
|
||||||
Mcu.Pin5=PA3
|
Mcu.Pin31=PB15
|
||||||
Mcu.Pin6=PA6
|
Mcu.Pin32=PD8
|
||||||
Mcu.Pin7=PA7
|
Mcu.Pin33=PD9
|
||||||
Mcu.Pin8=PB0
|
Mcu.Pin34=PD10
|
||||||
Mcu.Pin9=PB10
|
Mcu.Pin35=PD13
|
||||||
Mcu.PinsNb=30
|
Mcu.Pin36=PD14
|
||||||
|
Mcu.Pin37=PD15
|
||||||
|
Mcu.Pin38=PC6
|
||||||
|
Mcu.Pin39=PC7
|
||||||
|
Mcu.Pin4=PH0-OSC_IN
|
||||||
|
Mcu.Pin40=PC8
|
||||||
|
Mcu.Pin41=PC9
|
||||||
|
Mcu.Pin42=PA9
|
||||||
|
Mcu.Pin43=PA10
|
||||||
|
Mcu.Pin44=PA11
|
||||||
|
Mcu.Pin45=PA12
|
||||||
|
Mcu.Pin46=PA13
|
||||||
|
Mcu.Pin47=PA14
|
||||||
|
Mcu.Pin48=PC10
|
||||||
|
Mcu.Pin49=PC11
|
||||||
|
Mcu.Pin5=PH1-OSC_OUT
|
||||||
|
Mcu.Pin50=PC12
|
||||||
|
Mcu.Pin51=PD0
|
||||||
|
Mcu.Pin52=PD1
|
||||||
|
Mcu.Pin53=PD2
|
||||||
|
Mcu.Pin54=PD4
|
||||||
|
Mcu.Pin55=PD5
|
||||||
|
Mcu.Pin56=PD7
|
||||||
|
Mcu.Pin57=PB3
|
||||||
|
Mcu.Pin58=PB4
|
||||||
|
Mcu.Pin59=PB5
|
||||||
|
Mcu.Pin6=PC0
|
||||||
|
Mcu.Pin60=PB6
|
||||||
|
Mcu.Pin61=PB7
|
||||||
|
Mcu.Pin62=PB8
|
||||||
|
Mcu.Pin63=VP_CRC_VS_CRC
|
||||||
|
Mcu.Pin64=VP_FATFS_VS_SDIO
|
||||||
|
Mcu.Pin65=VP_SYS_VS_Systick
|
||||||
|
Mcu.Pin7=PC1
|
||||||
|
Mcu.Pin8=PC2
|
||||||
|
Mcu.Pin9=PC3
|
||||||
|
Mcu.PinsNb=66
|
||||||
Mcu.ThirdPartyNb=0
|
Mcu.ThirdPartyNb=0
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
Mcu.UserName=STM32F407VETx
|
Mcu.UserName=STM32F407VETx
|
||||||
MxCube.Version=5.3.0
|
MxCube.Version=5.3.0
|
||||||
MxDb.Version=DB.5.0.30
|
MxDb.Version=DB.5.0.30
|
||||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||||
NVIC.DMA1_Stream0_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
|
||||||
NVIC.DMA1_Stream1_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.DMA1_Stream1_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DMA1_Stream2_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.DMA1_Stream2_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DMA1_Stream3_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.DMA1_Stream3_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DMA1_Stream4_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.DMA1_Stream4_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DMA1_Stream5_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.DMA1_Stream5_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DMA1_Stream6_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.DMA1_Stream6_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DMA1_Stream7_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
|
||||||
NVIC.DMA2_Stream0_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
NVIC.DMA2_Stream0_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||||
NVIC.DMA2_Stream1_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.DMA2_Stream1_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DMA2_Stream2_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.DMA2_Stream2_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
|
NVIC.DMA2_Stream3_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||||
NVIC.DMA2_Stream4_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
NVIC.DMA2_Stream4_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||||
|
NVIC.DMA2_Stream5_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DMA2_Stream6_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.DMA2_Stream6_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DMA2_Stream7_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.DMA2_Stream7_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||||
|
@ -235,17 +282,26 @@ NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||||
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||||
|
NVIC.SPI1_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||||
|
NVIC.SPI2_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||||
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
|
||||||
NVIC.UART4_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
NVIC.UART4_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||||
NVIC.UART5_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
|
||||||
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||||
NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||||
NVIC.USART3_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
NVIC.USART3_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||||
NVIC.USART6_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
NVIC.USART6_IRQn=true\:0\:0\:false\:false\:true\:true\:true
|
||||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
|
||||||
|
PA0-WKUP.Mode=Asynchronous
|
||||||
|
PA0-WKUP.Signal=UART4_TX
|
||||||
|
PA1.Mode=Asynchronous
|
||||||
|
PA1.Signal=UART4_RX
|
||||||
PA10.Mode=Asynchronous
|
PA10.Mode=Asynchronous
|
||||||
PA10.Signal=USART1_RX
|
PA10.Signal=USART1_RX
|
||||||
|
PA11.Mode=Device_Only
|
||||||
|
PA11.Signal=USB_OTG_FS_DM
|
||||||
|
PA12.Mode=Device_Only
|
||||||
|
PA12.Signal=USB_OTG_FS_DP
|
||||||
PA13.Mode=Serial_Wire
|
PA13.Mode=Serial_Wire
|
||||||
PA13.Signal=SYS_JTMS-SWDIO
|
PA13.Signal=SYS_JTMS-SWDIO
|
||||||
PA14.Mode=Serial_Wire
|
PA14.Mode=Serial_Wire
|
||||||
|
@ -272,31 +328,72 @@ PB10.Mode=Asynchronous
|
||||||
PB10.Signal=USART3_TX
|
PB10.Signal=USART3_TX
|
||||||
PB11.Mode=Asynchronous
|
PB11.Mode=Asynchronous
|
||||||
PB11.Signal=USART3_RX
|
PB11.Signal=USART3_RX
|
||||||
|
PB12.GPIOParameters=GPIO_Label
|
||||||
|
PB12.GPIO_Label=T_CS
|
||||||
|
PB12.Locked=true
|
||||||
|
PB12.Signal=GPIO_Output
|
||||||
|
PB13.Locked=true
|
||||||
|
PB13.Mode=Full_Duplex_Master
|
||||||
|
PB13.Signal=SPI2_SCK
|
||||||
|
PB14.Locked=true
|
||||||
|
PB14.Mode=Full_Duplex_Master
|
||||||
|
PB14.Signal=SPI2_MISO
|
||||||
|
PB15.Locked=true
|
||||||
|
PB15.Mode=Full_Duplex_Master
|
||||||
|
PB15.Signal=SPI2_MOSI
|
||||||
PB3.Locked=true
|
PB3.Locked=true
|
||||||
PB3.Mode=Full_Duplex_Master
|
PB3.Mode=Full_Duplex_Master
|
||||||
PB3.Signal=SPI1_SCK
|
PB3.Signal=SPI1_SCK
|
||||||
PB4.Locked=true
|
|
||||||
PB4.Mode=Full_Duplex_Master
|
PB4.Mode=Full_Duplex_Master
|
||||||
PB4.Signal=SPI1_MISO
|
PB4.Signal=SPI1_MISO
|
||||||
PB5.Locked=true
|
|
||||||
PB5.Mode=Full_Duplex_Master
|
PB5.Mode=Full_Duplex_Master
|
||||||
PB5.Signal=SPI1_MOSI
|
PB5.Signal=SPI1_MOSI
|
||||||
PC10.Locked=true
|
PB6.GPIOParameters=GPIO_Label
|
||||||
PC10.Mode=Asynchronous
|
PB6.GPIO_Label=NRF_CE
|
||||||
PC10.Signal=UART4_TX
|
PB6.Locked=true
|
||||||
PC11.Locked=true
|
PB6.Signal=GPIO_Output
|
||||||
PC11.Mode=Asynchronous
|
PB7.GPIOParameters=GPIO_Label
|
||||||
PC11.Signal=UART4_RX
|
PB7.GPIO_Label=NRF_CS
|
||||||
PC12.Mode=Asynchronous
|
PB7.Locked=true
|
||||||
PC12.Signal=UART5_TX
|
PB7.Signal=GPIO_Output
|
||||||
|
PB8.GPIOParameters=GPIO_Label
|
||||||
|
PB8.GPIO_Label=NRF_IRQ
|
||||||
|
PB8.Locked=true
|
||||||
|
PB8.Signal=GPIO_Input
|
||||||
|
PC0.GPIOParameters=GPIO_Label
|
||||||
|
PC0.GPIO_Label=DEBUG0
|
||||||
|
PC0.Locked=true
|
||||||
|
PC0.Signal=GPIO_Output
|
||||||
|
PC1.GPIOParameters=GPIO_Label
|
||||||
|
PC1.GPIO_Label=DEBUG1
|
||||||
|
PC1.Locked=true
|
||||||
|
PC1.Signal=GPIO_Output
|
||||||
|
PC10.Mode=SD_4_bits_Wide_bus
|
||||||
|
PC10.Signal=SDIO_D2
|
||||||
|
PC11.Mode=SD_4_bits_Wide_bus
|
||||||
|
PC11.Signal=SDIO_D3
|
||||||
|
PC12.Mode=SD_4_bits_Wide_bus
|
||||||
|
PC12.Signal=SDIO_CK
|
||||||
PC14-OSC32_IN.Mode=LSE-External-Oscillator
|
PC14-OSC32_IN.Mode=LSE-External-Oscillator
|
||||||
PC14-OSC32_IN.Signal=RCC_OSC32_IN
|
PC14-OSC32_IN.Signal=RCC_OSC32_IN
|
||||||
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
PC15-OSC32_OUT.Mode=LSE-External-Oscillator
|
||||||
PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
|
PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
|
||||||
|
PC2.GPIOParameters=GPIO_Label
|
||||||
|
PC2.GPIO_Label=DEBUG2
|
||||||
|
PC2.Locked=true
|
||||||
|
PC2.Signal=GPIO_Output
|
||||||
|
PC3.GPIOParameters=GPIO_Label
|
||||||
|
PC3.GPIO_Label=DEBUG3
|
||||||
|
PC3.Locked=true
|
||||||
|
PC3.Signal=GPIO_Output
|
||||||
PC6.Mode=Asynchronous
|
PC6.Mode=Asynchronous
|
||||||
PC6.Signal=USART6_TX
|
PC6.Signal=USART6_TX
|
||||||
PC7.Mode=Asynchronous
|
PC7.Mode=Asynchronous
|
||||||
PC7.Signal=USART6_RX
|
PC7.Signal=USART6_RX
|
||||||
|
PC8.Mode=SD_4_bits_Wide_bus
|
||||||
|
PC8.Signal=SDIO_D0
|
||||||
|
PC9.Mode=SD_4_bits_Wide_bus
|
||||||
|
PC9.Signal=SDIO_D1
|
||||||
PCC.Checker=false
|
PCC.Checker=false
|
||||||
PCC.Line=STM32F407/417
|
PCC.Line=STM32F407/417
|
||||||
PCC.MCU=STM32F407V(E-G)Tx
|
PCC.MCU=STM32F407V(E-G)Tx
|
||||||
|
@ -305,24 +402,58 @@ PCC.Seq0=0
|
||||||
PCC.Series=STM32F4
|
PCC.Series=STM32F4
|
||||||
PCC.Temperature=25
|
PCC.Temperature=25
|
||||||
PCC.Vdd=3.3
|
PCC.Vdd=3.3
|
||||||
PD2.Mode=Asynchronous
|
PD0.Mode=16b-d1
|
||||||
PD2.Signal=UART5_RX
|
PD0.Signal=FSMC_D2
|
||||||
PD4.GPIOParameters=GPIO_Label
|
PD1.Mode=16b-d1
|
||||||
PD4.GPIO_Label=DIAG0
|
PD1.Signal=FSMC_D3
|
||||||
PD4.Locked=true
|
PD10.Mode=16b-d1
|
||||||
PD4.Signal=GPIO_Output
|
PD10.Signal=FSMC_D15
|
||||||
PD5.GPIOParameters=GPIO_Label
|
PD13.Mode=A18_1
|
||||||
PD5.GPIO_Label=DIAG1
|
PD13.Signal=FSMC_A18
|
||||||
PD5.Locked=true
|
PD14.Mode=16b-d1
|
||||||
PD5.Signal=GPIO_Output
|
PD14.Signal=FSMC_D0
|
||||||
PD6.GPIOParameters=GPIO_Label
|
PD15.Mode=16b-d1
|
||||||
PD6.GPIO_Label=DIAG2
|
PD15.Signal=FSMC_D1
|
||||||
PD6.Locked=true
|
PD2.Mode=SD_4_bits_Wide_bus
|
||||||
PD6.Signal=GPIO_Output
|
PD2.Signal=SDIO_CMD
|
||||||
PD7.GPIOParameters=GPIO_Label
|
PD4.Mode=Lcd1
|
||||||
PD7.GPIO_Label=DIAG3
|
PD4.Signal=FSMC_NOE
|
||||||
PD7.Locked=true
|
PD5.Mode=Lcd1
|
||||||
PD7.Signal=GPIO_Output
|
PD5.Signal=FSMC_NWE
|
||||||
|
PD7.Mode=NorPsramChipSelect1_1
|
||||||
|
PD7.Signal=FSMC_NE1
|
||||||
|
PD8.Mode=16b-d1
|
||||||
|
PD8.Signal=FSMC_D13
|
||||||
|
PD9.Mode=16b-d1
|
||||||
|
PD9.Signal=FSMC_D14
|
||||||
|
PE10.Mode=16b-d1
|
||||||
|
PE10.Signal=FSMC_D7
|
||||||
|
PE11.Mode=16b-d1
|
||||||
|
PE11.Signal=FSMC_D8
|
||||||
|
PE12.Mode=16b-d1
|
||||||
|
PE12.Signal=FSMC_D9
|
||||||
|
PE13.Mode=16b-d1
|
||||||
|
PE13.Signal=FSMC_D10
|
||||||
|
PE14.Mode=16b-d1
|
||||||
|
PE14.Signal=FSMC_D11
|
||||||
|
PE15.Mode=16b-d1
|
||||||
|
PE15.Signal=FSMC_D12
|
||||||
|
PE3.GPIOParameters=GPIO_PuPd,GPIO_Label
|
||||||
|
PE3.GPIO_Label=KEY1
|
||||||
|
PE3.GPIO_PuPd=GPIO_PULLUP
|
||||||
|
PE3.Locked=true
|
||||||
|
PE3.Signal=GPIO_Input
|
||||||
|
PE4.GPIOParameters=GPIO_PuPd,GPIO_Label
|
||||||
|
PE4.GPIO_Label=KEY0
|
||||||
|
PE4.GPIO_PuPd=GPIO_PULLUP
|
||||||
|
PE4.Locked=true
|
||||||
|
PE4.Signal=GPIO_Input
|
||||||
|
PE7.Mode=16b-d1
|
||||||
|
PE7.Signal=FSMC_D4
|
||||||
|
PE8.Mode=16b-d1
|
||||||
|
PE8.Signal=FSMC_D5
|
||||||
|
PE9.Mode=16b-d1
|
||||||
|
PE9.Signal=FSMC_D6
|
||||||
PH0-OSC_IN.Mode=HSE-External-Oscillator
|
PH0-OSC_IN.Mode=HSE-External-Oscillator
|
||||||
PH0-OSC_IN.Signal=RCC_OSC_IN
|
PH0-OSC_IN.Signal=RCC_OSC_IN
|
||||||
PH1-OSC_OUT.Mode=HSE-External-Oscillator
|
PH1-OSC_OUT.Mode=HSE-External-Oscillator
|
||||||
|
@ -354,8 +485,8 @@ ProjectManager.StackSize=0x400
|
||||||
ProjectManager.TargetToolchain=STM32CubeIDE
|
ProjectManager.TargetToolchain=STM32CubeIDE
|
||||||
ProjectManager.ToolChainLocation=
|
ProjectManager.ToolChainLocation=
|
||||||
ProjectManager.UnderRoot=true
|
ProjectManager.UnderRoot=true
|
||||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-LL-true,2-MX_DMA_Init-DMA-false-LL-true,3-SystemClock_Config-RCC-false-HAL-false,4-MX_SPI1_Init-SPI1-false-LL-true,5-MX_UART4_Init-UART4-false-LL-true,6-MX_UART5_Init-UART5-false-LL-true,7-MX_USART1_UART_Init-USART1-false-LL-true,8-MX_USART2_UART_Init-USART2-false-LL-true,9-MX_USART3_UART_Init-USART3-false-LL-true,10-MX_USART6_UART_Init-USART6-false-LL-true,11-MX_CRC_Init-CRC-false-LL-true
|
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-LL-true,2-MX_DMA_Init-DMA-false-LL-true,3-SystemClock_Config-RCC-false-HAL-false,4-MX_UART4_Init-UART4-false-LL-true,5-MX_USART1_UART_Init-USART1-false-LL-true,6-MX_USART2_UART_Init-USART2-false-LL-true,7-MX_USART3_UART_Init-USART3-false-LL-true,8-MX_USART6_UART_Init-USART6-false-LL-true,9-MX_CRC_Init-CRC-false-LL-true,10-MX_FSMC_Init-FSMC-true-HAL-true,11-MX_SDIO_SD_Init-SDIO-true-HAL-true,12-MX_SPI1_Init-SPI1-true-LL-true,13-MX_SPI2_Init-SPI2-true-LL-true,14-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-true-HAL-true,15-MX_FATFS_Init-FATFS-true-HAL-true
|
||||||
RCC.48MHZClocksFreq_Value=84000000
|
RCC.48MHZClocksFreq_Value=48000000
|
||||||
RCC.AHBFreq_Value=168000000
|
RCC.AHBFreq_Value=168000000
|
||||||
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
||||||
RCC.APB1Freq_Value=42000000
|
RCC.APB1Freq_Value=42000000
|
||||||
|
@ -372,14 +503,14 @@ RCC.HCLKFreq_Value=168000000
|
||||||
RCC.HSE_VALUE=8000000
|
RCC.HSE_VALUE=8000000
|
||||||
RCC.HSI_VALUE=16000000
|
RCC.HSI_VALUE=16000000
|
||||||
RCC.I2SClocksFreq_Value=192000000
|
RCC.I2SClocksFreq_Value=192000000
|
||||||
RCC.IPParameters=48MHZClocksFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FLatency,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSI_VALUE,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLM,PLLN,PLLQCLKFreq_Value,PLLSourceVirtual,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VcooutputI2S
|
RCC.IPParameters=48MHZClocksFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FLatency,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSI_VALUE,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLM,PLLN,PLLQ,PLLQCLKFreq_Value,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VcooutputI2S
|
||||||
RCC.LSI_VALUE=32000
|
RCC.LSI_VALUE=32000
|
||||||
RCC.MCO2PinFreq_Value=168000000
|
RCC.MCO2PinFreq_Value=168000000
|
||||||
RCC.PLLCLKFreq_Value=168000000
|
RCC.PLLCLKFreq_Value=168000000
|
||||||
RCC.PLLM=4
|
RCC.PLLM=4
|
||||||
RCC.PLLN=168
|
RCC.PLLN=168
|
||||||
RCC.PLLQCLKFreq_Value=84000000
|
RCC.PLLQ=7
|
||||||
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
|
RCC.PLLQCLKFreq_Value=48000000
|
||||||
RCC.RTCFreq_Value=32000
|
RCC.RTCFreq_Value=32000
|
||||||
RCC.RTCHSEDivFreq_Value=4000000
|
RCC.RTCHSEDivFreq_Value=4000000
|
||||||
RCC.SYSCLKFreq_VALUE=168000000
|
RCC.SYSCLKFreq_VALUE=168000000
|
||||||
|
@ -388,35 +519,18 @@ RCC.VCOI2SOutputFreq_Value=384000000
|
||||||
RCC.VCOInputFreq_Value=2000000
|
RCC.VCOInputFreq_Value=2000000
|
||||||
RCC.VCOOutputFreq_Value=336000000
|
RCC.VCOOutputFreq_Value=336000000
|
||||||
RCC.VcooutputI2S=192000000
|
RCC.VcooutputI2S=192000000
|
||||||
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_2
|
|
||||||
SPI1.CLKPhase=SPI_PHASE_1EDGE
|
|
||||||
SPI1.CLKPolarity=SPI_POLARITY_LOW
|
|
||||||
SPI1.CRCCalculation=SPI_CRCCALCULATION_DISABLE
|
|
||||||
SPI1.CalculateBaudRate=42.0 MBits/s
|
SPI1.CalculateBaudRate=42.0 MBits/s
|
||||||
SPI1.DataSize=SPI_DATASIZE_8BIT
|
|
||||||
SPI1.Direction=SPI_DIRECTION_2LINES
|
SPI1.Direction=SPI_DIRECTION_2LINES
|
||||||
SPI1.FirstBit=SPI_FIRSTBIT_MSB
|
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
|
||||||
SPI1.IPParameters=TIMode,DataSize,FirstBit,BaudRatePrescaler,CLKPolarity,CLKPhase,CRCCalculation,NSS,VirtualType,Mode,Direction,CalculateBaudRate
|
|
||||||
SPI1.Mode=SPI_MODE_MASTER
|
SPI1.Mode=SPI_MODE_MASTER
|
||||||
SPI1.NSS=SPI_NSS_SOFT
|
|
||||||
SPI1.TIMode=SPI_TIMODE_DISABLE
|
|
||||||
SPI1.VirtualType=VM_MASTER
|
SPI1.VirtualType=VM_MASTER
|
||||||
UART4.BaudRate=115200
|
SPI2.CalculateBaudRate=21.0 MBits/s
|
||||||
UART4.IPParameters=BaudRate,WordLength,Parity,StopBits,Mode,OverSampling,VirtualMode
|
SPI2.Direction=SPI_DIRECTION_2LINES
|
||||||
UART4.Mode=MODE_TX_RX
|
SPI2.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
|
||||||
UART4.OverSampling=UART_OVERSAMPLING_16
|
SPI2.Mode=SPI_MODE_MASTER
|
||||||
UART4.Parity=PARITY_NONE
|
SPI2.VirtualType=VM_MASTER
|
||||||
UART4.StopBits=UART_STOPBITS_1
|
UART4.IPParameters=VirtualMode
|
||||||
UART4.VirtualMode=Asynchronous
|
UART4.VirtualMode=Asynchronous
|
||||||
UART4.WordLength=WORDLENGTH_8B
|
|
||||||
UART5.BaudRate=5250000
|
|
||||||
UART5.IPParameters=BaudRate,WordLength,Parity,StopBits,Mode,OverSampling,VirtualMode
|
|
||||||
UART5.Mode=MODE_TX_RX
|
|
||||||
UART5.OverSampling=UART_OVERSAMPLING_8
|
|
||||||
UART5.Parity=PARITY_NONE
|
|
||||||
UART5.StopBits=UART_STOPBITS_1
|
|
||||||
UART5.VirtualMode=Asynchronous
|
|
||||||
UART5.WordLength=WORDLENGTH_8B
|
|
||||||
USART1.BaudRate=5250000
|
USART1.BaudRate=5250000
|
||||||
USART1.IPParameters=BaudRate,WordLength,Parity,StopBits,Mode,OverSampling,VirtualMode
|
USART1.IPParameters=BaudRate,WordLength,Parity,StopBits,Mode,OverSampling,VirtualMode
|
||||||
USART1.Mode=MODE_TX_RX
|
USART1.Mode=MODE_TX_RX
|
||||||
|
@ -449,8 +563,12 @@ USART6.Parity=PARITY_NONE
|
||||||
USART6.StopBits=STOPBITS_1
|
USART6.StopBits=STOPBITS_1
|
||||||
USART6.VirtualMode=VM_ASYNC
|
USART6.VirtualMode=VM_ASYNC
|
||||||
USART6.WordLength=WORDLENGTH_8B
|
USART6.WordLength=WORDLENGTH_8B
|
||||||
|
USB_OTG_FS.IPParameters=VirtualMode
|
||||||
|
USB_OTG_FS.VirtualMode=Device_Only
|
||||||
VP_CRC_VS_CRC.Mode=CRC_Activate
|
VP_CRC_VS_CRC.Mode=CRC_Activate
|
||||||
VP_CRC_VS_CRC.Signal=CRC_VS_CRC
|
VP_CRC_VS_CRC.Signal=CRC_VS_CRC
|
||||||
|
VP_FATFS_VS_SDIO.Mode=SDIO
|
||||||
|
VP_FATFS_VS_SDIO.Signal=FATFS_VS_SDIO
|
||||||
VP_SYS_VS_Systick.Mode=SysTick
|
VP_SYS_VS_Systick.Mode=SysTick
|
||||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||||
board=custom
|
board=custom
|
||||||
|
|
|
@ -9,19 +9,31 @@
|
||||||
#include "usart_handler.h"
|
#include "usart_handler.h"
|
||||||
#include "strutil.h"
|
#include "strutil.h"
|
||||||
|
|
||||||
|
#ifndef DIAG_INTERRUPT_IN
|
||||||
|
# define DIAG_INTERRUPT_IN()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DIAG_INTERRUPT_OUT
|
||||||
|
# define DIAG_INTERRUPT_OUT()
|
||||||
|
#endif
|
||||||
|
|
||||||
void HandleConsoleUsartTxDmaIrq(DMAINFO *info, USART_TypeDef *usart) // debug usart
|
void HandleConsoleUsartTxDmaIrq(DMAINFO *info, USART_TypeDef *usart) // debug usart
|
||||||
{
|
{
|
||||||
|
DIAG_INTERRUPT_IN();
|
||||||
if(*info->isReg & info->tcMask) { // DMA transfer complete
|
if(*info->isReg & info->tcMask) { // DMA transfer complete
|
||||||
*info->ifcReg = info->tcMask;
|
*info->ifcReg = info->tcMask;
|
||||||
LL_USART_EnableIT_TC(usart);
|
LL_USART_EnableIT_TC(usart);
|
||||||
LL_DMA_DisableStream(info->dma, info->stream);
|
LL_DMA_DisableStream(info->dma, info->stream);
|
||||||
}
|
}
|
||||||
|
DIAG_INTERRUPT_OUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleConsoleUsartIrq(USART_TypeDef *usart)
|
void HandleConsoleUsartIrq(USART_TypeDef *usart)
|
||||||
{
|
{
|
||||||
|
DIAG_INTERRUPT_IN();
|
||||||
if(LL_USART_IsActiveFlag_TC(usart) && LL_USART_IsEnabledIT_TC(usart)) // transmission complete
|
if(LL_USART_IsActiveFlag_TC(usart) && LL_USART_IsEnabledIT_TC(usart)) // transmission complete
|
||||||
LL_USART_DisableIT_TC(usart);
|
LL_USART_DisableIT_TC(usart);
|
||||||
|
DIAG_INTERRUPT_OUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ADDINFO(b,s,u) \
|
#define ADDINFO(b,s,u) \
|
||||||
|
|
|
@ -19,6 +19,15 @@
|
||||||
# define DIAG_CRC_CALC_END()
|
# define DIAG_CRC_CALC_END()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DIAG_INTERRUPT_IN
|
||||||
|
# define DIAG_INTERRUPT_IN()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DIAG_INTERRUPT_OUT
|
||||||
|
# define DIAG_INTERRUPT_OUT()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void InitCrcStatus(struct crcstatus_t *st, DMA_TypeDef *dma, uint32_t stream)
|
void InitCrcStatus(struct crcstatus_t *st, DMA_TypeDef *dma, uint32_t stream)
|
||||||
{
|
{
|
||||||
InitDmaInfo(&st->dmaInfo, dma, stream);
|
InitDmaInfo(&st->dmaInfo, dma, stream);
|
||||||
|
@ -90,6 +99,7 @@ void StartNextCrcTask(struct crcstatus_t *status)
|
||||||
|
|
||||||
void HandleCrcDmaIrq(struct crcstatus_t *status)
|
void HandleCrcDmaIrq(struct crcstatus_t *status)
|
||||||
{
|
{
|
||||||
|
DIAG_INTERRUPT_IN();
|
||||||
if(*status->dmaInfo.isReg & status->dmaInfo.tcMask) { // DMA transfer complete
|
if(*status->dmaInfo.isReg & status->dmaInfo.tcMask) { // DMA transfer complete
|
||||||
*status->dmaInfo.ifcReg = status->dmaInfo.tcMask;
|
*status->dmaInfo.ifcReg = status->dmaInfo.tcMask;
|
||||||
LL_DMA_DisableStream(status->dmaInfo.dma, status->dmaInfo.stream);
|
LL_DMA_DisableStream(status->dmaInfo.dma, status->dmaInfo.stream);
|
||||||
|
@ -118,5 +128,6 @@ void HandleCrcDmaIrq(struct crcstatus_t *status)
|
||||||
StartNextCrcTask(status);
|
StartNextCrcTask(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DIAG_INTERRUPT_OUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
33
lib/fault.c
33
lib/fault.c
|
@ -9,12 +9,7 @@
|
||||||
//#include <core_cm4.h>
|
//#include <core_cm4.h>
|
||||||
#include "stm32f4xx.h"
|
#include "stm32f4xx.h"
|
||||||
#include "strutil.h"
|
#include "strutil.h"
|
||||||
|
#include "fault.h"
|
||||||
#define HARD_FAULT 1
|
|
||||||
#define MEMMANAGE_FAULT 2
|
|
||||||
#define BUS_FAULT 3
|
|
||||||
#define USAGE_FAULT 4
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t R0;
|
uint32_t R0;
|
||||||
|
@ -42,6 +37,10 @@ typedef struct {
|
||||||
|
|
||||||
fault_context_t g_faultContext;
|
fault_context_t g_faultContext;
|
||||||
|
|
||||||
|
void __attribute__((weak)) app_fault_callback(uint32_t reason)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void SwoSendStr(char const *str, uint8_t len, uint8_t port)
|
void SwoSendStr(char const *str, uint8_t len, uint8_t port)
|
||||||
{
|
{
|
||||||
while(len) {
|
while(len) {
|
||||||
|
@ -107,16 +106,16 @@ __attribute__((noreturn)) void FaultHandler(uint32_t type, fault_context_t *cont
|
||||||
while(1) {
|
while(1) {
|
||||||
fault_print_str("\n++ Fault Handler ++\n\nFaultType: ",NULL);
|
fault_print_str("\n++ Fault Handler ++\n\nFaultType: ",NULL);
|
||||||
switch( type ) {
|
switch( type ) {
|
||||||
case HARD_FAULT:
|
case FAULT_REASON_HARD_FAULT:
|
||||||
fault_print_str("HardFault",NULL);
|
fault_print_str("HardFault",NULL);
|
||||||
break;
|
break;
|
||||||
case MEMMANAGE_FAULT:
|
case FAULT_REASON_MEMMANAGE_FAULT:
|
||||||
fault_print_str("MemManageFault",NULL);
|
fault_print_str("MemManageFault",NULL);
|
||||||
break;
|
break;
|
||||||
case BUS_FAULT:
|
case FAULT_REASON_BUS_FAULT:
|
||||||
fault_print_str("BusFault",NULL);
|
fault_print_str("BusFault",NULL);
|
||||||
break;
|
break;
|
||||||
case USAGE_FAULT:
|
case FAULT_REASON_USAGE_FAULT:
|
||||||
fault_print_str("UsageFault",NULL);
|
fault_print_str("UsageFault",NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -126,7 +125,8 @@ __attribute__((noreturn)) void FaultHandler(uint32_t type, fault_context_t *cont
|
||||||
|
|
||||||
fault_print_str("\n\nContext:",NULL);
|
fault_print_str("\n\nContext:",NULL);
|
||||||
|
|
||||||
fault_print_str( "\nR0 : %"
|
fault_print_str(
|
||||||
|
"\nR0 : %"
|
||||||
"\nR1 : %"
|
"\nR1 : %"
|
||||||
"\nR2 : %"
|
"\nR2 : %"
|
||||||
"\nR3 : %"
|
"\nR3 : %"
|
||||||
|
@ -144,18 +144,23 @@ __attribute__((noreturn)) void FaultHandler(uint32_t type, fault_context_t *cont
|
||||||
"\nPC : %"
|
"\nPC : %"
|
||||||
"\nxPSR : %"
|
"\nxPSR : %"
|
||||||
"\nPSP : %"
|
"\nPSP : %"
|
||||||
"\nMSP : %", (uint32_t *)context);
|
"\nMSP : %",
|
||||||
|
(uint32_t *)context);
|
||||||
|
|
||||||
//Capture CPUID to get core/cpu info
|
//Capture CPUID to get core/cpu info
|
||||||
fault_print_str("\nCPUID: %",(uint32_t *)&SCB->CPUID);
|
fault_print_str("\nCPUID: %",(uint32_t *)&SCB->CPUID);
|
||||||
|
|
||||||
fault_print_str("\nHFSR : %"
|
fault_print_str(
|
||||||
|
"\nHFSR : %"
|
||||||
"\nMMFSR: %"
|
"\nMMFSR: %"
|
||||||
"\nBFSR : %"
|
"\nBFSR : %"
|
||||||
"\nUFSR : %"
|
"\nUFSR : %"
|
||||||
"\nDFSR : %"
|
"\nDFSR : %"
|
||||||
"\nAFSR : %"
|
"\nAFSR : %"
|
||||||
"\nSHCSR: %",FSR);
|
"\nSHCSR: %",
|
||||||
|
FSR);
|
||||||
|
|
||||||
|
app_fault_callback(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
lib/fault.h
Normal file
11
lib/fault.h
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef __FAULT_H
|
||||||
|
#define __FAULT_H
|
||||||
|
|
||||||
|
#define FAULT_REASON_HARD_FAULT 1
|
||||||
|
#define FAULT_REASON_MEMMANAGE_FAULT 2
|
||||||
|
#define FAULT_REASON_BUS_FAULT 3
|
||||||
|
#define FAULT_REASON_USAGE_FAULT 4
|
||||||
|
|
||||||
|
void app_fault_callback(uint32_t reason);
|
||||||
|
|
||||||
|
#endif /* __FAULT_H */
|
|
@ -7,6 +7,14 @@
|
||||||
#include "memcpy_dma.h"
|
#include "memcpy_dma.h"
|
||||||
#include "dma_helper.h"
|
#include "dma_helper.h"
|
||||||
|
|
||||||
|
#ifndef DIAG_INTERRUPT_IN
|
||||||
|
# define DIAG_INTERRUPT_IN()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DIAG_INTERRUPT_OUT
|
||||||
|
# define DIAG_INTERRUPT_OUT()
|
||||||
|
#endif
|
||||||
|
|
||||||
volatile uint8_t g_memcpyDmaBusy = 0;
|
volatile uint8_t g_memcpyDmaBusy = 0;
|
||||||
|
|
||||||
static DMAINFO g_memcpyDmaInfo;
|
static DMAINFO g_memcpyDmaInfo;
|
||||||
|
@ -31,9 +39,11 @@ void * MemcpyDma(void *dst, void const *src, size_t length)
|
||||||
|
|
||||||
void HandleMemcpyDmaIrq()
|
void HandleMemcpyDmaIrq()
|
||||||
{
|
{
|
||||||
|
DIAG_INTERRUPT_IN();
|
||||||
if(*g_memcpyDmaInfo.isReg & g_memcpyDmaInfo.tcMask) { // DMA transfer complete
|
if(*g_memcpyDmaInfo.isReg & g_memcpyDmaInfo.tcMask) { // DMA transfer complete
|
||||||
*g_memcpyDmaInfo.ifcReg = g_memcpyDmaInfo.tcMask;
|
*g_memcpyDmaInfo.ifcReg = g_memcpyDmaInfo.tcMask;
|
||||||
LL_DMA_DisableStream(g_memcpyDmaInfo.dma, g_memcpyDmaInfo.stream);
|
LL_DMA_DisableStream(g_memcpyDmaInfo.dma, g_memcpyDmaInfo.stream);
|
||||||
g_memcpyDmaBusy = 0;
|
g_memcpyDmaBusy = 0;
|
||||||
}
|
}
|
||||||
|
DIAG_INTERRUPT_OUT();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,12 @@
|
||||||
#ifndef DIAG_RX_BUFFER_SWITCH
|
#ifndef DIAG_RX_BUFFER_SWITCH
|
||||||
# define DIAG_RX_BUFFER_SWITCH(x)
|
# define DIAG_RX_BUFFER_SWITCH(x)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef DIAG_INTERRUPT_IN
|
||||||
|
# define DIAG_INTERRUPT_IN()
|
||||||
|
#endif
|
||||||
|
#ifndef DIAG_INTERRUPT_OUT
|
||||||
|
# define DIAG_INTERRUPT_OUT()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void InitUartStatus(
|
void InitUartStatus(
|
||||||
|
@ -140,6 +146,7 @@ void RxCrcComputedCallback(void *callbackParm, uint32_t calculatedCrc, uint8_t s
|
||||||
|
|
||||||
void HandleUsartRxDmaIrq(UARTSTATUS *status)
|
void HandleUsartRxDmaIrq(UARTSTATUS *status)
|
||||||
{
|
{
|
||||||
|
DIAG_INTERRUPT_IN();
|
||||||
StatsIncRcvd(&status->stats);
|
StatsIncRcvd(&status->stats);
|
||||||
if(*status->rxDmaInfo.isReg & status->rxDmaInfo.tcMask) {
|
if(*status->rxDmaInfo.isReg & status->rxDmaInfo.tcMask) {
|
||||||
*status->rxDmaInfo.ifcReg = status->rxDmaInfo.tcMask;
|
*status->rxDmaInfo.ifcReg = status->rxDmaInfo.tcMask;
|
||||||
|
@ -163,10 +170,12 @@ void HandleUsartRxDmaIrq(UARTSTATUS *status)
|
||||||
if(status->rxBuffers[status->activeRxBuf].busy)
|
if(status->rxBuffers[status->activeRxBuf].busy)
|
||||||
StatsIncOverrun(&status->stats);
|
StatsIncOverrun(&status->stats);
|
||||||
SetupReceive(status);
|
SetupReceive(status);
|
||||||
|
DIAG_INTERRUPT_OUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleUsartTxDmaIrq(UARTSTATUS *status)
|
void HandleUsartTxDmaIrq(UARTSTATUS *status)
|
||||||
{
|
{
|
||||||
|
DIAG_INTERRUPT_IN();
|
||||||
if(*status->txDmaInfo.isReg & status->txDmaInfo.tcMask) { // DMA transfer complete
|
if(*status->txDmaInfo.isReg & status->txDmaInfo.tcMask) { // DMA transfer complete
|
||||||
*status->txDmaInfo.ifcReg = status->txDmaInfo.tcMask;
|
*status->txDmaInfo.ifcReg = status->txDmaInfo.tcMask;
|
||||||
LL_USART_EnableIT_TC(status->uart);
|
LL_USART_EnableIT_TC(status->uart);
|
||||||
|
@ -183,11 +192,12 @@ void HandleUsartTxDmaIrq(UARTSTATUS *status)
|
||||||
*status->txDmaInfo.ifcReg = status->txDmaInfo.htMask;
|
*status->txDmaInfo.ifcReg = status->txDmaInfo.htMask;
|
||||||
if(*status->txDmaInfo.isReg & status->txDmaInfo.dmeMask)
|
if(*status->txDmaInfo.isReg & status->txDmaInfo.dmeMask)
|
||||||
*status->txDmaInfo.ifcReg = status->txDmaInfo.dmeMask;
|
*status->txDmaInfo.ifcReg = status->txDmaInfo.dmeMask;
|
||||||
|
DIAG_INTERRUPT_OUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleUsartIrq(UARTSTATUS *status)
|
void HandleUsartIrq(UARTSTATUS *status)
|
||||||
{
|
{
|
||||||
|
DIAG_INTERRUPT_IN();
|
||||||
if(LL_USART_IsActiveFlag_IDLE(status->uart) && LL_USART_IsEnabledIT_IDLE(status->uart)) { // receiver idle
|
if(LL_USART_IsActiveFlag_IDLE(status->uart) && LL_USART_IsEnabledIT_IDLE(status->uart)) { // receiver idle
|
||||||
LL_USART_ClearFlag_IDLE(status->uart);
|
LL_USART_ClearFlag_IDLE(status->uart);
|
||||||
uint16_t rcvdLen = status->rxBuffers[status->activeRxBuf].requestedLength - LL_DMA_GetDataLength(status->rxDmaInfo.dma, status->rxDmaInfo.stream);
|
uint16_t rcvdLen = status->rxBuffers[status->activeRxBuf].requestedLength - LL_DMA_GetDataLength(status->rxDmaInfo.dma, status->rxDmaInfo.stream);
|
||||||
|
@ -210,5 +220,6 @@ void HandleUsartIrq(UARTSTATUS *status)
|
||||||
LL_USART_EnableDirectionTx(status->uart);
|
LL_USART_EnableDirectionTx(status->uart);
|
||||||
status->txBuffer.busy = 0;
|
status->txBuffer.busy = 0;
|
||||||
}
|
}
|
||||||
|
DIAG_INTERRUPT_OUT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ typedef struct {
|
||||||
UARTBUFFER rxBuffers[2];
|
UARTBUFFER rxBuffers[2];
|
||||||
} UARTSTATUS;
|
} UARTSTATUS;
|
||||||
|
|
||||||
#define STARTMARKER 0xa5
|
#define STARTMARKER 0x95
|
||||||
|
|
||||||
void InitUartStatus(
|
void InitUartStatus(
|
||||||
UARTSTATUS *st, USART_TypeDef *uart, DMA_TypeDef *dma,
|
UARTSTATUS *st, USART_TypeDef *uart, DMA_TypeDef *dma,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue