Initiale Verion
This commit is contained in:
parent
2a2bc4efca
commit
4ee754f8b0
249
.cproject
Normal file
249
.cproject
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||||
|
<cconfiguration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1136359567">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1136359567" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<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.1136359567" 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.1136359567." name="/" resourcePath="">
|
||||||
|
<toolChain id="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug.1566530055" name="MCU ARM GCC" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.812600019" name="MCU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu" useByScannerDiscovery="true" value="STM32G071KBTx" valueType="string"/>
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.945520948" name="CPU" 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.748516001" name="Core" 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.target_board.748507410" 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.2001688789" 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.6 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32G071KBTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../Drivers/STM32G0xx_HAL_Driver/Inc | ../Drivers/CMSIS/Device/ST/STM32G0xx/Include | ../Drivers/CMSIS/Include || || || STM32G071xx | USE_FULL_LL_DRIVER | HSE_VALUE=8000000 | HSE_STARTUP_TIMEOUT=100 | LSE_STARTUP_TIMEOUT=5000 | LSE_VALUE=32768 | EXTERNAL_CLOCK_VALUE=48000 | HSI_VALUE=16000000 | LSI_VALUE=32000 | VDD_VALUE=3300 | PREFETCH_ENABLE=1 | INSTRUCTION_CACHE_ENABLE=1 | DATA_CACHE_ENABLE=1 || || Drivers | Core/Startup | Core || || || ${workspace_loc:/${ProjName}/STM32G071KBTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.1376588588" name="Cpu clock frequence" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="64" valueType="string"/>
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.435639564" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||||
|
<builder buildPath="${workspace_loc:/Elektronische_Last}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1371483124" 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.678391705" 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.842759062" 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 IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.definedsymbols.1318994334" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.definedsymbols" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="DEBUG"/>
|
||||||
|
</option>
|
||||||
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.1970143257" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.328466809" 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.1868026007" 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.158434862" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false"/>
|
||||||
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.1758324306" 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="DEBUG"/>
|
||||||
|
<listOptionValue builtIn="false" value="STM32G071xx"/>
|
||||||
|
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSE_VALUE=8000000"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSE_STARTUP_TIMEOUT=100"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSE_STARTUP_TIMEOUT=5000"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSE_VALUE=32768"/>
|
||||||
|
<listOptionValue builtIn="false" value="EXTERNAL_CLOCK_VALUE=48000"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSI_VALUE=16000000"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSI_VALUE=32000"/>
|
||||||
|
<listOptionValue builtIn="false" value="VDD_VALUE=3300"/>
|
||||||
|
<listOptionValue builtIn="false" value="PREFETCH_ENABLE=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="INSTRUCTION_CACHE_ENABLE=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="DATA_CACHE_ENABLE=1"/>
|
||||||
|
</option>
|
||||||
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.207041864" 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="../Core/Inc"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/STM32G0xx_HAL_Driver/Inc"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32G0xx/Include"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/>
|
||||||
|
</option>
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.cyclomaticcomplexity.1886424559" name="Cyclomatic Complexity (-fcyclomatic-complexity)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.cyclomaticcomplexity" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||||
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1264476132" 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.1973630621" name="MCU G++ Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.1907554391" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.value.g3" valueType="enumerated"/>
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.531497089" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level" useByScannerDiscovery="false"/>
|
||||||
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols.921654673" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="DEBUG"/>
|
||||||
|
<listOptionValue builtIn="false" value="STM32G071xx"/>
|
||||||
|
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSE_VALUE=8000000"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSE_STARTUP_TIMEOUT=100"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSE_STARTUP_TIMEOUT=5000"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSE_VALUE=32768"/>
|
||||||
|
<listOptionValue builtIn="false" value="EXTERNAL_CLOCK_VALUE=48000"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSI_VALUE=16000000"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSI_VALUE=32000"/>
|
||||||
|
<listOptionValue builtIn="false" value="VDD_VALUE=3300"/>
|
||||||
|
<listOptionValue builtIn="false" value="PREFETCH_ENABLE=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="INSTRUCTION_CACHE_ENABLE=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="DATA_CACHE_ENABLE=1"/>
|
||||||
|
</option>
|
||||||
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.includepaths.1859335353" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value="../Core/Inc"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/STM32G0xx_HAL_Driver/Inc"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32G0xx/Include"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/>
|
||||||
|
</option>
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.cyclomaticcomplexity.252319591" name="Cyclomatic Complexity (-fcyclomatic-complexity)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.cyclomaticcomplexity" useByScannerDiscovery="false" value="false" valueType="boolean"/>
|
||||||
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.input.cpp.1927990509" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.input.cpp"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.1398078434" 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.cpp.linker.1322439394" name="MCU G++ Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.option.script.966398224" name="Linker Script (-T)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.option.script" value="${workspace_loc:/${ProjName}/STM32G071KBTX_FLASH.ld}" valueType="string"/>
|
||||||
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.option.otherflags.2122396564" name="Other flags" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.option.otherflags" useByScannerDiscovery="false" valueType="stringList">
|
||||||
|
<listOptionValue builtIn="false" value="-Wl,--no-warn-rwx-segments"/>
|
||||||
|
</option>
|
||||||
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.input.1329045540" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.input">
|
||||||
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
</inputType>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver.1399768551" name="MCU GCC Archiver" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size.1857892491" name="MCU Size" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile.393373774" name="MCU Output Converter list file" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex.273507499" name="MCU Output Converter Hex" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary.984800295" name="MCU Output Converter Binary" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog.1831484389" name="MCU Output Converter Verilog" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec.1081117956" name="MCU Output Converter Motorola S-rec" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.55873967" name="MCU Output Converter Motorola S-rec with symbols" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec"/>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<sourceEntries>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Source"/>
|
||||||
|
</sourceEntries>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
</cconfiguration>
|
||||||
|
<cconfiguration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1435234696">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1435234696" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<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.release" cleanCommand="rm -rf" description="" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1435234696" name="Release" parent="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release">
|
||||||
|
<folderInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1435234696." name="/" resourcePath="">
|
||||||
|
<toolChain id="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.release.196580810" name="MCU ARM GCC" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.release">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.373772048" name="MCU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu" useByScannerDiscovery="true" value="STM32G071KBTx" valueType="string"/>
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.15513387" name="CPU" 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.1882101594" name="Core" 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.target_board.960217654" 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.1195671514" 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.6 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32G071KBTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../Drivers/STM32G0xx_HAL_Driver/Inc | ../Drivers/CMSIS/Device/ST/STM32G0xx/Include | ../Drivers/CMSIS/Include || || || STM32G071xx | USE_FULL_LL_DRIVER | HSE_VALUE=8000000 | HSE_STARTUP_TIMEOUT=100 | LSE_STARTUP_TIMEOUT=5000 | LSE_VALUE=32768 | EXTERNAL_CLOCK_VALUE=48000 | HSI_VALUE=16000000 | LSI_VALUE=32000 | VDD_VALUE=3300 | PREFETCH_ENABLE=1 | INSTRUCTION_CACHE_ENABLE=1 | DATA_CACHE_ENABLE=1 || || Drivers | Core/Startup | Core || || || ${workspace_loc:/${ProjName}/STM32G071KBTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.1376887677" name="Cpu clock frequence" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="64" valueType="string"/>
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.2057771488" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||||
|
<builder buildPath="${workspace_loc:/Elektronische_Last}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1488546250" 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.1060209756" 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.236826865" 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.g0" valueType="enumerated"/>
|
||||||
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.670231085" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.762222919" 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.1638900605" 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.g0" valueType="enumerated"/>
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.753485463" 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.os" valueType="enumerated"/>
|
||||||
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.1153693824" 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="STM32G071xx"/>
|
||||||
|
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSE_VALUE=8000000"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSE_STARTUP_TIMEOUT=100"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSE_STARTUP_TIMEOUT=5000"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSE_VALUE=32768"/>
|
||||||
|
<listOptionValue builtIn="false" value="EXTERNAL_CLOCK_VALUE=48000"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSI_VALUE=16000000"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSI_VALUE=32000"/>
|
||||||
|
<listOptionValue builtIn="false" value="VDD_VALUE=3300"/>
|
||||||
|
<listOptionValue builtIn="false" value="PREFETCH_ENABLE=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="INSTRUCTION_CACHE_ENABLE=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="DATA_CACHE_ENABLE=1"/>
|
||||||
|
</option>
|
||||||
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.386914258" 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="../Core/Inc"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/STM32G0xx_HAL_Driver/Inc"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32G0xx/Include"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/>
|
||||||
|
</option>
|
||||||
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.445425540" 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.1865155422" name="MCU G++ Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.926161750" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.value.g0" valueType="enumerated"/>
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.444709166" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.value.os" valueType="enumerated"/>
|
||||||
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols.564197812" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="STM32G071xx"/>
|
||||||
|
<listOptionValue builtIn="false" value="USE_FULL_LL_DRIVER"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSE_VALUE=8000000"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSE_STARTUP_TIMEOUT=100"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSE_STARTUP_TIMEOUT=5000"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSE_VALUE=32768"/>
|
||||||
|
<listOptionValue builtIn="false" value="EXTERNAL_CLOCK_VALUE=48000"/>
|
||||||
|
<listOptionValue builtIn="false" value="HSI_VALUE=16000000"/>
|
||||||
|
<listOptionValue builtIn="false" value="LSI_VALUE=32000"/>
|
||||||
|
<listOptionValue builtIn="false" value="VDD_VALUE=3300"/>
|
||||||
|
<listOptionValue builtIn="false" value="PREFETCH_ENABLE=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="INSTRUCTION_CACHE_ENABLE=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="DATA_CACHE_ENABLE=1"/>
|
||||||
|
</option>
|
||||||
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.includepaths.686907796" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value="../Core/Inc"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/STM32G0xx_HAL_Driver/Inc"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32G0xx/Include"/>
|
||||||
|
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/>
|
||||||
|
</option>
|
||||||
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.input.cpp.1377472624" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.input.cpp"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.1192301450" 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.cpp.linker.494673465" name="MCU G++ Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker">
|
||||||
|
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.option.script.1637325835" name="Linker Script (-T)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.option.script" value="${workspace_loc:/${ProjName}/STM32G071KBTX_FLASH.ld}" valueType="string"/>
|
||||||
|
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.input.497509342" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.input">
|
||||||
|
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||||
|
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||||
|
</inputType>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver.676316545" name="MCU GCC Archiver" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size.1950972661" name="MCU Size" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile.1909635296" name="MCU Output Converter list file" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex.235016877" name="MCU Output Converter Hex" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary.465724624" name="MCU Output Converter Binary" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog.530976685" name="MCU Output Converter Verilog" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec.1569995238" name="MCU Output Converter Motorola S-rec" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec"/>
|
||||||
|
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.2133952340" name="MCU Output Converter Motorola S-rec with symbols" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec"/>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<sourceEntries>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
|
||||||
|
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Source"/>
|
||||||
|
</sourceEntries>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
</cconfiguration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.pathentry"/>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<project id="Elektronische_Last.null.1943098670" name="Elektronische_Last"/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
<scannerConfigBuildInfo instanceId="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1435234696;com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1435234696.;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.762222919;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.445425540">
|
||||||
|
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1136359567;com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1136359567.;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.1973630621;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.input.cpp.1927990509">
|
||||||
|
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1136359567;com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1136359567.;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.328466809;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1264476132">
|
||||||
|
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
<scannerConfigBuildInfo instanceId="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1435234696;com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1435234696.;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.1865155422;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.input.cpp.1377472624">
|
||||||
|
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
</scannerConfigBuildInfo>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="refreshScope"/>
|
||||||
|
</cproject>
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Debug
|
||||||
|
Elektronische_Last Debug.launch
|
||||||
|
.settings/
|
||||||
|
Core/Src/
|
||||||
|
Core/Startup/
|
24
.mxproject
Normal file
24
.mxproject
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
[PreviousLibFiles]
|
||||||
|
LibFiles=Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_gpio.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_exti.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_system.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_adc.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_dma.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_dmamux.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_bus.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_cortex.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_rcc.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_utils.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_pwr.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_dac.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_lpuart.h;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_gpio.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_exti.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_adc.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_dma.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_rcc.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_utils.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_dac.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_lpuart.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_pwr.c;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_gpio.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_exti.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_system.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_adc.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_dma.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_dmamux.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_bus.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_cortex.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_rcc.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_utils.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_pwr.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_dac.h;Drivers\STM32G0xx_HAL_Driver\Inc\stm32g0xx_ll_lpuart.h;Drivers\CMSIS\Device\ST\STM32G0xx\Include\stm32g071xx.h;Drivers\CMSIS\Device\ST\STM32G0xx\Include\stm32g0xx.h;Drivers\CMSIS\Device\ST\STM32G0xx\Include\system_stm32g0xx.h;Drivers\CMSIS\Device\ST\STM32G0xx\Source\Templates\system_stm32g0xx.c;Drivers\CMSIS\Include\cmsis_armcc.h;Drivers\CMSIS\Include\cmsis_armclang.h;Drivers\CMSIS\Include\cmsis_armclang_ltm.h;Drivers\CMSIS\Include\cmsis_compiler.h;Drivers\CMSIS\Include\cmsis_gcc.h;Drivers\CMSIS\Include\cmsis_iccarm.h;Drivers\CMSIS\Include\cmsis_version.h;Drivers\CMSIS\Include\core_armv81mml.h;Drivers\CMSIS\Include\core_armv8mbl.h;Drivers\CMSIS\Include\core_armv8mml.h;Drivers\CMSIS\Include\core_cm0.h;Drivers\CMSIS\Include\core_cm0plus.h;Drivers\CMSIS\Include\core_cm1.h;Drivers\CMSIS\Include\core_cm23.h;Drivers\CMSIS\Include\core_cm3.h;Drivers\CMSIS\Include\core_cm33.h;Drivers\CMSIS\Include\core_cm35p.h;Drivers\CMSIS\Include\core_cm4.h;Drivers\CMSIS\Include\core_cm7.h;Drivers\CMSIS\Include\core_sc000.h;Drivers\CMSIS\Include\core_sc300.h;Drivers\CMSIS\Include\mpu_armv7.h;Drivers\CMSIS\Include\mpu_armv8.h;Drivers\CMSIS\Include\tz_context.h;
|
||||||
|
|
||||||
|
[PreviousUsedCubeIDEFiles]
|
||||||
|
SourceFiles=Core\Src\main.c;Core\Src\stm32g0xx_it.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_gpio.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_exti.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_adc.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_dma.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_rcc.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_utils.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_dac.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_lpuart.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_pwr.c;Drivers\CMSIS\Device\ST\STM32G0xx\Source\Templates\system_stm32g0xx.c;Core\Src\system_stm32g0xx.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_gpio.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_exti.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_adc.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_dma.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_rcc.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_utils.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_dac.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_lpuart.c;Drivers\STM32G0xx_HAL_Driver\Src\stm32g0xx_ll_pwr.c;Drivers\CMSIS\Device\ST\STM32G0xx\Source\Templates\system_stm32g0xx.c;Core\Src\system_stm32g0xx.c;;;
|
||||||
|
HeaderPath=Drivers\STM32G0xx_HAL_Driver\Inc;Drivers\CMSIS\Device\ST\STM32G0xx\Include;Drivers\CMSIS\Include;Core\Inc;
|
||||||
|
CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;EXTERNAL_CLOCK_VALUE:48000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:1;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;STM32G071xx;USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;EXTERNAL_CLOCK_VALUE:48000;HSI_VALUE:16000000;LSI_VALUE:32000;VDD_VALUE:3300;PREFETCH_ENABLE:1;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;
|
||||||
|
|
||||||
|
[PreviousGenFiles]
|
||||||
|
AdvancedFolderStructure=true
|
||||||
|
HeaderFileListSize=3
|
||||||
|
HeaderFiles#0=..\Core\Inc\stm32g0xx_it.h
|
||||||
|
HeaderFiles#1=..\Core\Inc\stm32_assert.h
|
||||||
|
HeaderFiles#2=..\Core\Inc\main.h
|
||||||
|
HeaderFolderListSize=1
|
||||||
|
HeaderPath#0=..\Core\Inc
|
||||||
|
HeaderFiles=;
|
||||||
|
SourceFileListSize=2
|
||||||
|
SourceFiles#0=..\Core\Src\stm32g0xx_it.c
|
||||||
|
SourceFiles#1=..\Core\Src\main.c
|
||||||
|
SourceFolderListSize=1
|
||||||
|
SourcePath#0=..\Core\Src
|
||||||
|
SourceFiles=;
|
||||||
|
|
33
.project
Normal file
33
.project
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>Elektronische_Last</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<triggers>clean,full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>com.st.stm32cube.ide.mcu.MCUProjectNature</nature>
|
||||||
|
<nature>com.st.stm32cube.ide.mcu.MCUCubeProjectNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
|
<nature>com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature</nature>
|
||||||
|
<nature>com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature</nature>
|
||||||
|
<nature>com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature</nature>
|
||||||
|
<nature>com.st.stm32cube.ide.mcu.MCURootProjectNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
84
Core/Inc/main.h
Normal file
84
Core/Inc/main.h
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file : main.h
|
||||||
|
* @brief : Header for main.c file.
|
||||||
|
* This file contains the common defines of the application.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __MAIN_H
|
||||||
|
#define __MAIN_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx_ll_adc.h"
|
||||||
|
#include "stm32g0xx_ll_dac.h"
|
||||||
|
#include "stm32g0xx_ll_lpuart.h"
|
||||||
|
#include "stm32g0xx_ll_rcc.h"
|
||||||
|
#include "stm32g0xx_ll_bus.h"
|
||||||
|
#include "stm32g0xx_ll_system.h"
|
||||||
|
#include "stm32g0xx_ll_exti.h"
|
||||||
|
#include "stm32g0xx_ll_cortex.h"
|
||||||
|
#include "stm32g0xx_ll_utils.h"
|
||||||
|
#include "stm32g0xx_ll_pwr.h"
|
||||||
|
#include "stm32g0xx_ll_dma.h"
|
||||||
|
#include "stm32g0xx_ll_gpio.h"
|
||||||
|
|
||||||
|
#if defined(USE_FULL_ASSERT)
|
||||||
|
#include "stm32_assert.h"
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN ET */
|
||||||
|
|
||||||
|
/* USER CODE END ET */
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EC */
|
||||||
|
|
||||||
|
/* USER CODE END EC */
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EM */
|
||||||
|
|
||||||
|
/* USER CODE END EM */
|
||||||
|
|
||||||
|
/* Exported functions prototypes ---------------------------------------------*/
|
||||||
|
void Error_Handler(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN EFP */
|
||||||
|
|
||||||
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
|
/* Private defines -----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __MAIN_H */
|
53
Core/Inc/stm32_assert.h
Normal file
53
Core/Inc/stm32_assert.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32_assert.h
|
||||||
|
* @brief STM32 assert file.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __STM32_ASSERT_H
|
||||||
|
#define __STM32_ASSERT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
/**
|
||||||
|
* @brief The assert_param macro is used for function's parameters check.
|
||||||
|
* @param expr: If expr is false, it calls assert_failed function
|
||||||
|
* which reports the name of the source file and the source
|
||||||
|
* line number of the call that failed.
|
||||||
|
* If expr is true, it returns no value.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
|
||||||
|
/* Exported functions ------------------------------------------------------- */
|
||||||
|
void assert_failed(uint8_t* file, uint32_t line);
|
||||||
|
#else
|
||||||
|
#define assert_param(expr) ((void)0U)
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __STM32_ASSERT_H */
|
||||||
|
|
63
Core/Inc/stm32g0xx_it.h
Normal file
63
Core/Inc/stm32g0xx_it.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_it.h
|
||||||
|
* @brief This file contains the headers of the interrupt handlers.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __STM32G0xx_IT_H
|
||||||
|
#define __STM32G0xx_IT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Private includes ----------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN ET */
|
||||||
|
|
||||||
|
/* USER CODE END ET */
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EC */
|
||||||
|
|
||||||
|
/* USER CODE END EC */
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/* USER CODE BEGIN EM */
|
||||||
|
|
||||||
|
/* USER CODE END EM */
|
||||||
|
|
||||||
|
/* Exported functions prototypes ---------------------------------------------*/
|
||||||
|
void NMI_Handler(void);
|
||||||
|
void HardFault_Handler(void);
|
||||||
|
void SVC_Handler(void);
|
||||||
|
void PendSV_Handler(void);
|
||||||
|
void SysTick_Handler(void);
|
||||||
|
void USART3_4_LPUART1_IRQHandler(void);
|
||||||
|
/* USER CODE BEGIN EFP */
|
||||||
|
|
||||||
|
/* USER CODE END EFP */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __STM32G0xx_IT_H */
|
9249
Drivers/CMSIS/Device/ST/STM32G0xx/Include/stm32g071xx.h
Normal file
9249
Drivers/CMSIS/Device/ST/STM32G0xx/Include/stm32g071xx.h
Normal file
File diff suppressed because it is too large
Load Diff
244
Drivers/CMSIS/Device/ST/STM32G0xx/Include/stm32g0xx.h
Normal file
244
Drivers/CMSIS/Device/ST/STM32G0xx/Include/stm32g0xx.h
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief CMSIS STM32G0xx Device Peripheral Access Layer Header File.
|
||||||
|
*
|
||||||
|
* The file is the unique include file that the application programmer
|
||||||
|
* is using in the C source code, usually in main.c. This file contains:
|
||||||
|
* - Configuration section that allows to select:
|
||||||
|
* - The STM32G0xx device used in the target application
|
||||||
|
* - To use or not the peripherals drivers in application code(i.e.
|
||||||
|
* code will be based on direct access to peripherals registers
|
||||||
|
* rather than drivers API), this option is controlled by
|
||||||
|
* "#define USE_HAL_DRIVER"
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2021 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/** @addtogroup CMSIS
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup stm32g0xx
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef STM32G0xx_H
|
||||||
|
#define STM32G0xx_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/** @addtogroup Library_configuration_section
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief STM32 Family
|
||||||
|
*/
|
||||||
|
#if !defined (STM32G0)
|
||||||
|
#define STM32G0
|
||||||
|
#endif /* STM32G0 */
|
||||||
|
|
||||||
|
/* Uncomment the line below according to the target STM32G0 device used in your
|
||||||
|
application
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined (STM32G071xx) && !defined (STM32G081xx) && !defined (STM32G070xx) \
|
||||||
|
&& !defined (STM32G030xx) && !defined (STM32G031xx) && !defined (STM32G041xx) \
|
||||||
|
&& !defined (STM32G0B0xx) && !defined (STM32G0B1xx) && !defined (STM32G0C1xx) \
|
||||||
|
&& !defined (STM32G050xx) && !defined (STM32G051xx) && !defined (STM32G061xx)
|
||||||
|
/* #define STM32G0B0xx */ /*!< STM32G0B0xx Devices */
|
||||||
|
/* #define STM32G0B1xx */ /*!< STM32G0B1xx Devices */
|
||||||
|
/* #define STM32G0C1xx */ /*!< STM32G0C1xx Devices */
|
||||||
|
/* #define STM32G070xx */ /*!< STM32G070xx Devices */
|
||||||
|
/* #define STM32G071xx */ /*!< STM32G071xx Devices */
|
||||||
|
/* #define STM32G081xx */ /*!< STM32G081xx Devices */
|
||||||
|
/* #define STM32G050xx */ /*!< STM32G050xx Devices */
|
||||||
|
/* #define STM32G051xx */ /*!< STM32G051xx Devices */
|
||||||
|
/* #define STM32G061xx */ /*!< STM32G061xx Devices */
|
||||||
|
/* #define STM32G030xx */ /*!< STM32G030xx Devices */
|
||||||
|
/* #define STM32G031xx */ /*!< STM32G031xx Devices */
|
||||||
|
/* #define STM32G041xx */ /*!< STM32G041xx Devices */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Tip: To avoid modifying this file each time you need to switch between these
|
||||||
|
devices, you can define the device in your toolchain compiler preprocessor.
|
||||||
|
*/
|
||||||
|
#if !defined (USE_HAL_DRIVER)
|
||||||
|
/**
|
||||||
|
* @brief Comment the line below if you will not use the peripherals drivers.
|
||||||
|
In this case, these drivers will not be included and the application code will
|
||||||
|
be based on direct access to peripherals registers
|
||||||
|
*/
|
||||||
|
/*#define USE_HAL_DRIVER */
|
||||||
|
#endif /* USE_HAL_DRIVER */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CMSIS Device version number $VERSION$
|
||||||
|
*/
|
||||||
|
#define __STM32G0_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */
|
||||||
|
#define __STM32G0_CMSIS_VERSION_SUB1 (0x04U) /*!< [23:16] sub1 version */
|
||||||
|
#define __STM32G0_CMSIS_VERSION_SUB2 (0x03U) /*!< [15:8] sub2 version */
|
||||||
|
#define __STM32G0_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
|
||||||
|
#define __STM32G0_CMSIS_VERSION ((__STM32G0_CMSIS_VERSION_MAIN << 24)\
|
||||||
|
|(__STM32G0_CMSIS_VERSION_SUB1 << 16)\
|
||||||
|
|(__STM32G0_CMSIS_VERSION_SUB2 << 8 )\
|
||||||
|
|(__STM32G0_CMSIS_VERSION_RC))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup Device_Included
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(STM32G0B1xx)
|
||||||
|
#include "stm32g0b1xx.h"
|
||||||
|
#elif defined(STM32G0C1xx)
|
||||||
|
#include "stm32g0c1xx.h"
|
||||||
|
#elif defined(STM32G0B0xx)
|
||||||
|
#include "stm32g0b0xx.h"
|
||||||
|
#elif defined(STM32G071xx)
|
||||||
|
#include "stm32g071xx.h"
|
||||||
|
#elif defined(STM32G081xx)
|
||||||
|
#include "stm32g081xx.h"
|
||||||
|
#elif defined(STM32G070xx)
|
||||||
|
#include "stm32g070xx.h"
|
||||||
|
#elif defined(STM32G031xx)
|
||||||
|
#include "stm32g031xx.h"
|
||||||
|
#elif defined(STM32G041xx)
|
||||||
|
#include "stm32g041xx.h"
|
||||||
|
#elif defined(STM32G030xx)
|
||||||
|
#include "stm32g030xx.h"
|
||||||
|
#elif defined(STM32G051xx)
|
||||||
|
#include "stm32g051xx.h"
|
||||||
|
#elif defined(STM32G061xx)
|
||||||
|
#include "stm32g061xx.h"
|
||||||
|
#elif defined(STM32G050xx)
|
||||||
|
#include "stm32g050xx.h"
|
||||||
|
#else
|
||||||
|
#error "Please select first the target STM32G0xx device used in your application (in stm32g0xx.h file)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup Exported_types
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
RESET = 0,
|
||||||
|
SET = !RESET
|
||||||
|
} FlagStatus, ITStatus;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
DISABLE = 0,
|
||||||
|
ENABLE = !DISABLE
|
||||||
|
} FunctionalState;
|
||||||
|
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SUCCESS = 0,
|
||||||
|
ERROR = !SUCCESS
|
||||||
|
} ErrorStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** @addtogroup Exported_macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define SET_BIT(REG, BIT) ((REG) |= (BIT))
|
||||||
|
|
||||||
|
#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
|
||||||
|
|
||||||
|
#define READ_BIT(REG, BIT) ((REG) & (BIT))
|
||||||
|
|
||||||
|
#define CLEAR_REG(REG) ((REG) = (0x0))
|
||||||
|
|
||||||
|
#define WRITE_REG(REG, VAL) ((REG) = (VAL))
|
||||||
|
|
||||||
|
#define READ_REG(REG) ((REG))
|
||||||
|
|
||||||
|
#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
|
||||||
|
|
||||||
|
/* Use of interrupt control for register exclusive access */
|
||||||
|
/* Atomic 32-bit register access macro to set one or several bits */
|
||||||
|
#define ATOMIC_SET_BIT(REG, BIT) \
|
||||||
|
do { \
|
||||||
|
uint32_t primask; \
|
||||||
|
primask = __get_PRIMASK(); \
|
||||||
|
__set_PRIMASK(1); \
|
||||||
|
SET_BIT((REG), (BIT)); \
|
||||||
|
__set_PRIMASK(primask); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
/* Atomic 32-bit register access macro to clear one or several bits */
|
||||||
|
#define ATOMIC_CLEAR_BIT(REG, BIT) \
|
||||||
|
do { \
|
||||||
|
uint32_t primask; \
|
||||||
|
primask = __get_PRIMASK(); \
|
||||||
|
__set_PRIMASK(1); \
|
||||||
|
CLEAR_BIT((REG), (BIT)); \
|
||||||
|
__set_PRIMASK(primask); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
/* Atomic 32-bit register access macro to clear and set one or several bits */
|
||||||
|
#define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
|
||||||
|
do { \
|
||||||
|
uint32_t primask; \
|
||||||
|
primask = __get_PRIMASK(); \
|
||||||
|
__set_PRIMASK(1); \
|
||||||
|
MODIFY_REG((REG), (CLEARMSK), (SETMASK)); \
|
||||||
|
__set_PRIMASK(primask); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
/* Atomic 16-bit register access macro to set one or several bits */
|
||||||
|
#define ATOMIC_SETH_BIT(REG, BIT) ATOMIC_SET_BIT(REG, BIT) \
|
||||||
|
|
||||||
|
/* Atomic 16-bit register access macro to clear one or several bits */
|
||||||
|
#define ATOMIC_CLEARH_BIT(REG, BIT) ATOMIC_CLEAR_BIT(REG, BIT) \
|
||||||
|
|
||||||
|
/* Atomic 16-bit register access macro to clear and set one or several bits */
|
||||||
|
#define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
|
||||||
|
|
||||||
|
/*#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))*/
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (USE_HAL_DRIVER)
|
||||||
|
#include "stm32g0xx_hal.h"
|
||||||
|
#endif /* USE_HAL_DRIVER */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* STM32G0xx_H */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
103
Drivers/CMSIS/Device/ST/STM32G0xx/Include/system_stm32g0xx.h
Normal file
103
Drivers/CMSIS/Device/ST/STM32G0xx/Include/system_stm32g0xx.h
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file system_stm32g0xx.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief CMSIS Cortex-M0+ Device System Source File for STM32G0xx devices.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2021 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/** @addtogroup CMSIS
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup stm32g0xx_system
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Define to prevent recursive inclusion
|
||||||
|
*/
|
||||||
|
#ifndef SYSTEM_STM32G0XX_H
|
||||||
|
#define SYSTEM_STM32G0XX_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_System_Includes
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_System_Exported_types
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/* This variable is updated in three ways:
|
||||||
|
1) by calling CMSIS function SystemCoreClockUpdate()
|
||||||
|
2) by calling HAL API function HAL_RCC_GetSysClockFreq()
|
||||||
|
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||||
|
Note: If you use this function to configure the system clock; then there
|
||||||
|
is no need to call the 2 first functions listed above, since SystemCoreClock
|
||||||
|
variable is updated automatically.
|
||||||
|
*/
|
||||||
|
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
|
||||||
|
|
||||||
|
extern const uint32_t AHBPrescTable[16]; /*!< AHB prescalers table values */
|
||||||
|
extern const uint32_t APBPrescTable[8]; /*!< APB prescalers table values */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_System_Exported_Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_System_Exported_Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_System_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern void SystemInit(void);
|
||||||
|
extern void SystemCoreClockUpdate(void);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*SYSTEM_STM32G0XX_H */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
6
Drivers/CMSIS/Device/ST/STM32G0xx/LICENSE.txt
Normal file
6
Drivers/CMSIS/Device/ST/STM32G0xx/LICENSE.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
This software component is provided to you as part of a software package and
|
||||||
|
applicable license terms are in the Package_license file. If you received this
|
||||||
|
software component outside of a package or without applicable license terms,
|
||||||
|
the terms of the Apache-2.0 license shall apply.
|
||||||
|
You may obtain a copy of the Apache-2.0 at:
|
||||||
|
https://opensource.org/licenses/Apache-2.0
|
894
Drivers/CMSIS/Include/cmsis_armcc.h
Normal file
894
Drivers/CMSIS/Include/cmsis_armcc.h
Normal file
@ -0,0 +1,894 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* @file cmsis_armcc.h
|
||||||
|
* @brief CMSIS compiler ARMCC (Arm Compiler 5) header file
|
||||||
|
* @version V5.1.0
|
||||||
|
* @date 08. May 2019
|
||||||
|
******************************************************************************/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2019 Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CMSIS_ARMCC_H
|
||||||
|
#define __CMSIS_ARMCC_H
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677)
|
||||||
|
#error "Please use Arm Compiler Toolchain V4.0.677 or later!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* CMSIS compiler control architecture macros */
|
||||||
|
#if ((defined (__TARGET_ARCH_6_M ) && (__TARGET_ARCH_6_M == 1)) || \
|
||||||
|
(defined (__TARGET_ARCH_6S_M ) && (__TARGET_ARCH_6S_M == 1)) )
|
||||||
|
#define __ARM_ARCH_6M__ 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined (__TARGET_ARCH_7_M ) && (__TARGET_ARCH_7_M == 1))
|
||||||
|
#define __ARM_ARCH_7M__ 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined (__TARGET_ARCH_7E_M) && (__TARGET_ARCH_7E_M == 1))
|
||||||
|
#define __ARM_ARCH_7EM__ 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* __ARM_ARCH_8M_BASE__ not applicable */
|
||||||
|
/* __ARM_ARCH_8M_MAIN__ not applicable */
|
||||||
|
|
||||||
|
/* CMSIS compiler control DSP macros */
|
||||||
|
#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
|
||||||
|
#define __ARM_FEATURE_DSP 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* CMSIS compiler specific defines */
|
||||||
|
#ifndef __ASM
|
||||||
|
#define __ASM __asm
|
||||||
|
#endif
|
||||||
|
#ifndef __INLINE
|
||||||
|
#define __INLINE __inline
|
||||||
|
#endif
|
||||||
|
#ifndef __STATIC_INLINE
|
||||||
|
#define __STATIC_INLINE static __inline
|
||||||
|
#endif
|
||||||
|
#ifndef __STATIC_FORCEINLINE
|
||||||
|
#define __STATIC_FORCEINLINE static __forceinline
|
||||||
|
#endif
|
||||||
|
#ifndef __NO_RETURN
|
||||||
|
#define __NO_RETURN __declspec(noreturn)
|
||||||
|
#endif
|
||||||
|
#ifndef __USED
|
||||||
|
#define __USED __attribute__((used))
|
||||||
|
#endif
|
||||||
|
#ifndef __WEAK
|
||||||
|
#define __WEAK __attribute__((weak))
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED
|
||||||
|
#define __PACKED __attribute__((packed))
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED_STRUCT
|
||||||
|
#define __PACKED_STRUCT __packed struct
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED_UNION
|
||||||
|
#define __PACKED_UNION __packed union
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32 /* deprecated */
|
||||||
|
#define __UNALIGNED_UINT32(x) (*((__packed uint32_t *)(x)))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT16_WRITE
|
||||||
|
#define __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT16_READ
|
||||||
|
#define __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr)))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32_WRITE
|
||||||
|
#define __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32_READ
|
||||||
|
#define __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr)))
|
||||||
|
#endif
|
||||||
|
#ifndef __ALIGNED
|
||||||
|
#define __ALIGNED(x) __attribute__((aligned(x)))
|
||||||
|
#endif
|
||||||
|
#ifndef __RESTRICT
|
||||||
|
#define __RESTRICT __restrict
|
||||||
|
#endif
|
||||||
|
#ifndef __COMPILER_BARRIER
|
||||||
|
#define __COMPILER_BARRIER() __memory_changed()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ######################### Startup and Lowlevel Init ######################## */
|
||||||
|
|
||||||
|
#ifndef __PROGRAM_START
|
||||||
|
#define __PROGRAM_START __main
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __INITIAL_SP
|
||||||
|
#define __INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __STACK_LIMIT
|
||||||
|
#define __STACK_LIMIT Image$$ARM_LIB_STACK$$ZI$$Base
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VECTOR_TABLE
|
||||||
|
#define __VECTOR_TABLE __Vectors
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VECTOR_TABLE_ATTRIBUTE
|
||||||
|
#define __VECTOR_TABLE_ATTRIBUTE __attribute((used, section("RESET")))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ########################### Core Function Access ########################### */
|
||||||
|
/** \ingroup CMSIS_Core_FunctionInterface
|
||||||
|
\defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Enable IRQ Interrupts
|
||||||
|
\details Enables IRQ interrupts by clearing the I-bit in the CPSR.
|
||||||
|
Can only be executed in Privileged modes.
|
||||||
|
*/
|
||||||
|
/* intrinsic void __enable_irq(); */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Disable IRQ Interrupts
|
||||||
|
\details Disables IRQ interrupts by setting the I-bit in the CPSR.
|
||||||
|
Can only be executed in Privileged modes.
|
||||||
|
*/
|
||||||
|
/* intrinsic void __disable_irq(); */
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Control Register
|
||||||
|
\details Returns the content of the Control Register.
|
||||||
|
\return Control Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_CONTROL(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regControl __ASM("control");
|
||||||
|
return(__regControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Control Register
|
||||||
|
\details Writes the given value to the Control Register.
|
||||||
|
\param [in] control Control Register value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_CONTROL(uint32_t control)
|
||||||
|
{
|
||||||
|
register uint32_t __regControl __ASM("control");
|
||||||
|
__regControl = control;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get IPSR Register
|
||||||
|
\details Returns the content of the IPSR Register.
|
||||||
|
\return IPSR Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_IPSR(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regIPSR __ASM("ipsr");
|
||||||
|
return(__regIPSR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get APSR Register
|
||||||
|
\details Returns the content of the APSR Register.
|
||||||
|
\return APSR Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_APSR(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regAPSR __ASM("apsr");
|
||||||
|
return(__regAPSR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get xPSR Register
|
||||||
|
\details Returns the content of the xPSR Register.
|
||||||
|
\return xPSR Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_xPSR(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regXPSR __ASM("xpsr");
|
||||||
|
return(__regXPSR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Process Stack Pointer
|
||||||
|
\details Returns the current value of the Process Stack Pointer (PSP).
|
||||||
|
\return PSP Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_PSP(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regProcessStackPointer __ASM("psp");
|
||||||
|
return(__regProcessStackPointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Process Stack Pointer
|
||||||
|
\details Assigns the given value to the Process Stack Pointer (PSP).
|
||||||
|
\param [in] topOfProcStack Process Stack Pointer value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
|
||||||
|
{
|
||||||
|
register uint32_t __regProcessStackPointer __ASM("psp");
|
||||||
|
__regProcessStackPointer = topOfProcStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Main Stack Pointer
|
||||||
|
\details Returns the current value of the Main Stack Pointer (MSP).
|
||||||
|
\return MSP Register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_MSP(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regMainStackPointer __ASM("msp");
|
||||||
|
return(__regMainStackPointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Main Stack Pointer
|
||||||
|
\details Assigns the given value to the Main Stack Pointer (MSP).
|
||||||
|
\param [in] topOfMainStack Main Stack Pointer value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
|
||||||
|
{
|
||||||
|
register uint32_t __regMainStackPointer __ASM("msp");
|
||||||
|
__regMainStackPointer = topOfMainStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Priority Mask
|
||||||
|
\details Returns the current state of the priority mask bit from the Priority Mask Register.
|
||||||
|
\return Priority Mask value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_PRIMASK(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regPriMask __ASM("primask");
|
||||||
|
return(__regPriMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Priority Mask
|
||||||
|
\details Assigns the given value to the Priority Mask Register.
|
||||||
|
\param [in] priMask Priority Mask
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
|
||||||
|
{
|
||||||
|
register uint32_t __regPriMask __ASM("primask");
|
||||||
|
__regPriMask = (priMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
|
||||||
|
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Enable FIQ
|
||||||
|
\details Enables FIQ interrupts by clearing the F-bit in the CPSR.
|
||||||
|
Can only be executed in Privileged modes.
|
||||||
|
*/
|
||||||
|
#define __enable_fault_irq __enable_fiq
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Disable FIQ
|
||||||
|
\details Disables FIQ interrupts by setting the F-bit in the CPSR.
|
||||||
|
Can only be executed in Privileged modes.
|
||||||
|
*/
|
||||||
|
#define __disable_fault_irq __disable_fiq
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Base Priority
|
||||||
|
\details Returns the current value of the Base Priority register.
|
||||||
|
\return Base Priority register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_BASEPRI(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regBasePri __ASM("basepri");
|
||||||
|
return(__regBasePri);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Base Priority
|
||||||
|
\details Assigns the given value to the Base Priority register.
|
||||||
|
\param [in] basePri Base Priority value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
|
||||||
|
{
|
||||||
|
register uint32_t __regBasePri __ASM("basepri");
|
||||||
|
__regBasePri = (basePri & 0xFFU);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Base Priority with condition
|
||||||
|
\details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
|
||||||
|
or the new value increases the BASEPRI priority level.
|
||||||
|
\param [in] basePri Base Priority value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri)
|
||||||
|
{
|
||||||
|
register uint32_t __regBasePriMax __ASM("basepri_max");
|
||||||
|
__regBasePriMax = (basePri & 0xFFU);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Fault Mask
|
||||||
|
\details Returns the current value of the Fault Mask register.
|
||||||
|
\return Fault Mask register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_FAULTMASK(void)
|
||||||
|
{
|
||||||
|
register uint32_t __regFaultMask __ASM("faultmask");
|
||||||
|
return(__regFaultMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Fault Mask
|
||||||
|
\details Assigns the given value to the Fault Mask register.
|
||||||
|
\param [in] faultMask Fault Mask value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
|
||||||
|
{
|
||||||
|
register uint32_t __regFaultMask __ASM("faultmask");
|
||||||
|
__regFaultMask = (faultMask & (uint32_t)1U);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
|
||||||
|
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get FPSCR
|
||||||
|
\details Returns the current value of the Floating Point Status/Control register.
|
||||||
|
\return Floating Point Status/Control register value
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __get_FPSCR(void)
|
||||||
|
{
|
||||||
|
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||||
|
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
|
||||||
|
register uint32_t __regfpscr __ASM("fpscr");
|
||||||
|
return(__regfpscr);
|
||||||
|
#else
|
||||||
|
return(0U);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set FPSCR
|
||||||
|
\details Assigns the given value to the Floating Point Status/Control register.
|
||||||
|
\param [in] fpscr Floating Point Status/Control value to set
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
|
||||||
|
{
|
||||||
|
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||||
|
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
|
||||||
|
register uint32_t __regfpscr __ASM("fpscr");
|
||||||
|
__regfpscr = (fpscr);
|
||||||
|
#else
|
||||||
|
(void)fpscr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*@} end of CMSIS_Core_RegAccFunctions */
|
||||||
|
|
||||||
|
|
||||||
|
/* ########################## Core Instruction Access ######################### */
|
||||||
|
/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
|
||||||
|
Access to dedicated instructions
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief No Operation
|
||||||
|
\details No Operation does nothing. This instruction can be used for code alignment purposes.
|
||||||
|
*/
|
||||||
|
#define __NOP __nop
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Wait For Interrupt
|
||||||
|
\details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
|
||||||
|
*/
|
||||||
|
#define __WFI __wfi
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Wait For Event
|
||||||
|
\details Wait For Event is a hint instruction that permits the processor to enter
|
||||||
|
a low-power state until one of a number of events occurs.
|
||||||
|
*/
|
||||||
|
#define __WFE __wfe
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Send Event
|
||||||
|
\details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
|
||||||
|
*/
|
||||||
|
#define __SEV __sev
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Instruction Synchronization Barrier
|
||||||
|
\details Instruction Synchronization Barrier flushes the pipeline in the processor,
|
||||||
|
so that all instructions following the ISB are fetched from cache or memory,
|
||||||
|
after the instruction has been completed.
|
||||||
|
*/
|
||||||
|
#define __ISB() do {\
|
||||||
|
__schedule_barrier();\
|
||||||
|
__isb(0xF);\
|
||||||
|
__schedule_barrier();\
|
||||||
|
} while (0U)
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Data Synchronization Barrier
|
||||||
|
\details Acts as a special kind of Data Memory Barrier.
|
||||||
|
It completes when all explicit memory accesses before this instruction complete.
|
||||||
|
*/
|
||||||
|
#define __DSB() do {\
|
||||||
|
__schedule_barrier();\
|
||||||
|
__dsb(0xF);\
|
||||||
|
__schedule_barrier();\
|
||||||
|
} while (0U)
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Data Memory Barrier
|
||||||
|
\details Ensures the apparent order of the explicit memory operations before
|
||||||
|
and after the instruction, without ensuring their completion.
|
||||||
|
*/
|
||||||
|
#define __DMB() do {\
|
||||||
|
__schedule_barrier();\
|
||||||
|
__dmb(0xF);\
|
||||||
|
__schedule_barrier();\
|
||||||
|
} while (0U)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Reverse byte order (32 bit)
|
||||||
|
\details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
#define __REV __rev
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Reverse byte order (16 bit)
|
||||||
|
\details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
#ifndef __NO_EMBEDDED_ASM
|
||||||
|
__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
|
||||||
|
{
|
||||||
|
rev16 r0, r0
|
||||||
|
bx lr
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Reverse byte order (16 bit)
|
||||||
|
\details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
#ifndef __NO_EMBEDDED_ASM
|
||||||
|
__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int16_t __REVSH(int16_t value)
|
||||||
|
{
|
||||||
|
revsh r0, r0
|
||||||
|
bx lr
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Rotate Right in unsigned value (32 bit)
|
||||||
|
\details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
|
||||||
|
\param [in] op1 Value to rotate
|
||||||
|
\param [in] op2 Number of Bits to rotate
|
||||||
|
\return Rotated value
|
||||||
|
*/
|
||||||
|
#define __ROR __ror
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Breakpoint
|
||||||
|
\details Causes the processor to enter Debug state.
|
||||||
|
Debug tools can use this to investigate system state when the instruction at a particular address is reached.
|
||||||
|
\param [in] value is ignored by the processor.
|
||||||
|
If required, a debugger can use it to store additional information about the breakpoint.
|
||||||
|
*/
|
||||||
|
#define __BKPT(value) __breakpoint(value)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Reverse bit order of value
|
||||||
|
\details Reverses the bit order of the given value.
|
||||||
|
\param [in] value Value to reverse
|
||||||
|
\return Reversed value
|
||||||
|
*/
|
||||||
|
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
|
||||||
|
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
|
||||||
|
#define __RBIT __rbit
|
||||||
|
#else
|
||||||
|
__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */
|
||||||
|
|
||||||
|
result = value; /* r will be reversed bits of v; first get LSB of v */
|
||||||
|
for (value >>= 1U; value != 0U; value >>= 1U)
|
||||||
|
{
|
||||||
|
result <<= 1U;
|
||||||
|
result |= value & 1U;
|
||||||
|
s--;
|
||||||
|
}
|
||||||
|
result <<= s; /* shift when v's highest bits are zero */
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Count leading zeros
|
||||||
|
\details Counts the number of leading zeros of a data value.
|
||||||
|
\param [in] value Value to count the leading zeros
|
||||||
|
\return number of leading zeros in value
|
||||||
|
*/
|
||||||
|
#define __CLZ __clz
|
||||||
|
|
||||||
|
|
||||||
|
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
|
||||||
|
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief LDR Exclusive (8 bit)
|
||||||
|
\details Executes a exclusive LDR instruction for 8 bit value.
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint8_t at (*ptr)
|
||||||
|
*/
|
||||||
|
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
||||||
|
#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr))
|
||||||
|
#else
|
||||||
|
#define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief LDR Exclusive (16 bit)
|
||||||
|
\details Executes a exclusive LDR instruction for 16 bit values.
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint16_t at (*ptr)
|
||||||
|
*/
|
||||||
|
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
||||||
|
#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr))
|
||||||
|
#else
|
||||||
|
#define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief LDR Exclusive (32 bit)
|
||||||
|
\details Executes a exclusive LDR instruction for 32 bit values.
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint32_t at (*ptr)
|
||||||
|
*/
|
||||||
|
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
||||||
|
#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr))
|
||||||
|
#else
|
||||||
|
#define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief STR Exclusive (8 bit)
|
||||||
|
\details Executes a exclusive STR instruction for 8 bit values.
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
\return 0 Function succeeded
|
||||||
|
\return 1 Function failed
|
||||||
|
*/
|
||||||
|
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
||||||
|
#define __STREXB(value, ptr) __strex(value, ptr)
|
||||||
|
#else
|
||||||
|
#define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief STR Exclusive (16 bit)
|
||||||
|
\details Executes a exclusive STR instruction for 16 bit values.
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
\return 0 Function succeeded
|
||||||
|
\return 1 Function failed
|
||||||
|
*/
|
||||||
|
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
||||||
|
#define __STREXH(value, ptr) __strex(value, ptr)
|
||||||
|
#else
|
||||||
|
#define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief STR Exclusive (32 bit)
|
||||||
|
\details Executes a exclusive STR instruction for 32 bit values.
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
\return 0 Function succeeded
|
||||||
|
\return 1 Function failed
|
||||||
|
*/
|
||||||
|
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
|
||||||
|
#define __STREXW(value, ptr) __strex(value, ptr)
|
||||||
|
#else
|
||||||
|
#define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Remove the exclusive lock
|
||||||
|
\details Removes the exclusive lock which is created by LDREX.
|
||||||
|
*/
|
||||||
|
#define __CLREX __clrex
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Signed Saturate
|
||||||
|
\details Saturates a signed value.
|
||||||
|
\param [in] value Value to be saturated
|
||||||
|
\param [in] sat Bit position to saturate to (1..32)
|
||||||
|
\return Saturated value
|
||||||
|
*/
|
||||||
|
#define __SSAT __ssat
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Unsigned Saturate
|
||||||
|
\details Saturates an unsigned value.
|
||||||
|
\param [in] value Value to be saturated
|
||||||
|
\param [in] sat Bit position to saturate to (0..31)
|
||||||
|
\return Saturated value
|
||||||
|
*/
|
||||||
|
#define __USAT __usat
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Rotate Right with Extend (32 bit)
|
||||||
|
\details Moves each bit of a bitstring right by one bit.
|
||||||
|
The carry input is shifted in at the left end of the bitstring.
|
||||||
|
\param [in] value Value to rotate
|
||||||
|
\return Rotated value
|
||||||
|
*/
|
||||||
|
#ifndef __NO_EMBEDDED_ASM
|
||||||
|
__attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value)
|
||||||
|
{
|
||||||
|
rrx r0, r0
|
||||||
|
bx lr
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief LDRT Unprivileged (8 bit)
|
||||||
|
\details Executes a Unprivileged LDRT instruction for 8 bit value.
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint8_t at (*ptr)
|
||||||
|
*/
|
||||||
|
#define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr))
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief LDRT Unprivileged (16 bit)
|
||||||
|
\details Executes a Unprivileged LDRT instruction for 16 bit values.
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint16_t at (*ptr)
|
||||||
|
*/
|
||||||
|
#define __LDRHT(ptr) ((uint16_t) __ldrt(ptr))
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief LDRT Unprivileged (32 bit)
|
||||||
|
\details Executes a Unprivileged LDRT instruction for 32 bit values.
|
||||||
|
\param [in] ptr Pointer to data
|
||||||
|
\return value of type uint32_t at (*ptr)
|
||||||
|
*/
|
||||||
|
#define __LDRT(ptr) ((uint32_t ) __ldrt(ptr))
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief STRT Unprivileged (8 bit)
|
||||||
|
\details Executes a Unprivileged STRT instruction for 8 bit values.
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
*/
|
||||||
|
#define __STRBT(value, ptr) __strt(value, ptr)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief STRT Unprivileged (16 bit)
|
||||||
|
\details Executes a Unprivileged STRT instruction for 16 bit values.
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
*/
|
||||||
|
#define __STRHT(value, ptr) __strt(value, ptr)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief STRT Unprivileged (32 bit)
|
||||||
|
\details Executes a Unprivileged STRT instruction for 32 bit values.
|
||||||
|
\param [in] value Value to store
|
||||||
|
\param [in] ptr Pointer to location
|
||||||
|
*/
|
||||||
|
#define __STRT(value, ptr) __strt(value, ptr)
|
||||||
|
|
||||||
|
#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
|
||||||
|
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Signed Saturate
|
||||||
|
\details Saturates a signed value.
|
||||||
|
\param [in] value Value to be saturated
|
||||||
|
\param [in] sat Bit position to saturate to (1..32)
|
||||||
|
\return Saturated value
|
||||||
|
*/
|
||||||
|
__attribute__((always_inline)) __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat)
|
||||||
|
{
|
||||||
|
if ((sat >= 1U) && (sat <= 32U))
|
||||||
|
{
|
||||||
|
const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
|
||||||
|
const int32_t min = -1 - max ;
|
||||||
|
if (val > max)
|
||||||
|
{
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
else if (val < min)
|
||||||
|
{
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Unsigned Saturate
|
||||||
|
\details Saturates an unsigned value.
|
||||||
|
\param [in] value Value to be saturated
|
||||||
|
\param [in] sat Bit position to saturate to (0..31)
|
||||||
|
\return Saturated value
|
||||||
|
*/
|
||||||
|
__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat)
|
||||||
|
{
|
||||||
|
if (sat <= 31U)
|
||||||
|
{
|
||||||
|
const uint32_t max = ((1U << sat) - 1U);
|
||||||
|
if (val > (int32_t)max)
|
||||||
|
{
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
else if (val < 0)
|
||||||
|
{
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (uint32_t)val;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
|
||||||
|
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
|
||||||
|
|
||||||
|
/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
|
||||||
|
|
||||||
|
|
||||||
|
/* ################### Compiler specific Intrinsics ########################### */
|
||||||
|
/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
|
||||||
|
Access to dedicated SIMD instructions
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
|
||||||
|
|
||||||
|
#define __SADD8 __sadd8
|
||||||
|
#define __QADD8 __qadd8
|
||||||
|
#define __SHADD8 __shadd8
|
||||||
|
#define __UADD8 __uadd8
|
||||||
|
#define __UQADD8 __uqadd8
|
||||||
|
#define __UHADD8 __uhadd8
|
||||||
|
#define __SSUB8 __ssub8
|
||||||
|
#define __QSUB8 __qsub8
|
||||||
|
#define __SHSUB8 __shsub8
|
||||||
|
#define __USUB8 __usub8
|
||||||
|
#define __UQSUB8 __uqsub8
|
||||||
|
#define __UHSUB8 __uhsub8
|
||||||
|
#define __SADD16 __sadd16
|
||||||
|
#define __QADD16 __qadd16
|
||||||
|
#define __SHADD16 __shadd16
|
||||||
|
#define __UADD16 __uadd16
|
||||||
|
#define __UQADD16 __uqadd16
|
||||||
|
#define __UHADD16 __uhadd16
|
||||||
|
#define __SSUB16 __ssub16
|
||||||
|
#define __QSUB16 __qsub16
|
||||||
|
#define __SHSUB16 __shsub16
|
||||||
|
#define __USUB16 __usub16
|
||||||
|
#define __UQSUB16 __uqsub16
|
||||||
|
#define __UHSUB16 __uhsub16
|
||||||
|
#define __SASX __sasx
|
||||||
|
#define __QASX __qasx
|
||||||
|
#define __SHASX __shasx
|
||||||
|
#define __UASX __uasx
|
||||||
|
#define __UQASX __uqasx
|
||||||
|
#define __UHASX __uhasx
|
||||||
|
#define __SSAX __ssax
|
||||||
|
#define __QSAX __qsax
|
||||||
|
#define __SHSAX __shsax
|
||||||
|
#define __USAX __usax
|
||||||
|
#define __UQSAX __uqsax
|
||||||
|
#define __UHSAX __uhsax
|
||||||
|
#define __USAD8 __usad8
|
||||||
|
#define __USADA8 __usada8
|
||||||
|
#define __SSAT16 __ssat16
|
||||||
|
#define __USAT16 __usat16
|
||||||
|
#define __UXTB16 __uxtb16
|
||||||
|
#define __UXTAB16 __uxtab16
|
||||||
|
#define __SXTB16 __sxtb16
|
||||||
|
#define __SXTAB16 __sxtab16
|
||||||
|
#define __SMUAD __smuad
|
||||||
|
#define __SMUADX __smuadx
|
||||||
|
#define __SMLAD __smlad
|
||||||
|
#define __SMLADX __smladx
|
||||||
|
#define __SMLALD __smlald
|
||||||
|
#define __SMLALDX __smlaldx
|
||||||
|
#define __SMUSD __smusd
|
||||||
|
#define __SMUSDX __smusdx
|
||||||
|
#define __SMLSD __smlsd
|
||||||
|
#define __SMLSDX __smlsdx
|
||||||
|
#define __SMLSLD __smlsld
|
||||||
|
#define __SMLSLDX __smlsldx
|
||||||
|
#define __SEL __sel
|
||||||
|
#define __QADD __qadd
|
||||||
|
#define __QSUB __qsub
|
||||||
|
|
||||||
|
#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \
|
||||||
|
((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
|
||||||
|
|
||||||
|
#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \
|
||||||
|
((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
|
||||||
|
|
||||||
|
#define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \
|
||||||
|
((int64_t)(ARG3) << 32U) ) >> 32U))
|
||||||
|
|
||||||
|
#endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
|
||||||
|
/*@} end of group CMSIS_SIMD_intrinsics */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __CMSIS_ARMCC_H */
|
1444
Drivers/CMSIS/Include/cmsis_armclang.h
Normal file
1444
Drivers/CMSIS/Include/cmsis_armclang.h
Normal file
File diff suppressed because it is too large
Load Diff
1891
Drivers/CMSIS/Include/cmsis_armclang_ltm.h
Normal file
1891
Drivers/CMSIS/Include/cmsis_armclang_ltm.h
Normal file
File diff suppressed because it is too large
Load Diff
283
Drivers/CMSIS/Include/cmsis_compiler.h
Normal file
283
Drivers/CMSIS/Include/cmsis_compiler.h
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* @file cmsis_compiler.h
|
||||||
|
* @brief CMSIS compiler generic header file
|
||||||
|
* @version V5.1.0
|
||||||
|
* @date 09. October 2018
|
||||||
|
******************************************************************************/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CMSIS_COMPILER_H
|
||||||
|
#define __CMSIS_COMPILER_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Arm Compiler 4/5
|
||||||
|
*/
|
||||||
|
#if defined ( __CC_ARM )
|
||||||
|
#include "cmsis_armcc.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Arm Compiler 6.6 LTM (armclang)
|
||||||
|
*/
|
||||||
|
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) && (__ARMCC_VERSION < 6100100)
|
||||||
|
#include "cmsis_armclang_ltm.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Arm Compiler above 6.10.1 (armclang)
|
||||||
|
*/
|
||||||
|
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6100100)
|
||||||
|
#include "cmsis_armclang.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GNU Compiler
|
||||||
|
*/
|
||||||
|
#elif defined ( __GNUC__ )
|
||||||
|
#include "cmsis_gcc.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* IAR Compiler
|
||||||
|
*/
|
||||||
|
#elif defined ( __ICCARM__ )
|
||||||
|
#include <cmsis_iccarm.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TI Arm Compiler
|
||||||
|
*/
|
||||||
|
#elif defined ( __TI_ARM__ )
|
||||||
|
#include <cmsis_ccs.h>
|
||||||
|
|
||||||
|
#ifndef __ASM
|
||||||
|
#define __ASM __asm
|
||||||
|
#endif
|
||||||
|
#ifndef __INLINE
|
||||||
|
#define __INLINE inline
|
||||||
|
#endif
|
||||||
|
#ifndef __STATIC_INLINE
|
||||||
|
#define __STATIC_INLINE static inline
|
||||||
|
#endif
|
||||||
|
#ifndef __STATIC_FORCEINLINE
|
||||||
|
#define __STATIC_FORCEINLINE __STATIC_INLINE
|
||||||
|
#endif
|
||||||
|
#ifndef __NO_RETURN
|
||||||
|
#define __NO_RETURN __attribute__((noreturn))
|
||||||
|
#endif
|
||||||
|
#ifndef __USED
|
||||||
|
#define __USED __attribute__((used))
|
||||||
|
#endif
|
||||||
|
#ifndef __WEAK
|
||||||
|
#define __WEAK __attribute__((weak))
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED
|
||||||
|
#define __PACKED __attribute__((packed))
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED_STRUCT
|
||||||
|
#define __PACKED_STRUCT struct __attribute__((packed))
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED_UNION
|
||||||
|
#define __PACKED_UNION union __attribute__((packed))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32 /* deprecated */
|
||||||
|
struct __attribute__((packed)) T_UINT32 { uint32_t v; };
|
||||||
|
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT16_WRITE
|
||||||
|
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
|
||||||
|
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT16_READ
|
||||||
|
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
|
||||||
|
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32_WRITE
|
||||||
|
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
|
||||||
|
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32_READ
|
||||||
|
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
|
||||||
|
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
|
||||||
|
#endif
|
||||||
|
#ifndef __ALIGNED
|
||||||
|
#define __ALIGNED(x) __attribute__((aligned(x)))
|
||||||
|
#endif
|
||||||
|
#ifndef __RESTRICT
|
||||||
|
#define __RESTRICT __restrict
|
||||||
|
#endif
|
||||||
|
#ifndef __COMPILER_BARRIER
|
||||||
|
#warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
|
||||||
|
#define __COMPILER_BARRIER() (void)0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TASKING Compiler
|
||||||
|
*/
|
||||||
|
#elif defined ( __TASKING__ )
|
||||||
|
/*
|
||||||
|
* The CMSIS functions have been implemented as intrinsics in the compiler.
|
||||||
|
* Please use "carm -?i" to get an up to date list of all intrinsics,
|
||||||
|
* Including the CMSIS ones.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ASM
|
||||||
|
#define __ASM __asm
|
||||||
|
#endif
|
||||||
|
#ifndef __INLINE
|
||||||
|
#define __INLINE inline
|
||||||
|
#endif
|
||||||
|
#ifndef __STATIC_INLINE
|
||||||
|
#define __STATIC_INLINE static inline
|
||||||
|
#endif
|
||||||
|
#ifndef __STATIC_FORCEINLINE
|
||||||
|
#define __STATIC_FORCEINLINE __STATIC_INLINE
|
||||||
|
#endif
|
||||||
|
#ifndef __NO_RETURN
|
||||||
|
#define __NO_RETURN __attribute__((noreturn))
|
||||||
|
#endif
|
||||||
|
#ifndef __USED
|
||||||
|
#define __USED __attribute__((used))
|
||||||
|
#endif
|
||||||
|
#ifndef __WEAK
|
||||||
|
#define __WEAK __attribute__((weak))
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED
|
||||||
|
#define __PACKED __packed__
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED_STRUCT
|
||||||
|
#define __PACKED_STRUCT struct __packed__
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED_UNION
|
||||||
|
#define __PACKED_UNION union __packed__
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32 /* deprecated */
|
||||||
|
struct __packed__ T_UINT32 { uint32_t v; };
|
||||||
|
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT16_WRITE
|
||||||
|
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
|
||||||
|
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT16_READ
|
||||||
|
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
|
||||||
|
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32_WRITE
|
||||||
|
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
|
||||||
|
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32_READ
|
||||||
|
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
|
||||||
|
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
|
||||||
|
#endif
|
||||||
|
#ifndef __ALIGNED
|
||||||
|
#define __ALIGNED(x) __align(x)
|
||||||
|
#endif
|
||||||
|
#ifndef __RESTRICT
|
||||||
|
#warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
|
||||||
|
#define __RESTRICT
|
||||||
|
#endif
|
||||||
|
#ifndef __COMPILER_BARRIER
|
||||||
|
#warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
|
||||||
|
#define __COMPILER_BARRIER() (void)0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COSMIC Compiler
|
||||||
|
*/
|
||||||
|
#elif defined ( __CSMC__ )
|
||||||
|
#include <cmsis_csm.h>
|
||||||
|
|
||||||
|
#ifndef __ASM
|
||||||
|
#define __ASM _asm
|
||||||
|
#endif
|
||||||
|
#ifndef __INLINE
|
||||||
|
#define __INLINE inline
|
||||||
|
#endif
|
||||||
|
#ifndef __STATIC_INLINE
|
||||||
|
#define __STATIC_INLINE static inline
|
||||||
|
#endif
|
||||||
|
#ifndef __STATIC_FORCEINLINE
|
||||||
|
#define __STATIC_FORCEINLINE __STATIC_INLINE
|
||||||
|
#endif
|
||||||
|
#ifndef __NO_RETURN
|
||||||
|
// NO RETURN is automatically detected hence no warning here
|
||||||
|
#define __NO_RETURN
|
||||||
|
#endif
|
||||||
|
#ifndef __USED
|
||||||
|
#warning No compiler specific solution for __USED. __USED is ignored.
|
||||||
|
#define __USED
|
||||||
|
#endif
|
||||||
|
#ifndef __WEAK
|
||||||
|
#define __WEAK __weak
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED
|
||||||
|
#define __PACKED @packed
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED_STRUCT
|
||||||
|
#define __PACKED_STRUCT @packed struct
|
||||||
|
#endif
|
||||||
|
#ifndef __PACKED_UNION
|
||||||
|
#define __PACKED_UNION @packed union
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32 /* deprecated */
|
||||||
|
@packed struct T_UINT32 { uint32_t v; };
|
||||||
|
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT16_WRITE
|
||||||
|
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
|
||||||
|
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT16_READ
|
||||||
|
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
|
||||||
|
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32_WRITE
|
||||||
|
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
|
||||||
|
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
|
||||||
|
#endif
|
||||||
|
#ifndef __UNALIGNED_UINT32_READ
|
||||||
|
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
|
||||||
|
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
|
||||||
|
#endif
|
||||||
|
#ifndef __ALIGNED
|
||||||
|
#warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
|
||||||
|
#define __ALIGNED(x)
|
||||||
|
#endif
|
||||||
|
#ifndef __RESTRICT
|
||||||
|
#warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
|
||||||
|
#define __RESTRICT
|
||||||
|
#endif
|
||||||
|
#ifndef __COMPILER_BARRIER
|
||||||
|
#warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
|
||||||
|
#define __COMPILER_BARRIER() (void)0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error Unknown compiler.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __CMSIS_COMPILER_H */
|
||||||
|
|
2168
Drivers/CMSIS/Include/cmsis_gcc.h
Normal file
2168
Drivers/CMSIS/Include/cmsis_gcc.h
Normal file
File diff suppressed because it is too large
Load Diff
964
Drivers/CMSIS/Include/cmsis_iccarm.h
Normal file
964
Drivers/CMSIS/Include/cmsis_iccarm.h
Normal file
@ -0,0 +1,964 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* @file cmsis_iccarm.h
|
||||||
|
* @brief CMSIS compiler ICCARM (IAR Compiler for Arm) header file
|
||||||
|
* @version V5.1.0
|
||||||
|
* @date 08. May 2019
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Copyright (c) 2017-2019 IAR Systems
|
||||||
|
// Copyright (c) 2017-2019 Arm Limited. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License")
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __CMSIS_ICCARM_H__
|
||||||
|
#define __CMSIS_ICCARM_H__
|
||||||
|
|
||||||
|
#ifndef __ICCARM__
|
||||||
|
#error This file should only be compiled by ICCARM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma system_include
|
||||||
|
|
||||||
|
#define __IAR_FT _Pragma("inline=forced") __intrinsic
|
||||||
|
|
||||||
|
#if (__VER__ >= 8000000)
|
||||||
|
#define __ICCARM_V8 1
|
||||||
|
#else
|
||||||
|
#define __ICCARM_V8 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __ALIGNED
|
||||||
|
#if __ICCARM_V8
|
||||||
|
#define __ALIGNED(x) __attribute__((aligned(x)))
|
||||||
|
#elif (__VER__ >= 7080000)
|
||||||
|
/* Needs IAR language extensions */
|
||||||
|
#define __ALIGNED(x) __attribute__((aligned(x)))
|
||||||
|
#else
|
||||||
|
#warning No compiler specific solution for __ALIGNED.__ALIGNED is ignored.
|
||||||
|
#define __ALIGNED(x)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Define compiler macros for CPU architecture, used in CMSIS 5.
|
||||||
|
*/
|
||||||
|
#if __ARM_ARCH_6M__ || __ARM_ARCH_7M__ || __ARM_ARCH_7EM__ || __ARM_ARCH_8M_BASE__ || __ARM_ARCH_8M_MAIN__
|
||||||
|
/* Macros already defined */
|
||||||
|
#else
|
||||||
|
#if defined(__ARM8M_MAINLINE__) || defined(__ARM8EM_MAINLINE__)
|
||||||
|
#define __ARM_ARCH_8M_MAIN__ 1
|
||||||
|
#elif defined(__ARM8M_BASELINE__)
|
||||||
|
#define __ARM_ARCH_8M_BASE__ 1
|
||||||
|
#elif defined(__ARM_ARCH_PROFILE) && __ARM_ARCH_PROFILE == 'M'
|
||||||
|
#if __ARM_ARCH == 6
|
||||||
|
#define __ARM_ARCH_6M__ 1
|
||||||
|
#elif __ARM_ARCH == 7
|
||||||
|
#if __ARM_FEATURE_DSP
|
||||||
|
#define __ARM_ARCH_7EM__ 1
|
||||||
|
#else
|
||||||
|
#define __ARM_ARCH_7M__ 1
|
||||||
|
#endif
|
||||||
|
#endif /* __ARM_ARCH */
|
||||||
|
#endif /* __ARM_ARCH_PROFILE == 'M' */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Alternativ core deduction for older ICCARM's */
|
||||||
|
#if !defined(__ARM_ARCH_6M__) && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__) && \
|
||||||
|
!defined(__ARM_ARCH_8M_BASE__) && !defined(__ARM_ARCH_8M_MAIN__)
|
||||||
|
#if defined(__ARM6M__) && (__CORE__ == __ARM6M__)
|
||||||
|
#define __ARM_ARCH_6M__ 1
|
||||||
|
#elif defined(__ARM7M__) && (__CORE__ == __ARM7M__)
|
||||||
|
#define __ARM_ARCH_7M__ 1
|
||||||
|
#elif defined(__ARM7EM__) && (__CORE__ == __ARM7EM__)
|
||||||
|
#define __ARM_ARCH_7EM__ 1
|
||||||
|
#elif defined(__ARM8M_BASELINE__) && (__CORE == __ARM8M_BASELINE__)
|
||||||
|
#define __ARM_ARCH_8M_BASE__ 1
|
||||||
|
#elif defined(__ARM8M_MAINLINE__) && (__CORE == __ARM8M_MAINLINE__)
|
||||||
|
#define __ARM_ARCH_8M_MAIN__ 1
|
||||||
|
#elif defined(__ARM8EM_MAINLINE__) && (__CORE == __ARM8EM_MAINLINE__)
|
||||||
|
#define __ARM_ARCH_8M_MAIN__ 1
|
||||||
|
#else
|
||||||
|
#error "Unknown target."
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__ARM_ARCH_6M__) && __ARM_ARCH_6M__==1
|
||||||
|
#define __IAR_M0_FAMILY 1
|
||||||
|
#elif defined(__ARM_ARCH_8M_BASE__) && __ARM_ARCH_8M_BASE__==1
|
||||||
|
#define __IAR_M0_FAMILY 1
|
||||||
|
#else
|
||||||
|
#define __IAR_M0_FAMILY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __ASM
|
||||||
|
#define __ASM __asm
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __COMPILER_BARRIER
|
||||||
|
#define __COMPILER_BARRIER() __ASM volatile("":::"memory")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __INLINE
|
||||||
|
#define __INLINE inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __NO_RETURN
|
||||||
|
#if __ICCARM_V8
|
||||||
|
#define __NO_RETURN __attribute__((__noreturn__))
|
||||||
|
#else
|
||||||
|
#define __NO_RETURN _Pragma("object_attribute=__noreturn")
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PACKED
|
||||||
|
#if __ICCARM_V8
|
||||||
|
#define __PACKED __attribute__((packed, aligned(1)))
|
||||||
|
#else
|
||||||
|
/* Needs IAR language extensions */
|
||||||
|
#define __PACKED __packed
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PACKED_STRUCT
|
||||||
|
#if __ICCARM_V8
|
||||||
|
#define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
|
||||||
|
#else
|
||||||
|
/* Needs IAR language extensions */
|
||||||
|
#define __PACKED_STRUCT __packed struct
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PACKED_UNION
|
||||||
|
#if __ICCARM_V8
|
||||||
|
#define __PACKED_UNION union __attribute__((packed, aligned(1)))
|
||||||
|
#else
|
||||||
|
/* Needs IAR language extensions */
|
||||||
|
#define __PACKED_UNION __packed union
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __RESTRICT
|
||||||
|
#if __ICCARM_V8
|
||||||
|
#define __RESTRICT __restrict
|
||||||
|
#else
|
||||||
|
/* Needs IAR language extensions */
|
||||||
|
#define __RESTRICT restrict
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __STATIC_INLINE
|
||||||
|
#define __STATIC_INLINE static inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __FORCEINLINE
|
||||||
|
#define __FORCEINLINE _Pragma("inline=forced")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __STATIC_FORCEINLINE
|
||||||
|
#define __STATIC_FORCEINLINE __FORCEINLINE __STATIC_INLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __UNALIGNED_UINT16_READ
|
||||||
|
#pragma language=save
|
||||||
|
#pragma language=extended
|
||||||
|
__IAR_FT uint16_t __iar_uint16_read(void const *ptr)
|
||||||
|
{
|
||||||
|
return *(__packed uint16_t*)(ptr);
|
||||||
|
}
|
||||||
|
#pragma language=restore
|
||||||
|
#define __UNALIGNED_UINT16_READ(PTR) __iar_uint16_read(PTR)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __UNALIGNED_UINT16_WRITE
|
||||||
|
#pragma language=save
|
||||||
|
#pragma language=extended
|
||||||
|
__IAR_FT void __iar_uint16_write(void const *ptr, uint16_t val)
|
||||||
|
{
|
||||||
|
*(__packed uint16_t*)(ptr) = val;;
|
||||||
|
}
|
||||||
|
#pragma language=restore
|
||||||
|
#define __UNALIGNED_UINT16_WRITE(PTR,VAL) __iar_uint16_write(PTR,VAL)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __UNALIGNED_UINT32_READ
|
||||||
|
#pragma language=save
|
||||||
|
#pragma language=extended
|
||||||
|
__IAR_FT uint32_t __iar_uint32_read(void const *ptr)
|
||||||
|
{
|
||||||
|
return *(__packed uint32_t*)(ptr);
|
||||||
|
}
|
||||||
|
#pragma language=restore
|
||||||
|
#define __UNALIGNED_UINT32_READ(PTR) __iar_uint32_read(PTR)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __UNALIGNED_UINT32_WRITE
|
||||||
|
#pragma language=save
|
||||||
|
#pragma language=extended
|
||||||
|
__IAR_FT void __iar_uint32_write(void const *ptr, uint32_t val)
|
||||||
|
{
|
||||||
|
*(__packed uint32_t*)(ptr) = val;;
|
||||||
|
}
|
||||||
|
#pragma language=restore
|
||||||
|
#define __UNALIGNED_UINT32_WRITE(PTR,VAL) __iar_uint32_write(PTR,VAL)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __UNALIGNED_UINT32 /* deprecated */
|
||||||
|
#pragma language=save
|
||||||
|
#pragma language=extended
|
||||||
|
__packed struct __iar_u32 { uint32_t v; };
|
||||||
|
#pragma language=restore
|
||||||
|
#define __UNALIGNED_UINT32(PTR) (((struct __iar_u32 *)(PTR))->v)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __USED
|
||||||
|
#if __ICCARM_V8
|
||||||
|
#define __USED __attribute__((used))
|
||||||
|
#else
|
||||||
|
#define __USED _Pragma("__root")
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __WEAK
|
||||||
|
#if __ICCARM_V8
|
||||||
|
#define __WEAK __attribute__((weak))
|
||||||
|
#else
|
||||||
|
#define __WEAK _Pragma("__weak")
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PROGRAM_START
|
||||||
|
#define __PROGRAM_START __iar_program_start
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __INITIAL_SP
|
||||||
|
#define __INITIAL_SP CSTACK$$Limit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __STACK_LIMIT
|
||||||
|
#define __STACK_LIMIT CSTACK$$Base
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VECTOR_TABLE
|
||||||
|
#define __VECTOR_TABLE __vector_table
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VECTOR_TABLE_ATTRIBUTE
|
||||||
|
#define __VECTOR_TABLE_ATTRIBUTE @".intvec"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __ICCARM_INTRINSICS_VERSION__
|
||||||
|
#define __ICCARM_INTRINSICS_VERSION__ 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __ICCARM_INTRINSICS_VERSION__ == 2
|
||||||
|
|
||||||
|
#if defined(__CLZ)
|
||||||
|
#undef __CLZ
|
||||||
|
#endif
|
||||||
|
#if defined(__REVSH)
|
||||||
|
#undef __REVSH
|
||||||
|
#endif
|
||||||
|
#if defined(__RBIT)
|
||||||
|
#undef __RBIT
|
||||||
|
#endif
|
||||||
|
#if defined(__SSAT)
|
||||||
|
#undef __SSAT
|
||||||
|
#endif
|
||||||
|
#if defined(__USAT)
|
||||||
|
#undef __USAT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "iccarm_builtin.h"
|
||||||
|
|
||||||
|
#define __disable_fault_irq __iar_builtin_disable_fiq
|
||||||
|
#define __disable_irq __iar_builtin_disable_interrupt
|
||||||
|
#define __enable_fault_irq __iar_builtin_enable_fiq
|
||||||
|
#define __enable_irq __iar_builtin_enable_interrupt
|
||||||
|
#define __arm_rsr __iar_builtin_rsr
|
||||||
|
#define __arm_wsr __iar_builtin_wsr
|
||||||
|
|
||||||
|
|
||||||
|
#define __get_APSR() (__arm_rsr("APSR"))
|
||||||
|
#define __get_BASEPRI() (__arm_rsr("BASEPRI"))
|
||||||
|
#define __get_CONTROL() (__arm_rsr("CONTROL"))
|
||||||
|
#define __get_FAULTMASK() (__arm_rsr("FAULTMASK"))
|
||||||
|
|
||||||
|
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||||
|
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
|
||||||
|
#define __get_FPSCR() (__arm_rsr("FPSCR"))
|
||||||
|
#define __set_FPSCR(VALUE) (__arm_wsr("FPSCR", (VALUE)))
|
||||||
|
#else
|
||||||
|
#define __get_FPSCR() ( 0 )
|
||||||
|
#define __set_FPSCR(VALUE) ((void)VALUE)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __get_IPSR() (__arm_rsr("IPSR"))
|
||||||
|
#define __get_MSP() (__arm_rsr("MSP"))
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure MSPLIM is RAZ/WI
|
||||||
|
#define __get_MSPLIM() (0U)
|
||||||
|
#else
|
||||||
|
#define __get_MSPLIM() (__arm_rsr("MSPLIM"))
|
||||||
|
#endif
|
||||||
|
#define __get_PRIMASK() (__arm_rsr("PRIMASK"))
|
||||||
|
#define __get_PSP() (__arm_rsr("PSP"))
|
||||||
|
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure PSPLIM is RAZ/WI
|
||||||
|
#define __get_PSPLIM() (0U)
|
||||||
|
#else
|
||||||
|
#define __get_PSPLIM() (__arm_rsr("PSPLIM"))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __get_xPSR() (__arm_rsr("xPSR"))
|
||||||
|
|
||||||
|
#define __set_BASEPRI(VALUE) (__arm_wsr("BASEPRI", (VALUE)))
|
||||||
|
#define __set_BASEPRI_MAX(VALUE) (__arm_wsr("BASEPRI_MAX", (VALUE)))
|
||||||
|
#define __set_CONTROL(VALUE) (__arm_wsr("CONTROL", (VALUE)))
|
||||||
|
#define __set_FAULTMASK(VALUE) (__arm_wsr("FAULTMASK", (VALUE)))
|
||||||
|
#define __set_MSP(VALUE) (__arm_wsr("MSP", (VALUE)))
|
||||||
|
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure MSPLIM is RAZ/WI
|
||||||
|
#define __set_MSPLIM(VALUE) ((void)(VALUE))
|
||||||
|
#else
|
||||||
|
#define __set_MSPLIM(VALUE) (__arm_wsr("MSPLIM", (VALUE)))
|
||||||
|
#endif
|
||||||
|
#define __set_PRIMASK(VALUE) (__arm_wsr("PRIMASK", (VALUE)))
|
||||||
|
#define __set_PSP(VALUE) (__arm_wsr("PSP", (VALUE)))
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure PSPLIM is RAZ/WI
|
||||||
|
#define __set_PSPLIM(VALUE) ((void)(VALUE))
|
||||||
|
#else
|
||||||
|
#define __set_PSPLIM(VALUE) (__arm_wsr("PSPLIM", (VALUE)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __TZ_get_CONTROL_NS() (__arm_rsr("CONTROL_NS"))
|
||||||
|
#define __TZ_set_CONTROL_NS(VALUE) (__arm_wsr("CONTROL_NS", (VALUE)))
|
||||||
|
#define __TZ_get_PSP_NS() (__arm_rsr("PSP_NS"))
|
||||||
|
#define __TZ_set_PSP_NS(VALUE) (__arm_wsr("PSP_NS", (VALUE)))
|
||||||
|
#define __TZ_get_MSP_NS() (__arm_rsr("MSP_NS"))
|
||||||
|
#define __TZ_set_MSP_NS(VALUE) (__arm_wsr("MSP_NS", (VALUE)))
|
||||||
|
#define __TZ_get_SP_NS() (__arm_rsr("SP_NS"))
|
||||||
|
#define __TZ_set_SP_NS(VALUE) (__arm_wsr("SP_NS", (VALUE)))
|
||||||
|
#define __TZ_get_PRIMASK_NS() (__arm_rsr("PRIMASK_NS"))
|
||||||
|
#define __TZ_set_PRIMASK_NS(VALUE) (__arm_wsr("PRIMASK_NS", (VALUE)))
|
||||||
|
#define __TZ_get_BASEPRI_NS() (__arm_rsr("BASEPRI_NS"))
|
||||||
|
#define __TZ_set_BASEPRI_NS(VALUE) (__arm_wsr("BASEPRI_NS", (VALUE)))
|
||||||
|
#define __TZ_get_FAULTMASK_NS() (__arm_rsr("FAULTMASK_NS"))
|
||||||
|
#define __TZ_set_FAULTMASK_NS(VALUE)(__arm_wsr("FAULTMASK_NS", (VALUE)))
|
||||||
|
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure PSPLIM is RAZ/WI
|
||||||
|
#define __TZ_get_PSPLIM_NS() (0U)
|
||||||
|
#define __TZ_set_PSPLIM_NS(VALUE) ((void)(VALUE))
|
||||||
|
#else
|
||||||
|
#define __TZ_get_PSPLIM_NS() (__arm_rsr("PSPLIM_NS"))
|
||||||
|
#define __TZ_set_PSPLIM_NS(VALUE) (__arm_wsr("PSPLIM_NS", (VALUE)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __TZ_get_MSPLIM_NS() (__arm_rsr("MSPLIM_NS"))
|
||||||
|
#define __TZ_set_MSPLIM_NS(VALUE) (__arm_wsr("MSPLIM_NS", (VALUE)))
|
||||||
|
|
||||||
|
#define __NOP __iar_builtin_no_operation
|
||||||
|
|
||||||
|
#define __CLZ __iar_builtin_CLZ
|
||||||
|
#define __CLREX __iar_builtin_CLREX
|
||||||
|
|
||||||
|
#define __DMB __iar_builtin_DMB
|
||||||
|
#define __DSB __iar_builtin_DSB
|
||||||
|
#define __ISB __iar_builtin_ISB
|
||||||
|
|
||||||
|
#define __LDREXB __iar_builtin_LDREXB
|
||||||
|
#define __LDREXH __iar_builtin_LDREXH
|
||||||
|
#define __LDREXW __iar_builtin_LDREX
|
||||||
|
|
||||||
|
#define __RBIT __iar_builtin_RBIT
|
||||||
|
#define __REV __iar_builtin_REV
|
||||||
|
#define __REV16 __iar_builtin_REV16
|
||||||
|
|
||||||
|
__IAR_FT int16_t __REVSH(int16_t val)
|
||||||
|
{
|
||||||
|
return (int16_t) __iar_builtin_REVSH(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define __ROR __iar_builtin_ROR
|
||||||
|
#define __RRX __iar_builtin_RRX
|
||||||
|
|
||||||
|
#define __SEV __iar_builtin_SEV
|
||||||
|
|
||||||
|
#if !__IAR_M0_FAMILY
|
||||||
|
#define __SSAT __iar_builtin_SSAT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __STREXB __iar_builtin_STREXB
|
||||||
|
#define __STREXH __iar_builtin_STREXH
|
||||||
|
#define __STREXW __iar_builtin_STREX
|
||||||
|
|
||||||
|
#if !__IAR_M0_FAMILY
|
||||||
|
#define __USAT __iar_builtin_USAT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __WFE __iar_builtin_WFE
|
||||||
|
#define __WFI __iar_builtin_WFI
|
||||||
|
|
||||||
|
#if __ARM_MEDIA__
|
||||||
|
#define __SADD8 __iar_builtin_SADD8
|
||||||
|
#define __QADD8 __iar_builtin_QADD8
|
||||||
|
#define __SHADD8 __iar_builtin_SHADD8
|
||||||
|
#define __UADD8 __iar_builtin_UADD8
|
||||||
|
#define __UQADD8 __iar_builtin_UQADD8
|
||||||
|
#define __UHADD8 __iar_builtin_UHADD8
|
||||||
|
#define __SSUB8 __iar_builtin_SSUB8
|
||||||
|
#define __QSUB8 __iar_builtin_QSUB8
|
||||||
|
#define __SHSUB8 __iar_builtin_SHSUB8
|
||||||
|
#define __USUB8 __iar_builtin_USUB8
|
||||||
|
#define __UQSUB8 __iar_builtin_UQSUB8
|
||||||
|
#define __UHSUB8 __iar_builtin_UHSUB8
|
||||||
|
#define __SADD16 __iar_builtin_SADD16
|
||||||
|
#define __QADD16 __iar_builtin_QADD16
|
||||||
|
#define __SHADD16 __iar_builtin_SHADD16
|
||||||
|
#define __UADD16 __iar_builtin_UADD16
|
||||||
|
#define __UQADD16 __iar_builtin_UQADD16
|
||||||
|
#define __UHADD16 __iar_builtin_UHADD16
|
||||||
|
#define __SSUB16 __iar_builtin_SSUB16
|
||||||
|
#define __QSUB16 __iar_builtin_QSUB16
|
||||||
|
#define __SHSUB16 __iar_builtin_SHSUB16
|
||||||
|
#define __USUB16 __iar_builtin_USUB16
|
||||||
|
#define __UQSUB16 __iar_builtin_UQSUB16
|
||||||
|
#define __UHSUB16 __iar_builtin_UHSUB16
|
||||||
|
#define __SASX __iar_builtin_SASX
|
||||||
|
#define __QASX __iar_builtin_QASX
|
||||||
|
#define __SHASX __iar_builtin_SHASX
|
||||||
|
#define __UASX __iar_builtin_UASX
|
||||||
|
#define __UQASX __iar_builtin_UQASX
|
||||||
|
#define __UHASX __iar_builtin_UHASX
|
||||||
|
#define __SSAX __iar_builtin_SSAX
|
||||||
|
#define __QSAX __iar_builtin_QSAX
|
||||||
|
#define __SHSAX __iar_builtin_SHSAX
|
||||||
|
#define __USAX __iar_builtin_USAX
|
||||||
|
#define __UQSAX __iar_builtin_UQSAX
|
||||||
|
#define __UHSAX __iar_builtin_UHSAX
|
||||||
|
#define __USAD8 __iar_builtin_USAD8
|
||||||
|
#define __USADA8 __iar_builtin_USADA8
|
||||||
|
#define __SSAT16 __iar_builtin_SSAT16
|
||||||
|
#define __USAT16 __iar_builtin_USAT16
|
||||||
|
#define __UXTB16 __iar_builtin_UXTB16
|
||||||
|
#define __UXTAB16 __iar_builtin_UXTAB16
|
||||||
|
#define __SXTB16 __iar_builtin_SXTB16
|
||||||
|
#define __SXTAB16 __iar_builtin_SXTAB16
|
||||||
|
#define __SMUAD __iar_builtin_SMUAD
|
||||||
|
#define __SMUADX __iar_builtin_SMUADX
|
||||||
|
#define __SMMLA __iar_builtin_SMMLA
|
||||||
|
#define __SMLAD __iar_builtin_SMLAD
|
||||||
|
#define __SMLADX __iar_builtin_SMLADX
|
||||||
|
#define __SMLALD __iar_builtin_SMLALD
|
||||||
|
#define __SMLALDX __iar_builtin_SMLALDX
|
||||||
|
#define __SMUSD __iar_builtin_SMUSD
|
||||||
|
#define __SMUSDX __iar_builtin_SMUSDX
|
||||||
|
#define __SMLSD __iar_builtin_SMLSD
|
||||||
|
#define __SMLSDX __iar_builtin_SMLSDX
|
||||||
|
#define __SMLSLD __iar_builtin_SMLSLD
|
||||||
|
#define __SMLSLDX __iar_builtin_SMLSLDX
|
||||||
|
#define __SEL __iar_builtin_SEL
|
||||||
|
#define __QADD __iar_builtin_QADD
|
||||||
|
#define __QSUB __iar_builtin_QSUB
|
||||||
|
#define __PKHBT __iar_builtin_PKHBT
|
||||||
|
#define __PKHTB __iar_builtin_PKHTB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* __ICCARM_INTRINSICS_VERSION__ == 2 */
|
||||||
|
|
||||||
|
#if __IAR_M0_FAMILY
|
||||||
|
/* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */
|
||||||
|
#define __CLZ __cmsis_iar_clz_not_active
|
||||||
|
#define __SSAT __cmsis_iar_ssat_not_active
|
||||||
|
#define __USAT __cmsis_iar_usat_not_active
|
||||||
|
#define __RBIT __cmsis_iar_rbit_not_active
|
||||||
|
#define __get_APSR __cmsis_iar_get_APSR_not_active
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||||
|
(defined (__FPU_USED ) && (__FPU_USED == 1U)) ))
|
||||||
|
#define __get_FPSCR __cmsis_iar_get_FPSR_not_active
|
||||||
|
#define __set_FPSCR __cmsis_iar_set_FPSR_not_active
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __INTRINSICS_INCLUDED
|
||||||
|
#error intrinsics.h is already included previously!
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <intrinsics.h>
|
||||||
|
|
||||||
|
#if __IAR_M0_FAMILY
|
||||||
|
/* Avoid clash between intrinsics.h and arm_math.h when compiling for Cortex-M0. */
|
||||||
|
#undef __CLZ
|
||||||
|
#undef __SSAT
|
||||||
|
#undef __USAT
|
||||||
|
#undef __RBIT
|
||||||
|
#undef __get_APSR
|
||||||
|
|
||||||
|
__STATIC_INLINE uint8_t __CLZ(uint32_t data)
|
||||||
|
{
|
||||||
|
if (data == 0U) { return 32U; }
|
||||||
|
|
||||||
|
uint32_t count = 0U;
|
||||||
|
uint32_t mask = 0x80000000U;
|
||||||
|
|
||||||
|
while ((data & mask) == 0U)
|
||||||
|
{
|
||||||
|
count += 1U;
|
||||||
|
mask = mask >> 1U;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
__STATIC_INLINE uint32_t __RBIT(uint32_t v)
|
||||||
|
{
|
||||||
|
uint8_t sc = 31U;
|
||||||
|
uint32_t r = v;
|
||||||
|
for (v >>= 1U; v; v >>= 1U)
|
||||||
|
{
|
||||||
|
r <<= 1U;
|
||||||
|
r |= v & 1U;
|
||||||
|
sc--;
|
||||||
|
}
|
||||||
|
return (r << sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
__STATIC_INLINE uint32_t __get_APSR(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__asm("MRS %0,APSR" : "=r" (res));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (!((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||||
|
(defined (__FPU_USED ) && (__FPU_USED == 1U)) ))
|
||||||
|
#undef __get_FPSCR
|
||||||
|
#undef __set_FPSCR
|
||||||
|
#define __get_FPSCR() (0)
|
||||||
|
#define __set_FPSCR(VALUE) ((void)VALUE)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma diag_suppress=Pe940
|
||||||
|
#pragma diag_suppress=Pe177
|
||||||
|
|
||||||
|
#define __enable_irq __enable_interrupt
|
||||||
|
#define __disable_irq __disable_interrupt
|
||||||
|
#define __NOP __no_operation
|
||||||
|
|
||||||
|
#define __get_xPSR __get_PSR
|
||||||
|
|
||||||
|
#if (!defined(__ARM_ARCH_6M__) || __ARM_ARCH_6M__==0)
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __LDREXW(uint32_t volatile *ptr)
|
||||||
|
{
|
||||||
|
return __LDREX((unsigned long *)ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __STREXW(uint32_t value, uint32_t volatile *ptr)
|
||||||
|
{
|
||||||
|
return __STREX(value, (unsigned long *)ptr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */
|
||||||
|
#if (__CORTEX_M >= 0x03)
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __RRX(uint32_t value)
|
||||||
|
{
|
||||||
|
uint32_t result;
|
||||||
|
__ASM("RRX %0, %1" : "=r"(result) : "r" (value) : "cc");
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __set_BASEPRI_MAX(uint32_t value)
|
||||||
|
{
|
||||||
|
__asm volatile("MSR BASEPRI_MAX,%0"::"r" (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define __enable_fault_irq __enable_fiq
|
||||||
|
#define __disable_fault_irq __disable_fiq
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* (__CORTEX_M >= 0x03) */
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __ROR(uint32_t op1, uint32_t op2)
|
||||||
|
{
|
||||||
|
return (op1 >> op2) | (op1 << ((sizeof(op1)*8)-op2));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
|
||||||
|
(defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __get_MSPLIM(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure MSPLIM is RAZ/WI
|
||||||
|
res = 0U;
|
||||||
|
#else
|
||||||
|
__asm volatile("MRS %0,MSPLIM" : "=r" (res));
|
||||||
|
#endif
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __set_MSPLIM(uint32_t value)
|
||||||
|
{
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure MSPLIM is RAZ/WI
|
||||||
|
(void)value;
|
||||||
|
#else
|
||||||
|
__asm volatile("MSR MSPLIM,%0" :: "r" (value));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __get_PSPLIM(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure PSPLIM is RAZ/WI
|
||||||
|
res = 0U;
|
||||||
|
#else
|
||||||
|
__asm volatile("MRS %0,PSPLIM" : "=r" (res));
|
||||||
|
#endif
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __set_PSPLIM(uint32_t value)
|
||||||
|
{
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure PSPLIM is RAZ/WI
|
||||||
|
(void)value;
|
||||||
|
#else
|
||||||
|
__asm volatile("MSR PSPLIM,%0" :: "r" (value));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __TZ_get_CONTROL_NS(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__asm volatile("MRS %0,CONTROL_NS" : "=r" (res));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __TZ_set_CONTROL_NS(uint32_t value)
|
||||||
|
{
|
||||||
|
__asm volatile("MSR CONTROL_NS,%0" :: "r" (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __TZ_get_PSP_NS(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__asm volatile("MRS %0,PSP_NS" : "=r" (res));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __TZ_set_PSP_NS(uint32_t value)
|
||||||
|
{
|
||||||
|
__asm volatile("MSR PSP_NS,%0" :: "r" (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __TZ_get_MSP_NS(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__asm volatile("MRS %0,MSP_NS" : "=r" (res));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __TZ_set_MSP_NS(uint32_t value)
|
||||||
|
{
|
||||||
|
__asm volatile("MSR MSP_NS,%0" :: "r" (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __TZ_get_SP_NS(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__asm volatile("MRS %0,SP_NS" : "=r" (res));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
__IAR_FT void __TZ_set_SP_NS(uint32_t value)
|
||||||
|
{
|
||||||
|
__asm volatile("MSR SP_NS,%0" :: "r" (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __TZ_get_PRIMASK_NS(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__asm volatile("MRS %0,PRIMASK_NS" : "=r" (res));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __TZ_set_PRIMASK_NS(uint32_t value)
|
||||||
|
{
|
||||||
|
__asm volatile("MSR PRIMASK_NS,%0" :: "r" (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __TZ_get_BASEPRI_NS(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__asm volatile("MRS %0,BASEPRI_NS" : "=r" (res));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __TZ_set_BASEPRI_NS(uint32_t value)
|
||||||
|
{
|
||||||
|
__asm volatile("MSR BASEPRI_NS,%0" :: "r" (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __TZ_get_FAULTMASK_NS(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__asm volatile("MRS %0,FAULTMASK_NS" : "=r" (res));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __TZ_set_FAULTMASK_NS(uint32_t value)
|
||||||
|
{
|
||||||
|
__asm volatile("MSR FAULTMASK_NS,%0" :: "r" (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __TZ_get_PSPLIM_NS(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure PSPLIM is RAZ/WI
|
||||||
|
res = 0U;
|
||||||
|
#else
|
||||||
|
__asm volatile("MRS %0,PSPLIM_NS" : "=r" (res));
|
||||||
|
#endif
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __TZ_set_PSPLIM_NS(uint32_t value)
|
||||||
|
{
|
||||||
|
#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \
|
||||||
|
(!defined (__ARM_FEATURE_CMSE ) || (__ARM_FEATURE_CMSE < 3)))
|
||||||
|
// without main extensions, the non-secure PSPLIM is RAZ/WI
|
||||||
|
(void)value;
|
||||||
|
#else
|
||||||
|
__asm volatile("MSR PSPLIM_NS,%0" :: "r" (value));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __TZ_get_MSPLIM_NS(void)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__asm volatile("MRS %0,MSPLIM_NS" : "=r" (res));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __TZ_set_MSPLIM_NS(uint32_t value)
|
||||||
|
{
|
||||||
|
__asm volatile("MSR MSPLIM_NS,%0" :: "r" (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __ARM_ARCH_8M_MAIN__ or __ARM_ARCH_8M_BASE__ */
|
||||||
|
|
||||||
|
#endif /* __ICCARM_INTRINSICS_VERSION__ == 2 */
|
||||||
|
|
||||||
|
#define __BKPT(value) __asm volatile ("BKPT %0" : : "i"(value))
|
||||||
|
|
||||||
|
#if __IAR_M0_FAMILY
|
||||||
|
__STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat)
|
||||||
|
{
|
||||||
|
if ((sat >= 1U) && (sat <= 32U))
|
||||||
|
{
|
||||||
|
const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
|
||||||
|
const int32_t min = -1 - max ;
|
||||||
|
if (val > max)
|
||||||
|
{
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
else if (val < min)
|
||||||
|
{
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
__STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat)
|
||||||
|
{
|
||||||
|
if (sat <= 31U)
|
||||||
|
{
|
||||||
|
const uint32_t max = ((1U << sat) - 1U);
|
||||||
|
if (val > (int32_t)max)
|
||||||
|
{
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
else if (val < 0)
|
||||||
|
{
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (uint32_t)val;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (__CORTEX_M >= 0x03) /* __CORTEX_M is defined in core_cm0.h, core_cm3.h and core_cm4.h. */
|
||||||
|
|
||||||
|
__IAR_FT uint8_t __LDRBT(volatile uint8_t *addr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM("LDRBT %0, [%1]" : "=r" (res) : "r" (addr) : "memory");
|
||||||
|
return ((uint8_t)res);
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint16_t __LDRHT(volatile uint16_t *addr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM("LDRHT %0, [%1]" : "=r" (res) : "r" (addr) : "memory");
|
||||||
|
return ((uint16_t)res);
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __LDRT(volatile uint32_t *addr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM("LDRT %0, [%1]" : "=r" (res) : "r" (addr) : "memory");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __STRBT(uint8_t value, volatile uint8_t *addr)
|
||||||
|
{
|
||||||
|
__ASM("STRBT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __STRHT(uint16_t value, volatile uint16_t *addr)
|
||||||
|
{
|
||||||
|
__ASM("STRHT %1, [%0]" : : "r" (addr), "r" ((uint32_t)value) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __STRT(uint32_t value, volatile uint32_t *addr)
|
||||||
|
{
|
||||||
|
__ASM("STRT %1, [%0]" : : "r" (addr), "r" (value) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* (__CORTEX_M >= 0x03) */
|
||||||
|
|
||||||
|
#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \
|
||||||
|
(defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) )
|
||||||
|
|
||||||
|
|
||||||
|
__IAR_FT uint8_t __LDAB(volatile uint8_t *ptr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM volatile ("LDAB %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
|
||||||
|
return ((uint8_t)res);
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint16_t __LDAH(volatile uint16_t *ptr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM volatile ("LDAH %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
|
||||||
|
return ((uint16_t)res);
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __LDA(volatile uint32_t *ptr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM volatile ("LDA %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __STLB(uint8_t value, volatile uint8_t *ptr)
|
||||||
|
{
|
||||||
|
__ASM volatile ("STLB %1, [%0]" :: "r" (ptr), "r" (value) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __STLH(uint16_t value, volatile uint16_t *ptr)
|
||||||
|
{
|
||||||
|
__ASM volatile ("STLH %1, [%0]" :: "r" (ptr), "r" (value) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT void __STL(uint32_t value, volatile uint32_t *ptr)
|
||||||
|
{
|
||||||
|
__ASM volatile ("STL %1, [%0]" :: "r" (ptr), "r" (value) : "memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint8_t __LDAEXB(volatile uint8_t *ptr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM volatile ("LDAEXB %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
|
||||||
|
return ((uint8_t)res);
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint16_t __LDAEXH(volatile uint16_t *ptr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM volatile ("LDAEXH %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
|
||||||
|
return ((uint16_t)res);
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __LDAEX(volatile uint32_t *ptr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM volatile ("LDAEX %0, [%1]" : "=r" (res) : "r" (ptr) : "memory");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM volatile ("STLEXB %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM volatile ("STLEXH %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
__IAR_FT uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr)
|
||||||
|
{
|
||||||
|
uint32_t res;
|
||||||
|
__ASM volatile ("STLEX %0, %2, [%1]" : "=r" (res) : "r" (ptr), "r" (value) : "memory");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __ARM_ARCH_8M_MAIN__ or __ARM_ARCH_8M_BASE__ */
|
||||||
|
|
||||||
|
#undef __IAR_FT
|
||||||
|
#undef __IAR_M0_FAMILY
|
||||||
|
#undef __ICCARM_V8
|
||||||
|
|
||||||
|
#pragma diag_default=Pe940
|
||||||
|
#pragma diag_default=Pe177
|
||||||
|
|
||||||
|
#endif /* __CMSIS_ICCARM_H__ */
|
39
Drivers/CMSIS/Include/cmsis_version.h
Normal file
39
Drivers/CMSIS/Include/cmsis_version.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* @file cmsis_version.h
|
||||||
|
* @brief CMSIS Core(M) Version definitions
|
||||||
|
* @version V5.0.3
|
||||||
|
* @date 24. June 2019
|
||||||
|
******************************************************************************/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2019 ARM Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined ( __ICCARM__ )
|
||||||
|
#pragma system_include /* treat file as system include file for MISRA check */
|
||||||
|
#elif defined (__clang__)
|
||||||
|
#pragma clang system_header /* treat file as system include file */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __CMSIS_VERSION_H
|
||||||
|
#define __CMSIS_VERSION_H
|
||||||
|
|
||||||
|
/* CMSIS Version definitions */
|
||||||
|
#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
|
||||||
|
#define __CM_CMSIS_VERSION_SUB ( 3U) /*!< [15:0] CMSIS Core(M) sub version */
|
||||||
|
#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
|
||||||
|
__CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
|
||||||
|
#endif
|
2968
Drivers/CMSIS/Include/core_armv81mml.h
Normal file
2968
Drivers/CMSIS/Include/core_armv81mml.h
Normal file
File diff suppressed because it is too large
Load Diff
1921
Drivers/CMSIS/Include/core_armv8mbl.h
Normal file
1921
Drivers/CMSIS/Include/core_armv8mbl.h
Normal file
File diff suppressed because it is too large
Load Diff
2835
Drivers/CMSIS/Include/core_armv8mml.h
Normal file
2835
Drivers/CMSIS/Include/core_armv8mml.h
Normal file
File diff suppressed because it is too large
Load Diff
952
Drivers/CMSIS/Include/core_cm0.h
Normal file
952
Drivers/CMSIS/Include/core_cm0.h
Normal file
@ -0,0 +1,952 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* @file core_cm0.h
|
||||||
|
* @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File
|
||||||
|
* @version V5.0.6
|
||||||
|
* @date 13. March 2019
|
||||||
|
******************************************************************************/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2019 Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined ( __ICCARM__ )
|
||||||
|
#pragma system_include /* treat file as system include file for MISRA check */
|
||||||
|
#elif defined (__clang__)
|
||||||
|
#pragma clang system_header /* treat file as system include file */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __CORE_CM0_H_GENERIC
|
||||||
|
#define __CORE_CM0_H_GENERIC
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
\page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
|
||||||
|
CMSIS violates the following MISRA-C:2004 rules:
|
||||||
|
|
||||||
|
\li Required Rule 8.5, object/function definition in header file.<br>
|
||||||
|
Function definitions in header files are used to allow 'inlining'.
|
||||||
|
|
||||||
|
\li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
|
||||||
|
Unions are used for effective representation of core registers.
|
||||||
|
|
||||||
|
\li Advisory Rule 19.7, Function-like macro defined.<br>
|
||||||
|
Function-like macros are used to allow more efficient code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* CMSIS definitions
|
||||||
|
******************************************************************************/
|
||||||
|
/**
|
||||||
|
\ingroup Cortex_M0
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cmsis_version.h"
|
||||||
|
|
||||||
|
/* CMSIS CM0 definitions */
|
||||||
|
#define __CM0_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
|
||||||
|
#define __CM0_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
|
||||||
|
#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16U) | \
|
||||||
|
__CM0_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
|
||||||
|
|
||||||
|
#define __CORTEX_M (0U) /*!< Cortex-M Core */
|
||||||
|
|
||||||
|
/** __FPU_USED indicates whether an FPU is used or not.
|
||||||
|
This core does not support an FPU at all
|
||||||
|
*/
|
||||||
|
#define __FPU_USED 0U
|
||||||
|
|
||||||
|
#if defined ( __CC_ARM )
|
||||||
|
#if defined __TARGET_FPU_VFP
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||||
|
#if defined __ARM_FP
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( __GNUC__ )
|
||||||
|
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( __ICCARM__ )
|
||||||
|
#if defined __ARMVFP__
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( __TI_ARM__ )
|
||||||
|
#if defined __TI_VFP_SUPPORT__
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( __TASKING__ )
|
||||||
|
#if defined __FPU_VFP__
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( __CSMC__ )
|
||||||
|
#if ( __CSMC__ & 0x400U)
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __CORE_CM0_H_GENERIC */
|
||||||
|
|
||||||
|
#ifndef __CMSIS_GENERIC
|
||||||
|
|
||||||
|
#ifndef __CORE_CM0_H_DEPENDANT
|
||||||
|
#define __CORE_CM0_H_DEPENDANT
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* check device defines and use defaults */
|
||||||
|
#if defined __CHECK_DEVICE_DEFINES
|
||||||
|
#ifndef __CM0_REV
|
||||||
|
#define __CM0_REV 0x0000U
|
||||||
|
#warning "__CM0_REV not defined in device header file; using default!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __NVIC_PRIO_BITS
|
||||||
|
#define __NVIC_PRIO_BITS 2U
|
||||||
|
#warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __Vendor_SysTickConfig
|
||||||
|
#define __Vendor_SysTickConfig 0U
|
||||||
|
#warning "__Vendor_SysTickConfig not defined in device header file; using default!"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* IO definitions (access restrictions to peripheral registers) */
|
||||||
|
/**
|
||||||
|
\defgroup CMSIS_glob_defs CMSIS Global Defines
|
||||||
|
|
||||||
|
<strong>IO Type Qualifiers</strong> are used
|
||||||
|
\li to specify the access to peripheral variables.
|
||||||
|
\li for automatic generation of peripheral register debug information.
|
||||||
|
*/
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define __I volatile /*!< Defines 'read only' permissions */
|
||||||
|
#else
|
||||||
|
#define __I volatile const /*!< Defines 'read only' permissions */
|
||||||
|
#endif
|
||||||
|
#define __O volatile /*!< Defines 'write only' permissions */
|
||||||
|
#define __IO volatile /*!< Defines 'read / write' permissions */
|
||||||
|
|
||||||
|
/* following defines should be used for structure members */
|
||||||
|
#define __IM volatile const /*! Defines 'read only' structure member permissions */
|
||||||
|
#define __OM volatile /*! Defines 'write only' structure member permissions */
|
||||||
|
#define __IOM volatile /*! Defines 'read / write' structure member permissions */
|
||||||
|
|
||||||
|
/*@} end of group Cortex_M0 */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Register Abstraction
|
||||||
|
Core Register contain:
|
||||||
|
- Core Register
|
||||||
|
- Core NVIC Register
|
||||||
|
- Core SCB Register
|
||||||
|
- Core SysTick Register
|
||||||
|
******************************************************************************/
|
||||||
|
/**
|
||||||
|
\defgroup CMSIS_core_register Defines and Type Definitions
|
||||||
|
\brief Type definitions and defines for Cortex-M processor based devices.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_CORE Status and Control Registers
|
||||||
|
\brief Core Register type definitions.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Union type to access the Application Program Status Register (APSR).
|
||||||
|
*/
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
|
||||||
|
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
||||||
|
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
||||||
|
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
||||||
|
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
||||||
|
} b; /*!< Structure used for bit access */
|
||||||
|
uint32_t w; /*!< Type used for word access */
|
||||||
|
} APSR_Type;
|
||||||
|
|
||||||
|
/* APSR Register Definitions */
|
||||||
|
#define APSR_N_Pos 31U /*!< APSR: N Position */
|
||||||
|
#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
|
||||||
|
|
||||||
|
#define APSR_Z_Pos 30U /*!< APSR: Z Position */
|
||||||
|
#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
|
||||||
|
|
||||||
|
#define APSR_C_Pos 29U /*!< APSR: C Position */
|
||||||
|
#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
|
||||||
|
|
||||||
|
#define APSR_V_Pos 28U /*!< APSR: V Position */
|
||||||
|
#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Union type to access the Interrupt Program Status Register (IPSR).
|
||||||
|
*/
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
||||||
|
uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
|
||||||
|
} b; /*!< Structure used for bit access */
|
||||||
|
uint32_t w; /*!< Type used for word access */
|
||||||
|
} IPSR_Type;
|
||||||
|
|
||||||
|
/* IPSR Register Definitions */
|
||||||
|
#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
|
||||||
|
#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Union type to access the Special-Purpose Program Status Registers (xPSR).
|
||||||
|
*/
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
||||||
|
uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
|
||||||
|
uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
|
||||||
|
uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
|
||||||
|
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
||||||
|
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
||||||
|
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
||||||
|
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
||||||
|
} b; /*!< Structure used for bit access */
|
||||||
|
uint32_t w; /*!< Type used for word access */
|
||||||
|
} xPSR_Type;
|
||||||
|
|
||||||
|
/* xPSR Register Definitions */
|
||||||
|
#define xPSR_N_Pos 31U /*!< xPSR: N Position */
|
||||||
|
#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
|
||||||
|
|
||||||
|
#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
|
||||||
|
#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
|
||||||
|
|
||||||
|
#define xPSR_C_Pos 29U /*!< xPSR: C Position */
|
||||||
|
#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
|
||||||
|
|
||||||
|
#define xPSR_V_Pos 28U /*!< xPSR: V Position */
|
||||||
|
#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
|
||||||
|
|
||||||
|
#define xPSR_T_Pos 24U /*!< xPSR: T Position */
|
||||||
|
#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
|
||||||
|
|
||||||
|
#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
|
||||||
|
#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Union type to access the Control Registers (CONTROL).
|
||||||
|
*/
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t _reserved0:1; /*!< bit: 0 Reserved */
|
||||||
|
uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
|
||||||
|
uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
|
||||||
|
} b; /*!< Structure used for bit access */
|
||||||
|
uint32_t w; /*!< Type used for word access */
|
||||||
|
} CONTROL_Type;
|
||||||
|
|
||||||
|
/* CONTROL Register Definitions */
|
||||||
|
#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
|
||||||
|
#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_CORE */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
|
||||||
|
\brief Type definitions for the NVIC Registers
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
__IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
|
||||||
|
uint32_t RESERVED0[31U];
|
||||||
|
__IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
|
||||||
|
uint32_t RESERVED1[31U];
|
||||||
|
__IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
|
||||||
|
uint32_t RESERVED2[31U];
|
||||||
|
__IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
|
||||||
|
uint32_t RESERVED3[31U];
|
||||||
|
uint32_t RESERVED4[64U];
|
||||||
|
__IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
|
||||||
|
} NVIC_Type;
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_NVIC */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_SCB System Control Block (SCB)
|
||||||
|
\brief Type definitions for the System Control Block Registers
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Structure type to access the System Control Block (SCB).
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
__IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
|
||||||
|
__IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
|
||||||
|
uint32_t RESERVED0;
|
||||||
|
__IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
|
||||||
|
__IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
|
||||||
|
__IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
|
||||||
|
uint32_t RESERVED1;
|
||||||
|
__IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
|
||||||
|
__IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
|
||||||
|
} SCB_Type;
|
||||||
|
|
||||||
|
/* SCB CPUID Register Definitions */
|
||||||
|
#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
|
||||||
|
#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
|
||||||
|
|
||||||
|
#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
|
||||||
|
#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
|
||||||
|
|
||||||
|
#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
|
||||||
|
#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
|
||||||
|
|
||||||
|
#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
|
||||||
|
#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
|
||||||
|
|
||||||
|
#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
|
||||||
|
#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
|
||||||
|
|
||||||
|
/* SCB Interrupt Control State Register Definitions */
|
||||||
|
#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
|
||||||
|
#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
|
||||||
|
#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
|
||||||
|
#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
|
||||||
|
#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
|
||||||
|
#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
|
||||||
|
#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
|
||||||
|
#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
|
||||||
|
#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
|
||||||
|
#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
|
||||||
|
|
||||||
|
/* SCB Application Interrupt and Reset Control Register Definitions */
|
||||||
|
#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
|
||||||
|
#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
|
||||||
|
|
||||||
|
#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
|
||||||
|
#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
|
||||||
|
|
||||||
|
#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
|
||||||
|
#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
|
||||||
|
|
||||||
|
#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
|
||||||
|
#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
|
||||||
|
|
||||||
|
#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
|
||||||
|
#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
|
||||||
|
|
||||||
|
/* SCB System Control Register Definitions */
|
||||||
|
#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
|
||||||
|
#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
|
||||||
|
|
||||||
|
#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
|
||||||
|
#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
|
||||||
|
|
||||||
|
#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
|
||||||
|
#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
|
||||||
|
|
||||||
|
/* SCB Configuration Control Register Definitions */
|
||||||
|
#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
|
||||||
|
#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
|
||||||
|
|
||||||
|
#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
|
||||||
|
#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
|
||||||
|
|
||||||
|
/* SCB System Handler Control and State Register Definitions */
|
||||||
|
#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
|
||||||
|
#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_SCB */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_SysTick System Tick Timer (SysTick)
|
||||||
|
\brief Type definitions for the System Timer Registers.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Structure type to access the System Timer (SysTick).
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
__IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
|
||||||
|
__IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
|
||||||
|
__IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
|
||||||
|
__IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
|
||||||
|
} SysTick_Type;
|
||||||
|
|
||||||
|
/* SysTick Control / Status Register Definitions */
|
||||||
|
#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
|
||||||
|
#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
|
||||||
|
|
||||||
|
#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
|
||||||
|
#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
|
||||||
|
|
||||||
|
#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
|
||||||
|
#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
|
||||||
|
|
||||||
|
#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
|
||||||
|
#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
|
||||||
|
|
||||||
|
/* SysTick Reload Register Definitions */
|
||||||
|
#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
|
||||||
|
#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
|
||||||
|
|
||||||
|
/* SysTick Current Register Definitions */
|
||||||
|
#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
|
||||||
|
#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
|
||||||
|
|
||||||
|
/* SysTick Calibration Register Definitions */
|
||||||
|
#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
|
||||||
|
#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
|
||||||
|
|
||||||
|
#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
|
||||||
|
#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
|
||||||
|
|
||||||
|
#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
|
||||||
|
#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_SysTick */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
|
||||||
|
\brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
|
||||||
|
Therefore they are not covered by the Cortex-M0 header file.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
/*@} end of group CMSIS_CoreDebug */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_core_bitfield Core register bit field macros
|
||||||
|
\brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Mask and shift a bit field value for use in a register bit range.
|
||||||
|
\param[in] field Name of the register bit field.
|
||||||
|
\param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
|
||||||
|
\return Masked and shifted value.
|
||||||
|
*/
|
||||||
|
#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Mask and shift a register value to extract a bit filed value.
|
||||||
|
\param[in] field Name of the register bit field.
|
||||||
|
\param[in] value Value of register. This parameter is interpreted as an uint32_t type.
|
||||||
|
\return Masked and shifted bit field value.
|
||||||
|
*/
|
||||||
|
#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_core_bitfield */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_core_base Core Definitions
|
||||||
|
\brief Definitions for base addresses, unions, and structures.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Memory mapping of Core Hardware */
|
||||||
|
#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
|
||||||
|
#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
|
||||||
|
#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
|
||||||
|
#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
|
||||||
|
|
||||||
|
#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
|
||||||
|
#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
|
||||||
|
#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
|
||||||
|
|
||||||
|
|
||||||
|
/*@} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Hardware Abstraction Layer
|
||||||
|
Core Function Interface contains:
|
||||||
|
- Core NVIC Functions
|
||||||
|
- Core SysTick Functions
|
||||||
|
- Core Register Access Functions
|
||||||
|
******************************************************************************/
|
||||||
|
/**
|
||||||
|
\defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ########################## NVIC functions #################################### */
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_Core_FunctionInterface
|
||||||
|
\defgroup CMSIS_Core_NVICFunctions NVIC Functions
|
||||||
|
\brief Functions that manage interrupts and exceptions via the NVIC.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CMSIS_NVIC_VIRTUAL
|
||||||
|
#ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
|
||||||
|
#define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
|
||||||
|
#endif
|
||||||
|
#include CMSIS_NVIC_VIRTUAL_HEADER_FILE
|
||||||
|
#else
|
||||||
|
#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
|
||||||
|
#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
|
||||||
|
#define NVIC_EnableIRQ __NVIC_EnableIRQ
|
||||||
|
#define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
|
||||||
|
#define NVIC_DisableIRQ __NVIC_DisableIRQ
|
||||||
|
#define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
|
||||||
|
#define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
|
||||||
|
#define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
|
||||||
|
/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M0 */
|
||||||
|
#define NVIC_SetPriority __NVIC_SetPriority
|
||||||
|
#define NVIC_GetPriority __NVIC_GetPriority
|
||||||
|
#define NVIC_SystemReset __NVIC_SystemReset
|
||||||
|
#endif /* CMSIS_NVIC_VIRTUAL */
|
||||||
|
|
||||||
|
#ifdef CMSIS_VECTAB_VIRTUAL
|
||||||
|
#ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
|
||||||
|
#define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
|
||||||
|
#endif
|
||||||
|
#include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
|
||||||
|
#else
|
||||||
|
#define NVIC_SetVector __NVIC_SetVector
|
||||||
|
#define NVIC_GetVector __NVIC_GetVector
|
||||||
|
#endif /* (CMSIS_VECTAB_VIRTUAL) */
|
||||||
|
|
||||||
|
#define NVIC_USER_IRQ_OFFSET 16
|
||||||
|
|
||||||
|
|
||||||
|
/* The following EXC_RETURN values are saved the LR on exception entry */
|
||||||
|
#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
|
||||||
|
#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
|
||||||
|
#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
|
||||||
|
|
||||||
|
|
||||||
|
/* Interrupt Priorities are WORD accessible only under Armv6-M */
|
||||||
|
/* The following MACROS handle generation of the register offset and byte masks */
|
||||||
|
#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
|
||||||
|
#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
|
||||||
|
#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
|
||||||
|
|
||||||
|
#define __NVIC_SetPriorityGrouping(X) (void)(X)
|
||||||
|
#define __NVIC_GetPriorityGrouping() (0U)
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Enable Interrupt
|
||||||
|
\details Enables a device specific interrupt in the NVIC interrupt controller.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
__COMPILER_BARRIER();
|
||||||
|
NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
|
||||||
|
__COMPILER_BARRIER();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Interrupt Enable status
|
||||||
|
\details Returns a device specific interrupt enable status from the NVIC interrupt controller.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\return 0 Interrupt is not enabled.
|
||||||
|
\return 1 Interrupt is enabled.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(0U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Disable Interrupt
|
||||||
|
\details Disables a device specific interrupt in the NVIC interrupt controller.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
|
||||||
|
__DSB();
|
||||||
|
__ISB();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Pending Interrupt
|
||||||
|
\details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\return 0 Interrupt status is not pending.
|
||||||
|
\return 1 Interrupt status is pending.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(0U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Pending Interrupt
|
||||||
|
\details Sets the pending bit of a device specific interrupt in the NVIC pending register.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Clear Pending Interrupt
|
||||||
|
\details Clears the pending bit of a device specific interrupt in the NVIC pending register.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Interrupt Priority
|
||||||
|
\details Sets the priority of a device specific interrupt or a processor exception.
|
||||||
|
The interrupt number can be positive to specify a device specific interrupt,
|
||||||
|
or negative to specify a processor exception.
|
||||||
|
\param [in] IRQn Interrupt number.
|
||||||
|
\param [in] priority Priority to set.
|
||||||
|
\note The priority cannot be set for every processor exception.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
||||||
|
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
||||||
|
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Interrupt Priority
|
||||||
|
\details Reads the priority of a device specific interrupt or a processor exception.
|
||||||
|
The interrupt number can be positive to specify a device specific interrupt,
|
||||||
|
or negative to specify a processor exception.
|
||||||
|
\param [in] IRQn Interrupt number.
|
||||||
|
\return Interrupt Priority.
|
||||||
|
Value is aligned automatically to the implemented priority bits of the microcontroller.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Encode Priority
|
||||||
|
\details Encodes the priority for an interrupt with the given priority group,
|
||||||
|
preemptive priority value, and subpriority value.
|
||||||
|
In case of a conflict between priority grouping and available
|
||||||
|
priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
|
||||||
|
\param [in] PriorityGroup Used priority group.
|
||||||
|
\param [in] PreemptPriority Preemptive priority value (starting from 0).
|
||||||
|
\param [in] SubPriority Subpriority value (starting from 0).
|
||||||
|
\return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
|
||||||
|
{
|
||||||
|
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
|
||||||
|
uint32_t PreemptPriorityBits;
|
||||||
|
uint32_t SubPriorityBits;
|
||||||
|
|
||||||
|
PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
|
||||||
|
SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
|
||||||
|
|
||||||
|
return (
|
||||||
|
((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
|
||||||
|
((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Decode Priority
|
||||||
|
\details Decodes an interrupt priority value with a given priority group to
|
||||||
|
preemptive priority value and subpriority value.
|
||||||
|
In case of a conflict between priority grouping and available
|
||||||
|
priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
|
||||||
|
\param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
|
||||||
|
\param [in] PriorityGroup Used priority group.
|
||||||
|
\param [out] pPreemptPriority Preemptive priority value (starting from 0).
|
||||||
|
\param [out] pSubPriority Subpriority value (starting from 0).
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
|
||||||
|
{
|
||||||
|
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
|
||||||
|
uint32_t PreemptPriorityBits;
|
||||||
|
uint32_t SubPriorityBits;
|
||||||
|
|
||||||
|
PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
|
||||||
|
SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
|
||||||
|
|
||||||
|
*pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
|
||||||
|
*pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Interrupt Vector
|
||||||
|
\details Sets an interrupt vector in SRAM based interrupt vector table.
|
||||||
|
The interrupt number can be positive to specify a device specific interrupt,
|
||||||
|
or negative to specify a processor exception.
|
||||||
|
Address 0 must be mapped to SRAM.
|
||||||
|
\param [in] IRQn Interrupt number
|
||||||
|
\param [in] vector Address of interrupt handler function
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
|
||||||
|
{
|
||||||
|
uint32_t vectors = 0x0U;
|
||||||
|
(* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4)) = vector;
|
||||||
|
/* ARM Application Note 321 states that the M0 does not require the architectural barrier */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Interrupt Vector
|
||||||
|
\details Reads an interrupt vector from interrupt vector table.
|
||||||
|
The interrupt number can be positive to specify a device specific interrupt,
|
||||||
|
or negative to specify a processor exception.
|
||||||
|
\param [in] IRQn Interrupt number.
|
||||||
|
\return Address of interrupt handler function
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
uint32_t vectors = 0x0U;
|
||||||
|
return (uint32_t)(* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief System Reset
|
||||||
|
\details Initiates a system reset request to reset the MCU.
|
||||||
|
*/
|
||||||
|
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
|
||||||
|
{
|
||||||
|
__DSB(); /* Ensure all outstanding memory accesses included
|
||||||
|
buffered write are completed before reset */
|
||||||
|
SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
|
||||||
|
SCB_AIRCR_SYSRESETREQ_Msk);
|
||||||
|
__DSB(); /* Ensure completion of memory access */
|
||||||
|
|
||||||
|
for(;;) /* wait until reset */
|
||||||
|
{
|
||||||
|
__NOP();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@} end of CMSIS_Core_NVICFunctions */
|
||||||
|
|
||||||
|
|
||||||
|
/* ########################## FPU functions #################################### */
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_Core_FunctionInterface
|
||||||
|
\defgroup CMSIS_Core_FpuFunctions FPU Functions
|
||||||
|
\brief Function that provides FPU type.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief get FPU type
|
||||||
|
\details returns the FPU type
|
||||||
|
\returns
|
||||||
|
- \b 0: No FPU
|
||||||
|
- \b 1: Single precision FPU
|
||||||
|
- \b 2: Double + Single precision FPU
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t SCB_GetFPUType(void)
|
||||||
|
{
|
||||||
|
return 0U; /* No FPU */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*@} end of CMSIS_Core_FpuFunctions */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ################################## SysTick function ############################################ */
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_Core_FunctionInterface
|
||||||
|
\defgroup CMSIS_Core_SysTickFunctions SysTick Functions
|
||||||
|
\brief Functions that configure the System.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief System Tick Configuration
|
||||||
|
\details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
|
||||||
|
Counter is in free running mode to generate periodic interrupts.
|
||||||
|
\param [in] ticks Number of ticks between two interrupts.
|
||||||
|
\return 0 Function succeeded.
|
||||||
|
\return 1 Function failed.
|
||||||
|
\note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
|
||||||
|
function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
|
||||||
|
must contain a vendor-specific implementation of this function.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
|
||||||
|
{
|
||||||
|
if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
|
||||||
|
{
|
||||||
|
return (1UL); /* Reload value impossible */
|
||||||
|
}
|
||||||
|
|
||||||
|
SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
|
||||||
|
NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
|
||||||
|
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||||
|
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
|
||||||
|
SysTick_CTRL_TICKINT_Msk |
|
||||||
|
SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
|
||||||
|
return (0UL); /* Function successful */
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*@} end of CMSIS_Core_SysTickFunctions */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __CORE_CM0_H_DEPENDANT */
|
||||||
|
|
||||||
|
#endif /* __CMSIS_GENERIC */
|
1085
Drivers/CMSIS/Include/core_cm0plus.h
Normal file
1085
Drivers/CMSIS/Include/core_cm0plus.h
Normal file
File diff suppressed because it is too large
Load Diff
979
Drivers/CMSIS/Include/core_cm1.h
Normal file
979
Drivers/CMSIS/Include/core_cm1.h
Normal file
@ -0,0 +1,979 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* @file core_cm1.h
|
||||||
|
* @brief CMSIS Cortex-M1 Core Peripheral Access Layer Header File
|
||||||
|
* @version V1.0.1
|
||||||
|
* @date 12. November 2018
|
||||||
|
******************************************************************************/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined ( __ICCARM__ )
|
||||||
|
#pragma system_include /* treat file as system include file for MISRA check */
|
||||||
|
#elif defined (__clang__)
|
||||||
|
#pragma clang system_header /* treat file as system include file */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __CORE_CM1_H_GENERIC
|
||||||
|
#define __CORE_CM1_H_GENERIC
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
\page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions
|
||||||
|
CMSIS violates the following MISRA-C:2004 rules:
|
||||||
|
|
||||||
|
\li Required Rule 8.5, object/function definition in header file.<br>
|
||||||
|
Function definitions in header files are used to allow 'inlining'.
|
||||||
|
|
||||||
|
\li Required Rule 18.4, declaration of union type or object of union type: '{...}'.<br>
|
||||||
|
Unions are used for effective representation of core registers.
|
||||||
|
|
||||||
|
\li Advisory Rule 19.7, Function-like macro defined.<br>
|
||||||
|
Function-like macros are used to allow more efficient code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* CMSIS definitions
|
||||||
|
******************************************************************************/
|
||||||
|
/**
|
||||||
|
\ingroup Cortex_M1
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cmsis_version.h"
|
||||||
|
|
||||||
|
/* CMSIS CM1 definitions */
|
||||||
|
#define __CM1_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
|
||||||
|
#define __CM1_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
|
||||||
|
#define __CM1_CMSIS_VERSION ((__CM1_CMSIS_VERSION_MAIN << 16U) | \
|
||||||
|
__CM1_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
|
||||||
|
|
||||||
|
#define __CORTEX_M (1U) /*!< Cortex-M Core */
|
||||||
|
|
||||||
|
/** __FPU_USED indicates whether an FPU is used or not.
|
||||||
|
This core does not support an FPU at all
|
||||||
|
*/
|
||||||
|
#define __FPU_USED 0U
|
||||||
|
|
||||||
|
#if defined ( __CC_ARM )
|
||||||
|
#if defined __TARGET_FPU_VFP
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||||
|
#if defined __ARM_FP
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( __GNUC__ )
|
||||||
|
#if defined (__VFP_FP__) && !defined(__SOFTFP__)
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( __ICCARM__ )
|
||||||
|
#if defined __ARMVFP__
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( __TI_ARM__ )
|
||||||
|
#if defined __TI_VFP_SUPPORT__
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( __TASKING__ )
|
||||||
|
#if defined __FPU_VFP__
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined ( __CSMC__ )
|
||||||
|
#if ( __CSMC__ & 0x400U)
|
||||||
|
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __CORE_CM1_H_GENERIC */
|
||||||
|
|
||||||
|
#ifndef __CMSIS_GENERIC
|
||||||
|
|
||||||
|
#ifndef __CORE_CM1_H_DEPENDANT
|
||||||
|
#define __CORE_CM1_H_DEPENDANT
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* check device defines and use defaults */
|
||||||
|
#if defined __CHECK_DEVICE_DEFINES
|
||||||
|
#ifndef __CM1_REV
|
||||||
|
#define __CM1_REV 0x0100U
|
||||||
|
#warning "__CM1_REV not defined in device header file; using default!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __NVIC_PRIO_BITS
|
||||||
|
#define __NVIC_PRIO_BITS 2U
|
||||||
|
#warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __Vendor_SysTickConfig
|
||||||
|
#define __Vendor_SysTickConfig 0U
|
||||||
|
#warning "__Vendor_SysTickConfig not defined in device header file; using default!"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* IO definitions (access restrictions to peripheral registers) */
|
||||||
|
/**
|
||||||
|
\defgroup CMSIS_glob_defs CMSIS Global Defines
|
||||||
|
|
||||||
|
<strong>IO Type Qualifiers</strong> are used
|
||||||
|
\li to specify the access to peripheral variables.
|
||||||
|
\li for automatic generation of peripheral register debug information.
|
||||||
|
*/
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define __I volatile /*!< Defines 'read only' permissions */
|
||||||
|
#else
|
||||||
|
#define __I volatile const /*!< Defines 'read only' permissions */
|
||||||
|
#endif
|
||||||
|
#define __O volatile /*!< Defines 'write only' permissions */
|
||||||
|
#define __IO volatile /*!< Defines 'read / write' permissions */
|
||||||
|
|
||||||
|
/* following defines should be used for structure members */
|
||||||
|
#define __IM volatile const /*! Defines 'read only' structure member permissions */
|
||||||
|
#define __OM volatile /*! Defines 'write only' structure member permissions */
|
||||||
|
#define __IOM volatile /*! Defines 'read / write' structure member permissions */
|
||||||
|
|
||||||
|
/*@} end of group Cortex_M1 */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Register Abstraction
|
||||||
|
Core Register contain:
|
||||||
|
- Core Register
|
||||||
|
- Core NVIC Register
|
||||||
|
- Core SCB Register
|
||||||
|
- Core SysTick Register
|
||||||
|
******************************************************************************/
|
||||||
|
/**
|
||||||
|
\defgroup CMSIS_core_register Defines and Type Definitions
|
||||||
|
\brief Type definitions and defines for Cortex-M processor based devices.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_CORE Status and Control Registers
|
||||||
|
\brief Core Register type definitions.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Union type to access the Application Program Status Register (APSR).
|
||||||
|
*/
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */
|
||||||
|
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
||||||
|
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
||||||
|
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
||||||
|
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
||||||
|
} b; /*!< Structure used for bit access */
|
||||||
|
uint32_t w; /*!< Type used for word access */
|
||||||
|
} APSR_Type;
|
||||||
|
|
||||||
|
/* APSR Register Definitions */
|
||||||
|
#define APSR_N_Pos 31U /*!< APSR: N Position */
|
||||||
|
#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */
|
||||||
|
|
||||||
|
#define APSR_Z_Pos 30U /*!< APSR: Z Position */
|
||||||
|
#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */
|
||||||
|
|
||||||
|
#define APSR_C_Pos 29U /*!< APSR: C Position */
|
||||||
|
#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */
|
||||||
|
|
||||||
|
#define APSR_V_Pos 28U /*!< APSR: V Position */
|
||||||
|
#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Union type to access the Interrupt Program Status Register (IPSR).
|
||||||
|
*/
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
||||||
|
uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
|
||||||
|
} b; /*!< Structure used for bit access */
|
||||||
|
uint32_t w; /*!< Type used for word access */
|
||||||
|
} IPSR_Type;
|
||||||
|
|
||||||
|
/* IPSR Register Definitions */
|
||||||
|
#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
|
||||||
|
#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Union type to access the Special-Purpose Program Status Registers (xPSR).
|
||||||
|
*/
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
|
||||||
|
uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */
|
||||||
|
uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */
|
||||||
|
uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */
|
||||||
|
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */
|
||||||
|
uint32_t C:1; /*!< bit: 29 Carry condition code flag */
|
||||||
|
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
|
||||||
|
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
|
||||||
|
} b; /*!< Structure used for bit access */
|
||||||
|
uint32_t w; /*!< Type used for word access */
|
||||||
|
} xPSR_Type;
|
||||||
|
|
||||||
|
/* xPSR Register Definitions */
|
||||||
|
#define xPSR_N_Pos 31U /*!< xPSR: N Position */
|
||||||
|
#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */
|
||||||
|
|
||||||
|
#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */
|
||||||
|
#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */
|
||||||
|
|
||||||
|
#define xPSR_C_Pos 29U /*!< xPSR: C Position */
|
||||||
|
#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */
|
||||||
|
|
||||||
|
#define xPSR_V_Pos 28U /*!< xPSR: V Position */
|
||||||
|
#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */
|
||||||
|
|
||||||
|
#define xPSR_T_Pos 24U /*!< xPSR: T Position */
|
||||||
|
#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */
|
||||||
|
|
||||||
|
#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
|
||||||
|
#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Union type to access the Control Registers (CONTROL).
|
||||||
|
*/
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t _reserved0:1; /*!< bit: 0 Reserved */
|
||||||
|
uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
|
||||||
|
uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
|
||||||
|
} b; /*!< Structure used for bit access */
|
||||||
|
uint32_t w; /*!< Type used for word access */
|
||||||
|
} CONTROL_Type;
|
||||||
|
|
||||||
|
/* CONTROL Register Definitions */
|
||||||
|
#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */
|
||||||
|
#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_CORE */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
|
||||||
|
\brief Type definitions for the NVIC Registers
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
__IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
|
||||||
|
uint32_t RESERVED0[31U];
|
||||||
|
__IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
|
||||||
|
uint32_t RSERVED1[31U];
|
||||||
|
__IOM uint32_t ISPR[1U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */
|
||||||
|
uint32_t RESERVED2[31U];
|
||||||
|
__IOM uint32_t ICPR[1U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */
|
||||||
|
uint32_t RESERVED3[31U];
|
||||||
|
uint32_t RESERVED4[64U];
|
||||||
|
__IOM uint32_t IP[8U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */
|
||||||
|
} NVIC_Type;
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_NVIC */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_SCB System Control Block (SCB)
|
||||||
|
\brief Type definitions for the System Control Block Registers
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Structure type to access the System Control Block (SCB).
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
__IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
|
||||||
|
__IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
|
||||||
|
uint32_t RESERVED0;
|
||||||
|
__IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */
|
||||||
|
__IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */
|
||||||
|
__IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */
|
||||||
|
uint32_t RESERVED1;
|
||||||
|
__IOM uint32_t SHP[2U]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */
|
||||||
|
__IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */
|
||||||
|
} SCB_Type;
|
||||||
|
|
||||||
|
/* SCB CPUID Register Definitions */
|
||||||
|
#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */
|
||||||
|
#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */
|
||||||
|
|
||||||
|
#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */
|
||||||
|
#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */
|
||||||
|
|
||||||
|
#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */
|
||||||
|
#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */
|
||||||
|
|
||||||
|
#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */
|
||||||
|
#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */
|
||||||
|
|
||||||
|
#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */
|
||||||
|
#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */
|
||||||
|
|
||||||
|
/* SCB Interrupt Control State Register Definitions */
|
||||||
|
#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */
|
||||||
|
#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */
|
||||||
|
#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */
|
||||||
|
#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */
|
||||||
|
#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */
|
||||||
|
#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */
|
||||||
|
#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */
|
||||||
|
#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */
|
||||||
|
#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */
|
||||||
|
|
||||||
|
#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */
|
||||||
|
#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */
|
||||||
|
|
||||||
|
/* SCB Application Interrupt and Reset Control Register Definitions */
|
||||||
|
#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */
|
||||||
|
#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */
|
||||||
|
|
||||||
|
#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */
|
||||||
|
#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */
|
||||||
|
|
||||||
|
#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */
|
||||||
|
#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */
|
||||||
|
|
||||||
|
#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */
|
||||||
|
#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */
|
||||||
|
|
||||||
|
#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */
|
||||||
|
#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */
|
||||||
|
|
||||||
|
/* SCB System Control Register Definitions */
|
||||||
|
#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */
|
||||||
|
#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */
|
||||||
|
|
||||||
|
#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */
|
||||||
|
#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */
|
||||||
|
|
||||||
|
#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */
|
||||||
|
#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */
|
||||||
|
|
||||||
|
/* SCB Configuration Control Register Definitions */
|
||||||
|
#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */
|
||||||
|
#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */
|
||||||
|
|
||||||
|
#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */
|
||||||
|
#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */
|
||||||
|
|
||||||
|
/* SCB System Handler Control and State Register Definitions */
|
||||||
|
#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */
|
||||||
|
#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_SCB */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
|
||||||
|
\brief Type definitions for the System Control and ID Register not in the SCB
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Structure type to access the System Control and ID Register not in the SCB.
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t RESERVED0[2U];
|
||||||
|
__IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
|
||||||
|
} SCnSCB_Type;
|
||||||
|
|
||||||
|
/* Auxiliary Control Register Definitions */
|
||||||
|
#define SCnSCB_ACTLR_ITCMUAEN_Pos 4U /*!< ACTLR: Instruction TCM Upper Alias Enable Position */
|
||||||
|
#define SCnSCB_ACTLR_ITCMUAEN_Msk (1UL << SCnSCB_ACTLR_ITCMUAEN_Pos) /*!< ACTLR: Instruction TCM Upper Alias Enable Mask */
|
||||||
|
|
||||||
|
#define SCnSCB_ACTLR_ITCMLAEN_Pos 3U /*!< ACTLR: Instruction TCM Lower Alias Enable Position */
|
||||||
|
#define SCnSCB_ACTLR_ITCMLAEN_Msk (1UL << SCnSCB_ACTLR_ITCMLAEN_Pos) /*!< ACTLR: Instruction TCM Lower Alias Enable Mask */
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_SCnotSCB */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_SysTick System Tick Timer (SysTick)
|
||||||
|
\brief Type definitions for the System Timer Registers.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Structure type to access the System Timer (SysTick).
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
__IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
|
||||||
|
__IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
|
||||||
|
__IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
|
||||||
|
__IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */
|
||||||
|
} SysTick_Type;
|
||||||
|
|
||||||
|
/* SysTick Control / Status Register Definitions */
|
||||||
|
#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */
|
||||||
|
#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */
|
||||||
|
|
||||||
|
#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */
|
||||||
|
#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */
|
||||||
|
|
||||||
|
#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */
|
||||||
|
#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */
|
||||||
|
|
||||||
|
#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */
|
||||||
|
#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */
|
||||||
|
|
||||||
|
/* SysTick Reload Register Definitions */
|
||||||
|
#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */
|
||||||
|
#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */
|
||||||
|
|
||||||
|
/* SysTick Current Register Definitions */
|
||||||
|
#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */
|
||||||
|
#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */
|
||||||
|
|
||||||
|
/* SysTick Calibration Register Definitions */
|
||||||
|
#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */
|
||||||
|
#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */
|
||||||
|
|
||||||
|
#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */
|
||||||
|
#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */
|
||||||
|
|
||||||
|
#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */
|
||||||
|
#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_SysTick */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
|
||||||
|
\brief Cortex-M1 Core Debug Registers (DCB registers, SHCSR, and DFSR) are only accessible over DAP and not via processor.
|
||||||
|
Therefore they are not covered by the Cortex-M1 header file.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
/*@} end of group CMSIS_CoreDebug */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_core_bitfield Core register bit field macros
|
||||||
|
\brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk).
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Mask and shift a bit field value for use in a register bit range.
|
||||||
|
\param[in] field Name of the register bit field.
|
||||||
|
\param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
|
||||||
|
\return Masked and shifted value.
|
||||||
|
*/
|
||||||
|
#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk)
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Mask and shift a register value to extract a bit filed value.
|
||||||
|
\param[in] field Name of the register bit field.
|
||||||
|
\param[in] value Value of register. This parameter is interpreted as an uint32_t type.
|
||||||
|
\return Masked and shifted bit field value.
|
||||||
|
*/
|
||||||
|
#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos)
|
||||||
|
|
||||||
|
/*@} end of group CMSIS_core_bitfield */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_core_register
|
||||||
|
\defgroup CMSIS_core_base Core Definitions
|
||||||
|
\brief Definitions for base addresses, unions, and structures.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Memory mapping of Core Hardware */
|
||||||
|
#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */
|
||||||
|
#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */
|
||||||
|
#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
|
||||||
|
#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
|
||||||
|
|
||||||
|
#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */
|
||||||
|
#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */
|
||||||
|
#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */
|
||||||
|
#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */
|
||||||
|
|
||||||
|
|
||||||
|
/*@} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Hardware Abstraction Layer
|
||||||
|
Core Function Interface contains:
|
||||||
|
- Core NVIC Functions
|
||||||
|
- Core SysTick Functions
|
||||||
|
- Core Register Access Functions
|
||||||
|
******************************************************************************/
|
||||||
|
/**
|
||||||
|
\defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ########################## NVIC functions #################################### */
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_Core_FunctionInterface
|
||||||
|
\defgroup CMSIS_Core_NVICFunctions NVIC Functions
|
||||||
|
\brief Functions that manage interrupts and exceptions via the NVIC.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CMSIS_NVIC_VIRTUAL
|
||||||
|
#ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
|
||||||
|
#define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
|
||||||
|
#endif
|
||||||
|
#include CMSIS_NVIC_VIRTUAL_HEADER_FILE
|
||||||
|
#else
|
||||||
|
#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
|
||||||
|
#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
|
||||||
|
#define NVIC_EnableIRQ __NVIC_EnableIRQ
|
||||||
|
#define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
|
||||||
|
#define NVIC_DisableIRQ __NVIC_DisableIRQ
|
||||||
|
#define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
|
||||||
|
#define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
|
||||||
|
#define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
|
||||||
|
/*#define NVIC_GetActive __NVIC_GetActive not available for Cortex-M1 */
|
||||||
|
#define NVIC_SetPriority __NVIC_SetPriority
|
||||||
|
#define NVIC_GetPriority __NVIC_GetPriority
|
||||||
|
#define NVIC_SystemReset __NVIC_SystemReset
|
||||||
|
#endif /* CMSIS_NVIC_VIRTUAL */
|
||||||
|
|
||||||
|
#ifdef CMSIS_VECTAB_VIRTUAL
|
||||||
|
#ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
|
||||||
|
#define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
|
||||||
|
#endif
|
||||||
|
#include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
|
||||||
|
#else
|
||||||
|
#define NVIC_SetVector __NVIC_SetVector
|
||||||
|
#define NVIC_GetVector __NVIC_GetVector
|
||||||
|
#endif /* (CMSIS_VECTAB_VIRTUAL) */
|
||||||
|
|
||||||
|
#define NVIC_USER_IRQ_OFFSET 16
|
||||||
|
|
||||||
|
|
||||||
|
/* The following EXC_RETURN values are saved the LR on exception entry */
|
||||||
|
#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
|
||||||
|
#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
|
||||||
|
#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
|
||||||
|
|
||||||
|
|
||||||
|
/* Interrupt Priorities are WORD accessible only under Armv6-M */
|
||||||
|
/* The following MACROS handle generation of the register offset and byte masks */
|
||||||
|
#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL)
|
||||||
|
#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) )
|
||||||
|
#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) )
|
||||||
|
|
||||||
|
#define __NVIC_SetPriorityGrouping(X) (void)(X)
|
||||||
|
#define __NVIC_GetPriorityGrouping() (0U)
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Enable Interrupt
|
||||||
|
\details Enables a device specific interrupt in the NVIC interrupt controller.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
__COMPILER_BARRIER();
|
||||||
|
NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
|
||||||
|
__COMPILER_BARRIER();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Interrupt Enable status
|
||||||
|
\details Returns a device specific interrupt enable status from the NVIC interrupt controller.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\return 0 Interrupt is not enabled.
|
||||||
|
\return 1 Interrupt is enabled.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(0U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Disable Interrupt
|
||||||
|
\details Disables a device specific interrupt in the NVIC interrupt controller.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
|
||||||
|
__DSB();
|
||||||
|
__ISB();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Pending Interrupt
|
||||||
|
\details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\return 0 Interrupt status is not pending.
|
||||||
|
\return 1 Interrupt status is pending.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return(0U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Pending Interrupt
|
||||||
|
\details Sets the pending bit of a device specific interrupt in the NVIC pending register.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Clear Pending Interrupt
|
||||||
|
\details Clears the pending bit of a device specific interrupt in the NVIC pending register.
|
||||||
|
\param [in] IRQn Device specific interrupt number.
|
||||||
|
\note IRQn must not be negative.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Interrupt Priority
|
||||||
|
\details Sets the priority of a device specific interrupt or a processor exception.
|
||||||
|
The interrupt number can be positive to specify a device specific interrupt,
|
||||||
|
or negative to specify a processor exception.
|
||||||
|
\param [in] IRQn Interrupt number.
|
||||||
|
\param [in] priority Priority to set.
|
||||||
|
\note The priority cannot be set for every processor exception.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
|
||||||
|
{
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
||||||
|
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
|
||||||
|
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Interrupt Priority
|
||||||
|
\details Reads the priority of a device specific interrupt or a processor exception.
|
||||||
|
The interrupt number can be positive to specify a device specific interrupt,
|
||||||
|
or negative to specify a processor exception.
|
||||||
|
\param [in] IRQn Interrupt number.
|
||||||
|
\return Interrupt Priority.
|
||||||
|
Value is aligned automatically to the implemented priority bits of the microcontroller.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((int32_t)(IRQn) >= 0)
|
||||||
|
{
|
||||||
|
return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Encode Priority
|
||||||
|
\details Encodes the priority for an interrupt with the given priority group,
|
||||||
|
preemptive priority value, and subpriority value.
|
||||||
|
In case of a conflict between priority grouping and available
|
||||||
|
priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
|
||||||
|
\param [in] PriorityGroup Used priority group.
|
||||||
|
\param [in] PreemptPriority Preemptive priority value (starting from 0).
|
||||||
|
\param [in] SubPriority Subpriority value (starting from 0).
|
||||||
|
\return Encoded priority. Value can be used in the function \ref NVIC_SetPriority().
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
|
||||||
|
{
|
||||||
|
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
|
||||||
|
uint32_t PreemptPriorityBits;
|
||||||
|
uint32_t SubPriorityBits;
|
||||||
|
|
||||||
|
PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
|
||||||
|
SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
|
||||||
|
|
||||||
|
return (
|
||||||
|
((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) |
|
||||||
|
((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL)))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Decode Priority
|
||||||
|
\details Decodes an interrupt priority value with a given priority group to
|
||||||
|
preemptive priority value and subpriority value.
|
||||||
|
In case of a conflict between priority grouping and available
|
||||||
|
priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set.
|
||||||
|
\param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority().
|
||||||
|
\param [in] PriorityGroup Used priority group.
|
||||||
|
\param [out] pPreemptPriority Preemptive priority value (starting from 0).
|
||||||
|
\param [out] pSubPriority Subpriority value (starting from 0).
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority)
|
||||||
|
{
|
||||||
|
uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */
|
||||||
|
uint32_t PreemptPriorityBits;
|
||||||
|
uint32_t SubPriorityBits;
|
||||||
|
|
||||||
|
PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp);
|
||||||
|
SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS));
|
||||||
|
|
||||||
|
*pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL);
|
||||||
|
*pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Set Interrupt Vector
|
||||||
|
\details Sets an interrupt vector in SRAM based interrupt vector table.
|
||||||
|
The interrupt number can be positive to specify a device specific interrupt,
|
||||||
|
or negative to specify a processor exception.
|
||||||
|
Address 0 must be mapped to SRAM.
|
||||||
|
\param [in] IRQn Interrupt number
|
||||||
|
\param [in] vector Address of interrupt handler function
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
|
||||||
|
{
|
||||||
|
uint32_t *vectors = (uint32_t *)0x0U;
|
||||||
|
vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
|
||||||
|
/* ARM Application Note 321 states that the M1 does not require the architectural barrier */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Get Interrupt Vector
|
||||||
|
\details Reads an interrupt vector from interrupt vector table.
|
||||||
|
The interrupt number can be positive to specify a device specific interrupt,
|
||||||
|
or negative to specify a processor exception.
|
||||||
|
\param [in] IRQn Interrupt number.
|
||||||
|
\return Address of interrupt handler function
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
|
||||||
|
{
|
||||||
|
uint32_t *vectors = (uint32_t *)0x0U;
|
||||||
|
return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief System Reset
|
||||||
|
\details Initiates a system reset request to reset the MCU.
|
||||||
|
*/
|
||||||
|
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
|
||||||
|
{
|
||||||
|
__DSB(); /* Ensure all outstanding memory accesses included
|
||||||
|
buffered write are completed before reset */
|
||||||
|
SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
|
||||||
|
SCB_AIRCR_SYSRESETREQ_Msk);
|
||||||
|
__DSB(); /* Ensure completion of memory access */
|
||||||
|
|
||||||
|
for(;;) /* wait until reset */
|
||||||
|
{
|
||||||
|
__NOP();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@} end of CMSIS_Core_NVICFunctions */
|
||||||
|
|
||||||
|
|
||||||
|
/* ########################## FPU functions #################################### */
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_Core_FunctionInterface
|
||||||
|
\defgroup CMSIS_Core_FpuFunctions FPU Functions
|
||||||
|
\brief Function that provides FPU type.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief get FPU type
|
||||||
|
\details returns the FPU type
|
||||||
|
\returns
|
||||||
|
- \b 0: No FPU
|
||||||
|
- \b 1: Single precision FPU
|
||||||
|
- \b 2: Double + Single precision FPU
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t SCB_GetFPUType(void)
|
||||||
|
{
|
||||||
|
return 0U; /* No FPU */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*@} end of CMSIS_Core_FpuFunctions */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ################################## SysTick function ############################################ */
|
||||||
|
/**
|
||||||
|
\ingroup CMSIS_Core_FunctionInterface
|
||||||
|
\defgroup CMSIS_Core_SysTickFunctions SysTick Functions
|
||||||
|
\brief Functions that configure the System.
|
||||||
|
@{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief System Tick Configuration
|
||||||
|
\details Initializes the System Timer and its interrupt, and starts the System Tick Timer.
|
||||||
|
Counter is in free running mode to generate periodic interrupts.
|
||||||
|
\param [in] ticks Number of ticks between two interrupts.
|
||||||
|
\return 0 Function succeeded.
|
||||||
|
\return 1 Function failed.
|
||||||
|
\note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
|
||||||
|
function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
|
||||||
|
must contain a vendor-specific implementation of this function.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
|
||||||
|
{
|
||||||
|
if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
|
||||||
|
{
|
||||||
|
return (1UL); /* Reload value impossible */
|
||||||
|
}
|
||||||
|
|
||||||
|
SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
|
||||||
|
NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
|
||||||
|
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||||
|
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
|
||||||
|
SysTick_CTRL_TICKINT_Msk |
|
||||||
|
SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
|
||||||
|
return (0UL); /* Function successful */
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*@} end of CMSIS_Core_SysTickFunctions */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __CORE_CM1_H_DEPENDANT */
|
||||||
|
|
||||||
|
#endif /* __CMSIS_GENERIC */
|
1996
Drivers/CMSIS/Include/core_cm23.h
Normal file
1996
Drivers/CMSIS/Include/core_cm23.h
Normal file
File diff suppressed because it is too large
Load Diff
1937
Drivers/CMSIS/Include/core_cm3.h
Normal file
1937
Drivers/CMSIS/Include/core_cm3.h
Normal file
File diff suppressed because it is too large
Load Diff
2910
Drivers/CMSIS/Include/core_cm33.h
Normal file
2910
Drivers/CMSIS/Include/core_cm33.h
Normal file
File diff suppressed because it is too large
Load Diff
2910
Drivers/CMSIS/Include/core_cm35p.h
Normal file
2910
Drivers/CMSIS/Include/core_cm35p.h
Normal file
File diff suppressed because it is too large
Load Diff
2124
Drivers/CMSIS/Include/core_cm4.h
Normal file
2124
Drivers/CMSIS/Include/core_cm4.h
Normal file
File diff suppressed because it is too large
Load Diff
2725
Drivers/CMSIS/Include/core_cm7.h
Normal file
2725
Drivers/CMSIS/Include/core_cm7.h
Normal file
File diff suppressed because it is too large
Load Diff
1025
Drivers/CMSIS/Include/core_sc000.h
Normal file
1025
Drivers/CMSIS/Include/core_sc000.h
Normal file
File diff suppressed because it is too large
Load Diff
1912
Drivers/CMSIS/Include/core_sc300.h
Normal file
1912
Drivers/CMSIS/Include/core_sc300.h
Normal file
File diff suppressed because it is too large
Load Diff
272
Drivers/CMSIS/Include/mpu_armv7.h
Normal file
272
Drivers/CMSIS/Include/mpu_armv7.h
Normal file
@ -0,0 +1,272 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* @file mpu_armv7.h
|
||||||
|
* @brief CMSIS MPU API for Armv7-M MPU
|
||||||
|
* @version V5.1.0
|
||||||
|
* @date 08. March 2019
|
||||||
|
******************************************************************************/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017-2019 Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined ( __ICCARM__ )
|
||||||
|
#pragma system_include /* treat file as system include file for MISRA check */
|
||||||
|
#elif defined (__clang__)
|
||||||
|
#pragma clang system_header /* treat file as system include file */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ARM_MPU_ARMV7_H
|
||||||
|
#define ARM_MPU_ARMV7_H
|
||||||
|
|
||||||
|
#define ARM_MPU_REGION_SIZE_32B ((uint8_t)0x04U) ///!< MPU Region Size 32 Bytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_64B ((uint8_t)0x05U) ///!< MPU Region Size 64 Bytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_128B ((uint8_t)0x06U) ///!< MPU Region Size 128 Bytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_256B ((uint8_t)0x07U) ///!< MPU Region Size 256 Bytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_512B ((uint8_t)0x08U) ///!< MPU Region Size 512 Bytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_1KB ((uint8_t)0x09U) ///!< MPU Region Size 1 KByte
|
||||||
|
#define ARM_MPU_REGION_SIZE_2KB ((uint8_t)0x0AU) ///!< MPU Region Size 2 KBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_4KB ((uint8_t)0x0BU) ///!< MPU Region Size 4 KBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_8KB ((uint8_t)0x0CU) ///!< MPU Region Size 8 KBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_16KB ((uint8_t)0x0DU) ///!< MPU Region Size 16 KBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_32KB ((uint8_t)0x0EU) ///!< MPU Region Size 32 KBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_64KB ((uint8_t)0x0FU) ///!< MPU Region Size 64 KBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_128KB ((uint8_t)0x10U) ///!< MPU Region Size 128 KBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_256KB ((uint8_t)0x11U) ///!< MPU Region Size 256 KBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_512KB ((uint8_t)0x12U) ///!< MPU Region Size 512 KBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_1MB ((uint8_t)0x13U) ///!< MPU Region Size 1 MByte
|
||||||
|
#define ARM_MPU_REGION_SIZE_2MB ((uint8_t)0x14U) ///!< MPU Region Size 2 MBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_4MB ((uint8_t)0x15U) ///!< MPU Region Size 4 MBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_8MB ((uint8_t)0x16U) ///!< MPU Region Size 8 MBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_16MB ((uint8_t)0x17U) ///!< MPU Region Size 16 MBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_32MB ((uint8_t)0x18U) ///!< MPU Region Size 32 MBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_64MB ((uint8_t)0x19U) ///!< MPU Region Size 64 MBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_128MB ((uint8_t)0x1AU) ///!< MPU Region Size 128 MBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_256MB ((uint8_t)0x1BU) ///!< MPU Region Size 256 MBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_512MB ((uint8_t)0x1CU) ///!< MPU Region Size 512 MBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_1GB ((uint8_t)0x1DU) ///!< MPU Region Size 1 GByte
|
||||||
|
#define ARM_MPU_REGION_SIZE_2GB ((uint8_t)0x1EU) ///!< MPU Region Size 2 GBytes
|
||||||
|
#define ARM_MPU_REGION_SIZE_4GB ((uint8_t)0x1FU) ///!< MPU Region Size 4 GBytes
|
||||||
|
|
||||||
|
#define ARM_MPU_AP_NONE 0U ///!< MPU Access Permission no access
|
||||||
|
#define ARM_MPU_AP_PRIV 1U ///!< MPU Access Permission privileged access only
|
||||||
|
#define ARM_MPU_AP_URO 2U ///!< MPU Access Permission unprivileged access read-only
|
||||||
|
#define ARM_MPU_AP_FULL 3U ///!< MPU Access Permission full access
|
||||||
|
#define ARM_MPU_AP_PRO 5U ///!< MPU Access Permission privileged access read-only
|
||||||
|
#define ARM_MPU_AP_RO 6U ///!< MPU Access Permission read-only access
|
||||||
|
|
||||||
|
/** MPU Region Base Address Register Value
|
||||||
|
*
|
||||||
|
* \param Region The region to be configured, number 0 to 15.
|
||||||
|
* \param BaseAddress The base address for the region.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_RBAR(Region, BaseAddress) \
|
||||||
|
(((BaseAddress) & MPU_RBAR_ADDR_Msk) | \
|
||||||
|
((Region) & MPU_RBAR_REGION_Msk) | \
|
||||||
|
(MPU_RBAR_VALID_Msk))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPU Memory Access Attributes
|
||||||
|
*
|
||||||
|
* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral.
|
||||||
|
* \param IsShareable Region is shareable between multiple bus masters.
|
||||||
|
* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache.
|
||||||
|
* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable) \
|
||||||
|
((((TypeExtField) << MPU_RASR_TEX_Pos) & MPU_RASR_TEX_Msk) | \
|
||||||
|
(((IsShareable) << MPU_RASR_S_Pos) & MPU_RASR_S_Msk) | \
|
||||||
|
(((IsCacheable) << MPU_RASR_C_Pos) & MPU_RASR_C_Msk) | \
|
||||||
|
(((IsBufferable) << MPU_RASR_B_Pos) & MPU_RASR_B_Msk))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPU Region Attribute and Size Register Value
|
||||||
|
*
|
||||||
|
* \param DisableExec Instruction access disable bit, 1= disable instruction fetches.
|
||||||
|
* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode.
|
||||||
|
* \param AccessAttributes Memory access attribution, see \ref ARM_MPU_ACCESS_.
|
||||||
|
* \param SubRegionDisable Sub-region disable field.
|
||||||
|
* \param Size Region size of the region to be configured, for example 4K, 8K.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_RASR_EX(DisableExec, AccessPermission, AccessAttributes, SubRegionDisable, Size) \
|
||||||
|
((((DisableExec) << MPU_RASR_XN_Pos) & MPU_RASR_XN_Msk) | \
|
||||||
|
(((AccessPermission) << MPU_RASR_AP_Pos) & MPU_RASR_AP_Msk) | \
|
||||||
|
(((AccessAttributes) & (MPU_RASR_TEX_Msk | MPU_RASR_S_Msk | MPU_RASR_C_Msk | MPU_RASR_B_Msk))) | \
|
||||||
|
(((SubRegionDisable) << MPU_RASR_SRD_Pos) & MPU_RASR_SRD_Msk) | \
|
||||||
|
(((Size) << MPU_RASR_SIZE_Pos) & MPU_RASR_SIZE_Msk) | \
|
||||||
|
(((MPU_RASR_ENABLE_Msk))))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPU Region Attribute and Size Register Value
|
||||||
|
*
|
||||||
|
* \param DisableExec Instruction access disable bit, 1= disable instruction fetches.
|
||||||
|
* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode.
|
||||||
|
* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral.
|
||||||
|
* \param IsShareable Region is shareable between multiple bus masters.
|
||||||
|
* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache.
|
||||||
|
* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy.
|
||||||
|
* \param SubRegionDisable Sub-region disable field.
|
||||||
|
* \param Size Region size of the region to be configured, for example 4K, 8K.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size) \
|
||||||
|
ARM_MPU_RASR_EX(DisableExec, AccessPermission, ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable), SubRegionDisable, Size)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPU Memory Access Attribute for strongly ordered memory.
|
||||||
|
* - TEX: 000b
|
||||||
|
* - Shareable
|
||||||
|
* - Non-cacheable
|
||||||
|
* - Non-bufferable
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_ACCESS_ORDERED ARM_MPU_ACCESS_(0U, 1U, 0U, 0U)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPU Memory Access Attribute for device memory.
|
||||||
|
* - TEX: 000b (if shareable) or 010b (if non-shareable)
|
||||||
|
* - Shareable or non-shareable
|
||||||
|
* - Non-cacheable
|
||||||
|
* - Bufferable (if shareable) or non-bufferable (if non-shareable)
|
||||||
|
*
|
||||||
|
* \param IsShareable Configures the device memory as shareable or non-shareable.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_ACCESS_DEVICE(IsShareable) ((IsShareable) ? ARM_MPU_ACCESS_(0U, 1U, 0U, 1U) : ARM_MPU_ACCESS_(2U, 0U, 0U, 0U))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPU Memory Access Attribute for normal memory.
|
||||||
|
* - TEX: 1BBb (reflecting outer cacheability rules)
|
||||||
|
* - Shareable or non-shareable
|
||||||
|
* - Cacheable or non-cacheable (reflecting inner cacheability rules)
|
||||||
|
* - Bufferable or non-bufferable (reflecting inner cacheability rules)
|
||||||
|
*
|
||||||
|
* \param OuterCp Configures the outer cache policy.
|
||||||
|
* \param InnerCp Configures the inner cache policy.
|
||||||
|
* \param IsShareable Configures the memory as shareable or non-shareable.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_ACCESS_NORMAL(OuterCp, InnerCp, IsShareable) ARM_MPU_ACCESS_((4U | (OuterCp)), IsShareable, ((InnerCp) & 2U), ((InnerCp) & 1U))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPU Memory Access Attribute non-cacheable policy.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_CACHEP_NOCACHE 0U
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPU Memory Access Attribute write-back, write and read allocate policy.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_CACHEP_WB_WRA 1U
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPU Memory Access Attribute write-through, no write allocate policy.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_CACHEP_WT_NWA 2U
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MPU Memory Access Attribute write-back, no write allocate policy.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_CACHEP_WB_NWA 3U
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Struct for a single MPU Region
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
uint32_t RBAR; //!< The region base address register value (RBAR)
|
||||||
|
uint32_t RASR; //!< The region attribute and size register value (RASR) \ref MPU_RASR
|
||||||
|
} ARM_MPU_Region_t;
|
||||||
|
|
||||||
|
/** Enable the MPU.
|
||||||
|
* \param MPU_Control Default access permissions for unconfigured regions.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control)
|
||||||
|
{
|
||||||
|
MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
|
||||||
|
#ifdef SCB_SHCSR_MEMFAULTENA_Msk
|
||||||
|
SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
|
||||||
|
#endif
|
||||||
|
__DSB();
|
||||||
|
__ISB();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Disable the MPU.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_Disable(void)
|
||||||
|
{
|
||||||
|
__DMB();
|
||||||
|
#ifdef SCB_SHCSR_MEMFAULTENA_Msk
|
||||||
|
SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
|
||||||
|
#endif
|
||||||
|
MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Clear and disable the given MPU region.
|
||||||
|
* \param rnr Region number to be cleared.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr)
|
||||||
|
{
|
||||||
|
MPU->RNR = rnr;
|
||||||
|
MPU->RASR = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configure an MPU region.
|
||||||
|
* \param rbar Value for RBAR register.
|
||||||
|
* \param rsar Value for RSAR register.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rbar, uint32_t rasr)
|
||||||
|
{
|
||||||
|
MPU->RBAR = rbar;
|
||||||
|
MPU->RASR = rasr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configure the given MPU region.
|
||||||
|
* \param rnr Region number to be configured.
|
||||||
|
* \param rbar Value for RBAR register.
|
||||||
|
* \param rsar Value for RSAR register.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_SetRegionEx(uint32_t rnr, uint32_t rbar, uint32_t rasr)
|
||||||
|
{
|
||||||
|
MPU->RNR = rnr;
|
||||||
|
MPU->RBAR = rbar;
|
||||||
|
MPU->RASR = rasr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Memcopy with strictly ordered memory access, e.g. for register targets.
|
||||||
|
* \param dst Destination data is copied to.
|
||||||
|
* \param src Source data is copied from.
|
||||||
|
* \param len Amount of data words to be copied.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_OrderedMemcpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len)
|
||||||
|
{
|
||||||
|
uint32_t i;
|
||||||
|
for (i = 0U; i < len; ++i)
|
||||||
|
{
|
||||||
|
dst[i] = src[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Load the given number of MPU regions from a table.
|
||||||
|
* \param table Pointer to the MPU configuration table.
|
||||||
|
* \param cnt Amount of regions to be configured.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_Load(ARM_MPU_Region_t const* table, uint32_t cnt)
|
||||||
|
{
|
||||||
|
const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U;
|
||||||
|
while (cnt > MPU_TYPE_RALIASES) {
|
||||||
|
ARM_MPU_OrderedMemcpy(&(MPU->RBAR), &(table->RBAR), MPU_TYPE_RALIASES*rowWordSize);
|
||||||
|
table += MPU_TYPE_RALIASES;
|
||||||
|
cnt -= MPU_TYPE_RALIASES;
|
||||||
|
}
|
||||||
|
ARM_MPU_OrderedMemcpy(&(MPU->RBAR), &(table->RBAR), cnt*rowWordSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
346
Drivers/CMSIS/Include/mpu_armv8.h
Normal file
346
Drivers/CMSIS/Include/mpu_armv8.h
Normal file
@ -0,0 +1,346 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* @file mpu_armv8.h
|
||||||
|
* @brief CMSIS MPU API for Armv8-M and Armv8.1-M MPU
|
||||||
|
* @version V5.1.0
|
||||||
|
* @date 08. March 2019
|
||||||
|
******************************************************************************/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017-2019 Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined ( __ICCARM__ )
|
||||||
|
#pragma system_include /* treat file as system include file for MISRA check */
|
||||||
|
#elif defined (__clang__)
|
||||||
|
#pragma clang system_header /* treat file as system include file */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ARM_MPU_ARMV8_H
|
||||||
|
#define ARM_MPU_ARMV8_H
|
||||||
|
|
||||||
|
/** \brief Attribute for device memory (outer only) */
|
||||||
|
#define ARM_MPU_ATTR_DEVICE ( 0U )
|
||||||
|
|
||||||
|
/** \brief Attribute for non-cacheable, normal memory */
|
||||||
|
#define ARM_MPU_ATTR_NON_CACHEABLE ( 4U )
|
||||||
|
|
||||||
|
/** \brief Attribute for normal memory (outer and inner)
|
||||||
|
* \param NT Non-Transient: Set to 1 for non-transient data.
|
||||||
|
* \param WB Write-Back: Set to 1 to use write-back update policy.
|
||||||
|
* \param RA Read Allocation: Set to 1 to use cache allocation on read miss.
|
||||||
|
* \param WA Write Allocation: Set to 1 to use cache allocation on write miss.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_ATTR_MEMORY_(NT, WB, RA, WA) \
|
||||||
|
(((NT & 1U) << 3U) | ((WB & 1U) << 2U) | ((RA & 1U) << 1U) | (WA & 1U))
|
||||||
|
|
||||||
|
/** \brief Device memory type non Gathering, non Re-ordering, non Early Write Acknowledgement */
|
||||||
|
#define ARM_MPU_ATTR_DEVICE_nGnRnE (0U)
|
||||||
|
|
||||||
|
/** \brief Device memory type non Gathering, non Re-ordering, Early Write Acknowledgement */
|
||||||
|
#define ARM_MPU_ATTR_DEVICE_nGnRE (1U)
|
||||||
|
|
||||||
|
/** \brief Device memory type non Gathering, Re-ordering, Early Write Acknowledgement */
|
||||||
|
#define ARM_MPU_ATTR_DEVICE_nGRE (2U)
|
||||||
|
|
||||||
|
/** \brief Device memory type Gathering, Re-ordering, Early Write Acknowledgement */
|
||||||
|
#define ARM_MPU_ATTR_DEVICE_GRE (3U)
|
||||||
|
|
||||||
|
/** \brief Memory Attribute
|
||||||
|
* \param O Outer memory attributes
|
||||||
|
* \param I O == ARM_MPU_ATTR_DEVICE: Device memory attributes, else: Inner memory attributes
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_ATTR(O, I) (((O & 0xFU) << 4U) | (((O & 0xFU) != 0U) ? (I & 0xFU) : ((I & 0x3U) << 2U)))
|
||||||
|
|
||||||
|
/** \brief Normal memory non-shareable */
|
||||||
|
#define ARM_MPU_SH_NON (0U)
|
||||||
|
|
||||||
|
/** \brief Normal memory outer shareable */
|
||||||
|
#define ARM_MPU_SH_OUTER (2U)
|
||||||
|
|
||||||
|
/** \brief Normal memory inner shareable */
|
||||||
|
#define ARM_MPU_SH_INNER (3U)
|
||||||
|
|
||||||
|
/** \brief Memory access permissions
|
||||||
|
* \param RO Read-Only: Set to 1 for read-only memory.
|
||||||
|
* \param NP Non-Privileged: Set to 1 for non-privileged memory.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_AP_(RO, NP) (((RO & 1U) << 1U) | (NP & 1U))
|
||||||
|
|
||||||
|
/** \brief Region Base Address Register value
|
||||||
|
* \param BASE The base address bits [31:5] of a memory region. The value is zero extended. Effective address gets 32 byte aligned.
|
||||||
|
* \param SH Defines the Shareability domain for this memory region.
|
||||||
|
* \param RO Read-Only: Set to 1 for a read-only memory region.
|
||||||
|
* \param NP Non-Privileged: Set to 1 for a non-privileged memory region.
|
||||||
|
* \oaram XN eXecute Never: Set to 1 for a non-executable memory region.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_RBAR(BASE, SH, RO, NP, XN) \
|
||||||
|
((BASE & MPU_RBAR_BASE_Msk) | \
|
||||||
|
((SH << MPU_RBAR_SH_Pos) & MPU_RBAR_SH_Msk) | \
|
||||||
|
((ARM_MPU_AP_(RO, NP) << MPU_RBAR_AP_Pos) & MPU_RBAR_AP_Msk) | \
|
||||||
|
((XN << MPU_RBAR_XN_Pos) & MPU_RBAR_XN_Msk))
|
||||||
|
|
||||||
|
/** \brief Region Limit Address Register value
|
||||||
|
* \param LIMIT The limit address bits [31:5] for this memory region. The value is one extended.
|
||||||
|
* \param IDX The attribute index to be associated with this memory region.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_RLAR(LIMIT, IDX) \
|
||||||
|
((LIMIT & MPU_RLAR_LIMIT_Msk) | \
|
||||||
|
((IDX << MPU_RLAR_AttrIndx_Pos) & MPU_RLAR_AttrIndx_Msk) | \
|
||||||
|
(MPU_RLAR_EN_Msk))
|
||||||
|
|
||||||
|
#if defined(MPU_RLAR_PXN_Pos)
|
||||||
|
|
||||||
|
/** \brief Region Limit Address Register with PXN value
|
||||||
|
* \param LIMIT The limit address bits [31:5] for this memory region. The value is one extended.
|
||||||
|
* \param PXN Privileged execute never. Defines whether code can be executed from this privileged region.
|
||||||
|
* \param IDX The attribute index to be associated with this memory region.
|
||||||
|
*/
|
||||||
|
#define ARM_MPU_RLAR_PXN(LIMIT, PXN, IDX) \
|
||||||
|
((LIMIT & MPU_RLAR_LIMIT_Msk) | \
|
||||||
|
((PXN << MPU_RLAR_PXN_Pos) & MPU_RLAR_PXN_Msk) | \
|
||||||
|
((IDX << MPU_RLAR_AttrIndx_Pos) & MPU_RLAR_AttrIndx_Msk) | \
|
||||||
|
(MPU_RLAR_EN_Msk))
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Struct for a single MPU Region
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
uint32_t RBAR; /*!< Region Base Address Register value */
|
||||||
|
uint32_t RLAR; /*!< Region Limit Address Register value */
|
||||||
|
} ARM_MPU_Region_t;
|
||||||
|
|
||||||
|
/** Enable the MPU.
|
||||||
|
* \param MPU_Control Default access permissions for unconfigured regions.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control)
|
||||||
|
{
|
||||||
|
MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
|
||||||
|
#ifdef SCB_SHCSR_MEMFAULTENA_Msk
|
||||||
|
SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
|
||||||
|
#endif
|
||||||
|
__DSB();
|
||||||
|
__ISB();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Disable the MPU.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_Disable(void)
|
||||||
|
{
|
||||||
|
__DMB();
|
||||||
|
#ifdef SCB_SHCSR_MEMFAULTENA_Msk
|
||||||
|
SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
|
||||||
|
#endif
|
||||||
|
MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MPU_NS
|
||||||
|
/** Enable the Non-secure MPU.
|
||||||
|
* \param MPU_Control Default access permissions for unconfigured regions.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_Enable_NS(uint32_t MPU_Control)
|
||||||
|
{
|
||||||
|
MPU_NS->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
|
||||||
|
#ifdef SCB_SHCSR_MEMFAULTENA_Msk
|
||||||
|
SCB_NS->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
|
||||||
|
#endif
|
||||||
|
__DSB();
|
||||||
|
__ISB();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Disable the Non-secure MPU.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_Disable_NS(void)
|
||||||
|
{
|
||||||
|
__DMB();
|
||||||
|
#ifdef SCB_SHCSR_MEMFAULTENA_Msk
|
||||||
|
SCB_NS->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
|
||||||
|
#endif
|
||||||
|
MPU_NS->CTRL &= ~MPU_CTRL_ENABLE_Msk;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Set the memory attribute encoding to the given MPU.
|
||||||
|
* \param mpu Pointer to the MPU to be configured.
|
||||||
|
* \param idx The attribute index to be set [0-7]
|
||||||
|
* \param attr The attribute value to be set.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_SetMemAttrEx(MPU_Type* mpu, uint8_t idx, uint8_t attr)
|
||||||
|
{
|
||||||
|
const uint8_t reg = idx / 4U;
|
||||||
|
const uint32_t pos = ((idx % 4U) * 8U);
|
||||||
|
const uint32_t mask = 0xFFU << pos;
|
||||||
|
|
||||||
|
if (reg >= (sizeof(mpu->MAIR) / sizeof(mpu->MAIR[0]))) {
|
||||||
|
return; // invalid index
|
||||||
|
}
|
||||||
|
|
||||||
|
mpu->MAIR[reg] = ((mpu->MAIR[reg] & ~mask) | ((attr << pos) & mask));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set the memory attribute encoding.
|
||||||
|
* \param idx The attribute index to be set [0-7]
|
||||||
|
* \param attr The attribute value to be set.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_SetMemAttr(uint8_t idx, uint8_t attr)
|
||||||
|
{
|
||||||
|
ARM_MPU_SetMemAttrEx(MPU, idx, attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MPU_NS
|
||||||
|
/** Set the memory attribute encoding to the Non-secure MPU.
|
||||||
|
* \param idx The attribute index to be set [0-7]
|
||||||
|
* \param attr The attribute value to be set.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_SetMemAttr_NS(uint8_t idx, uint8_t attr)
|
||||||
|
{
|
||||||
|
ARM_MPU_SetMemAttrEx(MPU_NS, idx, attr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Clear and disable the given MPU region of the given MPU.
|
||||||
|
* \param mpu Pointer to MPU to be used.
|
||||||
|
* \param rnr Region number to be cleared.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_ClrRegionEx(MPU_Type* mpu, uint32_t rnr)
|
||||||
|
{
|
||||||
|
mpu->RNR = rnr;
|
||||||
|
mpu->RLAR = 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Clear and disable the given MPU region.
|
||||||
|
* \param rnr Region number to be cleared.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr)
|
||||||
|
{
|
||||||
|
ARM_MPU_ClrRegionEx(MPU, rnr);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MPU_NS
|
||||||
|
/** Clear and disable the given Non-secure MPU region.
|
||||||
|
* \param rnr Region number to be cleared.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_ClrRegion_NS(uint32_t rnr)
|
||||||
|
{
|
||||||
|
ARM_MPU_ClrRegionEx(MPU_NS, rnr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Configure the given MPU region of the given MPU.
|
||||||
|
* \param mpu Pointer to MPU to be used.
|
||||||
|
* \param rnr Region number to be configured.
|
||||||
|
* \param rbar Value for RBAR register.
|
||||||
|
* \param rlar Value for RLAR register.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_SetRegionEx(MPU_Type* mpu, uint32_t rnr, uint32_t rbar, uint32_t rlar)
|
||||||
|
{
|
||||||
|
mpu->RNR = rnr;
|
||||||
|
mpu->RBAR = rbar;
|
||||||
|
mpu->RLAR = rlar;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Configure the given MPU region.
|
||||||
|
* \param rnr Region number to be configured.
|
||||||
|
* \param rbar Value for RBAR register.
|
||||||
|
* \param rlar Value for RLAR register.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rnr, uint32_t rbar, uint32_t rlar)
|
||||||
|
{
|
||||||
|
ARM_MPU_SetRegionEx(MPU, rnr, rbar, rlar);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MPU_NS
|
||||||
|
/** Configure the given Non-secure MPU region.
|
||||||
|
* \param rnr Region number to be configured.
|
||||||
|
* \param rbar Value for RBAR register.
|
||||||
|
* \param rlar Value for RLAR register.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_SetRegion_NS(uint32_t rnr, uint32_t rbar, uint32_t rlar)
|
||||||
|
{
|
||||||
|
ARM_MPU_SetRegionEx(MPU_NS, rnr, rbar, rlar);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Memcopy with strictly ordered memory access, e.g. for register targets.
|
||||||
|
* \param dst Destination data is copied to.
|
||||||
|
* \param src Source data is copied from.
|
||||||
|
* \param len Amount of data words to be copied.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_OrderedMemcpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len)
|
||||||
|
{
|
||||||
|
uint32_t i;
|
||||||
|
for (i = 0U; i < len; ++i)
|
||||||
|
{
|
||||||
|
dst[i] = src[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Load the given number of MPU regions from a table to the given MPU.
|
||||||
|
* \param mpu Pointer to the MPU registers to be used.
|
||||||
|
* \param rnr First region number to be configured.
|
||||||
|
* \param table Pointer to the MPU configuration table.
|
||||||
|
* \param cnt Amount of regions to be configured.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_LoadEx(MPU_Type* mpu, uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt)
|
||||||
|
{
|
||||||
|
const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U;
|
||||||
|
if (cnt == 1U) {
|
||||||
|
mpu->RNR = rnr;
|
||||||
|
ARM_MPU_OrderedMemcpy(&(mpu->RBAR), &(table->RBAR), rowWordSize);
|
||||||
|
} else {
|
||||||
|
uint32_t rnrBase = rnr & ~(MPU_TYPE_RALIASES-1U);
|
||||||
|
uint32_t rnrOffset = rnr % MPU_TYPE_RALIASES;
|
||||||
|
|
||||||
|
mpu->RNR = rnrBase;
|
||||||
|
while ((rnrOffset + cnt) > MPU_TYPE_RALIASES) {
|
||||||
|
uint32_t c = MPU_TYPE_RALIASES - rnrOffset;
|
||||||
|
ARM_MPU_OrderedMemcpy(&(mpu->RBAR)+(rnrOffset*2U), &(table->RBAR), c*rowWordSize);
|
||||||
|
table += c;
|
||||||
|
cnt -= c;
|
||||||
|
rnrOffset = 0U;
|
||||||
|
rnrBase += MPU_TYPE_RALIASES;
|
||||||
|
mpu->RNR = rnrBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
ARM_MPU_OrderedMemcpy(&(mpu->RBAR)+(rnrOffset*2U), &(table->RBAR), cnt*rowWordSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Load the given number of MPU regions from a table.
|
||||||
|
* \param rnr First region number to be configured.
|
||||||
|
* \param table Pointer to the MPU configuration table.
|
||||||
|
* \param cnt Amount of regions to be configured.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_Load(uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt)
|
||||||
|
{
|
||||||
|
ARM_MPU_LoadEx(MPU, rnr, table, cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MPU_NS
|
||||||
|
/** Load the given number of MPU regions from a table to the Non-secure MPU.
|
||||||
|
* \param rnr First region number to be configured.
|
||||||
|
* \param table Pointer to the MPU configuration table.
|
||||||
|
* \param cnt Amount of regions to be configured.
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void ARM_MPU_Load_NS(uint32_t rnr, ARM_MPU_Region_t const* table, uint32_t cnt)
|
||||||
|
{
|
||||||
|
ARM_MPU_LoadEx(MPU_NS, rnr, table, cnt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
70
Drivers/CMSIS/Include/tz_context.h
Normal file
70
Drivers/CMSIS/Include/tz_context.h
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* @file tz_context.h
|
||||||
|
* @brief Context Management for Armv8-M TrustZone
|
||||||
|
* @version V1.0.1
|
||||||
|
* @date 10. January 2018
|
||||||
|
******************************************************************************/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017-2018 Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined ( __ICCARM__ )
|
||||||
|
#pragma system_include /* treat file as system include file for MISRA check */
|
||||||
|
#elif defined (__clang__)
|
||||||
|
#pragma clang system_header /* treat file as system include file */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TZ_CONTEXT_H
|
||||||
|
#define TZ_CONTEXT_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifndef TZ_MODULEID_T
|
||||||
|
#define TZ_MODULEID_T
|
||||||
|
/// \details Data type that identifies secure software modules called by a process.
|
||||||
|
typedef uint32_t TZ_ModuleId_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// \details TZ Memory ID identifies an allocated memory slot.
|
||||||
|
typedef uint32_t TZ_MemoryId_t;
|
||||||
|
|
||||||
|
/// Initialize secure context memory system
|
||||||
|
/// \return execution status (1: success, 0: error)
|
||||||
|
uint32_t TZ_InitContextSystem_S (void);
|
||||||
|
|
||||||
|
/// Allocate context memory for calling secure software modules in TrustZone
|
||||||
|
/// \param[in] module identifies software modules called from non-secure mode
|
||||||
|
/// \return value != 0 id TrustZone memory slot identifier
|
||||||
|
/// \return value 0 no memory available or internal error
|
||||||
|
TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
|
||||||
|
|
||||||
|
/// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
|
||||||
|
/// \param[in] id TrustZone memory slot identifier
|
||||||
|
/// \return execution status (1: success, 0: error)
|
||||||
|
uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
|
||||||
|
|
||||||
|
/// Load secure context (called on RTOS thread context switch)
|
||||||
|
/// \param[in] id TrustZone memory slot identifier
|
||||||
|
/// \return execution status (1: success, 0: error)
|
||||||
|
uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
|
||||||
|
|
||||||
|
/// Store secure context (called on RTOS thread context switch)
|
||||||
|
/// \param[in] id TrustZone memory slot identifier
|
||||||
|
/// \return execution status (1: success, 0: error)
|
||||||
|
uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
|
||||||
|
|
||||||
|
#endif // TZ_CONTEXT_H
|
201
Drivers/CMSIS/LICENSE.txt
Normal file
201
Drivers/CMSIS/LICENSE.txt
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright {yyyy} {name of copyright owner}
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
5419
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_adc.h
Normal file
5419
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_adc.h
Normal file
File diff suppressed because it is too large
Load Diff
1306
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_bus.h
Normal file
1306
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_bus.h
Normal file
File diff suppressed because it is too large
Load Diff
585
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_cortex.h
Normal file
585
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_cortex.h
Normal file
@ -0,0 +1,585 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_cortex.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file of CORTEX LL module.
|
||||||
|
@verbatim
|
||||||
|
==============================================================================
|
||||||
|
##### How to use this driver #####
|
||||||
|
==============================================================================
|
||||||
|
[..]
|
||||||
|
The LL CORTEX driver contains a set of generic APIs that can be
|
||||||
|
used by user:
|
||||||
|
(+) SYSTICK configuration used by LL_mDelay and LL_Init1msTick
|
||||||
|
functions
|
||||||
|
(+) Low power mode configuration (SCB register of Cortex-MCU)
|
||||||
|
(+) MPU API to configure and enable regions
|
||||||
|
(+) API to access to MCU info (CPUID register)
|
||||||
|
|
||||||
|
@endverbatim
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file in
|
||||||
|
* the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef STM32G0xx_LL_CORTEX_H
|
||||||
|
#define STM32G0xx_LL_CORTEX_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL CORTEX
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/** @defgroup CORTEX_LL_Exported_Constants CORTEX Exported Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EC_CLKSOURCE_HCLK SYSTICK Clock Source
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_SYSTICK_CLKSOURCE_HCLK_DIV8 0x00000000U /*!< AHB clock divided by 8 selected as SysTick clock source.*/
|
||||||
|
#define LL_SYSTICK_CLKSOURCE_HCLK SysTick_CTRL_CLKSOURCE_Msk /*!< AHB clock selected as SysTick clock source. */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if __MPU_PRESENT
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EC_CTRL_HFNMI_PRIVDEF MPU Control
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_MPU_CTRL_HFNMI_PRIVDEF_NONE 0x00000000U /*!< Disable NMI and privileged SW access */
|
||||||
|
#define LL_MPU_CTRL_HARDFAULT_NMI MPU_CTRL_HFNMIENA_Msk /*!< Enables the operation of MPU during hard fault, NMI, and FAULTMASK handlers */
|
||||||
|
#define LL_MPU_CTRL_PRIVILEGED_DEFAULT MPU_CTRL_PRIVDEFENA_Msk /*!< Enable privileged software access to default memory map */
|
||||||
|
#define LL_MPU_CTRL_HFNMI_PRIVDEF (MPU_CTRL_HFNMIENA_Msk | MPU_CTRL_PRIVDEFENA_Msk) /*!< Enable NMI and privileged SW access */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EC_REGION MPU Region Number
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_MPU_REGION_NUMBER0 0x00U /*!< REGION Number 0 */
|
||||||
|
#define LL_MPU_REGION_NUMBER1 0x01U /*!< REGION Number 1 */
|
||||||
|
#define LL_MPU_REGION_NUMBER2 0x02U /*!< REGION Number 2 */
|
||||||
|
#define LL_MPU_REGION_NUMBER3 0x03U /*!< REGION Number 3 */
|
||||||
|
#define LL_MPU_REGION_NUMBER4 0x04U /*!< REGION Number 4 */
|
||||||
|
#define LL_MPU_REGION_NUMBER5 0x05U /*!< REGION Number 5 */
|
||||||
|
#define LL_MPU_REGION_NUMBER6 0x06U /*!< REGION Number 6 */
|
||||||
|
#define LL_MPU_REGION_NUMBER7 0x07U /*!< REGION Number 7 */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EC_REGION_SIZE MPU Region Size
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_MPU_REGION_SIZE_256B (0x07U << MPU_RASR_SIZE_Pos) /*!< 256B Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_512B (0x08U << MPU_RASR_SIZE_Pos) /*!< 512B Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_1KB (0x09U << MPU_RASR_SIZE_Pos) /*!< 1KB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_2KB (0x0AU << MPU_RASR_SIZE_Pos) /*!< 2KB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_4KB (0x0BU << MPU_RASR_SIZE_Pos) /*!< 4KB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_8KB (0x0CU << MPU_RASR_SIZE_Pos) /*!< 8KB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_16KB (0x0DU << MPU_RASR_SIZE_Pos) /*!< 16KB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_32KB (0x0EU << MPU_RASR_SIZE_Pos) /*!< 32KB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_64KB (0x0FU << MPU_RASR_SIZE_Pos) /*!< 64KB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_128KB (0x10U << MPU_RASR_SIZE_Pos) /*!< 128KB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_256KB (0x11U << MPU_RASR_SIZE_Pos) /*!< 256KB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_512KB (0x12U << MPU_RASR_SIZE_Pos) /*!< 512KB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_1MB (0x13U << MPU_RASR_SIZE_Pos) /*!< 1MB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_2MB (0x14U << MPU_RASR_SIZE_Pos) /*!< 2MB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_4MB (0x15U << MPU_RASR_SIZE_Pos) /*!< 4MB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_8MB (0x16U << MPU_RASR_SIZE_Pos) /*!< 8MB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_16MB (0x17U << MPU_RASR_SIZE_Pos) /*!< 16MB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_32MB (0x18U << MPU_RASR_SIZE_Pos) /*!< 32MB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_64MB (0x19U << MPU_RASR_SIZE_Pos) /*!< 64MB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_128MB (0x1AU << MPU_RASR_SIZE_Pos) /*!< 128MB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_256MB (0x1BU << MPU_RASR_SIZE_Pos) /*!< 256MB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_512MB (0x1CU << MPU_RASR_SIZE_Pos) /*!< 512MB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_1GB (0x1DU << MPU_RASR_SIZE_Pos) /*!< 1GB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_2GB (0x1EU << MPU_RASR_SIZE_Pos) /*!< 2GB Size of the MPU protection region */
|
||||||
|
#define LL_MPU_REGION_SIZE_4GB (0x1FU << MPU_RASR_SIZE_Pos) /*!< 4GB Size of the MPU protection region */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EC_REGION_PRIVILEDGES MPU Region Privileges
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_MPU_REGION_NO_ACCESS (0x00U << MPU_RASR_AP_Pos) /*!< No access*/
|
||||||
|
#define LL_MPU_REGION_PRIV_RW (0x01U << MPU_RASR_AP_Pos) /*!< RW privileged (privileged access only)*/
|
||||||
|
#define LL_MPU_REGION_PRIV_RW_URO (0x02U << MPU_RASR_AP_Pos) /*!< RW privileged - RO user (Write in a user program generates a fault) */
|
||||||
|
#define LL_MPU_REGION_FULL_ACCESS (0x03U << MPU_RASR_AP_Pos) /*!< RW privileged & user (Full access) */
|
||||||
|
#define LL_MPU_REGION_PRIV_RO (0x05U << MPU_RASR_AP_Pos) /*!< RO privileged (privileged read only)*/
|
||||||
|
#define LL_MPU_REGION_PRIV_RO_URO (0x06U << MPU_RASR_AP_Pos) /*!< RO privileged & user (read only) */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EC_TEX MPU TEX Level
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_MPU_TEX_LEVEL0 (0x00U << MPU_RASR_TEX_Pos) /*!< b000 for TEX bits */
|
||||||
|
#define LL_MPU_TEX_LEVEL1 (0x01U << MPU_RASR_TEX_Pos) /*!< b001 for TEX bits */
|
||||||
|
#define LL_MPU_TEX_LEVEL2 (0x02U << MPU_RASR_TEX_Pos) /*!< b010 for TEX bits */
|
||||||
|
#define LL_MPU_TEX_LEVEL4 (0x04U << MPU_RASR_TEX_Pos) /*!< b100 for TEX bits */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EC_INSTRUCTION_ACCESS MPU Instruction Access
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_MPU_INSTRUCTION_ACCESS_ENABLE 0x00U /*!< Instruction fetches enabled */
|
||||||
|
#define LL_MPU_INSTRUCTION_ACCESS_DISABLE MPU_RASR_XN_Msk /*!< Instruction fetches disabled*/
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EC_SHAREABLE_ACCESS MPU Shareable Access
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_MPU_ACCESS_SHAREABLE MPU_RASR_S_Msk /*!< Shareable memory attribute */
|
||||||
|
#define LL_MPU_ACCESS_NOT_SHAREABLE 0x00U /*!< Not Shareable memory attribute */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EC_CACHEABLE_ACCESS MPU Cacheable Access
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_MPU_ACCESS_CACHEABLE MPU_RASR_C_Msk /*!< Cacheable memory attribute */
|
||||||
|
#define LL_MPU_ACCESS_NOT_CACHEABLE 0x00U /*!< Not Cacheable memory attribute */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EC_BUFFERABLE_ACCESS MPU Bufferable Access
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_MPU_ACCESS_BUFFERABLE MPU_RASR_B_Msk /*!< Bufferable memory attribute */
|
||||||
|
#define LL_MPU_ACCESS_NOT_BUFFERABLE 0x00U /*!< Not Bufferable memory attribute */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /* __MPU_PRESENT */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @defgroup CORTEX_LL_Exported_Functions CORTEX Exported Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EF_SYSTICK SYSTICK
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function checks if the Systick counter flag is active or not.
|
||||||
|
* @note It can be used in timeout function on application side.
|
||||||
|
* @rmtoll STK_CTRL COUNTFLAG LL_SYSTICK_IsActiveCounterFlag
|
||||||
|
* @retval State of bit (1 or 0).
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_SYSTICK_IsActiveCounterFlag(void)
|
||||||
|
{
|
||||||
|
return (((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) == (SysTick_CTRL_COUNTFLAG_Msk)) ? 1UL : 0UL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configures the SysTick clock source
|
||||||
|
* @rmtoll STK_CTRL CLKSOURCE LL_SYSTICK_SetClkSource
|
||||||
|
* @param Source This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_SYSTICK_CLKSOURCE_HCLK_DIV8
|
||||||
|
* @arg @ref LL_SYSTICK_CLKSOURCE_HCLK
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_SYSTICK_SetClkSource(uint32_t Source)
|
||||||
|
{
|
||||||
|
if (Source == LL_SYSTICK_CLKSOURCE_HCLK)
|
||||||
|
{
|
||||||
|
SET_BIT(SysTick->CTRL, LL_SYSTICK_CLKSOURCE_HCLK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CLEAR_BIT(SysTick->CTRL, LL_SYSTICK_CLKSOURCE_HCLK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the SysTick clock source
|
||||||
|
* @rmtoll STK_CTRL CLKSOURCE LL_SYSTICK_GetClkSource
|
||||||
|
* @retval Returned value can be one of the following values:
|
||||||
|
* @arg @ref LL_SYSTICK_CLKSOURCE_HCLK_DIV8
|
||||||
|
* @arg @ref LL_SYSTICK_CLKSOURCE_HCLK
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_SYSTICK_GetClkSource(void)
|
||||||
|
{
|
||||||
|
return READ_BIT(SysTick->CTRL, LL_SYSTICK_CLKSOURCE_HCLK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable SysTick exception request
|
||||||
|
* @rmtoll STK_CTRL TICKINT LL_SYSTICK_EnableIT
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_SYSTICK_EnableIT(void)
|
||||||
|
{
|
||||||
|
SET_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable SysTick exception request
|
||||||
|
* @rmtoll STK_CTRL TICKINT LL_SYSTICK_DisableIT
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_SYSTICK_DisableIT(void)
|
||||||
|
{
|
||||||
|
CLEAR_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if the SYSTICK interrupt is enabled or disabled.
|
||||||
|
* @rmtoll STK_CTRL TICKINT LL_SYSTICK_IsEnabledIT
|
||||||
|
* @retval State of bit (1 or 0).
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_SYSTICK_IsEnabledIT(void)
|
||||||
|
{
|
||||||
|
return ((READ_BIT(SysTick->CTRL, SysTick_CTRL_TICKINT_Msk) == (SysTick_CTRL_TICKINT_Msk)) ? 1UL : 0UL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EF_LOW_POWER_MODE LOW POWER MODE
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Processor uses sleep as its low power mode
|
||||||
|
* @rmtoll SCB_SCR SLEEPDEEP LL_LPM_EnableSleep
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_LPM_EnableSleep(void)
|
||||||
|
{
|
||||||
|
/* Clear SLEEPDEEP bit of Cortex System Control Register */
|
||||||
|
CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Processor uses deep sleep as its low power mode
|
||||||
|
* @rmtoll SCB_SCR SLEEPDEEP LL_LPM_EnableDeepSleep
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_LPM_EnableDeepSleep(void)
|
||||||
|
{
|
||||||
|
/* Set SLEEPDEEP bit of Cortex System Control Register */
|
||||||
|
SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPDEEP_Msk));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configures sleep-on-exit when returning from Handler mode to Thread mode.
|
||||||
|
* @note Setting this bit to 1 enables an interrupt-driven application to avoid returning to an
|
||||||
|
* empty main application.
|
||||||
|
* @rmtoll SCB_SCR SLEEPONEXIT LL_LPM_EnableSleepOnExit
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_LPM_EnableSleepOnExit(void)
|
||||||
|
{
|
||||||
|
/* Set SLEEPONEXIT bit of Cortex System Control Register */
|
||||||
|
SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Do not sleep when returning to Thread mode.
|
||||||
|
* @rmtoll SCB_SCR SLEEPONEXIT LL_LPM_DisableSleepOnExit
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_LPM_DisableSleepOnExit(void)
|
||||||
|
{
|
||||||
|
/* Clear SLEEPONEXIT bit of Cortex System Control Register */
|
||||||
|
CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SLEEPONEXIT_Msk));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enabled events and all interrupts, including disabled interrupts, can wakeup the
|
||||||
|
* processor.
|
||||||
|
* @rmtoll SCB_SCR SEVEONPEND LL_LPM_EnableEventOnPend
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_LPM_EnableEventOnPend(void)
|
||||||
|
{
|
||||||
|
/* Set SEVEONPEND bit of Cortex System Control Register */
|
||||||
|
SET_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Only enabled interrupts or events can wakeup the processor, disabled interrupts are
|
||||||
|
* excluded
|
||||||
|
* @rmtoll SCB_SCR SEVEONPEND LL_LPM_DisableEventOnPend
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_LPM_DisableEventOnPend(void)
|
||||||
|
{
|
||||||
|
/* Clear SEVEONPEND bit of Cortex System Control Register */
|
||||||
|
CLEAR_BIT(SCB->SCR, ((uint32_t)SCB_SCR_SEVONPEND_Msk));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup CORTEX_LL_EF_MCU_INFO MCU INFO
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Implementer code
|
||||||
|
* @rmtoll SCB_CPUID IMPLEMENTER LL_CPUID_GetImplementer
|
||||||
|
* @retval Value should be equal to 0x41 for ARM
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_CPUID_GetImplementer(void)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_IMPLEMENTER_Msk) >> SCB_CPUID_IMPLEMENTER_Pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Variant number (The r value in the rnpn product revision identifier)
|
||||||
|
* @rmtoll SCB_CPUID VARIANT LL_CPUID_GetVariant
|
||||||
|
* @retval Value between 0 and 255 (0x0: revision 0)
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_CPUID_GetVariant(void)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_VARIANT_Msk) >> SCB_CPUID_VARIANT_Pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Architecture number
|
||||||
|
* @rmtoll SCB_CPUID ARCHITECTURE LL_CPUID_GetArchitecture
|
||||||
|
* @retval Value should be equal to 0xC for Cortex-M0+ devices
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_CPUID_GetArchitecture(void)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_ARCHITECTURE_Msk) >> SCB_CPUID_ARCHITECTURE_Pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Part number
|
||||||
|
* @rmtoll SCB_CPUID PARTNO LL_CPUID_GetParNo
|
||||||
|
* @retval Value should be equal to 0xC60 for Cortex-M0+
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_CPUID_GetParNo(void)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_PARTNO_Msk) >> SCB_CPUID_PARTNO_Pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Revision number (The p value in the rnpn product revision identifier, indicates patch release)
|
||||||
|
* @rmtoll SCB_CPUID REVISION LL_CPUID_GetRevision
|
||||||
|
* @retval Value between 0 and 255 (0x1: patch 1)
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_CPUID_GetRevision(void)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(SCB->CPUID, SCB_CPUID_REVISION_Msk) >> SCB_CPUID_REVISION_Pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if __MPU_PRESENT
|
||||||
|
/** @defgroup CORTEX_LL_EF_MPU MPU
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable MPU with input options
|
||||||
|
* @rmtoll MPU_CTRL ENABLE LL_MPU_Enable
|
||||||
|
* @param Options This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_MPU_CTRL_HFNMI_PRIVDEF_NONE
|
||||||
|
* @arg @ref LL_MPU_CTRL_HARDFAULT_NMI
|
||||||
|
* @arg @ref LL_MPU_CTRL_PRIVILEGED_DEFAULT
|
||||||
|
* @arg @ref LL_MPU_CTRL_HFNMI_PRIVDEF
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_MPU_Enable(uint32_t Options)
|
||||||
|
{
|
||||||
|
/* Enable the MPU*/
|
||||||
|
WRITE_REG(MPU->CTRL, (MPU_CTRL_ENABLE_Msk | Options));
|
||||||
|
/* Ensure MPU settings take effects */
|
||||||
|
__DSB();
|
||||||
|
/* Sequence instruction fetches using update settings */
|
||||||
|
__ISB();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable MPU
|
||||||
|
* @rmtoll MPU_CTRL ENABLE LL_MPU_Disable
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_MPU_Disable(void)
|
||||||
|
{
|
||||||
|
/* Make sure outstanding transfers are done */
|
||||||
|
__DMB();
|
||||||
|
/* Disable MPU*/
|
||||||
|
WRITE_REG(MPU->CTRL, 0U);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if MPU is enabled or not
|
||||||
|
* @rmtoll MPU_CTRL ENABLE LL_MPU_IsEnabled
|
||||||
|
* @retval State of bit (1 or 0).
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_MPU_IsEnabled(void)
|
||||||
|
{
|
||||||
|
return ((READ_BIT(MPU->CTRL, MPU_CTRL_ENABLE_Msk) == (MPU_CTRL_ENABLE_Msk)) ? 1UL : 0UL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable a MPU region
|
||||||
|
* @rmtoll MPU_RASR ENABLE LL_MPU_EnableRegion
|
||||||
|
* @param Region This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER0
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER1
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER2
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER3
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER4
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER5
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER6
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER7
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_MPU_EnableRegion(uint32_t Region)
|
||||||
|
{
|
||||||
|
/* Set Region number */
|
||||||
|
WRITE_REG(MPU->RNR, Region);
|
||||||
|
/* Enable the MPU region */
|
||||||
|
SET_BIT(MPU->RASR, MPU_RASR_ENABLE_Msk);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configure and enable a region
|
||||||
|
* @rmtoll MPU_RNR REGION LL_MPU_ConfigRegion\n
|
||||||
|
* MPU_RBAR REGION LL_MPU_ConfigRegion\n
|
||||||
|
* MPU_RBAR ADDR LL_MPU_ConfigRegion\n
|
||||||
|
* MPU_RASR XN LL_MPU_ConfigRegion\n
|
||||||
|
* MPU_RASR AP LL_MPU_ConfigRegion\n
|
||||||
|
* MPU_RASR S LL_MPU_ConfigRegion\n
|
||||||
|
* MPU_RASR C LL_MPU_ConfigRegion\n
|
||||||
|
* MPU_RASR B LL_MPU_ConfigRegion\n
|
||||||
|
* MPU_RASR SIZE LL_MPU_ConfigRegion
|
||||||
|
* @param Region This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER0
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER1
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER2
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER3
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER4
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER5
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER6
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER7
|
||||||
|
* @param Address Value of region base address
|
||||||
|
* @param SubRegionDisable Sub-region disable value between Min_Data = 0x00 and Max_Data = 0xFF
|
||||||
|
* @param Attributes This parameter can be a combination of the following values:
|
||||||
|
* @arg @ref LL_MPU_REGION_SIZE_256B or @ref LL_MPU_REGION_SIZE_512B
|
||||||
|
* or @ref LL_MPU_REGION_SIZE_1KB or @ref LL_MPU_REGION_SIZE_2KB or @ref LL_MPU_REGION_SIZE_4KB or @ref LL_MPU_REGION_SIZE_8KB or @ref LL_MPU_REGION_SIZE_16KB
|
||||||
|
* or @ref LL_MPU_REGION_SIZE_32KB or @ref LL_MPU_REGION_SIZE_64KB or @ref LL_MPU_REGION_SIZE_128KB or @ref LL_MPU_REGION_SIZE_256KB or @ref LL_MPU_REGION_SIZE_512KB
|
||||||
|
* or @ref LL_MPU_REGION_SIZE_1MB or @ref LL_MPU_REGION_SIZE_2MB or @ref LL_MPU_REGION_SIZE_4MB or @ref LL_MPU_REGION_SIZE_8MB or @ref LL_MPU_REGION_SIZE_16MB
|
||||||
|
* or @ref LL_MPU_REGION_SIZE_32MB or @ref LL_MPU_REGION_SIZE_64MB or @ref LL_MPU_REGION_SIZE_128MB or @ref LL_MPU_REGION_SIZE_256MB or @ref LL_MPU_REGION_SIZE_512MB
|
||||||
|
* or @ref LL_MPU_REGION_SIZE_1GB or @ref LL_MPU_REGION_SIZE_2GB or @ref LL_MPU_REGION_SIZE_4GB
|
||||||
|
* @arg @ref LL_MPU_REGION_NO_ACCESS or @ref LL_MPU_REGION_PRIV_RW or @ref LL_MPU_REGION_PRIV_RW_URO or @ref LL_MPU_REGION_FULL_ACCESS
|
||||||
|
* or @ref LL_MPU_REGION_PRIV_RO or @ref LL_MPU_REGION_PRIV_RO_URO
|
||||||
|
* @arg @ref LL_MPU_TEX_LEVEL0 or @ref LL_MPU_TEX_LEVEL1 or @ref LL_MPU_TEX_LEVEL2 or @ref LL_MPU_TEX_LEVEL4
|
||||||
|
* @arg @ref LL_MPU_INSTRUCTION_ACCESS_ENABLE or @ref LL_MPU_INSTRUCTION_ACCESS_DISABLE
|
||||||
|
* @arg @ref LL_MPU_ACCESS_SHAREABLE or @ref LL_MPU_ACCESS_NOT_SHAREABLE
|
||||||
|
* @arg @ref LL_MPU_ACCESS_CACHEABLE or @ref LL_MPU_ACCESS_NOT_CACHEABLE
|
||||||
|
* @arg @ref LL_MPU_ACCESS_BUFFERABLE or @ref LL_MPU_ACCESS_NOT_BUFFERABLE
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_MPU_ConfigRegion(uint32_t Region, uint32_t SubRegionDisable, uint32_t Address, uint32_t Attributes)
|
||||||
|
{
|
||||||
|
/* Set Region number */
|
||||||
|
WRITE_REG(MPU->RNR, Region);
|
||||||
|
/* Set base address */
|
||||||
|
WRITE_REG(MPU->RBAR, (Address & 0xFFFFFFE0U));
|
||||||
|
/* Configure MPU */
|
||||||
|
WRITE_REG(MPU->RASR, (MPU_RASR_ENABLE_Msk | Attributes | (SubRegionDisable << MPU_RASR_SRD_Pos)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disable a region
|
||||||
|
* @rmtoll MPU_RNR REGION LL_MPU_DisableRegion\n
|
||||||
|
* MPU_RASR ENABLE LL_MPU_DisableRegion
|
||||||
|
* @param Region This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER0
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER1
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER2
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER3
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER4
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER5
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER6
|
||||||
|
* @arg @ref LL_MPU_REGION_NUMBER7
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_MPU_DisableRegion(uint32_t Region)
|
||||||
|
{
|
||||||
|
/* Set Region number */
|
||||||
|
WRITE_REG(MPU->RNR, Region);
|
||||||
|
/* Disable the MPU region */
|
||||||
|
CLEAR_BIT(MPU->RASR, MPU_RASR_ENABLE_Msk);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* __MPU_PRESENT */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* STM32G0xx_LL_CORTEX_H */
|
||||||
|
|
1801
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_dac.h
Normal file
1801
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_dac.h
Normal file
File diff suppressed because it is too large
Load Diff
2270
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_dma.h
Normal file
2270
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_dma.h
Normal file
File diff suppressed because it is too large
Load Diff
1838
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_dmamux.h
Normal file
1838
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_dmamux.h
Normal file
File diff suppressed because it is too large
Load Diff
1557
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_exti.h
Normal file
1557
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_exti.h
Normal file
File diff suppressed because it is too large
Load Diff
958
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_gpio.h
Normal file
958
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_gpio.h
Normal file
@ -0,0 +1,958 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_gpio.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file of GPIO LL module.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef STM32G0xx_LL_GPIO_H
|
||||||
|
#define STM32G0xx_LL_GPIO_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF)
|
||||||
|
|
||||||
|
/** @defgroup GPIO_LL GPIO
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/** MISRA C:2012 deviation rule has been granted for following rules:
|
||||||
|
* Rule-18.1_d - Medium: Array pointer `GPIOx' is accessed with index [..,..]
|
||||||
|
* which may be out of array bounds [..,UNKNOWN] in following APIs:
|
||||||
|
* LL_GPIO_GetAFPin_0_7
|
||||||
|
* LL_GPIO_SetAFPin_0_7
|
||||||
|
* LL_GPIO_SetAFPin_8_15
|
||||||
|
* LL_GPIO_GetAFPin_8_15
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
#if defined(USE_FULL_LL_DRIVER)
|
||||||
|
/** @defgroup GPIO_LL_Private_Macros GPIO Private Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /*USE_FULL_LL_DRIVER*/
|
||||||
|
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
#if defined(USE_FULL_LL_DRIVER)
|
||||||
|
/** @defgroup GPIO_LL_ES_INIT GPIO Exported Init structures
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief LL GPIO Init Structure definition
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t Pin; /*!< Specifies the GPIO pins to be configured.
|
||||||
|
This parameter can be any value of @ref GPIO_LL_EC_PIN */
|
||||||
|
|
||||||
|
uint32_t Mode; /*!< Specifies the operating mode for the selected pins.
|
||||||
|
This parameter can be a value of @ref GPIO_LL_EC_MODE.
|
||||||
|
|
||||||
|
GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinMode().*/
|
||||||
|
|
||||||
|
uint32_t Speed; /*!< Specifies the speed for the selected pins.
|
||||||
|
This parameter can be a value of @ref GPIO_LL_EC_SPEED.
|
||||||
|
|
||||||
|
GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinSpeed().*/
|
||||||
|
|
||||||
|
uint32_t OutputType; /*!< Specifies the operating output type for the selected pins.
|
||||||
|
This parameter can be a value of @ref GPIO_LL_EC_OUTPUT.
|
||||||
|
|
||||||
|
GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinOutputType().*/
|
||||||
|
|
||||||
|
uint32_t Pull; /*!< Specifies the operating Pull-up/Pull down for the selected pins.
|
||||||
|
This parameter can be a value of @ref GPIO_LL_EC_PULL.
|
||||||
|
|
||||||
|
GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinPull().*/
|
||||||
|
|
||||||
|
uint32_t Alternate; /*!< Specifies the Peripheral to be connected to the selected pins.
|
||||||
|
This parameter can be a value of @ref GPIO_LL_EC_AF.
|
||||||
|
|
||||||
|
GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetAFPin_0_7() and LL_GPIO_SetAFPin_8_15().*/
|
||||||
|
} LL_GPIO_InitTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /* USE_FULL_LL_DRIVER */
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/** @defgroup GPIO_LL_Exported_Constants GPIO Exported Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup GPIO_LL_EC_PIN PIN
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_GPIO_PIN_0 GPIO_BSRR_BS0 /*!< Select pin 0 */
|
||||||
|
#define LL_GPIO_PIN_1 GPIO_BSRR_BS1 /*!< Select pin 1 */
|
||||||
|
#define LL_GPIO_PIN_2 GPIO_BSRR_BS2 /*!< Select pin 2 */
|
||||||
|
#define LL_GPIO_PIN_3 GPIO_BSRR_BS3 /*!< Select pin 3 */
|
||||||
|
#define LL_GPIO_PIN_4 GPIO_BSRR_BS4 /*!< Select pin 4 */
|
||||||
|
#define LL_GPIO_PIN_5 GPIO_BSRR_BS5 /*!< Select pin 5 */
|
||||||
|
#define LL_GPIO_PIN_6 GPIO_BSRR_BS6 /*!< Select pin 6 */
|
||||||
|
#define LL_GPIO_PIN_7 GPIO_BSRR_BS7 /*!< Select pin 7 */
|
||||||
|
#define LL_GPIO_PIN_8 GPIO_BSRR_BS8 /*!< Select pin 8 */
|
||||||
|
#define LL_GPIO_PIN_9 GPIO_BSRR_BS9 /*!< Select pin 9 */
|
||||||
|
#define LL_GPIO_PIN_10 GPIO_BSRR_BS10 /*!< Select pin 10 */
|
||||||
|
#define LL_GPIO_PIN_11 GPIO_BSRR_BS11 /*!< Select pin 11 */
|
||||||
|
#define LL_GPIO_PIN_12 GPIO_BSRR_BS12 /*!< Select pin 12 */
|
||||||
|
#define LL_GPIO_PIN_13 GPIO_BSRR_BS13 /*!< Select pin 13 */
|
||||||
|
#define LL_GPIO_PIN_14 GPIO_BSRR_BS14 /*!< Select pin 14 */
|
||||||
|
#define LL_GPIO_PIN_15 GPIO_BSRR_BS15 /*!< Select pin 15 */
|
||||||
|
#define LL_GPIO_PIN_ALL (GPIO_BSRR_BS0 | GPIO_BSRR_BS1 | GPIO_BSRR_BS2 | \
|
||||||
|
GPIO_BSRR_BS3 | GPIO_BSRR_BS4 | GPIO_BSRR_BS5 | \
|
||||||
|
GPIO_BSRR_BS6 | GPIO_BSRR_BS7 | GPIO_BSRR_BS8 | \
|
||||||
|
GPIO_BSRR_BS9 | GPIO_BSRR_BS10 | GPIO_BSRR_BS11 | \
|
||||||
|
GPIO_BSRR_BS12 | GPIO_BSRR_BS13 | GPIO_BSRR_BS14 | \
|
||||||
|
GPIO_BSRR_BS15) /*!< Select all pins */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup GPIO_LL_EC_MODE Mode
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_GPIO_MODE_INPUT (0x00000000U) /*!< Select input mode */
|
||||||
|
#define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODE0_0 /*!< Select output mode */
|
||||||
|
#define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODE0_1 /*!< Select alternate function mode */
|
||||||
|
#define LL_GPIO_MODE_ANALOG GPIO_MODER_MODE0 /*!< Select analog mode */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup GPIO_LL_EC_OUTPUT Output Type
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_GPIO_OUTPUT_PUSHPULL (0x00000000U) /*!< Select push-pull as output type */
|
||||||
|
#define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT0 /*!< Select open-drain as output type */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup GPIO_LL_EC_SPEED Output Speed
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_GPIO_SPEED_FREQ_LOW (0x00000000U) /*!< Select I/O low output speed */
|
||||||
|
#define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDR_OSPEED0_0 /*!< Select I/O medium output speed */
|
||||||
|
#define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDR_OSPEED0_1 /*!< Select I/O fast output speed */
|
||||||
|
#define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDR_OSPEED0 /*!< Select I/O high output speed */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#define LL_GPIO_SPEED_LOW LL_GPIO_SPEED_FREQ_LOW
|
||||||
|
#define LL_GPIO_SPEED_MEDIUM LL_GPIO_SPEED_FREQ_MEDIUM
|
||||||
|
#define LL_GPIO_SPEED_FAST LL_GPIO_SPEED_FREQ_HIGH
|
||||||
|
#define LL_GPIO_SPEED_HIGH LL_GPIO_SPEED_FREQ_VERY_HIGH
|
||||||
|
|
||||||
|
|
||||||
|
/** @defgroup GPIO_LL_EC_PULL Pull Up Pull Down
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_GPIO_PULL_NO (0x00000000U) /*!< Select I/O no pull */
|
||||||
|
#define LL_GPIO_PULL_UP GPIO_PUPDR_PUPD0_0 /*!< Select I/O pull up */
|
||||||
|
#define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPD0_1 /*!< Select I/O pull down */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup GPIO_LL_EC_AF Alternate Function
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_GPIO_AF_0 (0x0000000U) /*!< Select alternate function 0 */
|
||||||
|
#define LL_GPIO_AF_1 (0x0000001U) /*!< Select alternate function 1 */
|
||||||
|
#define LL_GPIO_AF_2 (0x0000002U) /*!< Select alternate function 2 */
|
||||||
|
#define LL_GPIO_AF_3 (0x0000003U) /*!< Select alternate function 3 */
|
||||||
|
#define LL_GPIO_AF_4 (0x0000004U) /*!< Select alternate function 4 */
|
||||||
|
#define LL_GPIO_AF_5 (0x0000005U) /*!< Select alternate function 5 */
|
||||||
|
#define LL_GPIO_AF_6 (0x0000006U) /*!< Select alternate function 6 */
|
||||||
|
#define LL_GPIO_AF_7 (0x0000007U) /*!< Select alternate function 7 */
|
||||||
|
#if defined(STM32G0B0xx) || defined(STM32G0B1xx) || defined (STM32G0C1xx)
|
||||||
|
#define LL_GPIO_AF_8 (0x0000008U) /*!< Select alternate function 8 */
|
||||||
|
#define LL_GPIO_AF_9 (0x0000009U) /*!< Select alternate function 9 */
|
||||||
|
#define LL_GPIO_AF_10 (0x000000AU) /*!< Select alternate function 10 */
|
||||||
|
#endif /* STM32G0B0xx || STM32G0B1xx || STM32G0C1xx */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
/** @defgroup GPIO_LL_Exported_Macros GPIO Exported Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup GPIO_LL_EM_WRITE_READ Common Write and read registers Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write a value in GPIO register
|
||||||
|
* @param __INSTANCE__ GPIO Instance
|
||||||
|
* @param __REG__ Register to be written
|
||||||
|
* @param __VALUE__ Value to be written in the register
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
#define LL_GPIO_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read a value in GPIO register
|
||||||
|
* @param __INSTANCE__ GPIO Instance
|
||||||
|
* @param __REG__ Register to be read
|
||||||
|
* @retval Register value
|
||||||
|
*/
|
||||||
|
#define LL_GPIO_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @defgroup GPIO_LL_Exported_Functions GPIO Exported Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup GPIO_LL_EF_Port_Configuration Port Configuration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configure gpio mode for a dedicated pin on dedicated port.
|
||||||
|
* @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
|
||||||
|
* @note Warning: only one pin can be passed as parameter.
|
||||||
|
* @rmtoll MODER MODEy LL_GPIO_SetPinMode
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @param Mode This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_MODE_INPUT
|
||||||
|
* @arg @ref LL_GPIO_MODE_OUTPUT
|
||||||
|
* @arg @ref LL_GPIO_MODE_ALTERNATE
|
||||||
|
* @arg @ref LL_GPIO_MODE_ANALOG
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode)
|
||||||
|
{
|
||||||
|
MODIFY_REG(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODE0), ((Pin * Pin) * Mode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return gpio mode for a dedicated pin on dedicated port.
|
||||||
|
* @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
|
||||||
|
* @note Warning: only one pin can be passed as parameter.
|
||||||
|
* @rmtoll MODER MODEy LL_GPIO_GetPinMode
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @retval Returned value can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_MODE_INPUT
|
||||||
|
* @arg @ref LL_GPIO_MODE_OUTPUT
|
||||||
|
* @arg @ref LL_GPIO_MODE_ALTERNATE
|
||||||
|
* @arg @ref LL_GPIO_MODE_ANALOG
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODE0)) / (Pin * Pin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configure gpio output type for several pins on dedicated port.
|
||||||
|
* @note Output type as to be set when gpio pin is in output or
|
||||||
|
* alternate modes. Possible type are Push-pull or Open-drain.
|
||||||
|
* @rmtoll OTYPER OTy LL_GPIO_SetPinOutputType
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param PinMask This parameter can be a combination of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @arg @ref LL_GPIO_PIN_ALL
|
||||||
|
* @param OutputType This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_OUTPUT_PUSHPULL
|
||||||
|
* @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType)
|
||||||
|
{
|
||||||
|
MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return gpio output type for several pins on dedicated port.
|
||||||
|
* @note Output type as to be set when gpio pin is in output or
|
||||||
|
* alternate modes. Possible type are Push-pull or Open-drain.
|
||||||
|
* @note Warning: only one pin can be passed as parameter.
|
||||||
|
* @rmtoll OTYPER OTy LL_GPIO_GetPinOutputType
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @arg @ref LL_GPIO_PIN_ALL
|
||||||
|
* @retval Returned value can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_OUTPUT_PUSHPULL
|
||||||
|
* @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_GetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t Pin)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(GPIOx->OTYPER, Pin) / Pin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configure gpio speed for a dedicated pin on dedicated port.
|
||||||
|
* @note I/O speed can be Low, Medium, Fast or High speed.
|
||||||
|
* @note Warning: only one pin can be passed as parameter.
|
||||||
|
* @note Refer to datasheet for frequency specifications and the power
|
||||||
|
* supply and load conditions for each speed.
|
||||||
|
* @rmtoll OSPEEDR OSPEEDy LL_GPIO_SetPinSpeed
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @param Speed This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_SPEED_FREQ_LOW
|
||||||
|
* @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
|
||||||
|
* @arg @ref LL_GPIO_SPEED_FREQ_HIGH
|
||||||
|
* @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed)
|
||||||
|
{
|
||||||
|
MODIFY_REG(GPIOx->OSPEEDR, ((Pin * Pin) * GPIO_OSPEEDR_OSPEED0), ((Pin * Pin) * Speed));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return gpio speed for a dedicated pin on dedicated port.
|
||||||
|
* @note I/O speed can be Low, Medium, Fast or High speed.
|
||||||
|
* @note Warning: only one pin can be passed as parameter.
|
||||||
|
* @note Refer to datasheet for frequency specifications and the power
|
||||||
|
* supply and load conditions for each speed.
|
||||||
|
* @rmtoll OSPEEDR OSPEEDy LL_GPIO_GetPinSpeed
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @retval Returned value can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_SPEED_FREQ_LOW
|
||||||
|
* @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
|
||||||
|
* @arg @ref LL_GPIO_SPEED_FREQ_HIGH
|
||||||
|
* @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_GetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(GPIOx->OSPEEDR, ((Pin * Pin) * GPIO_OSPEEDR_OSPEED0)) / (Pin * Pin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port.
|
||||||
|
* @note Warning: only one pin can be passed as parameter.
|
||||||
|
* @rmtoll PUPDR PUPDy LL_GPIO_SetPinPull
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @param Pull This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PULL_NO
|
||||||
|
* @arg @ref LL_GPIO_PULL_UP
|
||||||
|
* @arg @ref LL_GPIO_PULL_DOWN
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull)
|
||||||
|
{
|
||||||
|
MODIFY_REG(GPIOx->PUPDR, ((Pin * Pin) * GPIO_PUPDR_PUPD0), ((Pin * Pin) * Pull));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return gpio pull-up or pull-down for a dedicated pin on a dedicated port
|
||||||
|
* @note Warning: only one pin can be passed as parameter.
|
||||||
|
* @rmtoll PUPDR PUPDy LL_GPIO_GetPinPull
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @retval Returned value can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PULL_NO
|
||||||
|
* @arg @ref LL_GPIO_PULL_UP
|
||||||
|
* @arg @ref LL_GPIO_PULL_DOWN
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_GetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(GPIOx->PUPDR, ((Pin * Pin) * GPIO_PUPDR_PUPD0)) / (Pin * Pin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configure gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
|
||||||
|
* @note Possible values are from AF0 to AF7 depending on target.
|
||||||
|
* @note Warning: only one pin can be passed as parameter.
|
||||||
|
* @rmtoll AFRL AFSELy LL_GPIO_SetAFPin_0_7
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @param Alternate This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_AF_0
|
||||||
|
* @arg @ref LL_GPIO_AF_1
|
||||||
|
* @arg @ref LL_GPIO_AF_2
|
||||||
|
* @arg @ref LL_GPIO_AF_3
|
||||||
|
* @arg @ref LL_GPIO_AF_4
|
||||||
|
* @arg @ref LL_GPIO_AF_5
|
||||||
|
* @arg @ref LL_GPIO_AF_6
|
||||||
|
* @arg @ref LL_GPIO_AF_7
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
|
||||||
|
{
|
||||||
|
MODIFY_REG(GPIOx->AFR[0], ((((Pin * Pin) * Pin) * Pin) * GPIO_AFRL_AFSEL0),
|
||||||
|
((((Pin * Pin) * Pin) * Pin) * Alternate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
|
||||||
|
* @rmtoll AFRL AFSELy LL_GPIO_GetAFPin_0_7
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @retval Returned value can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_AF_0
|
||||||
|
* @arg @ref LL_GPIO_AF_1
|
||||||
|
* @arg @ref LL_GPIO_AF_2
|
||||||
|
* @arg @ref LL_GPIO_AF_3
|
||||||
|
* @arg @ref LL_GPIO_AF_4
|
||||||
|
* @arg @ref LL_GPIO_AF_5
|
||||||
|
* @arg @ref LL_GPIO_AF_6
|
||||||
|
* @arg @ref LL_GPIO_AF_7
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_GetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(GPIOx->AFR[0],
|
||||||
|
((((Pin * Pin) * Pin) * Pin) * GPIO_AFRL_AFSEL0)) / (((Pin * Pin) * Pin) * Pin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
|
||||||
|
* @note Possible values are from AF0 to AF7 depending on target.
|
||||||
|
* @note Warning: only one pin can be passed as parameter.
|
||||||
|
* @rmtoll AFRH AFSELy LL_GPIO_SetAFPin_8_15
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @param Alternate This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_AF_0
|
||||||
|
* @arg @ref LL_GPIO_AF_1
|
||||||
|
* @arg @ref LL_GPIO_AF_2
|
||||||
|
* @arg @ref LL_GPIO_AF_3
|
||||||
|
* @arg @ref LL_GPIO_AF_4
|
||||||
|
* @arg @ref LL_GPIO_AF_5
|
||||||
|
* @arg @ref LL_GPIO_AF_6
|
||||||
|
* @arg @ref LL_GPIO_AF_7
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
|
||||||
|
{
|
||||||
|
MODIFY_REG(GPIOx->AFR[1], (((((Pin >> 8U) * (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)) * GPIO_AFRH_AFSEL8),
|
||||||
|
(((((Pin >> 8U) * (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)) * Alternate));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
|
||||||
|
* @note Possible values are from AF0 to AF7 depending on target.
|
||||||
|
* @rmtoll AFRH AFSELy LL_GPIO_GetAFPin_8_15
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param Pin This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @retval Returned value can be one of the following values:
|
||||||
|
* @arg @ref LL_GPIO_AF_0
|
||||||
|
* @arg @ref LL_GPIO_AF_1
|
||||||
|
* @arg @ref LL_GPIO_AF_2
|
||||||
|
* @arg @ref LL_GPIO_AF_3
|
||||||
|
* @arg @ref LL_GPIO_AF_4
|
||||||
|
* @arg @ref LL_GPIO_AF_5
|
||||||
|
* @arg @ref LL_GPIO_AF_6
|
||||||
|
* @arg @ref LL_GPIO_AF_7
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_GetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_BIT(GPIOx->AFR[1],
|
||||||
|
(((((Pin >> 8U) * (Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)) * GPIO_AFRH_AFSEL8)) / ((((Pin >> 8U) *
|
||||||
|
(Pin >> 8U)) * (Pin >> 8U)) * (Pin >> 8U)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Lock configuration of several pins for a dedicated port.
|
||||||
|
* @note When the lock sequence has been applied on a port bit, the
|
||||||
|
* value of this port bit can no longer be modified until the
|
||||||
|
* next reset.
|
||||||
|
* @note Each lock bit freezes a specific configuration register
|
||||||
|
* (control and alternate function registers).
|
||||||
|
* @rmtoll LCKR LCKK LL_GPIO_LockPin
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param PinMask This parameter can be a combination of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @arg @ref LL_GPIO_PIN_ALL
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
|
||||||
|
{
|
||||||
|
__IO uint32_t temp;
|
||||||
|
WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
|
||||||
|
WRITE_REG(GPIOx->LCKR, PinMask);
|
||||||
|
WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
|
||||||
|
/* Read LCKK register. This read is mandatory to complete key lock sequence */
|
||||||
|
temp = READ_REG(GPIOx->LCKR);
|
||||||
|
(void) temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return 1 if all pins passed as parameter, of a dedicated port, are locked. else Return 0.
|
||||||
|
* @rmtoll LCKR LCKy LL_GPIO_IsPinLocked
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param PinMask This parameter can be a combination of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @arg @ref LL_GPIO_PIN_ALL
|
||||||
|
* @retval State of bit (1 or 0).
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_IsPinLocked(GPIO_TypeDef *GPIOx, uint32_t PinMask)
|
||||||
|
{
|
||||||
|
return ((READ_BIT(GPIOx->LCKR, PinMask) == (PinMask)) ? 1UL : 0UL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return 1 if one of the pin of a dedicated port is locked. else return 0.
|
||||||
|
* @rmtoll LCKR LCKK LL_GPIO_IsAnyPinLocked
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @retval State of bit (1 or 0).
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_IsAnyPinLocked(GPIO_TypeDef *GPIOx)
|
||||||
|
{
|
||||||
|
return ((READ_BIT(GPIOx->LCKR, GPIO_LCKR_LCKK) == (GPIO_LCKR_LCKK)) ? 1UL : 0UL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup GPIO_LL_EF_Data_Access Data Access
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return full input data register value for a dedicated port.
|
||||||
|
* @rmtoll IDR IDy LL_GPIO_ReadInputPort
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @retval Input data register value of port
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_ReadInputPort(GPIO_TypeDef *GPIOx)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_REG(GPIOx->IDR));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return if input data level for several pins of dedicated port is high or low.
|
||||||
|
* @rmtoll IDR IDy LL_GPIO_IsInputPinSet
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param PinMask This parameter can be a combination of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @arg @ref LL_GPIO_PIN_ALL
|
||||||
|
* @retval State of bit (1 or 0).
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_IsInputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask)
|
||||||
|
{
|
||||||
|
return ((READ_BIT(GPIOx->IDR, PinMask) == (PinMask)) ? 1UL : 0UL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write output data register for the port.
|
||||||
|
* @rmtoll ODR ODy LL_GPIO_WriteOutputPort
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param PortValue Level value for each pin of the port
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_WriteOutputPort(GPIO_TypeDef *GPIOx, uint32_t PortValue)
|
||||||
|
{
|
||||||
|
WRITE_REG(GPIOx->ODR, PortValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return full output data register value for a dedicated port.
|
||||||
|
* @rmtoll ODR ODy LL_GPIO_ReadOutputPort
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @retval Output data register value of port
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_ReadOutputPort(GPIO_TypeDef *GPIOx)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_REG(GPIOx->ODR));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Return if input data level for several pins of dedicated port is high or low.
|
||||||
|
* @rmtoll ODR ODy LL_GPIO_IsOutputPinSet
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param PinMask This parameter can be a combination of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @arg @ref LL_GPIO_PIN_ALL
|
||||||
|
* @retval State of bit (1 or 0).
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GPIO_IsOutputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask)
|
||||||
|
{
|
||||||
|
return ((READ_BIT(GPIOx->ODR, PinMask) == (PinMask)) ? 1UL : 0UL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set several pins to high level on dedicated gpio port.
|
||||||
|
* @rmtoll BSRR BSy LL_GPIO_SetOutputPin
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param PinMask This parameter can be a combination of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @arg @ref LL_GPIO_PIN_ALL
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_SetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
|
||||||
|
{
|
||||||
|
WRITE_REG(GPIOx->BSRR, PinMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set several pins to low level on dedicated gpio port.
|
||||||
|
* @rmtoll BRR BRy LL_GPIO_ResetOutputPin
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param PinMask This parameter can be a combination of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @arg @ref LL_GPIO_PIN_ALL
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_ResetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
|
||||||
|
{
|
||||||
|
WRITE_REG(GPIOx->BRR, PinMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Toggle data value for several pin of dedicated port.
|
||||||
|
* @rmtoll ODR ODy LL_GPIO_TogglePin
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param PinMask This parameter can be a combination of the following values:
|
||||||
|
* @arg @ref LL_GPIO_PIN_0
|
||||||
|
* @arg @ref LL_GPIO_PIN_1
|
||||||
|
* @arg @ref LL_GPIO_PIN_2
|
||||||
|
* @arg @ref LL_GPIO_PIN_3
|
||||||
|
* @arg @ref LL_GPIO_PIN_4
|
||||||
|
* @arg @ref LL_GPIO_PIN_5
|
||||||
|
* @arg @ref LL_GPIO_PIN_6
|
||||||
|
* @arg @ref LL_GPIO_PIN_7
|
||||||
|
* @arg @ref LL_GPIO_PIN_8
|
||||||
|
* @arg @ref LL_GPIO_PIN_9
|
||||||
|
* @arg @ref LL_GPIO_PIN_10
|
||||||
|
* @arg @ref LL_GPIO_PIN_11
|
||||||
|
* @arg @ref LL_GPIO_PIN_12
|
||||||
|
* @arg @ref LL_GPIO_PIN_13
|
||||||
|
* @arg @ref LL_GPIO_PIN_14
|
||||||
|
* @arg @ref LL_GPIO_PIN_15
|
||||||
|
* @arg @ref LL_GPIO_PIN_ALL
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
|
||||||
|
{
|
||||||
|
uint32_t odr = READ_REG(GPIOx->ODR);
|
||||||
|
WRITE_REG(GPIOx->BSRR, ((odr & PinMask) << 16u) | (~odr & PinMask));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(USE_FULL_LL_DRIVER)
|
||||||
|
/** @defgroup GPIO_LL_EF_Init Initialization and de-initialization functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx);
|
||||||
|
ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct);
|
||||||
|
void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /* USE_FULL_LL_DRIVER */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* STM32G0xx_LL_GPIO_H */
|
||||||
|
|
2651
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_lpuart.h
Normal file
2651
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_lpuart.h
Normal file
File diff suppressed because it is too large
Load Diff
1526
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_pwr.h
Normal file
1526
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_pwr.h
Normal file
File diff suppressed because it is too large
Load Diff
3973
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_rcc.h
Normal file
3973
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_rcc.h
Normal file
File diff suppressed because it is too large
Load Diff
2085
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_system.h
Normal file
2085
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_system.h
Normal file
File diff suppressed because it is too large
Load Diff
343
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_utils.h
Normal file
343
Drivers/STM32G0xx_HAL_Driver/Inc/stm32g0xx_ll_utils.h
Normal file
@ -0,0 +1,343 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_utils.h
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief Header file of UTILS LL module.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
@verbatim
|
||||||
|
==============================================================================
|
||||||
|
##### How to use this driver #####
|
||||||
|
==============================================================================
|
||||||
|
[..]
|
||||||
|
The LL UTILS driver contains a set of generic APIs that can be
|
||||||
|
used by user:
|
||||||
|
(+) Device electronic signature
|
||||||
|
(+) Timing functions
|
||||||
|
(+) PLL configuration functions
|
||||||
|
|
||||||
|
@endverbatim
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef STM32G0xx_LL_UTILS_H
|
||||||
|
#define STM32G0xx_LL_UTILS_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup UTILS_LL UTILS
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/** @defgroup UTILS_LL_Private_Constants UTILS Private Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Max delay can be used in LL_mDelay */
|
||||||
|
#define LL_MAX_DELAY 0xFFFFFFFFU
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unique device ID register base address
|
||||||
|
*/
|
||||||
|
#define UID_BASE_ADDRESS UID_BASE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Flash size data register base address
|
||||||
|
*/
|
||||||
|
#define FLASHSIZE_BASE_ADDRESS FLASHSIZE_BASE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Package data register base address
|
||||||
|
*/
|
||||||
|
#define PACKAGE_BASE_ADDRESS PACKAGE_BASE
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/** @defgroup UTILS_LL_Private_Macros UTILS Private Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
/* Exported types ------------------------------------------------------------*/
|
||||||
|
/** @defgroup UTILS_LL_ES_INIT UTILS Exported structures
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @brief UTILS PLL structure definition
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t PLLM; /*!< Division factor for PLL VCO input clock.
|
||||||
|
This parameter can be a value of @ref RCC_LL_EC_PLLM_DIV
|
||||||
|
|
||||||
|
This feature can be modified afterwards using unitary function
|
||||||
|
@ref LL_RCC_PLL_ConfigDomain_SYS(). */
|
||||||
|
|
||||||
|
uint32_t PLLN; /*!< Multiplication factor for PLL VCO output clock.
|
||||||
|
This parameter must be a number between Min_Data = 8 and Max_Data = 86
|
||||||
|
|
||||||
|
This feature can be modified afterwards using unitary function
|
||||||
|
@ref LL_RCC_PLL_ConfigDomain_SYS(). */
|
||||||
|
|
||||||
|
uint32_t PLLR; /*!< Division for the main system clock.
|
||||||
|
This parameter can be a value of @ref RCC_LL_EC_PLLR_DIV
|
||||||
|
|
||||||
|
This feature can be modified afterwards using unitary function
|
||||||
|
@ref LL_RCC_PLL_ConfigDomain_SYS(). */
|
||||||
|
} LL_UTILS_PLLInitTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief UTILS System, AHB and APB buses clock configuration structure definition
|
||||||
|
*/
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK).
|
||||||
|
This parameter can be a value of @ref RCC_LL_EC_SYSCLK_DIV
|
||||||
|
|
||||||
|
This feature can be modified afterwards using unitary function
|
||||||
|
@ref LL_RCC_SetAHBPrescaler(). */
|
||||||
|
|
||||||
|
uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK).
|
||||||
|
This parameter can be a value of @ref RCC_LL_EC_APB1_DIV
|
||||||
|
|
||||||
|
This feature can be modified afterwards using unitary function
|
||||||
|
@ref LL_RCC_SetAPB1Prescaler(). */
|
||||||
|
} LL_UTILS_ClkInitTypeDef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported constants --------------------------------------------------------*/
|
||||||
|
/** @defgroup UTILS_LL_Exported_Constants UTILS Exported Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup UTILS_EC_HSE_BYPASS HSE Bypass activation
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define LL_UTILS_HSEBYPASS_OFF 0x00000000U /*!< HSE Bypass is not enabled */
|
||||||
|
#define LL_UTILS_HSEBYPASS_ON 0x00000001U /*!< HSE Bypass is enabled */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup UTILS_EC_PACKAGETYPE PACKAGE TYPE
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFP100 0x00000000U /*!< LQFP100 package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN32_GP 0x00000001U /*!< LQFP32/UFQFPN32 General purpose (GP) */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN32_N 0x00000002U /*!< LQFP32/UFQFPN32 N-version */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN48_GP 0x00000004U /*!< LQFP48/UFQPN48 General purpose (GP) */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN48_N 0x00000005U /*!< LQFP48/UFQPN48 N-version */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_WLCSP52 0x00000006U /*!< WLCSP52 */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN64_GP 0x00000007U /*!< LQFP64 General purpose (GP) */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN64_N 0x00000008U /*!< LQFP64 N-version */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_BGA64_N 0x0000000AU /*!< UFBGA64 N-version */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFP80 0x0000000BU /*!< LQFP80 package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_BGA100 0x0000000CU /*!< UBGA100 package type */
|
||||||
|
#elif defined(STM32G061xx) || defined(STM32G051xx) || defined(STM32G050xx) || defined(STM32G041xx) || defined(STM32G031xx) || defined(STM32G030xx)
|
||||||
|
#define LL_UTILS_PACKAGETYPE_SO8 0x00000001U /*!< SO8 package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_WLCSP18 0x00000002U /*!< WLCSP18 package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_TSSOP20 0x00000003U /*!< TSSOP20 package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFP28 0x00000004U /*!< UFQFPN28 package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN32 0x00000005U /*!< UFQFPN32 / LQFP32 package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN48 0x00000007U /*!< UFQFPN48 / LQFP48 package type */
|
||||||
|
#elif defined(STM32G081xx) || defined(STM32G071xx) || defined(STM32G070xx)
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN28_GP 0x00000000U /*!< UFQFPN28 general purpose (GP) package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN28_PD 0x00000001U /*!< UFQFPN28 Power Delivery (PD) */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN32_GP 0x00000004U /*!< UFQFPN32 / LQFP32 general purpose (GP) package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN32_PD 0x00000005U /*!< UFQFPN32 / LQFP32 Power Delivery (PD) package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFN48 0x00000008U /*!< UFQFPN48 / LQFP488 package type */
|
||||||
|
#define LL_UTILS_PACKAGETYPE_QFP64 0x0000000CU /*!< LQPF64 package type */
|
||||||
|
#endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @defgroup UTILS_LL_Exported_Functions UTILS Exported Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup UTILS_EF_DEVICE_ELECTRONIC_SIGNATURE DEVICE ELECTRONIC SIGNATURE
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Word0 of the unique device identifier (UID based on 96 bits)
|
||||||
|
* @retval UID[31:0]: X and Y coordinates on the wafer expressed in BCD format
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GetUID_Word0(void)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_REG(*((uint32_t *)UID_BASE_ADDRESS)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Word1 of the unique device identifier (UID based on 96 bits)
|
||||||
|
* @retval UID[63:32]: Wafer number (UID[39:32]) & LOT_NUM[23:0] (UID[63:40])
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GetUID_Word1(void)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 4U))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Word2 of the unique device identifier (UID based on 96 bits)
|
||||||
|
* @retval UID[95:64]: Lot number (ASCII encoded) - LOT_NUM[55:24]
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GetUID_Word2(void)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 8U))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Flash memory size
|
||||||
|
* @note This bitfield indicates the size of the device Flash memory expressed in
|
||||||
|
* Kbytes. As an example, 0x040 corresponds to 64 Kbytes.
|
||||||
|
* @retval FLASH_SIZE[15:0]: Flash memory size
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GetFlashSize(void)
|
||||||
|
{
|
||||||
|
return (uint32_t)(READ_REG(*((uint32_t *)FLASHSIZE_BASE_ADDRESS)) & 0x0000FFFFUL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get Package type
|
||||||
|
* @retval PKG[3:0]: Package type - This parameter can be a value of @ref UTILS_EC_PACKAGETYPE
|
||||||
|
* @if defined(STM32G0C1xx)
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFP100
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN32_GP
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN32_N
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN48_GP
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN48_N
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_WLCSP52
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN64_GP
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN64_N
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_BGA64_N
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFP80
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_BGA100
|
||||||
|
* @elif defined(STM32G061xx) || defined(STM32G041xx)
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_SO8
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_WLCSP18
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_TSSOP20
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFP28
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN32
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN48
|
||||||
|
* @elif defined(STM32G081xx)
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN28_GP
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN28_PD
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN32_GP
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN32_PD
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFN48
|
||||||
|
* @arg @ref LL_UTILS_PACKAGETYPE_QFP64
|
||||||
|
* @endif
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE uint32_t LL_GetPackageType(void)
|
||||||
|
{
|
||||||
|
#if defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
|
||||||
|
return (uint32_t)(READ_REG(*((uint32_t *)PACKAGE_BASE_ADDRESS)) & 0x1FU);
|
||||||
|
#else
|
||||||
|
return (uint32_t)(READ_REG(*((uint32_t *)PACKAGE_BASE_ADDRESS)) & 0xFU);
|
||||||
|
#endif /* STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup UTILS_LL_EF_DELAY DELAY
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function configures the Cortex-M SysTick source of the time base.
|
||||||
|
* @param HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro)
|
||||||
|
* @note When a RTOS is used, it is recommended to avoid changing the SysTick
|
||||||
|
* configuration by calling this function, for a delay use rather osDelay RTOS service.
|
||||||
|
* @param Ticks Number of ticks
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
__STATIC_INLINE void LL_InitTick(uint32_t HCLKFrequency, uint32_t Ticks)
|
||||||
|
{
|
||||||
|
/* Configure the SysTick to have interrupt in 1ms time base */
|
||||||
|
SysTick->LOAD = (uint32_t)((HCLKFrequency / Ticks) - 1UL); /* set reload register */
|
||||||
|
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||||
|
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk |
|
||||||
|
SysTick_CTRL_ENABLE_Msk; /* Enable the Systick Timer */
|
||||||
|
}
|
||||||
|
|
||||||
|
void LL_Init1msTick(uint32_t HCLKFrequency);
|
||||||
|
void LL_mDelay(uint32_t Delay);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @defgroup UTILS_EF_SYSTEM SYSTEM
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
void LL_SetSystemCoreClock(uint32_t HCLKFrequency);
|
||||||
|
ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct,
|
||||||
|
LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct);
|
||||||
|
ErrorStatus LL_PLL_ConfigSystemClock_HSE(uint32_t HSEFrequency, uint32_t HSEBypass,
|
||||||
|
LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct);
|
||||||
|
ErrorStatus LL_SetFlashLatency(uint32_t HCLKFrequency);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* STM32G0xx_LL_UTILS_H */
|
6
Drivers/STM32G0xx_HAL_Driver/LICENSE.txt
Normal file
6
Drivers/STM32G0xx_HAL_Driver/LICENSE.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
This software component is provided to you as part of a software package and
|
||||||
|
applicable license terms are in the Package_license file. If you received this
|
||||||
|
software component outside of a package or without applicable license terms,
|
||||||
|
the terms of the BSD-3-Clause license shall apply.
|
||||||
|
You may obtain a copy of the BSD-3-Clause at:
|
||||||
|
https://opensource.org/licenses/BSD-3-Clause
|
787
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_adc.c
Normal file
787
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_adc.c
Normal file
@ -0,0 +1,787 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_adc.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief ADC LL module driver
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
#if defined(USE_FULL_LL_DRIVER)
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx_ll_adc.h"
|
||||||
|
#include "stm32g0xx_ll_bus.h"
|
||||||
|
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
#include "stm32_assert.h"
|
||||||
|
#else
|
||||||
|
#define assert_param(expr) ((void)0U)
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (ADC1)
|
||||||
|
|
||||||
|
/** @addtogroup ADC_LL ADC
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/** @addtogroup ADC_LL_Private_Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Definitions of ADC hardware constraints delays */
|
||||||
|
/* Note: Only ADC peripheral HW delays are defined in ADC LL driver driver, */
|
||||||
|
/* not timeout values: */
|
||||||
|
/* Timeout values for ADC operations are dependent to device clock */
|
||||||
|
/* configuration (system clock versus ADC clock), */
|
||||||
|
/* and therefore must be defined in user application. */
|
||||||
|
/* Refer to @ref ADC_LL_EC_HW_DELAYS for description of ADC timeout */
|
||||||
|
/* values definition. */
|
||||||
|
/* Note: ADC timeout values are defined here in CPU cycles to be independent */
|
||||||
|
/* of device clock setting. */
|
||||||
|
/* In user application, ADC timeout values should be defined with */
|
||||||
|
/* temporal values, in function of device clock settings. */
|
||||||
|
/* Highest ratio CPU clock frequency vs ADC clock frequency: */
|
||||||
|
/* - ADC clock from synchronous clock with AHB prescaler 512, */
|
||||||
|
/* APB prescaler 16, ADC prescaler 4. */
|
||||||
|
/* - ADC clock from asynchronous clock (HSI) with prescaler 1, */
|
||||||
|
/* with highest ratio CPU clock frequency vs HSI clock frequency: */
|
||||||
|
/* CPU clock frequency max 56MHz, HSI frequency 16MHz: ratio 4. */
|
||||||
|
/* Unit: CPU cycles. */
|
||||||
|
#define ADC_CLOCK_RATIO_VS_CPU_HIGHEST (512UL * 16UL * 4UL)
|
||||||
|
#define ADC_TIMEOUT_DISABLE_CPU_CYCLES (ADC_CLOCK_RATIO_VS_CPU_HIGHEST * 1UL)
|
||||||
|
#define ADC_TIMEOUT_STOP_CONVERSION_CPU_CYCLES (ADC_CLOCK_RATIO_VS_CPU_HIGHEST * 1UL)
|
||||||
|
/* Note: CCRDY handshake requires 1APB + 2 ADC + 3 APB cycles */
|
||||||
|
/* after the channel configuration has been changed. */
|
||||||
|
/* Driver timeout is approximated to 6 CPU cycles. */
|
||||||
|
#define ADC_TIMEOUT_CCRDY_CPU_CYCLES (ADC_CLOCK_RATIO_VS_CPU_HIGHEST * 6UL)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @addtogroup ADC_LL_Private_Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Check of parameters for configuration of ADC hierarchical scope: */
|
||||||
|
/* common to several ADC instances. */
|
||||||
|
#define IS_LL_ADC_COMMON_CLOCK(__CLOCK__) \
|
||||||
|
(((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV1) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV2) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV4) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV6) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV8) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV10) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV12) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV16) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV32) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV64) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV128) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC_DIV256) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_ADC_CLOCK_FREQ_MODE(__CLOCK_FREQ_MODE__) \
|
||||||
|
(((__CLOCK_FREQ_MODE__) == LL_ADC_CLOCK_FREQ_MODE_HIGH) \
|
||||||
|
|| ((__CLOCK_FREQ_MODE__) == LL_ADC_CLOCK_FREQ_MODE_LOW) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Check of parameters for configuration of ADC hierarchical scope: */
|
||||||
|
/* ADC instance. */
|
||||||
|
#define IS_LL_ADC_CLOCK(__CLOCK__) \
|
||||||
|
(((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV4) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV2) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_SYNC_PCLK_DIV1) \
|
||||||
|
|| ((__CLOCK__) == LL_ADC_CLOCK_ASYNC) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_ADC_RESOLUTION(__RESOLUTION__) \
|
||||||
|
(((__RESOLUTION__) == LL_ADC_RESOLUTION_12B) \
|
||||||
|
|| ((__RESOLUTION__) == LL_ADC_RESOLUTION_10B) \
|
||||||
|
|| ((__RESOLUTION__) == LL_ADC_RESOLUTION_8B) \
|
||||||
|
|| ((__RESOLUTION__) == LL_ADC_RESOLUTION_6B) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_ADC_DATA_ALIGN(__DATA_ALIGN__) \
|
||||||
|
(((__DATA_ALIGN__) == LL_ADC_DATA_ALIGN_RIGHT) \
|
||||||
|
|| ((__DATA_ALIGN__) == LL_ADC_DATA_ALIGN_LEFT) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_ADC_LOW_POWER(__LOW_POWER__) \
|
||||||
|
(((__LOW_POWER__) == LL_ADC_LP_MODE_NONE) \
|
||||||
|
|| ((__LOW_POWER__) == LL_ADC_LP_AUTOWAIT) \
|
||||||
|
|| ((__LOW_POWER__) == LL_ADC_LP_AUTOPOWEROFF) \
|
||||||
|
|| ((__LOW_POWER__) == LL_ADC_LP_AUTOWAIT_AUTOPOWEROFF) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Check of parameters for configuration of ADC hierarchical scope: */
|
||||||
|
/* ADC group regular */
|
||||||
|
#if defined(TIM15) && defined(TIM6) && defined(TIM2)
|
||||||
|
#define IS_LL_ADC_REG_TRIG_SOURCE(__REG_TRIG_SOURCE__) \
|
||||||
|
(((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_TRGO2) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH4 ) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_TRGO) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_TRGO) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM6_TRGO) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM15_TRGO) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_EXTI_LINE11) \
|
||||||
|
)
|
||||||
|
#elif defined(TIM15) && defined(TIM6)
|
||||||
|
#define IS_LL_ADC_REG_TRIG_SOURCE(__REG_TRIG_SOURCE__) \
|
||||||
|
(((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_TRGO2) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH4 ) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_TRGO) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM6_TRGO) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM15_TRGO) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_EXTI_LINE11) \
|
||||||
|
)
|
||||||
|
#elif defined(TIM2)
|
||||||
|
#define IS_LL_ADC_REG_TRIG_SOURCE(__REG_TRIG_SOURCE__) \
|
||||||
|
(((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_TRGO2) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH4 ) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM2_TRGO) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_TRGO) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_EXTI_LINE11) \
|
||||||
|
)
|
||||||
|
#else
|
||||||
|
#define IS_LL_ADC_REG_TRIG_SOURCE(__REG_TRIG_SOURCE__) \
|
||||||
|
(((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_SOFTWARE) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_TRGO2) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM1_CH4 ) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_TIM3_TRGO) \
|
||||||
|
|| ((__REG_TRIG_SOURCE__) == LL_ADC_REG_TRIG_EXT_EXTI_LINE11) \
|
||||||
|
)
|
||||||
|
#endif /* TIM15 && TIM6 && TIM2 */
|
||||||
|
|
||||||
|
#define IS_LL_ADC_REG_CONTINUOUS_MODE(__REG_CONTINUOUS_MODE__) \
|
||||||
|
(((__REG_CONTINUOUS_MODE__) == LL_ADC_REG_CONV_SINGLE) \
|
||||||
|
|| ((__REG_CONTINUOUS_MODE__) == LL_ADC_REG_CONV_CONTINUOUS) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_ADC_REG_DMA_TRANSFER(__REG_DMA_TRANSFER__) \
|
||||||
|
(((__REG_DMA_TRANSFER__) == LL_ADC_REG_DMA_TRANSFER_NONE) \
|
||||||
|
|| ((__REG_DMA_TRANSFER__) == LL_ADC_REG_DMA_TRANSFER_LIMITED) \
|
||||||
|
|| ((__REG_DMA_TRANSFER__) == LL_ADC_REG_DMA_TRANSFER_UNLIMITED) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_ADC_REG_OVR_DATA_BEHAVIOR(__REG_OVR_DATA_BEHAVIOR__) \
|
||||||
|
(((__REG_OVR_DATA_BEHAVIOR__) == LL_ADC_REG_OVR_DATA_PRESERVED) \
|
||||||
|
|| ((__REG_OVR_DATA_BEHAVIOR__) == LL_ADC_REG_OVR_DATA_OVERWRITTEN) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_ADC_REG_SEQ_MODE(__REG_SEQ_MODE__) \
|
||||||
|
(((__REG_SEQ_MODE__) == LL_ADC_REG_SEQ_FIXED) \
|
||||||
|
|| ((__REG_SEQ_MODE__) == LL_ADC_REG_SEQ_CONFIGURABLE) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_ADC_REG_SEQ_SCAN_LENGTH(__REG_SEQ_SCAN_LENGTH__) \
|
||||||
|
(((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_DISABLE) \
|
||||||
|
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_2RANKS) \
|
||||||
|
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_3RANKS) \
|
||||||
|
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_4RANKS) \
|
||||||
|
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_5RANKS) \
|
||||||
|
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_6RANKS) \
|
||||||
|
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_7RANKS) \
|
||||||
|
|| ((__REG_SEQ_SCAN_LENGTH__) == LL_ADC_REG_SEQ_SCAN_ENABLE_8RANKS) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_ADC_REG_SEQ_SCAN_DISCONT_MODE(__REG_SEQ_DISCONT_MODE__) \
|
||||||
|
(((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_DISABLE) \
|
||||||
|
|| ((__REG_SEQ_DISCONT_MODE__) == LL_ADC_REG_SEQ_DISCONT_1RANK) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup ADC_LL_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup ADC_LL_EF_Init
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief De-initialize registers of all ADC instances belonging to
|
||||||
|
* the same ADC common instance to their default reset values.
|
||||||
|
* @note This function is performing a hard reset, using high level
|
||||||
|
* clock source RCC ADC reset.
|
||||||
|
* @param ADCxy_COMMON ADC common instance
|
||||||
|
* (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: ADC common registers are de-initialized
|
||||||
|
* - ERROR: not applicable
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_ADC_CommonDeInit(ADC_Common_TypeDef *ADCxy_COMMON)
|
||||||
|
{
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_ADC_COMMON_INSTANCE(ADCxy_COMMON));
|
||||||
|
|
||||||
|
/* Prevent unused argument(s) compilation warning if no assert_param check */
|
||||||
|
(void)(ADCxy_COMMON);
|
||||||
|
|
||||||
|
/* Force reset of ADC clock (core clock) */
|
||||||
|
LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_ADC);
|
||||||
|
|
||||||
|
/* Release reset of ADC clock (core clock) */
|
||||||
|
LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_ADC);
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize some features of ADC common parameters
|
||||||
|
* (all ADC instances belonging to the same ADC common instance)
|
||||||
|
* and multimode (for devices with several ADC instances available).
|
||||||
|
* @note The setting of ADC common parameters is conditioned to
|
||||||
|
* ADC instances state:
|
||||||
|
* All ADC instances belonging to the same ADC common instance
|
||||||
|
* must be disabled.
|
||||||
|
* @param ADCxy_COMMON ADC common instance
|
||||||
|
* (can be set directly from CMSIS definition or by using helper macro @ref __LL_ADC_COMMON_INSTANCE() )
|
||||||
|
* @param pADC_CommonInitStruct Pointer to a @ref LL_ADC_CommonInitTypeDef structure
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: ADC common registers are initialized
|
||||||
|
* - ERROR: ADC common registers are not initialized
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_ADC_CommonInit(ADC_Common_TypeDef *ADCxy_COMMON, LL_ADC_CommonInitTypeDef *pADC_CommonInitStruct)
|
||||||
|
{
|
||||||
|
ErrorStatus status = SUCCESS;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_ADC_COMMON_INSTANCE(ADCxy_COMMON));
|
||||||
|
assert_param(IS_LL_ADC_COMMON_CLOCK(pADC_CommonInitStruct->CommonClock));
|
||||||
|
|
||||||
|
/* Note: Hardware constraint (refer to description of functions */
|
||||||
|
/* "LL_ADC_SetCommonXXX()": */
|
||||||
|
/* On this STM32 series, setting of these features is conditioned to */
|
||||||
|
/* ADC state: */
|
||||||
|
/* All ADC instances of the ADC common group must be disabled. */
|
||||||
|
if (__LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(ADCxy_COMMON) == 0UL)
|
||||||
|
{
|
||||||
|
/* Configuration of ADC hierarchical scope: */
|
||||||
|
/* - common to several ADC */
|
||||||
|
/* (all ADC instances belonging to the same ADC common instance) */
|
||||||
|
/* - Set ADC clock (conversion clock) */
|
||||||
|
LL_ADC_SetCommonClock(ADCxy_COMMON, pADC_CommonInitStruct->CommonClock);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Initialization error: One or several ADC instances belonging to */
|
||||||
|
/* the same ADC common instance are not disabled. */
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set each @ref LL_ADC_CommonInitTypeDef field to default value.
|
||||||
|
* @param pADC_CommonInitStruct Pointer to a @ref LL_ADC_CommonInitTypeDef structure
|
||||||
|
* whose fields will be set to default values.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void LL_ADC_CommonStructInit(LL_ADC_CommonInitTypeDef *pADC_CommonInitStruct)
|
||||||
|
{
|
||||||
|
/* Set pADC_CommonInitStruct fields to default values */
|
||||||
|
/* Set fields of ADC common */
|
||||||
|
/* (all ADC instances belonging to the same ADC common instance) */
|
||||||
|
pADC_CommonInitStruct->CommonClock = LL_ADC_CLOCK_ASYNC_DIV2;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief De-initialize registers of the selected ADC instance
|
||||||
|
* to their default reset values.
|
||||||
|
* @note To reset all ADC instances quickly (perform a hard reset),
|
||||||
|
* use function @ref LL_ADC_CommonDeInit().
|
||||||
|
* @note If this functions returns error status, it means that ADC instance
|
||||||
|
* is in an unknown state.
|
||||||
|
* In this case, perform a hard reset using high level
|
||||||
|
* clock source RCC ADC reset.
|
||||||
|
* Refer to function @ref LL_ADC_CommonDeInit().
|
||||||
|
* @param ADCx ADC instance
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: ADC registers are de-initialized
|
||||||
|
* - ERROR: ADC registers are not de-initialized
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_ADC_DeInit(ADC_TypeDef *ADCx)
|
||||||
|
{
|
||||||
|
ErrorStatus status = SUCCESS;
|
||||||
|
|
||||||
|
__IO uint32_t timeout_cpu_cycles = 0UL;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_ADC_ALL_INSTANCE(ADCx));
|
||||||
|
|
||||||
|
/* Disable ADC instance if not already disabled. */
|
||||||
|
if (LL_ADC_IsEnabled(ADCx) == 1UL)
|
||||||
|
{
|
||||||
|
/* Set ADC group regular trigger source to SW start to ensure to not */
|
||||||
|
/* have an external trigger event occurring during the conversion stop */
|
||||||
|
/* ADC disable process. */
|
||||||
|
LL_ADC_REG_SetTriggerSource(ADCx, LL_ADC_REG_TRIG_SOFTWARE);
|
||||||
|
|
||||||
|
/* Stop potential ADC conversion on going on ADC group regular. */
|
||||||
|
if (LL_ADC_REG_IsConversionOngoing(ADCx) != 0UL)
|
||||||
|
{
|
||||||
|
if (LL_ADC_REG_IsStopConversionOngoing(ADCx) == 0UL)
|
||||||
|
{
|
||||||
|
LL_ADC_REG_StopConversion(ADCx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait for ADC conversions are effectively stopped */
|
||||||
|
timeout_cpu_cycles = ADC_TIMEOUT_STOP_CONVERSION_CPU_CYCLES;
|
||||||
|
while (LL_ADC_REG_IsStopConversionOngoing(ADCx) == 1UL)
|
||||||
|
{
|
||||||
|
timeout_cpu_cycles--;
|
||||||
|
if (timeout_cpu_cycles == 0UL)
|
||||||
|
{
|
||||||
|
/* Time-out error */
|
||||||
|
status = ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disable the ADC instance */
|
||||||
|
LL_ADC_Disable(ADCx);
|
||||||
|
|
||||||
|
/* Wait for ADC instance is effectively disabled */
|
||||||
|
timeout_cpu_cycles = ADC_TIMEOUT_DISABLE_CPU_CYCLES;
|
||||||
|
while (LL_ADC_IsDisableOngoing(ADCx) == 1UL)
|
||||||
|
{
|
||||||
|
timeout_cpu_cycles--;
|
||||||
|
if (timeout_cpu_cycles == 0UL)
|
||||||
|
{
|
||||||
|
/* Time-out error */
|
||||||
|
status = ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check whether ADC state is compliant with expected state */
|
||||||
|
if (READ_BIT(ADCx->CR,
|
||||||
|
(ADC_CR_ADSTP | ADC_CR_ADSTART
|
||||||
|
| ADC_CR_ADDIS | ADC_CR_ADEN)
|
||||||
|
)
|
||||||
|
== 0UL)
|
||||||
|
{
|
||||||
|
/* ========== Reset ADC registers ========== */
|
||||||
|
/* Reset register IER */
|
||||||
|
CLEAR_BIT(ADCx->IER,
|
||||||
|
(LL_ADC_IT_ADRDY
|
||||||
|
| LL_ADC_IT_EOC
|
||||||
|
| LL_ADC_IT_EOS
|
||||||
|
| LL_ADC_IT_OVR
|
||||||
|
| LL_ADC_IT_EOSMP
|
||||||
|
| LL_ADC_IT_AWD1
|
||||||
|
| LL_ADC_IT_AWD2
|
||||||
|
| LL_ADC_IT_AWD3
|
||||||
|
| LL_ADC_IT_EOCAL
|
||||||
|
| LL_ADC_IT_CCRDY
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Reset register ISR */
|
||||||
|
SET_BIT(ADCx->ISR,
|
||||||
|
(LL_ADC_FLAG_ADRDY
|
||||||
|
| LL_ADC_FLAG_EOC
|
||||||
|
| LL_ADC_FLAG_EOS
|
||||||
|
| LL_ADC_FLAG_OVR
|
||||||
|
| LL_ADC_FLAG_EOSMP
|
||||||
|
| LL_ADC_FLAG_AWD1
|
||||||
|
| LL_ADC_FLAG_AWD2
|
||||||
|
| LL_ADC_FLAG_AWD3
|
||||||
|
| LL_ADC_FLAG_EOCAL
|
||||||
|
| LL_ADC_FLAG_CCRDY
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Reset register CR */
|
||||||
|
/* Bits ADC_CR_ADCAL, ADC_CR_ADSTP, ADC_CR_ADSTART are in access mode */
|
||||||
|
/* "read-set": no direct reset applicable. */
|
||||||
|
CLEAR_BIT(ADCx->CR, ADC_CR_ADVREGEN);
|
||||||
|
|
||||||
|
/* Reset register CFGR1 */
|
||||||
|
CLEAR_BIT(ADCx->CFGR1,
|
||||||
|
(ADC_CFGR1_AWD1CH | ADC_CFGR1_AWD1EN | ADC_CFGR1_AWD1SGL | ADC_CFGR1_DISCEN
|
||||||
|
| ADC_CFGR1_AUTOFF | ADC_CFGR1_WAIT | ADC_CFGR1_CONT | ADC_CFGR1_OVRMOD
|
||||||
|
| ADC_CFGR1_EXTEN | ADC_CFGR1_EXTSEL | ADC_CFGR1_ALIGN | ADC_CFGR1_RES
|
||||||
|
| ADC_CFGR1_SCANDIR | ADC_CFGR1_DMACFG | ADC_CFGR1_DMAEN)
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Reset register CFGR2 */
|
||||||
|
/* Note: Update of ADC clock mode is conditioned to ADC state disabled: */
|
||||||
|
/* already done above. */
|
||||||
|
CLEAR_BIT(ADCx->CFGR2,
|
||||||
|
(ADC_CFGR2_CKMODE
|
||||||
|
| ADC_CFGR2_TOVS | ADC_CFGR2_OVSS | ADC_CFGR2_OVSR
|
||||||
|
| ADC_CFGR2_OVSE)
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Reset register SMPR */
|
||||||
|
CLEAR_BIT(ADCx->SMPR, ADC_SMPR_SMP1 | ADC_SMPR_SMP2 | ADC_SMPR_SMPSEL);
|
||||||
|
|
||||||
|
/* Reset register AWD1TR */
|
||||||
|
MODIFY_REG(ADCx->AWD1TR, ADC_AWD1TR_HT1 | ADC_AWD1TR_LT1, ADC_AWD1TR_HT1);
|
||||||
|
|
||||||
|
/* Reset register AWD2TR */
|
||||||
|
MODIFY_REG(ADCx->AWD2TR, ADC_AWD2TR_HT2 | ADC_AWD2TR_LT2, ADC_AWD2TR_HT2);
|
||||||
|
|
||||||
|
/* Reset register AWD3TR */
|
||||||
|
MODIFY_REG(ADCx->AWD3TR, ADC_AWD3TR_HT3 | ADC_AWD3TR_LT3, ADC_AWD3TR_HT3);
|
||||||
|
|
||||||
|
/* Reset register CHSELR */
|
||||||
|
CLEAR_BIT(ADCx->CHSELR,
|
||||||
|
(ADC_CHSELR_CHSEL18 | ADC_CHSELR_CHSEL17 | ADC_CHSELR_CHSEL16
|
||||||
|
| ADC_CHSELR_CHSEL15 | ADC_CHSELR_CHSEL14 | ADC_CHSELR_CHSEL13 | ADC_CHSELR_CHSEL12
|
||||||
|
| ADC_CHSELR_CHSEL11 | ADC_CHSELR_CHSEL10 | ADC_CHSELR_CHSEL9 | ADC_CHSELR_CHSEL8
|
||||||
|
| ADC_CHSELR_CHSEL7 | ADC_CHSELR_CHSEL6 | ADC_CHSELR_CHSEL5 | ADC_CHSELR_CHSEL4
|
||||||
|
| ADC_CHSELR_CHSEL3 | ADC_CHSELR_CHSEL2 | ADC_CHSELR_CHSEL1 | ADC_CHSELR_CHSEL0)
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Wait for ADC channel configuration ready */
|
||||||
|
timeout_cpu_cycles = ADC_TIMEOUT_CCRDY_CPU_CYCLES;
|
||||||
|
while (LL_ADC_IsActiveFlag_CCRDY(ADCx) == 0UL)
|
||||||
|
{
|
||||||
|
timeout_cpu_cycles--;
|
||||||
|
if (timeout_cpu_cycles == 0UL)
|
||||||
|
{
|
||||||
|
/* Time-out error */
|
||||||
|
status = ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clear flag ADC channel configuration ready */
|
||||||
|
LL_ADC_ClearFlag_CCRDY(ADCx);
|
||||||
|
|
||||||
|
/* Reset register DR */
|
||||||
|
/* bits in access mode read only, no direct reset applicable */
|
||||||
|
|
||||||
|
/* Reset register CALFACT */
|
||||||
|
CLEAR_BIT(ADCx->CALFACT, ADC_CALFACT_CALFACT);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* ADC instance is in an unknown state */
|
||||||
|
/* Need to performing a hard reset of ADC instance, using high level */
|
||||||
|
/* clock source RCC ADC reset. */
|
||||||
|
/* Caution: On this STM32 series, if several ADC instances are available */
|
||||||
|
/* on the selected device, RCC ADC reset will reset */
|
||||||
|
/* all ADC instances belonging to the common ADC instance. */
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize some features of ADC instance.
|
||||||
|
* @note These parameters have an impact on ADC scope: ADC instance.
|
||||||
|
* Refer to corresponding unitary functions into
|
||||||
|
* @ref ADC_LL_EF_Configuration_ADC_Instance .
|
||||||
|
* @note The setting of these parameters by function @ref LL_ADC_Init()
|
||||||
|
* is conditioned to ADC state:
|
||||||
|
* ADC instance must be disabled.
|
||||||
|
* This condition is applied to all ADC features, for efficiency
|
||||||
|
* and compatibility over all STM32 families. However, the different
|
||||||
|
* features can be set under different ADC state conditions
|
||||||
|
* (setting possible with ADC enabled without conversion on going,
|
||||||
|
* ADC enabled with conversion on going, ...)
|
||||||
|
* Each feature can be updated afterwards with a unitary function
|
||||||
|
* and potentially with ADC in a different state than disabled,
|
||||||
|
* refer to description of each function for setting
|
||||||
|
* conditioned to ADC state.
|
||||||
|
* @note After using this function, some other features must be configured
|
||||||
|
* using LL unitary functions.
|
||||||
|
* The minimum configuration remaining to be done is:
|
||||||
|
* - Set ADC group regular sequencer:
|
||||||
|
* Depending on the sequencer mode (refer to
|
||||||
|
* function @ref LL_ADC_REG_SetSequencerConfigurable() ):
|
||||||
|
* - map channel on the selected sequencer rank.
|
||||||
|
* Refer to function @ref LL_ADC_REG_SetSequencerRanks();
|
||||||
|
* - map channel on rank corresponding to channel number.
|
||||||
|
* Refer to function @ref LL_ADC_REG_SetSequencerChannels();
|
||||||
|
* - Set ADC channel sampling time
|
||||||
|
* Refer to function LL_ADC_SetSamplingTimeCommonChannels();
|
||||||
|
* Refer to function LL_ADC_SetChannelSamplingTime();
|
||||||
|
* @param ADCx ADC instance
|
||||||
|
* @param pADC_InitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: ADC registers are initialized
|
||||||
|
* - ERROR: ADC registers are not initialized
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_ADC_Init(ADC_TypeDef *ADCx, LL_ADC_InitTypeDef *pADC_InitStruct)
|
||||||
|
{
|
||||||
|
ErrorStatus status = SUCCESS;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_ADC_ALL_INSTANCE(ADCx));
|
||||||
|
|
||||||
|
assert_param(IS_LL_ADC_CLOCK(pADC_InitStruct->Clock));
|
||||||
|
assert_param(IS_LL_ADC_RESOLUTION(pADC_InitStruct->Resolution));
|
||||||
|
assert_param(IS_LL_ADC_DATA_ALIGN(pADC_InitStruct->DataAlignment));
|
||||||
|
assert_param(IS_LL_ADC_LOW_POWER(pADC_InitStruct->LowPowerMode));
|
||||||
|
|
||||||
|
/* Note: Hardware constraint (refer to description of this function): */
|
||||||
|
/* ADC instance must be disabled. */
|
||||||
|
if (LL_ADC_IsEnabled(ADCx) == 0UL)
|
||||||
|
{
|
||||||
|
/* Configuration of ADC hierarchical scope: */
|
||||||
|
/* - ADC instance */
|
||||||
|
/* - Set ADC data resolution */
|
||||||
|
/* - Set ADC conversion data alignment */
|
||||||
|
/* - Set ADC low power mode */
|
||||||
|
MODIFY_REG(ADCx->CFGR1,
|
||||||
|
ADC_CFGR1_RES
|
||||||
|
| ADC_CFGR1_ALIGN
|
||||||
|
| ADC_CFGR1_WAIT
|
||||||
|
| ADC_CFGR1_AUTOFF
|
||||||
|
,
|
||||||
|
pADC_InitStruct->Resolution
|
||||||
|
| pADC_InitStruct->DataAlignment
|
||||||
|
| pADC_InitStruct->LowPowerMode
|
||||||
|
);
|
||||||
|
|
||||||
|
MODIFY_REG(ADCx->CFGR2,
|
||||||
|
ADC_CFGR2_CKMODE
|
||||||
|
,
|
||||||
|
pADC_InitStruct->Clock
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Initialization error: ADC instance is not disabled. */
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set each @ref LL_ADC_InitTypeDef field to default value.
|
||||||
|
* @param pADC_InitStruct Pointer to a @ref LL_ADC_InitTypeDef structure
|
||||||
|
* whose fields will be set to default values.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void LL_ADC_StructInit(LL_ADC_InitTypeDef *pADC_InitStruct)
|
||||||
|
{
|
||||||
|
/* Set pADC_InitStruct fields to default values */
|
||||||
|
/* Set fields of ADC instance */
|
||||||
|
pADC_InitStruct->Clock = LL_ADC_CLOCK_SYNC_PCLK_DIV2;
|
||||||
|
pADC_InitStruct->Resolution = LL_ADC_RESOLUTION_12B;
|
||||||
|
pADC_InitStruct->DataAlignment = LL_ADC_DATA_ALIGN_RIGHT;
|
||||||
|
pADC_InitStruct->LowPowerMode = LL_ADC_LP_MODE_NONE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize some features of ADC group regular.
|
||||||
|
* @note These parameters have an impact on ADC scope: ADC group regular.
|
||||||
|
* Refer to corresponding unitary functions into
|
||||||
|
* @ref ADC_LL_EF_Configuration_ADC_Group_Regular
|
||||||
|
* (functions with prefix "REG").
|
||||||
|
* @note The setting of these parameters by function @ref LL_ADC_Init()
|
||||||
|
* is conditioned to ADC state:
|
||||||
|
* ADC instance must be disabled.
|
||||||
|
* This condition is applied to all ADC features, for efficiency
|
||||||
|
* and compatibility over all STM32 families. However, the different
|
||||||
|
* features can be set under different ADC state conditions
|
||||||
|
* (setting possible with ADC enabled without conversion on going,
|
||||||
|
* ADC enabled with conversion on going, ...)
|
||||||
|
* Each feature can be updated afterwards with a unitary function
|
||||||
|
* and potentially with ADC in a different state than disabled,
|
||||||
|
* refer to description of each function for setting
|
||||||
|
* conditioned to ADC state.
|
||||||
|
* @note Before using this function, ADC group regular sequencer
|
||||||
|
* must be configured: refer to function
|
||||||
|
* @ref LL_ADC_REG_SetSequencerConfigurable().
|
||||||
|
* @note After using this function, other features must be configured
|
||||||
|
* using LL unitary functions.
|
||||||
|
* The minimum configuration remaining to be done is:
|
||||||
|
* - Set ADC group regular sequencer:
|
||||||
|
* Depending on the sequencer mode (refer to
|
||||||
|
* function @ref LL_ADC_REG_SetSequencerConfigurable() ):
|
||||||
|
* - map channel on the selected sequencer rank.
|
||||||
|
* Refer to function @ref LL_ADC_REG_SetSequencerRanks();
|
||||||
|
* - map channel on rank corresponding to channel number.
|
||||||
|
* Refer to function @ref LL_ADC_REG_SetSequencerChannels();
|
||||||
|
* - Set ADC channel sampling time
|
||||||
|
* Refer to function LL_ADC_SetSamplingTimeCommonChannels();
|
||||||
|
* Refer to function LL_ADC_SetChannelSamplingTime();
|
||||||
|
* @param ADCx ADC instance
|
||||||
|
* @param pADC_RegInitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: ADC registers are initialized
|
||||||
|
* - ERROR: ADC registers are not initialized
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_ADC_REG_Init(ADC_TypeDef *ADCx, LL_ADC_REG_InitTypeDef *pADC_RegInitStruct)
|
||||||
|
{
|
||||||
|
ErrorStatus status = SUCCESS;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_ADC_ALL_INSTANCE(ADCx));
|
||||||
|
assert_param(IS_LL_ADC_REG_TRIG_SOURCE(pADC_RegInitStruct->TriggerSource));
|
||||||
|
assert_param(IS_LL_ADC_REG_CONTINUOUS_MODE(pADC_RegInitStruct->ContinuousMode));
|
||||||
|
assert_param(IS_LL_ADC_REG_DMA_TRANSFER(pADC_RegInitStruct->DMATransfer));
|
||||||
|
assert_param(IS_LL_ADC_REG_OVR_DATA_BEHAVIOR(pADC_RegInitStruct->Overrun));
|
||||||
|
|
||||||
|
if (LL_ADC_REG_GetSequencerConfigurable(ADCx) != LL_ADC_REG_SEQ_FIXED)
|
||||||
|
{
|
||||||
|
assert_param(IS_LL_ADC_REG_SEQ_SCAN_LENGTH(pADC_RegInitStruct->SequencerLength));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((LL_ADC_REG_GetSequencerConfigurable(ADCx) == LL_ADC_REG_SEQ_FIXED)
|
||||||
|
|| (pADC_RegInitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
assert_param(IS_LL_ADC_REG_SEQ_SCAN_DISCONT_MODE(pADC_RegInitStruct->SequencerDiscont));
|
||||||
|
|
||||||
|
/* ADC group regular continuous mode and discontinuous mode */
|
||||||
|
/* can not be enabled simultenaeously */
|
||||||
|
assert_param((pADC_RegInitStruct->ContinuousMode == LL_ADC_REG_CONV_SINGLE)
|
||||||
|
|| (pADC_RegInitStruct->SequencerDiscont == LL_ADC_REG_SEQ_DISCONT_DISABLE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Note: Hardware constraint (refer to description of this function): */
|
||||||
|
/* ADC instance must be disabled. */
|
||||||
|
if (LL_ADC_IsEnabled(ADCx) == 0UL)
|
||||||
|
{
|
||||||
|
/* Configuration of ADC hierarchical scope: */
|
||||||
|
/* - ADC group regular */
|
||||||
|
/* - Set ADC group regular trigger source */
|
||||||
|
/* - Set ADC group regular sequencer length */
|
||||||
|
/* - Set ADC group regular sequencer discontinuous mode */
|
||||||
|
/* - Set ADC group regular continuous mode */
|
||||||
|
/* - Set ADC group regular conversion data transfer: no transfer or */
|
||||||
|
/* transfer by DMA, and DMA requests mode */
|
||||||
|
/* - Set ADC group regular overrun behavior */
|
||||||
|
/* Note: On this STM32 series, ADC trigger edge is set to value 0x0 by */
|
||||||
|
/* setting of trigger source to SW start. */
|
||||||
|
if ((LL_ADC_REG_GetSequencerConfigurable(ADCx) == LL_ADC_REG_SEQ_FIXED)
|
||||||
|
|| (pADC_RegInitStruct->SequencerLength != LL_ADC_REG_SEQ_SCAN_DISABLE)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
/* Case of sequencer mode fixed
|
||||||
|
or sequencer length >= 2 ranks with sequencer mode fully configurable:
|
||||||
|
discontinuous mode configured */
|
||||||
|
MODIFY_REG(ADCx->CFGR1,
|
||||||
|
ADC_CFGR1_EXTSEL
|
||||||
|
| ADC_CFGR1_EXTEN
|
||||||
|
| ADC_CFGR1_DISCEN
|
||||||
|
| ADC_CFGR1_CONT
|
||||||
|
| ADC_CFGR1_DMAEN
|
||||||
|
| ADC_CFGR1_DMACFG
|
||||||
|
| ADC_CFGR1_OVRMOD
|
||||||
|
,
|
||||||
|
pADC_RegInitStruct->TriggerSource
|
||||||
|
| pADC_RegInitStruct->SequencerDiscont
|
||||||
|
| pADC_RegInitStruct->ContinuousMode
|
||||||
|
| pADC_RegInitStruct->DMATransfer
|
||||||
|
| pADC_RegInitStruct->Overrun
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Case of sequencer mode fully configurable
|
||||||
|
and sequencer length 1 rank (sequencer disabled):
|
||||||
|
discontinuous mode discarded (fixed to disable) */
|
||||||
|
MODIFY_REG(ADCx->CFGR1,
|
||||||
|
ADC_CFGR1_EXTSEL
|
||||||
|
| ADC_CFGR1_EXTEN
|
||||||
|
| ADC_CFGR1_DISCEN
|
||||||
|
| ADC_CFGR1_CONT
|
||||||
|
| ADC_CFGR1_DMAEN
|
||||||
|
| ADC_CFGR1_DMACFG
|
||||||
|
| ADC_CFGR1_OVRMOD
|
||||||
|
,
|
||||||
|
pADC_RegInitStruct->TriggerSource
|
||||||
|
| LL_ADC_REG_SEQ_DISCONT_DISABLE
|
||||||
|
| pADC_RegInitStruct->ContinuousMode
|
||||||
|
| pADC_RegInitStruct->DMATransfer
|
||||||
|
| pADC_RegInitStruct->Overrun
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set ADC group regular sequencer length */
|
||||||
|
if (LL_ADC_REG_GetSequencerConfigurable(ADCx) != LL_ADC_REG_SEQ_FIXED)
|
||||||
|
{
|
||||||
|
LL_ADC_REG_SetSequencerLength(ADCx, pADC_RegInitStruct->SequencerLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Initialization error: ADC instance is not disabled. */
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set each @ref LL_ADC_REG_InitTypeDef field to default value.
|
||||||
|
* @param pADC_RegInitStruct Pointer to a @ref LL_ADC_REG_InitTypeDef structure
|
||||||
|
* whose fields will be set to default values.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void LL_ADC_REG_StructInit(LL_ADC_REG_InitTypeDef *pADC_RegInitStruct)
|
||||||
|
{
|
||||||
|
/* Set pADC_RegInitStruct fields to default values */
|
||||||
|
/* Set fields of ADC group regular */
|
||||||
|
/* Note: On this STM32 series, ADC trigger edge is set to value 0x0 by */
|
||||||
|
/* setting of trigger source to SW start. */
|
||||||
|
pADC_RegInitStruct->TriggerSource = LL_ADC_REG_TRIG_SOFTWARE;
|
||||||
|
pADC_RegInitStruct->SequencerLength = LL_ADC_REG_SEQ_SCAN_DISABLE;
|
||||||
|
pADC_RegInitStruct->SequencerDiscont = LL_ADC_REG_SEQ_DISCONT_DISABLE;
|
||||||
|
pADC_RegInitStruct->ContinuousMode = LL_ADC_REG_CONV_SINGLE;
|
||||||
|
pADC_RegInitStruct->DMATransfer = LL_ADC_REG_DMA_TRANSFER_NONE;
|
||||||
|
pADC_RegInitStruct->Overrun = LL_ADC_REG_OVR_DATA_OVERWRITTEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* ADC1 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* USE_FULL_LL_DRIVER */
|
293
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_dac.c
Normal file
293
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_dac.c
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_dac.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief DAC LL module driver
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
#if defined(USE_FULL_LL_DRIVER)
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx_ll_dac.h"
|
||||||
|
#include "stm32g0xx_ll_bus.h"
|
||||||
|
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
#include "stm32_assert.h"
|
||||||
|
#else
|
||||||
|
#define assert_param(expr) ((void)0U)
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(DAC1)
|
||||||
|
|
||||||
|
/** @addtogroup DAC_LL DAC
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/** @addtogroup DAC_LL_Private_Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define IS_LL_DAC_CHANNEL(__DAC_CHANNEL__) \
|
||||||
|
( ((__DAC_CHANNEL__) == LL_DAC_CHANNEL_1) \
|
||||||
|
|| ((__DAC_CHANNEL__) == LL_DAC_CHANNEL_2) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_DAC_TRIGGER_SOURCE(__TRIGGER_SOURCE__) \
|
||||||
|
( ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_SOFTWARE) \
|
||||||
|
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM1_TRGO) \
|
||||||
|
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM2_TRGO) \
|
||||||
|
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM3_TRGO) \
|
||||||
|
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM6_TRGO) \
|
||||||
|
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM7_TRGO) \
|
||||||
|
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM15_TRGO) \
|
||||||
|
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_LPTIM1_OUT) \
|
||||||
|
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_LPTIM2_OUT) \
|
||||||
|
|| ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_EXTI_LINE9) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_DAC_WAVE_AUTO_GENER_MODE(__WAVE_AUTO_GENERATION_MODE__) \
|
||||||
|
( ((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_NONE) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_NOISE) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_TRIANGLE) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_DAC_WAVE_AUTO_GENER_CONFIG(__WAVE_AUTO_GENERATION_MODE__, __WAVE_AUTO_GENERATION_CONFIG__) \
|
||||||
|
( (((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_NOISE) \
|
||||||
|
&& ( ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BIT0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS1_0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS2_0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS3_0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS4_0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS5_0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS6_0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS7_0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS8_0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS9_0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS10_0) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS11_0)) \
|
||||||
|
) \
|
||||||
|
||(((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_TRIANGLE) \
|
||||||
|
&& ( ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_1) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_3) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_7) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_15) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_31) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_63) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_127) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_255) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_511) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_1023) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_2047) \
|
||||||
|
|| ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_4095)) \
|
||||||
|
) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_DAC_OUTPUT_BUFFER(__OUTPUT_BUFFER__) \
|
||||||
|
( ((__OUTPUT_BUFFER__) == LL_DAC_OUTPUT_BUFFER_ENABLE) \
|
||||||
|
|| ((__OUTPUT_BUFFER__) == LL_DAC_OUTPUT_BUFFER_DISABLE) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_DAC_OUTPUT_CONNECTION(__OUTPUT_CONNECTION__) \
|
||||||
|
( ((__OUTPUT_CONNECTION__) == LL_DAC_OUTPUT_CONNECT_GPIO) \
|
||||||
|
|| ((__OUTPUT_CONNECTION__) == LL_DAC_OUTPUT_CONNECT_INTERNAL) \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define IS_LL_DAC_OUTPUT_MODE(__OUTPUT_MODE__) \
|
||||||
|
( ((__OUTPUT_MODE__) == LL_DAC_OUTPUT_MODE_NORMAL) \
|
||||||
|
|| ((__OUTPUT_MODE__) == LL_DAC_OUTPUT_MODE_SAMPLE_AND_HOLD) \
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup DAC_LL_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup DAC_LL_EF_Init
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief De-initialize registers of the selected DAC instance
|
||||||
|
* to their default reset values.
|
||||||
|
* @param DACx DAC instance
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: DAC registers are de-initialized
|
||||||
|
* - ERROR: not applicable
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_DAC_DeInit(DAC_TypeDef *DACx)
|
||||||
|
{
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_DAC_ALL_INSTANCE(DACx));
|
||||||
|
|
||||||
|
/* Force reset of DAC clock */
|
||||||
|
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_DAC1);
|
||||||
|
|
||||||
|
/* Release reset of DAC clock */
|
||||||
|
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_DAC1);
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize some features of DAC channel.
|
||||||
|
* @note @ref LL_DAC_Init() aims to ease basic configuration of a DAC channel.
|
||||||
|
* Leaving it ready to be enabled and output:
|
||||||
|
* a level by calling one of
|
||||||
|
* @ref LL_DAC_ConvertData12RightAligned
|
||||||
|
* @ref LL_DAC_ConvertData12LeftAligned
|
||||||
|
* @ref LL_DAC_ConvertData8RightAligned
|
||||||
|
* or one of the supported autogenerated wave.
|
||||||
|
* @note This function allows configuration of:
|
||||||
|
* - Output mode
|
||||||
|
* - Trigger
|
||||||
|
* - Wave generation
|
||||||
|
* @note The setting of these parameters by function @ref LL_DAC_Init()
|
||||||
|
* is conditioned to DAC state:
|
||||||
|
* DAC channel must be disabled.
|
||||||
|
* @param DACx DAC instance
|
||||||
|
* @param DAC_Channel This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_DAC_CHANNEL_1
|
||||||
|
* @arg @ref LL_DAC_CHANNEL_2
|
||||||
|
* @param DAC_InitStruct Pointer to a @ref LL_DAC_InitTypeDef structure
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: DAC registers are initialized
|
||||||
|
* - ERROR: DAC registers are not initialized
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_DAC_Init(DAC_TypeDef *DACx, uint32_t DAC_Channel, LL_DAC_InitTypeDef *DAC_InitStruct)
|
||||||
|
{
|
||||||
|
ErrorStatus status = SUCCESS;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_DAC_ALL_INSTANCE(DACx));
|
||||||
|
assert_param(IS_LL_DAC_CHANNEL(DAC_Channel));
|
||||||
|
assert_param(IS_LL_DAC_TRIGGER_SOURCE(DAC_InitStruct->TriggerSource));
|
||||||
|
assert_param(IS_LL_DAC_OUTPUT_BUFFER(DAC_InitStruct->OutputBuffer));
|
||||||
|
assert_param(IS_LL_DAC_OUTPUT_CONNECTION(DAC_InitStruct->OutputConnection));
|
||||||
|
assert_param(IS_LL_DAC_OUTPUT_MODE(DAC_InitStruct->OutputMode));
|
||||||
|
assert_param(IS_LL_DAC_WAVE_AUTO_GENER_MODE(DAC_InitStruct->WaveAutoGeneration));
|
||||||
|
if (DAC_InitStruct->WaveAutoGeneration != LL_DAC_WAVE_AUTO_GENERATION_NONE)
|
||||||
|
{
|
||||||
|
assert_param(IS_LL_DAC_WAVE_AUTO_GENER_CONFIG(DAC_InitStruct->WaveAutoGeneration,
|
||||||
|
DAC_InitStruct->WaveAutoGenerationConfig));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Note: Hardware constraint (refer to description of this function) */
|
||||||
|
/* DAC instance must be disabled. */
|
||||||
|
if (LL_DAC_IsEnabled(DACx, DAC_Channel) == 0UL)
|
||||||
|
{
|
||||||
|
/* Configuration of DAC channel: */
|
||||||
|
/* - TriggerSource */
|
||||||
|
/* - WaveAutoGeneration */
|
||||||
|
/* - OutputBuffer */
|
||||||
|
/* - OutputConnection */
|
||||||
|
/* - OutputMode */
|
||||||
|
if (DAC_InitStruct->WaveAutoGeneration != LL_DAC_WAVE_AUTO_GENERATION_NONE)
|
||||||
|
{
|
||||||
|
MODIFY_REG(DACx->CR,
|
||||||
|
(DAC_CR_TSEL1
|
||||||
|
| DAC_CR_WAVE1
|
||||||
|
| DAC_CR_MAMP1
|
||||||
|
) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
|
||||||
|
,
|
||||||
|
(DAC_InitStruct->TriggerSource
|
||||||
|
| DAC_InitStruct->WaveAutoGeneration
|
||||||
|
| DAC_InitStruct->WaveAutoGenerationConfig
|
||||||
|
) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MODIFY_REG(DACx->CR,
|
||||||
|
(DAC_CR_TSEL1
|
||||||
|
| DAC_CR_WAVE1
|
||||||
|
) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
|
||||||
|
,
|
||||||
|
(DAC_InitStruct->TriggerSource
|
||||||
|
| LL_DAC_WAVE_AUTO_GENERATION_NONE
|
||||||
|
) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
MODIFY_REG(DACx->MCR,
|
||||||
|
(DAC_MCR_MODE1_1
|
||||||
|
| DAC_MCR_MODE1_0
|
||||||
|
| DAC_MCR_MODE1_2
|
||||||
|
) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
|
||||||
|
,
|
||||||
|
(DAC_InitStruct->OutputBuffer
|
||||||
|
| DAC_InitStruct->OutputConnection
|
||||||
|
| DAC_InitStruct->OutputMode
|
||||||
|
) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Initialization error: DAC instance is not disabled. */
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set each @ref LL_DAC_InitTypeDef field to default value.
|
||||||
|
* @param DAC_InitStruct pointer to a @ref LL_DAC_InitTypeDef structure
|
||||||
|
* whose fields will be set to default values.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void LL_DAC_StructInit(LL_DAC_InitTypeDef *DAC_InitStruct)
|
||||||
|
{
|
||||||
|
/* Set DAC_InitStruct fields to default values */
|
||||||
|
DAC_InitStruct->TriggerSource = LL_DAC_TRIG_SOFTWARE;
|
||||||
|
DAC_InitStruct->WaveAutoGeneration = LL_DAC_WAVE_AUTO_GENERATION_NONE;
|
||||||
|
/* Note: Parameter discarded if wave auto generation is disabled, */
|
||||||
|
/* set anyway to its default value. */
|
||||||
|
DAC_InitStruct->WaveAutoGenerationConfig = LL_DAC_NOISE_LFSR_UNMASK_BIT0;
|
||||||
|
DAC_InitStruct->OutputBuffer = LL_DAC_OUTPUT_BUFFER_ENABLE;
|
||||||
|
DAC_InitStruct->OutputConnection = LL_DAC_OUTPUT_CONNECT_GPIO;
|
||||||
|
DAC_InitStruct->OutputMode = LL_DAC_OUTPUT_MODE_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* DAC1 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* USE_FULL_LL_DRIVER */
|
||||||
|
|
367
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_dma.c
Normal file
367
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_dma.c
Normal file
@ -0,0 +1,367 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_dma.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief DMA LL module driver.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
#if defined(USE_FULL_LL_DRIVER)
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx_ll_dma.h"
|
||||||
|
#include "stm32g0xx_ll_bus.h"
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
#include "stm32_assert.h"
|
||||||
|
#else
|
||||||
|
#define assert_param(expr) ((void)0U)
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (DMA1) || defined (DMA2)
|
||||||
|
|
||||||
|
/** @defgroup DMA_LL DMA
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/** @addtogroup DMA_LL_Private_Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define IS_LL_DMA_DIRECTION(__VALUE__) (((__VALUE__) == LL_DMA_DIRECTION_PERIPH_TO_MEMORY) || \
|
||||||
|
((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_PERIPH) || \
|
||||||
|
((__VALUE__) == LL_DMA_DIRECTION_MEMORY_TO_MEMORY))
|
||||||
|
|
||||||
|
#define IS_LL_DMA_MODE(__VALUE__) (((__VALUE__) == LL_DMA_MODE_NORMAL) || \
|
||||||
|
((__VALUE__) == LL_DMA_MODE_CIRCULAR))
|
||||||
|
|
||||||
|
#define IS_LL_DMA_PERIPHINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_PERIPH_INCREMENT) || \
|
||||||
|
((__VALUE__) == LL_DMA_PERIPH_NOINCREMENT))
|
||||||
|
|
||||||
|
#define IS_LL_DMA_MEMORYINCMODE(__VALUE__) (((__VALUE__) == LL_DMA_MEMORY_INCREMENT) || \
|
||||||
|
((__VALUE__) == LL_DMA_MEMORY_NOINCREMENT))
|
||||||
|
|
||||||
|
#define IS_LL_DMA_PERIPHDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_PDATAALIGN_BYTE) || \
|
||||||
|
((__VALUE__) == LL_DMA_PDATAALIGN_HALFWORD) || \
|
||||||
|
((__VALUE__) == LL_DMA_PDATAALIGN_WORD))
|
||||||
|
|
||||||
|
#define IS_LL_DMA_MEMORYDATASIZE(__VALUE__) (((__VALUE__) == LL_DMA_MDATAALIGN_BYTE) || \
|
||||||
|
((__VALUE__) == LL_DMA_MDATAALIGN_HALFWORD) || \
|
||||||
|
((__VALUE__) == LL_DMA_MDATAALIGN_WORD))
|
||||||
|
|
||||||
|
#define IS_LL_DMA_NBDATA(__VALUE__) ((__VALUE__) <= 0x0000FFFFU)
|
||||||
|
|
||||||
|
#define IS_LL_DMA_PERIPHREQUEST(__VALUE__) ((__VALUE__) <= LL_DMAMUX_MAX_REQ)
|
||||||
|
|
||||||
|
#define IS_LL_DMA_PRIORITY(__VALUE__) (((__VALUE__) == LL_DMA_PRIORITY_LOW) || \
|
||||||
|
((__VALUE__) == LL_DMA_PRIORITY_MEDIUM) || \
|
||||||
|
((__VALUE__) == LL_DMA_PRIORITY_HIGH) || \
|
||||||
|
((__VALUE__) == LL_DMA_PRIORITY_VERYHIGH))
|
||||||
|
|
||||||
|
#if defined(DMA2)
|
||||||
|
#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \
|
||||||
|
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_2) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_3) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_4) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_5) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_6) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_7))) || \
|
||||||
|
(((INSTANCE) == DMA2) && \
|
||||||
|
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_2) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_3) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_4) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_5))))
|
||||||
|
#else /* DMA1 */
|
||||||
|
#if defined(DMA1_Channel7)
|
||||||
|
#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \
|
||||||
|
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_2) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_3) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_4) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_5) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_6) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_7))))
|
||||||
|
#else
|
||||||
|
#define IS_LL_DMA_ALL_CHANNEL_INSTANCE(INSTANCE, CHANNEL) ((((INSTANCE) == DMA1) && \
|
||||||
|
(((CHANNEL) == LL_DMA_CHANNEL_1) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_2) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_3) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_4) || \
|
||||||
|
((CHANNEL) == LL_DMA_CHANNEL_5))))
|
||||||
|
#endif /* DMA1_Channel8 */
|
||||||
|
#endif /* DMA2 */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup DMA_LL_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup DMA_LL_EF_Init
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief De-initialize the DMA registers to their default reset values.
|
||||||
|
* @param DMAx DMAx Instance
|
||||||
|
* @param Channel This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_1
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_2
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_3
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_4
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_5
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_6
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_7
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_ALL
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: DMA registers are de-initialized
|
||||||
|
* - ERROR: DMA registers are not de-initialized
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_DMA_DeInit(DMA_TypeDef *DMAx, uint32_t Channel)
|
||||||
|
{
|
||||||
|
ErrorStatus status = SUCCESS;
|
||||||
|
|
||||||
|
/* Check the DMA Instance DMAx and Channel parameters*/
|
||||||
|
assert_param(IS_LL_DMA_ALL_CHANNEL_INSTANCE(DMAx, Channel) || (Channel == LL_DMA_CHANNEL_ALL));
|
||||||
|
|
||||||
|
if (Channel == LL_DMA_CHANNEL_ALL)
|
||||||
|
{
|
||||||
|
if (DMAx == DMA1)
|
||||||
|
{
|
||||||
|
/* Force reset of DMA clock */
|
||||||
|
LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA1);
|
||||||
|
|
||||||
|
/* Release reset of DMA clock */
|
||||||
|
LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA1);
|
||||||
|
}
|
||||||
|
#if defined(DMA2)
|
||||||
|
else if (DMAx == DMA2)
|
||||||
|
{
|
||||||
|
/* Force reset of DMA clock */
|
||||||
|
LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA2);
|
||||||
|
|
||||||
|
/* Release reset of DMA clock */
|
||||||
|
LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA2);
|
||||||
|
}
|
||||||
|
#endif /* DMA2 */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DMA_Channel_TypeDef *tmp;
|
||||||
|
|
||||||
|
tmp = (DMA_Channel_TypeDef *)(__LL_DMA_GET_CHANNEL_INSTANCE(DMAx, Channel));
|
||||||
|
|
||||||
|
/* Disable the selected DMAx_Channely */
|
||||||
|
CLEAR_BIT(tmp->CCR, DMA_CCR_EN);
|
||||||
|
|
||||||
|
/* Reset DMAx_Channely control register */
|
||||||
|
WRITE_REG(tmp->CCR, 0U);
|
||||||
|
|
||||||
|
/* Reset DMAx_Channely remaining bytes register */
|
||||||
|
WRITE_REG(tmp->CNDTR, 0U);
|
||||||
|
|
||||||
|
/* Reset DMAx_Channely peripheral address register */
|
||||||
|
WRITE_REG(tmp->CPAR, 0U);
|
||||||
|
|
||||||
|
/* Reset DMAx_Channely memory address register */
|
||||||
|
WRITE_REG(tmp->CMAR, 0U);
|
||||||
|
|
||||||
|
/* Reset Request register field for DMAx Channel */
|
||||||
|
LL_DMA_SetPeriphRequest(DMAx, Channel, LL_DMAMUX_REQ_MEM2MEM);
|
||||||
|
|
||||||
|
if (Channel == LL_DMA_CHANNEL_1)
|
||||||
|
{
|
||||||
|
/* Reset interrupt pending bits for DMAx Channel1 */
|
||||||
|
LL_DMA_ClearFlag_GI1(DMAx);
|
||||||
|
}
|
||||||
|
else if (Channel == LL_DMA_CHANNEL_2)
|
||||||
|
{
|
||||||
|
/* Reset interrupt pending bits for DMAx Channel2 */
|
||||||
|
LL_DMA_ClearFlag_GI2(DMAx);
|
||||||
|
}
|
||||||
|
else if (Channel == LL_DMA_CHANNEL_3)
|
||||||
|
{
|
||||||
|
/* Reset interrupt pending bits for DMAx Channel3 */
|
||||||
|
LL_DMA_ClearFlag_GI3(DMAx);
|
||||||
|
}
|
||||||
|
else if (Channel == LL_DMA_CHANNEL_4)
|
||||||
|
{
|
||||||
|
/* Reset interrupt pending bits for DMAx Channel4 */
|
||||||
|
LL_DMA_ClearFlag_GI4(DMAx);
|
||||||
|
}
|
||||||
|
else if (Channel == LL_DMA_CHANNEL_5)
|
||||||
|
{
|
||||||
|
/* Reset interrupt pending bits for DMAx Channel5 */
|
||||||
|
LL_DMA_ClearFlag_GI5(DMAx);
|
||||||
|
}
|
||||||
|
#if defined(DMA1_Channel6)
|
||||||
|
else if (Channel == LL_DMA_CHANNEL_6)
|
||||||
|
{
|
||||||
|
/* Reset interrupt pending bits for DMAx Channel6 */
|
||||||
|
LL_DMA_ClearFlag_GI6(DMAx);
|
||||||
|
}
|
||||||
|
#endif /* DMA1_Channel6 */
|
||||||
|
#if defined(DMA1_Channel7)
|
||||||
|
else if (Channel == LL_DMA_CHANNEL_7)
|
||||||
|
{
|
||||||
|
/* Reset interrupt pending bits for DMAx Channel7 */
|
||||||
|
LL_DMA_ClearFlag_GI7(DMAx);
|
||||||
|
}
|
||||||
|
#endif /* DMA1_Channel7 */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize the DMA registers according to the specified parameters in DMA_InitStruct.
|
||||||
|
* @note To convert DMAx_Channely Instance to DMAx Instance and Channely, use helper macros :
|
||||||
|
* @arg @ref __LL_DMA_GET_INSTANCE
|
||||||
|
* @arg @ref __LL_DMA_GET_CHANNEL
|
||||||
|
* @param DMAx DMAx Instance
|
||||||
|
* @param Channel This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_1
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_2
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_3
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_4
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_5
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_6
|
||||||
|
* @arg @ref LL_DMA_CHANNEL_7
|
||||||
|
* @param DMA_InitStruct pointer to a @ref LL_DMA_InitTypeDef structure.
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: DMA registers are initialized
|
||||||
|
* - ERROR: Not applicable
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_DMA_Init(DMA_TypeDef *DMAx, uint32_t Channel, LL_DMA_InitTypeDef *DMA_InitStruct)
|
||||||
|
{
|
||||||
|
/* Check the DMA Instance DMAx and Channel parameters*/
|
||||||
|
assert_param(IS_LL_DMA_ALL_CHANNEL_INSTANCE(DMAx, Channel));
|
||||||
|
|
||||||
|
/* Check the DMA parameters from DMA_InitStruct */
|
||||||
|
assert_param(IS_LL_DMA_DIRECTION(DMA_InitStruct->Direction));
|
||||||
|
assert_param(IS_LL_DMA_MODE(DMA_InitStruct->Mode));
|
||||||
|
assert_param(IS_LL_DMA_PERIPHINCMODE(DMA_InitStruct->PeriphOrM2MSrcIncMode));
|
||||||
|
assert_param(IS_LL_DMA_MEMORYINCMODE(DMA_InitStruct->MemoryOrM2MDstIncMode));
|
||||||
|
assert_param(IS_LL_DMA_PERIPHDATASIZE(DMA_InitStruct->PeriphOrM2MSrcDataSize));
|
||||||
|
assert_param(IS_LL_DMA_MEMORYDATASIZE(DMA_InitStruct->MemoryOrM2MDstDataSize));
|
||||||
|
assert_param(IS_LL_DMA_NBDATA(DMA_InitStruct->NbData));
|
||||||
|
assert_param(IS_LL_DMA_PERIPHREQUEST(DMA_InitStruct->PeriphRequest));
|
||||||
|
assert_param(IS_LL_DMA_PRIORITY(DMA_InitStruct->Priority));
|
||||||
|
|
||||||
|
/*---------------------------- DMAx CCR Configuration ------------------------
|
||||||
|
* Configure DMAx_Channely: data transfer direction, data transfer mode,
|
||||||
|
* peripheral and memory increment mode,
|
||||||
|
* data size alignment and priority level with parameters :
|
||||||
|
* - Direction: DMA_CCR_DIR and DMA_CCR_MEM2MEM bits
|
||||||
|
* - Mode: DMA_CCR_CIRC bit
|
||||||
|
* - PeriphOrM2MSrcIncMode: DMA_CCR_PINC bit
|
||||||
|
* - MemoryOrM2MDstIncMode: DMA_CCR_MINC bit
|
||||||
|
* - PeriphOrM2MSrcDataSize: DMA_CCR_PSIZE[1:0] bits
|
||||||
|
* - MemoryOrM2MDstDataSize: DMA_CCR_MSIZE[1:0] bits
|
||||||
|
* - Priority: DMA_CCR_PL[1:0] bits
|
||||||
|
*/
|
||||||
|
LL_DMA_ConfigTransfer(DMAx, Channel, DMA_InitStruct->Direction | \
|
||||||
|
DMA_InitStruct->Mode | \
|
||||||
|
DMA_InitStruct->PeriphOrM2MSrcIncMode | \
|
||||||
|
DMA_InitStruct->MemoryOrM2MDstIncMode | \
|
||||||
|
DMA_InitStruct->PeriphOrM2MSrcDataSize | \
|
||||||
|
DMA_InitStruct->MemoryOrM2MDstDataSize | \
|
||||||
|
DMA_InitStruct->Priority);
|
||||||
|
|
||||||
|
/*-------------------------- DMAx CMAR Configuration -------------------------
|
||||||
|
* Configure the memory or destination base address with parameter :
|
||||||
|
* - MemoryOrM2MDstAddress: DMA_CMAR_MA[31:0] bits
|
||||||
|
*/
|
||||||
|
LL_DMA_SetMemoryAddress(DMAx, Channel, DMA_InitStruct->MemoryOrM2MDstAddress);
|
||||||
|
|
||||||
|
/*-------------------------- DMAx CPAR Configuration -------------------------
|
||||||
|
* Configure the peripheral or source base address with parameter :
|
||||||
|
* - PeriphOrM2MSrcAddress: DMA_CPAR_PA[31:0] bits
|
||||||
|
*/
|
||||||
|
LL_DMA_SetPeriphAddress(DMAx, Channel, DMA_InitStruct->PeriphOrM2MSrcAddress);
|
||||||
|
|
||||||
|
/*--------------------------- DMAx CNDTR Configuration -----------------------
|
||||||
|
* Configure the peripheral base address with parameter :
|
||||||
|
* - NbData: DMA_CNDTR_NDT[15:0] bits
|
||||||
|
*/
|
||||||
|
LL_DMA_SetDataLength(DMAx, Channel, DMA_InitStruct->NbData);
|
||||||
|
|
||||||
|
/*--------------------------- DMAMUXx CCR Configuration ----------------------
|
||||||
|
* Configure the DMA request for DMA Channels on DMAMUX Channel x with parameter :
|
||||||
|
* - PeriphRequest: DMA_CxCR[7:0] bits
|
||||||
|
*/
|
||||||
|
LL_DMA_SetPeriphRequest(DMAx, Channel, DMA_InitStruct->PeriphRequest);
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set each @ref LL_DMA_InitTypeDef field to default value.
|
||||||
|
* @param DMA_InitStruct Pointer to a @ref LL_DMA_InitTypeDef structure.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void LL_DMA_StructInit(LL_DMA_InitTypeDef *DMA_InitStruct)
|
||||||
|
{
|
||||||
|
/* Set DMA_InitStruct fields to default values */
|
||||||
|
DMA_InitStruct->PeriphOrM2MSrcAddress = 0x00000000U;
|
||||||
|
DMA_InitStruct->MemoryOrM2MDstAddress = 0x00000000U;
|
||||||
|
DMA_InitStruct->Direction = LL_DMA_DIRECTION_PERIPH_TO_MEMORY;
|
||||||
|
DMA_InitStruct->Mode = LL_DMA_MODE_NORMAL;
|
||||||
|
DMA_InitStruct->PeriphOrM2MSrcIncMode = LL_DMA_PERIPH_NOINCREMENT;
|
||||||
|
DMA_InitStruct->MemoryOrM2MDstIncMode = LL_DMA_MEMORY_NOINCREMENT;
|
||||||
|
DMA_InitStruct->PeriphOrM2MSrcDataSize = LL_DMA_PDATAALIGN_BYTE;
|
||||||
|
DMA_InitStruct->MemoryOrM2MDstDataSize = LL_DMA_MDATAALIGN_BYTE;
|
||||||
|
DMA_InitStruct->NbData = 0x00000000U;
|
||||||
|
DMA_InitStruct->PeriphRequest = LL_DMAMUX_REQ_MEM2MEM;
|
||||||
|
DMA_InitStruct->Priority = LL_DMA_PRIORITY_LOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* DMA1 || DMA2 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* USE_FULL_LL_DRIVER */
|
||||||
|
|
293
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_exti.c
Normal file
293
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_exti.c
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_exti.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief EXTI LL module driver.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
#if defined(USE_FULL_LL_DRIVER)
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx_ll_exti.h"
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
#include "stm32_assert.h"
|
||||||
|
#else
|
||||||
|
#define assert_param(expr) ((void)0U)
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (EXTI)
|
||||||
|
|
||||||
|
/** @defgroup EXTI_LL EXTI
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/** @addtogroup EXTI_LL_Private_Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define IS_LL_EXTI_LINE_0_31(__VALUE__) (((__VALUE__) & ~LL_EXTI_LINE_ALL_0_31) == 0x00000000U)
|
||||||
|
#if defined(STM32G081xx) || defined(STM32G071xx) || defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
|
||||||
|
#define IS_LL_EXTI_LINE_32_63(__VALUE__) (((__VALUE__) & ~LL_EXTI_LINE_ALL_32_63) == 0x00000000U)
|
||||||
|
#endif /* STM32G081xx || STM32G071xx || STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
|
||||||
|
#define IS_LL_EXTI_MODE(__VALUE__) (((__VALUE__) == LL_EXTI_MODE_IT) \
|
||||||
|
|| ((__VALUE__) == LL_EXTI_MODE_EVENT) \
|
||||||
|
|| ((__VALUE__) == LL_EXTI_MODE_IT_EVENT))
|
||||||
|
|
||||||
|
|
||||||
|
#define IS_LL_EXTI_TRIGGER(__VALUE__) (((__VALUE__) == LL_EXTI_TRIGGER_NONE) \
|
||||||
|
|| ((__VALUE__) == LL_EXTI_TRIGGER_RISING) \
|
||||||
|
|| ((__VALUE__) == LL_EXTI_TRIGGER_FALLING) \
|
||||||
|
|| ((__VALUE__) == LL_EXTI_TRIGGER_RISING_FALLING))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup EXTI_LL_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup EXTI_LL_EF_Init
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief De-initialize the EXTI registers to their default reset values.
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - 0x00: EXTI registers are de-initialized
|
||||||
|
*/
|
||||||
|
uint32_t LL_EXTI_DeInit(void)
|
||||||
|
{
|
||||||
|
/* Interrupt mask register set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(IMR1, 0xFFF80000U);
|
||||||
|
/* Event mask register set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(EMR1, 0x00000000U);
|
||||||
|
/* Rising Trigger selection register set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(RTSR1, 0x00000000U);
|
||||||
|
/* Falling Trigger selection register set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(FTSR1, 0x00000000U);
|
||||||
|
/* Software interrupt event register set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(SWIER1, 0x00000000U);
|
||||||
|
/* Pending register set to default reset values */
|
||||||
|
#if defined(STM32G0C1xx) || defined(STM32G0B1xx)
|
||||||
|
LL_EXTI_WriteReg(RPR1, 0x0017FFFFU);
|
||||||
|
LL_EXTI_WriteReg(FPR1, 0x0017FFFFU);
|
||||||
|
#elif defined(STM32G081xx) || defined(STM32G071xx) || defined(STM32G061xx) || defined(STM32G051xx)
|
||||||
|
LL_EXTI_WriteReg(RPR1, 0x0007FFFFU);
|
||||||
|
LL_EXTI_WriteReg(FPR1, 0x0007FFFFU);
|
||||||
|
#elif defined(STM32G041xx) || defined(STM32G031xx)
|
||||||
|
LL_EXTI_WriteReg(RPR1, 0x0001FFFFU);
|
||||||
|
LL_EXTI_WriteReg(FPR1, 0x0001FFFFU);
|
||||||
|
#elif defined(STM32G0B0xx) || defined(STM32G070xx) || defined(STM32G050xx) || defined(STM32G030xx)
|
||||||
|
LL_EXTI_WriteReg(RPR1, 0x0000FFFFU);
|
||||||
|
LL_EXTI_WriteReg(FPR1, 0x0000FFFFU);
|
||||||
|
#endif /* STM32G0C1xx || STM32G0B1xx */
|
||||||
|
|
||||||
|
#if defined(STM32G081xx) || defined(STM32G071xx)
|
||||||
|
/* Interrupt mask register 2 set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(IMR2, 0x00000003U);
|
||||||
|
/* Event mask register 2 set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(EMR2, 0x00000000U);
|
||||||
|
#elif defined(STM32G0C1xx) || defined(STM32G0B1xx)
|
||||||
|
/* Interrupt mask register 2 set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(IMR2, 0x0000001FU);
|
||||||
|
/* Event mask register 2 set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(EMR2, 0x00000000U);
|
||||||
|
/* Rising Trigger selection register set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(RTSR2, 0x00000000U);
|
||||||
|
/* Falling Trigger selection register set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(FTSR2, 0x00000000U);
|
||||||
|
/* Software interrupt event register set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(SWIER2, 0x00000000U);
|
||||||
|
/* Pending register set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(RPR2, 0x00000004U);
|
||||||
|
LL_EXTI_WriteReg(FPR2, 0x00000004U);
|
||||||
|
#elif defined(STM32G0B0xx)
|
||||||
|
/* Interrupt mask register 2 set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(IMR2, 0x00000010U);
|
||||||
|
/* Event mask register 2 set to default reset values */
|
||||||
|
LL_EXTI_WriteReg(EMR2, 0x00000000U);
|
||||||
|
#endif /* STM32G081xx || STM32G071xx */
|
||||||
|
|
||||||
|
return 0x00u;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize the EXTI registers according to the specified parameters in EXTI_InitStruct.
|
||||||
|
* @param EXTI_InitStruct pointer to a @ref LL_EXTI_InitTypeDef structure.
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - 0x00: EXTI registers are initialized
|
||||||
|
* - any other value : wrong configuration
|
||||||
|
*/
|
||||||
|
uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct)
|
||||||
|
{
|
||||||
|
uint32_t status = 0x00u;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_LL_EXTI_LINE_0_31(EXTI_InitStruct->Line_0_31));
|
||||||
|
#if defined(STM32G081xx) || defined(STM32G071xx) || defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
|
||||||
|
assert_param(IS_LL_EXTI_LINE_32_63(EXTI_InitStruct->Line_32_63));
|
||||||
|
#endif /* STM32G081xx || STM32G071xx || STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
|
||||||
|
assert_param(IS_FUNCTIONAL_STATE(EXTI_InitStruct->LineCommand));
|
||||||
|
assert_param(IS_LL_EXTI_MODE(EXTI_InitStruct->Mode));
|
||||||
|
|
||||||
|
/* ENABLE LineCommand */
|
||||||
|
if (EXTI_InitStruct->LineCommand != DISABLE)
|
||||||
|
{
|
||||||
|
assert_param(IS_LL_EXTI_TRIGGER(EXTI_InitStruct->Trigger));
|
||||||
|
|
||||||
|
/* Configure EXTI Lines in range from 0 to 31 */
|
||||||
|
if (EXTI_InitStruct->Line_0_31 != LL_EXTI_LINE_NONE)
|
||||||
|
{
|
||||||
|
switch (EXTI_InitStruct->Mode)
|
||||||
|
{
|
||||||
|
case LL_EXTI_MODE_IT:
|
||||||
|
/* First Disable Event on provided Lines */
|
||||||
|
LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
/* Then Enable IT on provided Lines */
|
||||||
|
LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
break;
|
||||||
|
case LL_EXTI_MODE_EVENT:
|
||||||
|
/* First Disable IT on provided Lines */
|
||||||
|
LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
/* Then Enable Event on provided Lines */
|
||||||
|
LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
break;
|
||||||
|
case LL_EXTI_MODE_IT_EVENT:
|
||||||
|
/* Directly Enable IT & Event on provided Lines */
|
||||||
|
LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
status = 0x01u;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (EXTI_InitStruct->Trigger != LL_EXTI_TRIGGER_NONE)
|
||||||
|
{
|
||||||
|
switch (EXTI_InitStruct->Trigger)
|
||||||
|
{
|
||||||
|
case LL_EXTI_TRIGGER_RISING:
|
||||||
|
/* First Disable Falling Trigger on provided Lines */
|
||||||
|
LL_EXTI_DisableFallingTrig_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
/* Then Enable Rising Trigger on provided Lines */
|
||||||
|
LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
break;
|
||||||
|
case LL_EXTI_TRIGGER_FALLING:
|
||||||
|
/* First Disable Rising Trigger on provided Lines */
|
||||||
|
LL_EXTI_DisableRisingTrig_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
/* Then Enable Falling Trigger on provided Lines */
|
||||||
|
LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
break;
|
||||||
|
case LL_EXTI_TRIGGER_RISING_FALLING:
|
||||||
|
LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
status |= 0x02u;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if defined(STM32G081xx) || defined(STM32G071xx) || defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
|
||||||
|
/* Configure EXTI Lines in range from 32 to 63 */
|
||||||
|
if (EXTI_InitStruct->Line_32_63 != LL_EXTI_LINE_NONE)
|
||||||
|
{
|
||||||
|
switch (EXTI_InitStruct->Mode)
|
||||||
|
{
|
||||||
|
case LL_EXTI_MODE_IT:
|
||||||
|
/* First Disable Event on provided Lines */
|
||||||
|
LL_EXTI_DisableEvent_32_63(EXTI_InitStruct->Line_32_63);
|
||||||
|
/* Then Enable IT on provided Lines */
|
||||||
|
LL_EXTI_EnableIT_32_63(EXTI_InitStruct->Line_32_63);
|
||||||
|
break;
|
||||||
|
case LL_EXTI_MODE_EVENT:
|
||||||
|
/* First Disable IT on provided Lines */
|
||||||
|
LL_EXTI_DisableIT_32_63(EXTI_InitStruct->Line_32_63);
|
||||||
|
/* Then Enable Event on provided Lines */
|
||||||
|
LL_EXTI_EnableEvent_32_63(EXTI_InitStruct->Line_32_63);
|
||||||
|
break;
|
||||||
|
case LL_EXTI_MODE_IT_EVENT:
|
||||||
|
/* Directly Enable IT & Event on provided Lines */
|
||||||
|
LL_EXTI_EnableIT_32_63(EXTI_InitStruct->Line_32_63);
|
||||||
|
LL_EXTI_EnableEvent_32_63(EXTI_InitStruct->Line_32_63);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
status |= 0x04u;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* STM32G081xx || STM32G071xx || STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
|
||||||
|
}
|
||||||
|
/* DISABLE LineCommand */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* De-configure EXTI Lines in range from 0 to 31 */
|
||||||
|
LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31);
|
||||||
|
#if defined(STM32G081xx) || defined(STM32G071xx) || defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
|
||||||
|
/* De-configure EXTI Lines in range from 32 to 63 */
|
||||||
|
LL_EXTI_DisableIT_32_63(EXTI_InitStruct->Line_32_63);
|
||||||
|
LL_EXTI_DisableEvent_32_63(EXTI_InitStruct->Line_32_63);
|
||||||
|
#endif /* STM32G081xx || STM32G071xx || STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set each @ref LL_EXTI_InitTypeDef field to default value.
|
||||||
|
* @param EXTI_InitStruct Pointer to a @ref LL_EXTI_InitTypeDef structure.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void LL_EXTI_StructInit(LL_EXTI_InitTypeDef *EXTI_InitStruct)
|
||||||
|
{
|
||||||
|
EXTI_InitStruct->Line_0_31 = LL_EXTI_LINE_NONE;
|
||||||
|
#if defined(STM32G081xx) || defined(STM32G071xx) || defined(STM32G0C1xx) || defined(STM32G0B1xx) || defined(STM32G0B0xx)
|
||||||
|
EXTI_InitStruct->Line_32_63 = LL_EXTI_LINE_NONE;
|
||||||
|
#endif /* STM32G081xx || STM32G071xx || STM32G0C1xx || STM32G0B1xx || STM32G0B0xx */
|
||||||
|
EXTI_InitStruct->LineCommand = DISABLE;
|
||||||
|
EXTI_InitStruct->Mode = LL_EXTI_MODE_IT;
|
||||||
|
EXTI_InitStruct->Trigger = LL_EXTI_TRIGGER_FALLING;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* defined (EXTI) */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* USE_FULL_LL_DRIVER */
|
||||||
|
|
278
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_gpio.c
Normal file
278
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_gpio.c
Normal file
@ -0,0 +1,278 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_gpio.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief GPIO LL module driver.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
#if defined(USE_FULL_LL_DRIVER)
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx_ll_gpio.h"
|
||||||
|
#include "stm32g0xx_ll_bus.h"
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
#include "stm32_assert.h"
|
||||||
|
#else
|
||||||
|
#define assert_param(expr) ((void)0U)
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF)
|
||||||
|
|
||||||
|
/** @addtogroup GPIO_LL
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
/** MISRA C:2012 deviation rule has been granted for following rules:
|
||||||
|
* Rule-12.2 - Medium: RHS argument is in interval [0,INF] which is out of
|
||||||
|
* range of the shift operator in following API :
|
||||||
|
* LL_GPIO_Init
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/** @addtogroup GPIO_LL_Private_Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define IS_LL_GPIO_PIN(__VALUE__) (((0x00u) < (__VALUE__)) && ((__VALUE__) <= (LL_GPIO_PIN_ALL)))
|
||||||
|
|
||||||
|
#define IS_LL_GPIO_MODE(__VALUE__) (((__VALUE__) == LL_GPIO_MODE_INPUT) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_MODE_OUTPUT) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_MODE_ALTERNATE) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_MODE_ANALOG))
|
||||||
|
|
||||||
|
#define IS_LL_GPIO_OUTPUT_TYPE(__VALUE__) (((__VALUE__) == LL_GPIO_OUTPUT_PUSHPULL) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_OUTPUT_OPENDRAIN))
|
||||||
|
|
||||||
|
#define IS_LL_GPIO_SPEED(__VALUE__) (((__VALUE__) == LL_GPIO_SPEED_FREQ_LOW) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_SPEED_FREQ_MEDIUM) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_SPEED_FREQ_HIGH) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_SPEED_FREQ_VERY_HIGH))
|
||||||
|
|
||||||
|
#define IS_LL_GPIO_PULL(__VALUE__) (((__VALUE__) == LL_GPIO_PULL_NO) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_PULL_UP) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_PULL_DOWN))
|
||||||
|
|
||||||
|
#if defined(GPIOE)
|
||||||
|
#define IS_LL_GPIO_ALTERNATE(__VALUE__) (((__VALUE__) == LL_GPIO_AF_0 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_1 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_2 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_3 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_4 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_5 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_6 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_7 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_8 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_9 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_10 ))
|
||||||
|
#else
|
||||||
|
#define IS_LL_GPIO_ALTERNATE(__VALUE__) (((__VALUE__) == LL_GPIO_AF_0 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_1 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_2 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_3 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_4 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_5 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_6 ) ||\
|
||||||
|
((__VALUE__) == LL_GPIO_AF_7 ))
|
||||||
|
#endif /* GPIOE */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup GPIO_LL_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup GPIO_LL_EF_Init
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief De-initialize GPIO registers (Registers restored to their default values).
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: GPIO registers are de-initialized
|
||||||
|
* - ERROR: Wrong GPIO Port
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx)
|
||||||
|
{
|
||||||
|
ErrorStatus status = SUCCESS;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
|
||||||
|
|
||||||
|
/* Force and Release reset on clock of GPIOx Port */
|
||||||
|
if (GPIOx == GPIOA)
|
||||||
|
{
|
||||||
|
LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOA);
|
||||||
|
LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOA);
|
||||||
|
}
|
||||||
|
else if (GPIOx == GPIOB)
|
||||||
|
{
|
||||||
|
LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOB);
|
||||||
|
LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOB);
|
||||||
|
}
|
||||||
|
else if (GPIOx == GPIOC)
|
||||||
|
{
|
||||||
|
LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOC);
|
||||||
|
LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOC);
|
||||||
|
}
|
||||||
|
#if defined(GPIOD)
|
||||||
|
else if (GPIOx == GPIOD)
|
||||||
|
{
|
||||||
|
LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOD);
|
||||||
|
LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOD);
|
||||||
|
}
|
||||||
|
#endif /* GPIOD */
|
||||||
|
#if defined(GPIOE)
|
||||||
|
else if (GPIOx == GPIOE)
|
||||||
|
{
|
||||||
|
LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOE);
|
||||||
|
LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOE);
|
||||||
|
}
|
||||||
|
#endif /* GPIOE */
|
||||||
|
#if defined(GPIOF)
|
||||||
|
else if (GPIOx == GPIOF)
|
||||||
|
{
|
||||||
|
LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOF);
|
||||||
|
LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOF);
|
||||||
|
}
|
||||||
|
#endif /* GPIOF */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize GPIO registers according to the specified parameters in GPIO_InitStruct.
|
||||||
|
* @param GPIOx GPIO Port
|
||||||
|
* @param GPIO_InitStruct pointer to a @ref LL_GPIO_InitTypeDef structure
|
||||||
|
* that contains the configuration information for the specified GPIO peripheral.
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: GPIO registers are initialized according to GPIO_InitStruct content
|
||||||
|
* - ERROR: Not applicable
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct)
|
||||||
|
{
|
||||||
|
uint32_t pinpos;
|
||||||
|
uint32_t currentpin;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
|
||||||
|
assert_param(IS_LL_GPIO_PIN(GPIO_InitStruct->Pin));
|
||||||
|
assert_param(IS_LL_GPIO_MODE(GPIO_InitStruct->Mode));
|
||||||
|
assert_param(IS_LL_GPIO_PULL(GPIO_InitStruct->Pull));
|
||||||
|
|
||||||
|
/* ------------------------- Configure the port pins ---------------- */
|
||||||
|
/* Initialize pinpos on first pin set */
|
||||||
|
pinpos = 0;
|
||||||
|
|
||||||
|
/* Configure the port pins */
|
||||||
|
while (((GPIO_InitStruct->Pin) >> pinpos) != 0x00u)
|
||||||
|
{
|
||||||
|
/* Get current io position */
|
||||||
|
currentpin = (GPIO_InitStruct->Pin) & (0x00000001uL << pinpos);
|
||||||
|
|
||||||
|
if (currentpin != 0x00u)
|
||||||
|
{
|
||||||
|
if ((GPIO_InitStruct->Mode == LL_GPIO_MODE_OUTPUT) || (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE))
|
||||||
|
{
|
||||||
|
/* Check Speed mode parameters */
|
||||||
|
assert_param(IS_LL_GPIO_SPEED(GPIO_InitStruct->Speed));
|
||||||
|
|
||||||
|
/* Speed mode configuration */
|
||||||
|
LL_GPIO_SetPinSpeed(GPIOx, currentpin, GPIO_InitStruct->Speed);
|
||||||
|
|
||||||
|
/* Check Output mode parameters */
|
||||||
|
assert_param(IS_LL_GPIO_OUTPUT_TYPE(GPIO_InitStruct->OutputType));
|
||||||
|
|
||||||
|
/* Output mode configuration*/
|
||||||
|
LL_GPIO_SetPinOutputType(GPIOx, currentpin, GPIO_InitStruct->OutputType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pull-up Pull down resistor configuration*/
|
||||||
|
LL_GPIO_SetPinPull(GPIOx, currentpin, GPIO_InitStruct->Pull);
|
||||||
|
|
||||||
|
if (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE)
|
||||||
|
{
|
||||||
|
/* Check Alternate parameter */
|
||||||
|
assert_param(IS_LL_GPIO_ALTERNATE(GPIO_InitStruct->Alternate));
|
||||||
|
|
||||||
|
/* Speed mode configuration */
|
||||||
|
if (currentpin < LL_GPIO_PIN_8)
|
||||||
|
{
|
||||||
|
LL_GPIO_SetAFPin_0_7(GPIOx, currentpin, GPIO_InitStruct->Alternate);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_GPIO_SetAFPin_8_15(GPIOx, currentpin, GPIO_InitStruct->Alternate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pin Mode configuration */
|
||||||
|
LL_GPIO_SetPinMode(GPIOx, currentpin, GPIO_InitStruct->Mode);
|
||||||
|
}
|
||||||
|
pinpos++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set each @ref LL_GPIO_InitTypeDef field to default value.
|
||||||
|
* @param GPIO_InitStruct pointer to a @ref LL_GPIO_InitTypeDef structure
|
||||||
|
* whose fields will be set to default values.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
|
||||||
|
void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct)
|
||||||
|
{
|
||||||
|
/* Reset GPIO init structure parameters values */
|
||||||
|
GPIO_InitStruct->Pin = LL_GPIO_PIN_ALL;
|
||||||
|
GPIO_InitStruct->Mode = LL_GPIO_MODE_ANALOG;
|
||||||
|
GPIO_InitStruct->Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||||
|
GPIO_InitStruct->OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||||
|
GPIO_InitStruct->Pull = LL_GPIO_PULL_NO;
|
||||||
|
GPIO_InitStruct->Alternate = LL_GPIO_AF_0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* USE_FULL_LL_DRIVER */
|
||||||
|
|
311
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_lpuart.c
Normal file
311
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_lpuart.c
Normal file
@ -0,0 +1,311 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_lpuart.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief LPUART LL module driver.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
#if defined(USE_FULL_LL_DRIVER)
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx_ll_lpuart.h"
|
||||||
|
#include "stm32g0xx_ll_rcc.h"
|
||||||
|
#include "stm32g0xx_ll_bus.h"
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
#include "stm32_assert.h"
|
||||||
|
#else
|
||||||
|
#define assert_param(expr) ((void)0U)
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (LPUART1) || defined (LPUART2)
|
||||||
|
|
||||||
|
/** @addtogroup LPUART_LL
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/** @addtogroup LPUART_LL_Private_Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/** @addtogroup LPUART_LL_Private_Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Check of parameters for configuration of LPUART registers */
|
||||||
|
|
||||||
|
#define IS_LL_LPUART_PRESCALER(__VALUE__) (((__VALUE__) == LL_LPUART_PRESCALER_DIV1) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV2) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV4) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV6) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV8) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV10) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV12) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV16) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV32) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV64) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV128) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PRESCALER_DIV256))
|
||||||
|
|
||||||
|
/* __BAUDRATE__ Depending on constraints applicable for LPUART BRR register */
|
||||||
|
/* value : */
|
||||||
|
/* - fck must be in the range [3 x baudrate, 4096 x baudrate] */
|
||||||
|
/* - LPUART_BRR register value should be >= 0x300 */
|
||||||
|
/* - LPUART_BRR register value should be <= 0xFFFFF (20 bits) */
|
||||||
|
/* Baudrate specified by the user should belong to [8, 21300000].*/
|
||||||
|
#define IS_LL_LPUART_BAUDRATE(__BAUDRATE__) (((__BAUDRATE__) <= 21300000U) && ((__BAUDRATE__) >= 8U))
|
||||||
|
|
||||||
|
/* __VALUE__ BRR content must be greater than or equal to 0x300. */
|
||||||
|
#define IS_LL_LPUART_BRR_MIN(__VALUE__) ((__VALUE__) >= 0x300U)
|
||||||
|
|
||||||
|
/* __VALUE__ BRR content must be lower than or equal to 0xFFFFF. */
|
||||||
|
#define IS_LL_LPUART_BRR_MAX(__VALUE__) ((__VALUE__) <= 0x000FFFFFU)
|
||||||
|
|
||||||
|
#define IS_LL_LPUART_DIRECTION(__VALUE__) (((__VALUE__) == LL_LPUART_DIRECTION_NONE) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_DIRECTION_RX) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_DIRECTION_TX) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_DIRECTION_TX_RX))
|
||||||
|
|
||||||
|
#define IS_LL_LPUART_PARITY(__VALUE__) (((__VALUE__) == LL_LPUART_PARITY_NONE) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PARITY_EVEN) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_PARITY_ODD))
|
||||||
|
|
||||||
|
#define IS_LL_LPUART_DATAWIDTH(__VALUE__) (((__VALUE__) == LL_LPUART_DATAWIDTH_7B) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_DATAWIDTH_8B) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_DATAWIDTH_9B))
|
||||||
|
|
||||||
|
#define IS_LL_LPUART_STOPBITS(__VALUE__) (((__VALUE__) == LL_LPUART_STOPBITS_1) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_STOPBITS_2))
|
||||||
|
|
||||||
|
#define IS_LL_LPUART_HWCONTROL(__VALUE__) (((__VALUE__) == LL_LPUART_HWCONTROL_NONE) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_HWCONTROL_RTS) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_HWCONTROL_CTS) \
|
||||||
|
|| ((__VALUE__) == LL_LPUART_HWCONTROL_RTS_CTS))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup LPUART_LL_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup LPUART_LL_EF_Init
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief De-initialize LPUART registers (Registers restored to their default values).
|
||||||
|
* @param LPUARTx LPUART Instance
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: LPUART registers are de-initialized
|
||||||
|
* - ERROR: not applicable
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_LPUART_DeInit(const USART_TypeDef *LPUARTx)
|
||||||
|
{
|
||||||
|
ErrorStatus status = SUCCESS;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_LPUART_INSTANCE(LPUARTx));
|
||||||
|
|
||||||
|
if (LPUARTx == LPUART1)
|
||||||
|
{
|
||||||
|
/* Force reset of LPUART peripheral */
|
||||||
|
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_LPUART1);
|
||||||
|
|
||||||
|
/* Release reset of LPUART peripheral */
|
||||||
|
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_LPUART1);
|
||||||
|
}
|
||||||
|
#if defined(LPUART2)
|
||||||
|
else if (LPUARTx == LPUART2)
|
||||||
|
{
|
||||||
|
/* Force reset of LPUART peripheral */
|
||||||
|
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_LPUART2);
|
||||||
|
|
||||||
|
/* Release reset of LPUART peripheral */
|
||||||
|
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_LPUART2);
|
||||||
|
}
|
||||||
|
#endif /* LPUART2 */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initialize LPUART registers according to the specified
|
||||||
|
* parameters in LPUART_InitStruct.
|
||||||
|
* @note As some bits in LPUART configuration registers can only be written when
|
||||||
|
* the LPUART is disabled (USART_CR1_UE bit =0),
|
||||||
|
* LPUART Peripheral should be in disabled state prior calling this function.
|
||||||
|
* Otherwise, ERROR result will be returned.
|
||||||
|
* @note Baud rate value stored in LPUART_InitStruct BaudRate field, should be valid (different from 0).
|
||||||
|
* @param LPUARTx LPUART Instance
|
||||||
|
* @param LPUART_InitStruct pointer to a @ref LL_LPUART_InitTypeDef structure
|
||||||
|
* that contains the configuration information for the specified LPUART peripheral.
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: LPUART registers are initialized according to LPUART_InitStruct content
|
||||||
|
* - ERROR: Problem occurred during LPUART Registers initialization
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_LPUART_Init(USART_TypeDef *LPUARTx, const LL_LPUART_InitTypeDef *LPUART_InitStruct)
|
||||||
|
{
|
||||||
|
ErrorStatus status = ERROR;
|
||||||
|
#if defined(LPUART2)
|
||||||
|
uint32_t periphclk = LL_RCC_PERIPH_FREQUENCY_NO;
|
||||||
|
#else
|
||||||
|
uint32_t periphclk;
|
||||||
|
#endif /* LPUART2 */
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_LPUART_INSTANCE(LPUARTx));
|
||||||
|
assert_param(IS_LL_LPUART_PRESCALER(LPUART_InitStruct->PrescalerValue));
|
||||||
|
assert_param(IS_LL_LPUART_BAUDRATE(LPUART_InitStruct->BaudRate));
|
||||||
|
assert_param(IS_LL_LPUART_DATAWIDTH(LPUART_InitStruct->DataWidth));
|
||||||
|
assert_param(IS_LL_LPUART_STOPBITS(LPUART_InitStruct->StopBits));
|
||||||
|
assert_param(IS_LL_LPUART_PARITY(LPUART_InitStruct->Parity));
|
||||||
|
assert_param(IS_LL_LPUART_DIRECTION(LPUART_InitStruct->TransferDirection));
|
||||||
|
assert_param(IS_LL_LPUART_HWCONTROL(LPUART_InitStruct->HardwareFlowControl));
|
||||||
|
|
||||||
|
/* LPUART needs to be in disabled state, in order to be able to configure some bits in
|
||||||
|
CRx registers. Otherwise (LPUART not in Disabled state) => return ERROR */
|
||||||
|
if (LL_LPUART_IsEnabled(LPUARTx) == 0U)
|
||||||
|
{
|
||||||
|
/*---------------------------- LPUART CR1 Configuration -----------------------
|
||||||
|
* Configure LPUARTx CR1 (LPUART Word Length, Parity and Transfer Direction bits) with parameters:
|
||||||
|
* - DataWidth: USART_CR1_M bits according to LPUART_InitStruct->DataWidth value
|
||||||
|
* - Parity: USART_CR1_PCE, USART_CR1_PS bits according to LPUART_InitStruct->Parity value
|
||||||
|
* - TransferDirection: USART_CR1_TE, USART_CR1_RE bits according to LPUART_InitStruct->TransferDirection value
|
||||||
|
*/
|
||||||
|
MODIFY_REG(LPUARTx->CR1,
|
||||||
|
(USART_CR1_M | USART_CR1_PCE | USART_CR1_PS | USART_CR1_TE | USART_CR1_RE),
|
||||||
|
(LPUART_InitStruct->DataWidth | LPUART_InitStruct->Parity | LPUART_InitStruct->TransferDirection));
|
||||||
|
|
||||||
|
/*---------------------------- LPUART CR2 Configuration -----------------------
|
||||||
|
* Configure LPUARTx CR2 (Stop bits) with parameters:
|
||||||
|
* - Stop Bits: USART_CR2_STOP bits according to LPUART_InitStruct->StopBits value.
|
||||||
|
*/
|
||||||
|
LL_LPUART_SetStopBitsLength(LPUARTx, LPUART_InitStruct->StopBits);
|
||||||
|
|
||||||
|
/*---------------------------- LPUART CR3 Configuration -----------------------
|
||||||
|
* Configure LPUARTx CR3 (Hardware Flow Control) with parameters:
|
||||||
|
* - HardwareFlowControl: USART_CR3_RTSE, USART_CR3_CTSE bits according
|
||||||
|
* to LPUART_InitStruct->HardwareFlowControl value.
|
||||||
|
*/
|
||||||
|
LL_LPUART_SetHWFlowCtrl(LPUARTx, LPUART_InitStruct->HardwareFlowControl);
|
||||||
|
|
||||||
|
/*---------------------------- LPUART BRR Configuration -----------------------
|
||||||
|
* Retrieve Clock frequency used for LPUART Peripheral
|
||||||
|
*/
|
||||||
|
#if defined(LPUART2)
|
||||||
|
if (LPUARTx == LPUART1)
|
||||||
|
{
|
||||||
|
periphclk = LL_RCC_GetLPUARTClockFreq(LL_RCC_LPUART1_CLKSOURCE);
|
||||||
|
}
|
||||||
|
else if (LPUARTx == LPUART2)
|
||||||
|
{
|
||||||
|
periphclk = LL_RCC_GetLPUARTClockFreq(LL_RCC_LPUART2_CLKSOURCE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Nothing to do, as error code is already assigned to ERROR value */
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
periphclk = LL_RCC_GetLPUARTClockFreq(LL_RCC_LPUART1_CLKSOURCE);
|
||||||
|
#endif /* LPUART2 */
|
||||||
|
|
||||||
|
/* Configure the LPUART Baud Rate :
|
||||||
|
- prescaler value is required
|
||||||
|
- valid baud rate value (different from 0) is required
|
||||||
|
- Peripheral clock as returned by RCC service, should be valid (different from 0).
|
||||||
|
*/
|
||||||
|
if ((periphclk != LL_RCC_PERIPH_FREQUENCY_NO)
|
||||||
|
&& (LPUART_InitStruct->BaudRate != 0U))
|
||||||
|
{
|
||||||
|
status = SUCCESS;
|
||||||
|
LL_LPUART_SetBaudRate(LPUARTx,
|
||||||
|
periphclk,
|
||||||
|
LPUART_InitStruct->PrescalerValue,
|
||||||
|
LPUART_InitStruct->BaudRate);
|
||||||
|
|
||||||
|
/* Check BRR is greater than or equal to 0x300 */
|
||||||
|
assert_param(IS_LL_LPUART_BRR_MIN(LPUARTx->BRR));
|
||||||
|
|
||||||
|
/* Check BRR is lower than or equal to 0xFFFFF */
|
||||||
|
assert_param(IS_LL_LPUART_BRR_MAX(LPUARTx->BRR));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------- LPUART PRESC Configuration -----------------------
|
||||||
|
* Configure LPUARTx PRESC (Prescaler) with parameters:
|
||||||
|
* - PrescalerValue: LPUART_PRESC_PRESCALER bits according to LPUART_InitStruct->PrescalerValue value.
|
||||||
|
*/
|
||||||
|
LL_LPUART_SetPrescaler(LPUARTx, LPUART_InitStruct->PrescalerValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set each @ref LL_LPUART_InitTypeDef field to default value.
|
||||||
|
* @param LPUART_InitStruct pointer to a @ref LL_LPUART_InitTypeDef structure
|
||||||
|
* whose fields will be set to default values.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
|
||||||
|
void LL_LPUART_StructInit(LL_LPUART_InitTypeDef *LPUART_InitStruct)
|
||||||
|
{
|
||||||
|
/* Set LPUART_InitStruct fields to default values */
|
||||||
|
LPUART_InitStruct->PrescalerValue = LL_LPUART_PRESCALER_DIV1;
|
||||||
|
LPUART_InitStruct->BaudRate = 9600U;
|
||||||
|
LPUART_InitStruct->DataWidth = LL_LPUART_DATAWIDTH_8B;
|
||||||
|
LPUART_InitStruct->StopBits = LL_LPUART_STOPBITS_1;
|
||||||
|
LPUART_InitStruct->Parity = LL_LPUART_PARITY_NONE ;
|
||||||
|
LPUART_InitStruct->TransferDirection = LL_LPUART_DIRECTION_TX_RX;
|
||||||
|
LPUART_InitStruct->HardwareFlowControl = LL_LPUART_HWCONTROL_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* LPUART1 || LPUART2 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* USE_FULL_LL_DRIVER */
|
82
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_pwr.c
Normal file
82
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_pwr.c
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_pwr.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief PWR LL module driver.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
#if defined(USE_FULL_LL_DRIVER)
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx_ll_pwr.h"
|
||||||
|
#include "stm32g0xx_ll_bus.h"
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(PWR)
|
||||||
|
|
||||||
|
/** @defgroup PWR_LL PWR
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup PWR_LL_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup PWR_LL_EF_Init
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief De-initialize the PWR registers to their default reset values.
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: PWR registers are de-initialized
|
||||||
|
* - ERROR: not applicable
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_PWR_DeInit(void)
|
||||||
|
{
|
||||||
|
/* Force reset of PWR clock */
|
||||||
|
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_PWR);
|
||||||
|
|
||||||
|
/* Release reset of PWR clock */
|
||||||
|
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_PWR);
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
#endif /* defined(PWR) */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* USE_FULL_LL_DRIVER */
|
1380
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_rcc.c
Normal file
1380
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_rcc.c
Normal file
File diff suppressed because it is too large
Load Diff
574
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_utils.c
Normal file
574
Drivers/STM32G0xx_HAL_Driver/Src/stm32g0xx_ll_utils.c
Normal file
@ -0,0 +1,574 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file stm32g0xx_ll_utils.c
|
||||||
|
* @author MCD Application Team
|
||||||
|
* @brief UTILS LL module driver.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "stm32g0xx_ll_utils.h"
|
||||||
|
#include "stm32g0xx_ll_rcc.h"
|
||||||
|
#include "stm32g0xx_ll_system.h"
|
||||||
|
#include "stm32g0xx_ll_pwr.h"
|
||||||
|
#ifdef USE_FULL_ASSERT
|
||||||
|
#include "stm32_assert.h"
|
||||||
|
#else
|
||||||
|
#define assert_param(expr) ((void)0U)
|
||||||
|
#endif /* USE_FULL_ASSERT */
|
||||||
|
|
||||||
|
/** @addtogroup STM32G0xx_LL_Driver
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup UTILS_LL
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private types -------------------------------------------------------------*/
|
||||||
|
/* Private variables ---------------------------------------------------------*/
|
||||||
|
/* Private constants ---------------------------------------------------------*/
|
||||||
|
/** @addtogroup UTILS_LL_Private_Constants
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define UTILS_MAX_FREQUENCY 64000000U /*!< Maximum frequency for system clock, in Hz */
|
||||||
|
|
||||||
|
/* Defines used for PLL range */
|
||||||
|
#define UTILS_PLLVCO_INPUT_MIN 4000000U /*!< Frequency min for PLLVCO input, in Hz */
|
||||||
|
#define UTILS_PLLVCO_INPUT_MAX 8000000U /*!< Frequency max for PLLVCO input, in Hz */
|
||||||
|
#define UTILS_PLLVCO_OUTPUT_MIN 64000000U /*!< Frequency min for PLLVCO output, in Hz */
|
||||||
|
#define UTILS_PLLVCO_OUTPUT_MAX 344000000U /*!< Frequency max for PLLVCO output, in Hz */
|
||||||
|
|
||||||
|
/* Defines used for HSE range */
|
||||||
|
#define UTILS_HSE_FREQUENCY_MIN 4000000U /*!< Frequency min for HSE frequency, in Hz */
|
||||||
|
#define UTILS_HSE_FREQUENCY_MAX 48000000U /*!< Frequency max for HSE frequency, in Hz */
|
||||||
|
|
||||||
|
/* Defines used for FLASH latency according to HCLK Frequency */
|
||||||
|
#define UTILS_SCALE1_LATENCY1_FREQ 24000000U /*!< HCLK frequency to set FLASH latency 1 in power scale 1 */
|
||||||
|
#define UTILS_SCALE1_LATENCY2_FREQ 48000000U /*!< HCLK frequency to set FLASH latency 2 in power scale 1 */
|
||||||
|
#define UTILS_SCALE1_LATENCY3_FREQ 64000000U /*!< HCLK frequency to set FLASH latency 3 in power scale 1 */
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Private macros ------------------------------------------------------------*/
|
||||||
|
/** @addtogroup UTILS_LL_Private_Macros
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define IS_LL_UTILS_SYSCLK_DIV(__VALUE__) (((__VALUE__) == LL_RCC_SYSCLK_DIV_1) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_SYSCLK_DIV_2) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_SYSCLK_DIV_4) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_SYSCLK_DIV_8) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_SYSCLK_DIV_16) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_SYSCLK_DIV_64) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_SYSCLK_DIV_128) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_SYSCLK_DIV_256) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_SYSCLK_DIV_512))
|
||||||
|
|
||||||
|
#define IS_LL_UTILS_APB1_DIV(__VALUE__) (((__VALUE__) == LL_RCC_APB1_DIV_1) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_APB1_DIV_2) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_APB1_DIV_4) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_APB1_DIV_8) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_APB1_DIV_16))
|
||||||
|
|
||||||
|
#define IS_LL_UTILS_HSI_DIV(__VALUE__) (((__VALUE__) == LL_RCC_HSI_DIV_1) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_HSI_DIV_2) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_HSI_DIV_4) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_HSI_DIV_8) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_HSI_DIV_16) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_HSI_DIV_32) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_HSI_DIV_64) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_HSI_DIV_128))
|
||||||
|
|
||||||
|
#define IS_LL_UTILS_PLLM_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PLLM_DIV_1) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLM_DIV_2) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLM_DIV_3) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLM_DIV_4) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLM_DIV_5) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLM_DIV_6) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLM_DIV_7) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLM_DIV_8))
|
||||||
|
|
||||||
|
#define IS_LL_UTILS_PLLN_VALUE(__VALUE__) ((8U <= (__VALUE__)) && ((__VALUE__) <= 86U))
|
||||||
|
|
||||||
|
#define IS_LL_UTILS_PLLR_VALUE(__VALUE__) (((__VALUE__) == LL_RCC_PLLR_DIV_2) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLR_DIV_3) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLR_DIV_4) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLR_DIV_5) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLR_DIV_6) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLR_DIV_7) \
|
||||||
|
|| ((__VALUE__) == LL_RCC_PLLR_DIV_8))
|
||||||
|
|
||||||
|
#define IS_LL_UTILS_PLLVCO_INPUT(__VALUE__) ((UTILS_PLLVCO_INPUT_MIN <= (__VALUE__)) && ((__VALUE__) <= UTILS_PLLVCO_INPUT_MAX))
|
||||||
|
|
||||||
|
#define IS_LL_UTILS_PLLVCO_OUTPUT(__VALUE__) ((UTILS_PLLVCO_OUTPUT_MIN <= (__VALUE__)) && ((__VALUE__) <= UTILS_PLLVCO_OUTPUT_MAX))
|
||||||
|
|
||||||
|
#define IS_LL_UTILS_PLL_FREQUENCY(__VALUE__) ((__VALUE__) <= UTILS_MAX_FREQUENCY)
|
||||||
|
|
||||||
|
#define IS_LL_UTILS_HSE_BYPASS(__STATE__) (((__STATE__) == LL_UTILS_HSEBYPASS_ON) \
|
||||||
|
|| ((__STATE__) == LL_UTILS_HSEBYPASS_OFF))
|
||||||
|
|
||||||
|
#define IS_LL_UTILS_HSE_FREQUENCY(__FREQUENCY__) (((__FREQUENCY__) >= UTILS_HSE_FREQUENCY_MIN) && ((__FREQUENCY__) <= UTILS_HSE_FREQUENCY_MAX))
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
/** @defgroup UTILS_LL_Private_Functions UTILS Private functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency,
|
||||||
|
LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct);
|
||||||
|
static ErrorStatus UTILS_EnablePLLAndSwitchSystem(uint32_t SYSCLK_Frequency, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct);
|
||||||
|
static ErrorStatus UTILS_PLL_IsBusy(void);
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Exported functions --------------------------------------------------------*/
|
||||||
|
/** @addtogroup UTILS_LL_Exported_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup UTILS_LL_EF_DELAY
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function configures the Cortex-M SysTick source to have 1ms time base.
|
||||||
|
* @note When a RTOS is used, it is recommended to avoid changing the Systick
|
||||||
|
* configuration by calling this function, for a delay use rather osDelay RTOS service.
|
||||||
|
* @param HCLKFrequency HCLK frequency in Hz
|
||||||
|
* @note HCLK frequency can be calculated thanks to RCC helper macro or function @ref LL_RCC_GetSystemClocksFreq
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void LL_Init1msTick(uint32_t HCLKFrequency)
|
||||||
|
{
|
||||||
|
/* Use frequency provided in argument */
|
||||||
|
LL_InitTick(HCLKFrequency, 1000U);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function provides accurate delay (in milliseconds) based
|
||||||
|
* on SysTick counter flag
|
||||||
|
* @note When a RTOS is used, it is recommended to avoid using blocking delay
|
||||||
|
* and use rather osDelay service.
|
||||||
|
* @note To respect 1ms timebase, user should call @ref LL_Init1msTick function which
|
||||||
|
* will configure Systick to 1ms
|
||||||
|
* @param Delay specifies the delay time length, in milliseconds.
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void LL_mDelay(uint32_t Delay)
|
||||||
|
{
|
||||||
|
__IO uint32_t tmp = SysTick->CTRL; /* Clear the COUNTFLAG first */
|
||||||
|
uint32_t tmpDelay; /* MISRAC2012-Rule-17.8 */
|
||||||
|
/* Add this code to indicate that local variable is not used */
|
||||||
|
((void)tmp);
|
||||||
|
tmpDelay = Delay;
|
||||||
|
/* Add a period to guaranty minimum wait */
|
||||||
|
if (tmpDelay < LL_MAX_DELAY)
|
||||||
|
{
|
||||||
|
tmpDelay ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (tmpDelay != 0U)
|
||||||
|
{
|
||||||
|
if ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) != 0U)
|
||||||
|
{
|
||||||
|
tmpDelay --;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup UTILS_EF_SYSTEM
|
||||||
|
* @brief System Configuration functions
|
||||||
|
*
|
||||||
|
@verbatim
|
||||||
|
===============================================================================
|
||||||
|
##### System Configuration functions #####
|
||||||
|
===============================================================================
|
||||||
|
[..]
|
||||||
|
System, AHB and APB buses clocks configuration
|
||||||
|
|
||||||
|
(+) The maximum frequency of the SYSCLK, HCLK, PCLK1 is 64000000 Hz.
|
||||||
|
@endverbatim
|
||||||
|
@internal
|
||||||
|
Depending on the device voltage range, the maximum frequency should be
|
||||||
|
adapted accordingly:
|
||||||
|
|
||||||
|
(++) Table 1. HCLK clock frequency.
|
||||||
|
(++) +-------------------------------------------------------+
|
||||||
|
(++) | Latency | HCLK clock frequency (MHz) |
|
||||||
|
(++) | |-------------------------------------|
|
||||||
|
(++) | | voltage range 1 | voltage range 2 |
|
||||||
|
(++) | | 1.08V - 1.32V | 0.9 V - 1.10V |
|
||||||
|
(++) |-----------------|------------------|------------------|
|
||||||
|
(++) |0WS(1 CPU cycles)| HCLK <= 24 | HCLK <= 8 |
|
||||||
|
(++) |-----------------|------------------|------------------|
|
||||||
|
(++) |1WS(2 CPU cycles)| HCLK <= 48 | HCLK <= 16 |
|
||||||
|
(++) |-----------------|------------------|------------------|
|
||||||
|
(++) |2WS(3 CPU cycles)| HCLK <= 64 | - |
|
||||||
|
(++) |-----------------|------------------|------------------|
|
||||||
|
|
||||||
|
@endinternal
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function sets directly SystemCoreClock CMSIS variable.
|
||||||
|
* @note Variable can be calculated also through SystemCoreClockUpdate function.
|
||||||
|
* @param HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro)
|
||||||
|
* @retval None
|
||||||
|
*/
|
||||||
|
void LL_SetSystemCoreClock(uint32_t HCLKFrequency)
|
||||||
|
{
|
||||||
|
/* HCLK clock frequency */
|
||||||
|
SystemCoreClock = HCLKFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function configures system clock at maximum frequency with HSI as clock source of the PLL
|
||||||
|
* @note The application need to ensure that PLL is disabled.
|
||||||
|
* @note Function is based on the following formula:
|
||||||
|
* - PLL output frequency = (((HSI frequency / PLLM) * PLLN) / PLLR)
|
||||||
|
* - PLLM: ensure that the VCO input frequency ranges from 4 to 16 MHz (PLLVCO_input = HSI frequency / PLLM)
|
||||||
|
* - PLLN: ensure that the VCO output frequency is between 64 and 344 MHz (PLLVCO_output = PLLVCO_input * PLLN)
|
||||||
|
* - PLLR: ensure that max frequency at 64000000 Hz is reach (PLLVCO_output / PLLR)
|
||||||
|
* @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains
|
||||||
|
* the configuration information for the PLL.
|
||||||
|
* @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains
|
||||||
|
* the configuration information for the BUS prescalers.
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: Max frequency configuration done
|
||||||
|
* - ERROR: Max frequency configuration not done
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct,
|
||||||
|
LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct)
|
||||||
|
{
|
||||||
|
ErrorStatus status;
|
||||||
|
uint32_t pllfreq;
|
||||||
|
|
||||||
|
/* Check if one of the PLL is enabled */
|
||||||
|
if (UTILS_PLL_IsBusy() == SUCCESS)
|
||||||
|
{
|
||||||
|
/* Calculate the new PLL output frequency */
|
||||||
|
pllfreq = UTILS_GetPLLOutputFrequency(HSI_VALUE, UTILS_PLLInitStruct);
|
||||||
|
|
||||||
|
/* Enable HSI if not enabled */
|
||||||
|
if (LL_RCC_HSI_IsReady() != 1U)
|
||||||
|
{
|
||||||
|
LL_RCC_HSI_Enable();
|
||||||
|
while (LL_RCC_HSI_IsReady() != 1U)
|
||||||
|
{
|
||||||
|
/* Wait for HSI ready */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Configure PLL */
|
||||||
|
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI, UTILS_PLLInitStruct->PLLM, UTILS_PLLInitStruct->PLLN,
|
||||||
|
UTILS_PLLInitStruct->PLLR);
|
||||||
|
|
||||||
|
/* Enable PLL and switch system clock to PLL */
|
||||||
|
status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Current PLL configuration cannot be modified */
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function configures system clock with HSE as clock source of the PLL
|
||||||
|
* @note The application need to ensure that PLL is disabled.
|
||||||
|
* @note Function is based on the following formula:
|
||||||
|
* - PLL output frequency = (((HSE frequency / PLLM) * PLLN) / PLLR)
|
||||||
|
* - PLLM: ensure that the VCO input frequency ranges from 4 to 16 MHz (PLLVCO_input = HSE frequency / PLLM)
|
||||||
|
* - PLLN: ensure that the VCO output frequency is between 64 and 344 MHz (PLLVCO_output = PLLVCO_input * PLLN)
|
||||||
|
* - PLLR: ensure that max frequency at 64000000 Hz is reached (PLLVCO_output / PLLR)
|
||||||
|
* @param HSEFrequency Value between Min_Data = 4000000 and Max_Data = 48000000
|
||||||
|
* @param HSEBypass This parameter can be one of the following values:
|
||||||
|
* @arg @ref LL_UTILS_HSEBYPASS_ON
|
||||||
|
* @arg @ref LL_UTILS_HSEBYPASS_OFF
|
||||||
|
* @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains
|
||||||
|
* the configuration information for the PLL.
|
||||||
|
* @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains
|
||||||
|
* the configuration information for the BUS prescalers.
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: Max frequency configuration done
|
||||||
|
* - ERROR: Max frequency configuration not done
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_PLL_ConfigSystemClock_HSE(uint32_t HSEFrequency, uint32_t HSEBypass,
|
||||||
|
LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct)
|
||||||
|
{
|
||||||
|
ErrorStatus status;
|
||||||
|
uint32_t pllfreq;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_LL_UTILS_HSE_FREQUENCY(HSEFrequency));
|
||||||
|
assert_param(IS_LL_UTILS_HSE_BYPASS(HSEBypass));
|
||||||
|
|
||||||
|
/* Check if one of the PLL is enabled */
|
||||||
|
if (UTILS_PLL_IsBusy() == SUCCESS)
|
||||||
|
{
|
||||||
|
/* Calculate the new PLL output frequency */
|
||||||
|
pllfreq = UTILS_GetPLLOutputFrequency(HSEFrequency, UTILS_PLLInitStruct);
|
||||||
|
|
||||||
|
/* Enable HSE if not enabled */
|
||||||
|
if (LL_RCC_HSE_IsReady() != 1U)
|
||||||
|
{
|
||||||
|
/* Check if need to enable HSE bypass feature or not */
|
||||||
|
if (HSEBypass == LL_UTILS_HSEBYPASS_ON)
|
||||||
|
{
|
||||||
|
LL_RCC_HSE_EnableBypass();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LL_RCC_HSE_DisableBypass();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable HSE */
|
||||||
|
LL_RCC_HSE_Enable();
|
||||||
|
while (LL_RCC_HSE_IsReady() != 1U)
|
||||||
|
{
|
||||||
|
/* Wait for HSE ready */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Configure PLL */
|
||||||
|
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, UTILS_PLLInitStruct->PLLM, UTILS_PLLInitStruct->PLLN,
|
||||||
|
UTILS_PLLInitStruct->PLLR);
|
||||||
|
|
||||||
|
/* Enable PLL and switch system clock to PLL */
|
||||||
|
status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Current PLL configuration cannot be modified */
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Update number of Flash wait states in line with new frequency and current
|
||||||
|
* voltage range.
|
||||||
|
* @param HCLKFrequency HCLK frequency
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: Latency has been modified
|
||||||
|
* - ERROR: Latency cannot be modified
|
||||||
|
*/
|
||||||
|
ErrorStatus LL_SetFlashLatency(uint32_t HCLKFrequency)
|
||||||
|
{
|
||||||
|
uint32_t timeout;
|
||||||
|
uint32_t getlatency;
|
||||||
|
uint32_t latency;
|
||||||
|
ErrorStatus status;
|
||||||
|
|
||||||
|
/* Frequency cannot be equal to 0 or greater than max clock */
|
||||||
|
if ((HCLKFrequency == 0U) || (HCLKFrequency > UTILS_SCALE1_LATENCY3_FREQ))
|
||||||
|
{
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (HCLKFrequency > UTILS_SCALE1_LATENCY2_FREQ)
|
||||||
|
{
|
||||||
|
/* 48 < HCLK <= 64 => 2WS (3 CPU cycles) */
|
||||||
|
latency = LL_FLASH_LATENCY_2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (HCLKFrequency > UTILS_SCALE1_LATENCY1_FREQ)
|
||||||
|
{
|
||||||
|
/* 24 < HCLK <= 48 => 1WS (2 CPU cycles) */
|
||||||
|
latency = LL_FLASH_LATENCY_1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* else HCLKFrequency < 24MHz default LL_FLASH_LATENCY_0 0WS */
|
||||||
|
latency = LL_FLASH_LATENCY_0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LL_FLASH_SetLatency(latency);
|
||||||
|
|
||||||
|
/* Check that the new number of wait states is taken into account to access the Flash
|
||||||
|
memory by reading the FLASH_ACR register */
|
||||||
|
timeout = 2u;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
/* Wait for Flash latency to be updated */
|
||||||
|
getlatency = LL_FLASH_GetLatency();
|
||||||
|
timeout--;
|
||||||
|
} while ((getlatency != latency) && (timeout > 0u));
|
||||||
|
|
||||||
|
if(getlatency != latency)
|
||||||
|
{
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @addtogroup UTILS_LL_Private_Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to check that PLL can be modified
|
||||||
|
* @param PLL_InputFrequency PLL input frequency (in Hz)
|
||||||
|
* @param UTILS_PLLInitStruct pointer to a @ref LL_UTILS_PLLInitTypeDef structure that contains
|
||||||
|
* the configuration information for the PLL.
|
||||||
|
* @retval PLL output frequency (in Hz)
|
||||||
|
*/
|
||||||
|
static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct)
|
||||||
|
{
|
||||||
|
uint32_t pllfreq;
|
||||||
|
|
||||||
|
/* Check the parameters */
|
||||||
|
assert_param(IS_LL_UTILS_PLLM_VALUE(UTILS_PLLInitStruct->PLLM));
|
||||||
|
assert_param(IS_LL_UTILS_PLLN_VALUE(UTILS_PLLInitStruct->PLLN));
|
||||||
|
assert_param(IS_LL_UTILS_PLLR_VALUE(UTILS_PLLInitStruct->PLLR));
|
||||||
|
|
||||||
|
/* Check different PLL parameters according to RM */
|
||||||
|
/* - PLLM: ensure that the VCO input frequency ranges from 4 to 16 MHz. */
|
||||||
|
pllfreq = PLL_InputFrequency / (((UTILS_PLLInitStruct->PLLM >> RCC_PLLCFGR_PLLM_Pos) + 1U));
|
||||||
|
assert_param(IS_LL_UTILS_PLLVCO_INPUT(pllfreq));
|
||||||
|
|
||||||
|
/* - PLLN: ensure that the VCO output frequency is between 64 and 344 MHz.*/
|
||||||
|
pllfreq = pllfreq * (UTILS_PLLInitStruct->PLLN & (RCC_PLLCFGR_PLLN >> RCC_PLLCFGR_PLLN_Pos));
|
||||||
|
assert_param(IS_LL_UTILS_PLLVCO_OUTPUT(pllfreq));
|
||||||
|
|
||||||
|
/* - PLLR: ensure that max frequency at 64000000 Hz is reached */
|
||||||
|
pllfreq = pllfreq / (((UTILS_PLLInitStruct->PLLR >> RCC_PLLCFGR_PLLR_Pos) + 1U));
|
||||||
|
assert_param(IS_LL_UTILS_PLL_FREQUENCY(pllfreq));
|
||||||
|
|
||||||
|
return pllfreq;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to check that PLL can be modified
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: PLL modification can be done
|
||||||
|
* - ERROR: PLL is busy
|
||||||
|
*/
|
||||||
|
static ErrorStatus UTILS_PLL_IsBusy(void)
|
||||||
|
{
|
||||||
|
ErrorStatus status = SUCCESS;
|
||||||
|
|
||||||
|
/* Check if PLL is busy*/
|
||||||
|
if (LL_RCC_PLL_IsReady() != 0U)
|
||||||
|
{
|
||||||
|
/* PLL configuration cannot be modified */
|
||||||
|
status = ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to enable PLL and switch system clock to PLL
|
||||||
|
* @param SYSCLK_Frequency SYSCLK frequency
|
||||||
|
* @param UTILS_ClkInitStruct pointer to a @ref LL_UTILS_ClkInitTypeDef structure that contains
|
||||||
|
* the configuration information for the BUS prescalers.
|
||||||
|
* @retval An ErrorStatus enumeration value:
|
||||||
|
* - SUCCESS: No problem to switch system to PLL
|
||||||
|
* - ERROR: Problem to switch system to PLL
|
||||||
|
*/
|
||||||
|
static ErrorStatus UTILS_EnablePLLAndSwitchSystem(uint32_t SYSCLK_Frequency, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct)
|
||||||
|
{
|
||||||
|
ErrorStatus status = SUCCESS;
|
||||||
|
uint32_t hclk_frequency;
|
||||||
|
|
||||||
|
assert_param(IS_LL_UTILS_SYSCLK_DIV(UTILS_ClkInitStruct->AHBCLKDivider));
|
||||||
|
assert_param(IS_LL_UTILS_APB1_DIV(UTILS_ClkInitStruct->APB1CLKDivider));
|
||||||
|
|
||||||
|
/* Calculate HCLK frequency */
|
||||||
|
hclk_frequency = __LL_RCC_CALC_HCLK_FREQ(SYSCLK_Frequency, UTILS_ClkInitStruct->AHBCLKDivider);
|
||||||
|
|
||||||
|
/* Increasing the number of wait states because of higher CPU frequency */
|
||||||
|
if (SystemCoreClock < hclk_frequency)
|
||||||
|
{
|
||||||
|
/* Set FLASH latency to highest latency */
|
||||||
|
status = LL_SetFlashLatency(hclk_frequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update system clock configuration */
|
||||||
|
if (status == SUCCESS)
|
||||||
|
{
|
||||||
|
/* Enable PLL */
|
||||||
|
LL_RCC_PLL_Enable();
|
||||||
|
LL_RCC_PLL_EnableDomain_SYS();
|
||||||
|
while (LL_RCC_PLL_IsReady() != 1U)
|
||||||
|
{
|
||||||
|
/* Wait for PLL ready */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sysclk activation on the main PLL */
|
||||||
|
LL_RCC_SetAHBPrescaler(UTILS_ClkInitStruct->AHBCLKDivider);
|
||||||
|
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
|
||||||
|
while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
|
||||||
|
{
|
||||||
|
/* Wait for system clock switch to PLL */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set APB1 & APB2 prescaler*/
|
||||||
|
LL_RCC_SetAPB1Prescaler(UTILS_ClkInitStruct->APB1CLKDivider);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Decreasing the number of wait states because of lower CPU frequency */
|
||||||
|
if (SystemCoreClock > hclk_frequency)
|
||||||
|
{
|
||||||
|
/* Set FLASH latency to lowest latency */
|
||||||
|
status = LL_SetFlashLatency(hclk_frequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update SystemCoreClock variable */
|
||||||
|
if (status == SUCCESS)
|
||||||
|
{
|
||||||
|
LL_SetSystemCoreClock(hclk_frequency);
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
158
Elektronische_Last.ioc
Normal file
158
Elektronische_Last.ioc
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
#MicroXplorer Configuration settings - do not modify
|
||||||
|
ADC1.Channel-0\#ChannelRegularConversion=ADC_CHANNEL_0
|
||||||
|
ADC1.Channel-1\#ChannelRegularConversion=ADC_CHANNEL_1
|
||||||
|
ADC1.EOCSelection=ADC_EOC_SEQ_CONV
|
||||||
|
ADC1.ExternalTrigConv=ADC_EXTERNALTRIG_T1_TRGO2
|
||||||
|
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,master,SelectedChannel,EOCSelection,SamplingTimeCommon1,SamplingTimeCommon2,ExternalTrigConv,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,NbrOfConversion
|
||||||
|
ADC1.NbrOfConversion=2
|
||||||
|
ADC1.NbrOfConversionFlag=1
|
||||||
|
ADC1.Rank-0\#ChannelRegularConversion=1
|
||||||
|
ADC1.Rank-1\#ChannelRegularConversion=2
|
||||||
|
ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLINGTIME_COMMON_1
|
||||||
|
ADC1.SamplingTime-1\#ChannelRegularConversion=ADC_SAMPLINGTIME_COMMON_1
|
||||||
|
ADC1.SamplingTimeCommon1=ADC_SAMPLETIME_12CYCLES_5
|
||||||
|
ADC1.SamplingTimeCommon2=ADC_SAMPLETIME_12CYCLES_5
|
||||||
|
ADC1.SelectedChannel=ADC_CHANNEL_0|ADC_CHANNEL_1
|
||||||
|
ADC1.master=1
|
||||||
|
CAD.formats=[]
|
||||||
|
CAD.pinconfig=Project naming
|
||||||
|
CAD.provider=
|
||||||
|
DAC1.DAC_Channel-DAC_OUT1=DAC_CHANNEL_1
|
||||||
|
DAC1.DAC_Channel-DAC_OUT2=DAC_CHANNEL_2
|
||||||
|
DAC1.DAC_Trigger-DAC_OUT1=DAC_TRIGGER_SOFTWARE
|
||||||
|
DAC1.DAC_Trigger-DAC_OUT2=DAC_TRIGGER_SOFTWARE
|
||||||
|
DAC1.IPParameters=DAC_Channel-DAC_OUT1,DAC_Channel-DAC_OUT2,DAC_Trigger-DAC_OUT1,DAC_Trigger-DAC_OUT2
|
||||||
|
File.Version=6
|
||||||
|
GPIO.groupedBy=Group By Peripherals
|
||||||
|
KeepUserPlacement=false
|
||||||
|
LPUART1.BaudRate=115200
|
||||||
|
LPUART1.FifoMode=UART_FIFOMODE_ENABLE
|
||||||
|
LPUART1.IPParameters=BaudRate,WordLength,FifoMode
|
||||||
|
LPUART1.WordLength=UART_WORDLENGTH_8B
|
||||||
|
Mcu.CPN=STM32G071KBT3
|
||||||
|
Mcu.Family=STM32G0
|
||||||
|
Mcu.IP0=ADC1
|
||||||
|
Mcu.IP1=DAC1
|
||||||
|
Mcu.IP2=LPUART1
|
||||||
|
Mcu.IP3=NVIC
|
||||||
|
Mcu.IP4=RCC
|
||||||
|
Mcu.IP5=SYS
|
||||||
|
Mcu.IPNb=6
|
||||||
|
Mcu.Name=STM32G071K(6-8-B)Tx
|
||||||
|
Mcu.Package=LQFP32
|
||||||
|
Mcu.Pin0=PC14-OSC32_IN (PC14)
|
||||||
|
Mcu.Pin1=PA0
|
||||||
|
Mcu.Pin10=VP_SYS_VS_Systick
|
||||||
|
Mcu.Pin2=PA1
|
||||||
|
Mcu.Pin3=PA2
|
||||||
|
Mcu.Pin4=PA3
|
||||||
|
Mcu.Pin5=PA4
|
||||||
|
Mcu.Pin6=PA5
|
||||||
|
Mcu.Pin7=PC6
|
||||||
|
Mcu.Pin8=PA13
|
||||||
|
Mcu.Pin9=PA14-BOOT0
|
||||||
|
Mcu.PinsNb=11
|
||||||
|
Mcu.ThirdPartyNb=0
|
||||||
|
Mcu.UserConstants=
|
||||||
|
Mcu.UserName=STM32G071KBTx
|
||||||
|
MxCube.Version=6.8.1
|
||||||
|
MxDb.Version=DB.6.0.81
|
||||||
|
NVIC.ForceEnableDMAVector=true
|
||||||
|
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
|
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
|
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||||
|
NVIC.SVC_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true
|
||||||
|
NVIC.SysTick_IRQn=true\:3\:0\:false\:false\:true\:false\:true\:false
|
||||||
|
NVIC.USART3_4_LPUART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||||
|
PA0.Mode=IN0
|
||||||
|
PA0.Signal=ADC1_IN0
|
||||||
|
PA1.Mode=IN1
|
||||||
|
PA1.Signal=ADC1_IN1
|
||||||
|
PA13.Mode=Serial_Wire
|
||||||
|
PA13.Signal=SYS_SWDIO
|
||||||
|
PA14-BOOT0.Mode=Serial_Wire
|
||||||
|
PA14-BOOT0.Signal=SYS_SWCLK
|
||||||
|
PA2.Mode=Asynchronous
|
||||||
|
PA2.Signal=LPUART1_TX
|
||||||
|
PA3.Mode=Asynchronous
|
||||||
|
PA3.Signal=LPUART1_RX
|
||||||
|
PA4.Signal=COMP_DAC11_group
|
||||||
|
PA5.Signal=COMP_DAC12_group
|
||||||
|
PC14-OSC32_IN\ (PC14).Mode=HSE-External-Clock-Source
|
||||||
|
PC14-OSC32_IN\ (PC14).Signal=RCC_OSC_IN
|
||||||
|
PC6.Locked=true
|
||||||
|
PC6.Signal=GPIO_Output
|
||||||
|
PinOutPanel.RotationAngle=0
|
||||||
|
ProjectManager.AskForMigrate=true
|
||||||
|
ProjectManager.BackupPrevious=false
|
||||||
|
ProjectManager.CompilerOptimize=6
|
||||||
|
ProjectManager.ComputerToolchain=false
|
||||||
|
ProjectManager.CoupleFile=false
|
||||||
|
ProjectManager.CustomerFirmwarePackage=
|
||||||
|
ProjectManager.DefaultFWLocation=true
|
||||||
|
ProjectManager.DeletePrevious=true
|
||||||
|
ProjectManager.DeviceId=STM32G071KBTx
|
||||||
|
ProjectManager.FirmwarePackage=STM32Cube FW_G0 V1.6.1
|
||||||
|
ProjectManager.FreePins=false
|
||||||
|
ProjectManager.HalAssertFull=false
|
||||||
|
ProjectManager.HeapSize=0x200
|
||||||
|
ProjectManager.KeepUserCode=true
|
||||||
|
ProjectManager.LastFirmware=true
|
||||||
|
ProjectManager.LibraryCopy=1
|
||||||
|
ProjectManager.MainLocation=Core/Src
|
||||||
|
ProjectManager.NoMain=false
|
||||||
|
ProjectManager.PreviousToolchain=
|
||||||
|
ProjectManager.ProjectBuild=false
|
||||||
|
ProjectManager.ProjectFileName=Elektronische_Last.ioc
|
||||||
|
ProjectManager.ProjectName=Elektronische_Last
|
||||||
|
ProjectManager.ProjectStructure=
|
||||||
|
ProjectManager.RegisterCallBack=
|
||||||
|
ProjectManager.StackSize=0x400
|
||||||
|
ProjectManager.TargetToolchain=STM32CubeIDE
|
||||||
|
ProjectManager.ToolChainLocation=
|
||||||
|
ProjectManager.UnderRoot=true
|
||||||
|
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-LL-false,2-MX_GPIO_Init-GPIO-false-LL-true,3-MX_ADC1_Init-ADC1-false-LL-true,4-MX_DAC1_Init-DAC1-false-LL-true,5-MX_LPUART1_UART_Init-LPUART1-false-LL-true
|
||||||
|
RCC.ADCFreq_Value=64000000
|
||||||
|
RCC.AHBFreq_Value=64000000
|
||||||
|
RCC.APBFreq_Value=64000000
|
||||||
|
RCC.APBTimFreq_Value=64000000
|
||||||
|
RCC.CECFreq_Value=32786.88524590164
|
||||||
|
RCC.CortexFreq_Value=64000000
|
||||||
|
RCC.EXTERNAL_CLOCK_VALUE=48000
|
||||||
|
RCC.FCLKCortexFreq_Value=64000000
|
||||||
|
RCC.FamilyName=M
|
||||||
|
RCC.HCLKFreq_Value=64000000
|
||||||
|
RCC.HSE_VALUE=8000000
|
||||||
|
RCC.HSI_VALUE=16000000
|
||||||
|
RCC.I2C1Freq_Value=64000000
|
||||||
|
RCC.I2S1Freq_Value=64000000
|
||||||
|
RCC.IPParameters=ADCFreq_Value,AHBFreq_Value,APBFreq_Value,APBTimFreq_Value,CECFreq_Value,CortexFreq_Value,EXTERNAL_CLOCK_VALUE,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2C1Freq_Value,I2S1Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSE_VALUE,LSI_VALUE,MCO1PinFreq_Value,PLLN,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PLLSourceVirtual,PWRFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,TIM15Freq_Value,TIM1Freq_Value,USART1Freq_Value,USART2Freq_Value,VCOInputFreq_Value,VCOOutputFreq_Value
|
||||||
|
RCC.LPTIM1Freq_Value=64000000
|
||||||
|
RCC.LPTIM2Freq_Value=64000000
|
||||||
|
RCC.LPUART1Freq_Value=64000000
|
||||||
|
RCC.LSCOPinFreq_Value=32000
|
||||||
|
RCC.LSE_VALUE=32768
|
||||||
|
RCC.LSI_VALUE=32000
|
||||||
|
RCC.MCO1PinFreq_Value=64000000
|
||||||
|
RCC.PLLN=16
|
||||||
|
RCC.PLLPoutputFreq_Value=64000000
|
||||||
|
RCC.PLLQoutputFreq_Value=64000000
|
||||||
|
RCC.PLLRCLKFreq_Value=64000000
|
||||||
|
RCC.PLLSourceVirtual=RCC_PLLSOURCE_HSE
|
||||||
|
RCC.PWRFreq_Value=64000000
|
||||||
|
RCC.SYSCLKFreq_VALUE=64000000
|
||||||
|
RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
|
||||||
|
RCC.TIM15Freq_Value=64000000
|
||||||
|
RCC.TIM1Freq_Value=64000000
|
||||||
|
RCC.USART1Freq_Value=64000000
|
||||||
|
RCC.USART2Freq_Value=64000000
|
||||||
|
RCC.VCOInputFreq_Value=8000000
|
||||||
|
RCC.VCOOutputFreq_Value=128000000
|
||||||
|
SH.COMP_DAC11_group.0=DAC1_OUT1,DAC_OUT1
|
||||||
|
SH.COMP_DAC11_group.ConfNb=1
|
||||||
|
SH.COMP_DAC12_group.0=DAC1_OUT2,DAC_OUT2
|
||||||
|
SH.COMP_DAC12_group.ConfNb=1
|
||||||
|
VP_SYS_VS_Systick.Mode=SysTick
|
||||||
|
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||||
|
board=custom
|
||||||
|
isbadioc=false
|
185
STM32G071KBTX_FLASH.ld
Normal file
185
STM32G071KBTX_FLASH.ld
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
/*
|
||||||
|
******************************************************************************
|
||||||
|
**
|
||||||
|
** @file : LinkerScript.ld
|
||||||
|
**
|
||||||
|
** @author : Auto-generated by STM32CubeIDE
|
||||||
|
**
|
||||||
|
** @brief : Linker script for STM32G071KBTx Device from STM32G0 series
|
||||||
|
** 128Kbytes FLASH
|
||||||
|
** 36Kbytes RAM
|
||||||
|
**
|
||||||
|
** Set heap size, stack size and stack location according
|
||||||
|
** to application requirements.
|
||||||
|
**
|
||||||
|
** Set memory bank area and size if external memory is used
|
||||||
|
**
|
||||||
|
** Target : STMicroelectronics STM32
|
||||||
|
**
|
||||||
|
** Distribution: The file is distributed as is, without any warranty
|
||||||
|
** of any kind.
|
||||||
|
**
|
||||||
|
******************************************************************************
|
||||||
|
** @attention
|
||||||
|
**
|
||||||
|
** Copyright (c) 2023 STMicroelectronics.
|
||||||
|
** All rights reserved.
|
||||||
|
**
|
||||||
|
** This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
** in the root directory of this software component.
|
||||||
|
** If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
**
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Entry Point */
|
||||||
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
/* Highest address of the user mode stack */
|
||||||
|
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
|
||||||
|
|
||||||
|
_Min_Heap_Size = 0x200; /* required amount of heap */
|
||||||
|
_Min_Stack_Size = 0x400; /* required amount of stack */
|
||||||
|
|
||||||
|
/* Memories definition */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 36K
|
||||||
|
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sections */
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
/* The startup code into "FLASH" Rom type memory */
|
||||||
|
.isr_vector :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.isr_vector)) /* Startup code */
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
/* The program code and other data into "FLASH" Rom type memory */
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.text) /* .text sections (code) */
|
||||||
|
*(.text*) /* .text* sections (code) */
|
||||||
|
*(.glue_7) /* glue arm to thumb code */
|
||||||
|
*(.glue_7t) /* glue thumb to arm code */
|
||||||
|
*(.eh_frame)
|
||||||
|
|
||||||
|
KEEP (*(.init))
|
||||||
|
KEEP (*(.fini))
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_etext = .; /* define a global symbols at end of code */
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
/* Constant data into "FLASH" Rom type memory */
|
||||||
|
.rodata :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.rodata) /* .rodata sections (constants, strings, etc.) */
|
||||||
|
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
.ARM.extab : {
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
.ARM : {
|
||||||
|
. = ALIGN(4);
|
||||||
|
__exidx_start = .;
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
__exidx_end = .;
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
.preinit_array :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||||
|
KEEP (*(.preinit_array*))
|
||||||
|
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
.init_array :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
PROVIDE_HIDDEN (__init_array_start = .);
|
||||||
|
KEEP (*(SORT(.init_array.*)))
|
||||||
|
KEEP (*(.init_array*))
|
||||||
|
PROVIDE_HIDDEN (__init_array_end = .);
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
.fini_array :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||||
|
KEEP (*(SORT(.fini_array.*)))
|
||||||
|
KEEP (*(.fini_array*))
|
||||||
|
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||||
|
. = ALIGN(4);
|
||||||
|
} >FLASH
|
||||||
|
|
||||||
|
/* Used by the startup to initialize data */
|
||||||
|
_sidata = LOADADDR(.data);
|
||||||
|
|
||||||
|
/* Initialized data sections into "RAM" Ram type memory */
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sdata = .; /* create a global symbol at data start */
|
||||||
|
*(.data) /* .data sections */
|
||||||
|
*(.data*) /* .data* sections */
|
||||||
|
*(.RamFunc) /* .RamFunc sections */
|
||||||
|
*(.RamFunc*) /* .RamFunc* sections */
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = .; /* define a global symbol at data end */
|
||||||
|
|
||||||
|
} >RAM AT> FLASH
|
||||||
|
|
||||||
|
/* Uninitialized data section into "RAM" Ram type memory */
|
||||||
|
. = ALIGN(4);
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
/* This is used by the startup in order to initialize the .bss section */
|
||||||
|
_sbss = .; /* define a global symbol at bss start */
|
||||||
|
__bss_start__ = _sbss;
|
||||||
|
*(.bss)
|
||||||
|
*(.bss*)
|
||||||
|
*(COMMON)
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = .; /* define a global symbol at bss end */
|
||||||
|
__bss_end__ = _ebss;
|
||||||
|
} >RAM
|
||||||
|
|
||||||
|
/* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
|
||||||
|
._user_heap_stack :
|
||||||
|
{
|
||||||
|
. = ALIGN(8);
|
||||||
|
PROVIDE ( end = . );
|
||||||
|
PROVIDE ( _end = . );
|
||||||
|
. = . + _Min_Heap_Size;
|
||||||
|
. = . + _Min_Stack_Size;
|
||||||
|
. = ALIGN(8);
|
||||||
|
} >RAM
|
||||||
|
|
||||||
|
/* Remove information from the compiler libraries */
|
||||||
|
/DISCARD/ :
|
||||||
|
{
|
||||||
|
libc.a ( * )
|
||||||
|
libm.a ( * )
|
||||||
|
libgcc.a ( * )
|
||||||
|
}
|
||||||
|
|
||||||
|
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||||
|
}
|
21
Source/ElektronischeLast.cpp
Normal file
21
Source/ElektronischeLast.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* ElektronischeLast.cpp
|
||||||
|
*
|
||||||
|
* Created on: Jun 23, 2023
|
||||||
|
* Author: Carst
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "STM32G071KBT6.hpp"
|
||||||
|
#include <stm32g0xx.h>
|
||||||
|
#include "LED.hpp"
|
||||||
|
|
||||||
|
int main (void)
|
||||||
|
{
|
||||||
|
__enable_irq();
|
||||||
|
ElektronischeLast::LED led = ElektronischeLast::LED(500U);
|
||||||
|
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
led.blink();
|
||||||
|
}
|
||||||
|
}
|
46
Source/LED.cpp
Normal file
46
Source/LED.cpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* LED.cpp
|
||||||
|
*
|
||||||
|
* Created on: Jun 25, 2023
|
||||||
|
* Author: Carst
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stm32g0xx_ll_gpio.h>
|
||||||
|
#include "STM32G071KBT6.hpp"
|
||||||
|
#include "LED.hpp"
|
||||||
|
|
||||||
|
namespace ElektronischeLast
|
||||||
|
{
|
||||||
|
LED::LED(std::uint32_t interval)
|
||||||
|
{
|
||||||
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {
|
||||||
|
.Pin = LL_GPIO_PIN_6,
|
||||||
|
.Mode = LL_GPIO_MODE_OUTPUT,
|
||||||
|
.Speed = LL_GPIO_SPEED_FREQ_LOW,
|
||||||
|
.OutputType = LL_GPIO_OUTPUT_PUSHPULL,
|
||||||
|
.Pull = LL_GPIO_PULL_NO,
|
||||||
|
};
|
||||||
|
|
||||||
|
LL_GPIO_ResetOutputPin(GPIOC, LL_GPIO_PIN_6);
|
||||||
|
LL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
this->last_toggle = systick;
|
||||||
|
this->interval = interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
LED::~LED()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void LED::blink(void)
|
||||||
|
{
|
||||||
|
if((systick - this->last_toggle) > this->interval)
|
||||||
|
{
|
||||||
|
LL_GPIO_TogglePin(GPIOC, LL_GPIO_PIN_6);
|
||||||
|
this->last_toggle = systick;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
27
Source/LED.hpp
Normal file
27
Source/LED.hpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* LED.hpp
|
||||||
|
*
|
||||||
|
* Created on: Jun 25, 2023
|
||||||
|
* Author: Carst
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LED_HPP_
|
||||||
|
#define LED_HPP_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace ElektronischeLast
|
||||||
|
{
|
||||||
|
class LED
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LED(std::uint32_t interval);
|
||||||
|
~LED();
|
||||||
|
void blink(void);
|
||||||
|
private:
|
||||||
|
std::uint32_t last_toggle;
|
||||||
|
std::uint32_t interval;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* LED_HPP_ */
|
242
Source/STM32G071KBT6.cpp
Normal file
242
Source/STM32G071KBT6.cpp
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
/*
|
||||||
|
* STM32G071KBT6.cpp
|
||||||
|
*
|
||||||
|
* Created on: Jun 23, 2023
|
||||||
|
* Author: Carst
|
||||||
|
*/
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <stm32g0xx_ll_bus.h>
|
||||||
|
#include <stm32g0xx_ll_cortex.h>
|
||||||
|
#include <stm32g0xx_ll_rcc.h>
|
||||||
|
#include <stm32g0xx_ll_system.h>
|
||||||
|
#include <stm32g0xx_ll_utils.h>
|
||||||
|
|
||||||
|
extern "C" void Reset_Handler(void);
|
||||||
|
extern "C" void NMI_Handler(void);
|
||||||
|
extern "C" void HardFault_Handler(void);
|
||||||
|
extern "C" void SVC_Handler(void);
|
||||||
|
extern "C" void PendSV_Handler(void);
|
||||||
|
extern "C" void SysTick_Handler(void);
|
||||||
|
extern "C" void WWDG_IRQHandler(void); /* Window WatchDog */
|
||||||
|
extern "C" void PVD_IRQHandler(void); /* PVD through EXTI Line detect */
|
||||||
|
extern "C" void RTC_TAMP_IRQHandler(void); /* RTC through the EXTI line */
|
||||||
|
extern "C" void FLASH_IRQHandler(void); /* FLASH */
|
||||||
|
extern "C" void RCC_IRQHandler(void); /* RCC */
|
||||||
|
extern "C" void EXTI0_1_IRQHandler(void); /* EXTI Line 0 and 1 */
|
||||||
|
extern "C" void EXTI2_3_IRQHandler(void); /* EXTI Line 2 and 3 */
|
||||||
|
extern "C" void EXTI4_15_IRQHandler(void); /* EXTI Line 4 to 15 */
|
||||||
|
extern "C" void UCPD1_2_IRQHandler(void); /* UCPD1, UCPD2 */
|
||||||
|
extern "C" void DMA1_Channel1_IRQHandler(void); /* DMA1 Channel 1 */
|
||||||
|
extern "C" void DMA1_Channel2_3_IRQHandler(void); /* DMA1 Channel 2 and Channel 3 */
|
||||||
|
extern "C" void DMA1_Ch4_7_DMAMUX1_OVR_IRQHandler(void); /* DMA1 Channel 4 to Channel 7, DMAMUX1 overrun */
|
||||||
|
extern "C" void ADC1_COMP_IRQHandler(void); /* ADC1, COMP1 and COMP2 */
|
||||||
|
extern "C" void TIM1_BRK_UP_TRG_COM_IRQHandler(void); /* TIM1 Break, Update, Trigger and Commutation */
|
||||||
|
extern "C" void TIM1_CC_IRQHandler(void); /* TIM1 Capture Compare */
|
||||||
|
extern "C" void TIM2_IRQHandler(void); /* TIM2 */
|
||||||
|
extern "C" void TIM3_IRQHandler(void); /* TIM3 */
|
||||||
|
extern "C" void TIM6_DAC_LPTIM1_IRQHandler(void); /* TIM6, DAC and LPTIM1 */
|
||||||
|
extern "C" void TIM7_LPTIM2_IRQHandler(void); /* TIM7 and LPTIM2 */
|
||||||
|
extern "C" void TIM14_IRQHandler(void); /* TIM14 */
|
||||||
|
extern "C" void TIM15_IRQHandler(void); /* TIM15 */
|
||||||
|
extern "C" void TIM16_IRQHandler(void); /* TIM16 */
|
||||||
|
extern "C" void TIM17_IRQHandler(void); /* TIM17 */
|
||||||
|
extern "C" void I2C1_IRQHandler(void); /* I2C1 */
|
||||||
|
extern "C" void I2C2_IRQHandler(void); /* I2C2 */
|
||||||
|
extern "C" void SPI1_IRQHandler(void); /* SPI1 */
|
||||||
|
extern "C" void SPI2_IRQHandler(void); /* SPI2 */
|
||||||
|
extern "C" void USART1_IRQHandler(void); /* USART1 */
|
||||||
|
extern "C" void USART2_IRQHandler(void); /* USART2 */
|
||||||
|
extern "C" void USART3_4_LPUART1_IRQHandler(void); /* USART3, USART4 and LPUART1 */
|
||||||
|
extern "C" void CEC_IRQHandler(void); /* CEC */
|
||||||
|
|
||||||
|
extern std::uint32_t _estack;
|
||||||
|
std::uint32_t systick;
|
||||||
|
|
||||||
|
const std::uintptr_t interruptVectorTable[] __attribute__((section(".isr_vector")))
|
||||||
|
{
|
||||||
|
reinterpret_cast<std::uintptr_t>(&_estack),
|
||||||
|
reinterpret_cast<std::uintptr_t>(Reset_Handler),
|
||||||
|
reinterpret_cast<std::uintptr_t>(NMI_Handler),
|
||||||
|
reinterpret_cast<std::uintptr_t>(HardFault_Handler),
|
||||||
|
reinterpret_cast<std::uintptr_t>(nullptr),
|
||||||
|
reinterpret_cast<std::uintptr_t>(nullptr),
|
||||||
|
reinterpret_cast<std::uintptr_t>(nullptr),
|
||||||
|
reinterpret_cast<std::uintptr_t>(nullptr),
|
||||||
|
reinterpret_cast<std::uintptr_t>(nullptr),
|
||||||
|
reinterpret_cast<std::uintptr_t>(nullptr),
|
||||||
|
reinterpret_cast<std::uintptr_t>(nullptr),
|
||||||
|
reinterpret_cast<std::uintptr_t>(SVC_Handler),
|
||||||
|
reinterpret_cast<std::uintptr_t>(nullptr),
|
||||||
|
reinterpret_cast<std::uintptr_t>(nullptr),
|
||||||
|
reinterpret_cast<std::uintptr_t>(PendSV_Handler),
|
||||||
|
reinterpret_cast<std::uintptr_t>(SysTick_Handler),
|
||||||
|
reinterpret_cast<std::uintptr_t>(WWDG_IRQHandler), /* Window WatchDog */
|
||||||
|
reinterpret_cast<std::uintptr_t>(PVD_IRQHandler), /* PVD through EXTI Line detect */
|
||||||
|
reinterpret_cast<std::uintptr_t>(RTC_TAMP_IRQHandler), /* RTC through the EXTI line */
|
||||||
|
reinterpret_cast<std::uintptr_t>(FLASH_IRQHandler), /* FLASH */
|
||||||
|
reinterpret_cast<std::uintptr_t>(RCC_IRQHandler), /* RCC */
|
||||||
|
reinterpret_cast<std::uintptr_t>(EXTI0_1_IRQHandler), /* EXTI Line 0 and 1 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(EXTI2_3_IRQHandler), /* EXTI Line 2 and 3 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(EXTI4_15_IRQHandler), /* EXTI Line 4 to 15 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(UCPD1_2_IRQHandler), /* UCPD1, UCPD2 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(DMA1_Channel1_IRQHandler), /* DMA1 Channel 1 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(DMA1_Channel2_3_IRQHandler), /* DMA1 Channel 2 and Channel 3 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(DMA1_Ch4_7_DMAMUX1_OVR_IRQHandler), /* DMA1 Channel 4 to Channel 7, DMAMUX1 overrun */
|
||||||
|
reinterpret_cast<std::uintptr_t>(ADC1_COMP_IRQHandler), /* ADC1, COMP1 and COMP2 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(TIM1_BRK_UP_TRG_COM_IRQHandler), /* TIM1 Break, Update, Trigger and Commutation */
|
||||||
|
reinterpret_cast<std::uintptr_t>(TIM1_CC_IRQHandler), /* TIM1 Capture Compare */
|
||||||
|
reinterpret_cast<std::uintptr_t>(TIM2_IRQHandler), /* TIM2 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(TIM3_IRQHandler), /* TIM3 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(TIM6_DAC_LPTIM1_IRQHandler), /* TIM6, DAC and LPTIM1 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(TIM7_LPTIM2_IRQHandler), /* TIM7 and LPTIM2 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(TIM14_IRQHandler), /* TIM14 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(TIM15_IRQHandler), /* TIM15 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(TIM16_IRQHandler), /* TIM16 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(TIM17_IRQHandler), /* TIM17 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(I2C1_IRQHandler), /* I2C1 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(I2C2_IRQHandler), /* I2C2 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(SPI1_IRQHandler), /* SPI1 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(SPI2_IRQHandler), /* SPI2 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(USART1_IRQHandler), /* USART1 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(USART2_IRQHandler), /* USART2 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(USART3_4_LPUART1_IRQHandler), /* USART3, USART4 and LPUART1 */
|
||||||
|
reinterpret_cast<std::uintptr_t>(CEC_IRQHandler), /* CEC */
|
||||||
|
};
|
||||||
|
|
||||||
|
extern "C" void Reset_Handler(void)
|
||||||
|
{
|
||||||
|
/* Stack-Pointer wird automatisch von der HW initialisiert */
|
||||||
|
|
||||||
|
|
||||||
|
/* Copy the data segment initializers from flash to SRAM */
|
||||||
|
extern std::uint8_t _sdata;
|
||||||
|
extern std::uint8_t _edata;
|
||||||
|
extern std::uint8_t _sidata;
|
||||||
|
std::size_t size = static_cast<size_t>(&_edata - &_sdata);
|
||||||
|
std::copy(&_sidata, &_sidata + size, &_sdata);
|
||||||
|
|
||||||
|
/* Initialize bss section */
|
||||||
|
extern std::uint8_t _sbss;
|
||||||
|
extern std::uint8_t _ebss;
|
||||||
|
std::fill(&_sbss, &_ebss, UINT8_C(0x00));
|
||||||
|
|
||||||
|
/* Call the clock system initialization function.*/
|
||||||
|
SystemInit();
|
||||||
|
|
||||||
|
/* Initialize static objects by calling their constructors */
|
||||||
|
typedef void (*function_t)();
|
||||||
|
extern function_t __init_array_start;
|
||||||
|
extern function_t __init_array_end;
|
||||||
|
std::for_each(&__init_array_start, &__init_array_end, [](const function_t pfn) {
|
||||||
|
pfn();
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Jump to main */
|
||||||
|
asm ("bl main");
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void NMI_Handler(void){}
|
||||||
|
extern "C" void HardFault_Handler(void){}
|
||||||
|
extern "C" void SVC_Handler(void){}
|
||||||
|
extern "C" void PendSV_Handler(void){}
|
||||||
|
|
||||||
|
extern "C" void SysTick_Handler(void)
|
||||||
|
{
|
||||||
|
systick++;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void WWDG_IRQHandler(void){} /* Window WatchDog */
|
||||||
|
extern "C" void PVD_IRQHandler(void){} /* PVD through EXTI Line detect */
|
||||||
|
extern "C" void RTC_TAMP_IRQHandler(void){} /* RTC through the EXTI line */
|
||||||
|
extern "C" void FLASH_IRQHandler(void){} /* FLASH */
|
||||||
|
extern "C" void RCC_IRQHandler(void){} /* RCC */
|
||||||
|
extern "C" void EXTI0_1_IRQHandler(void){} /* EXTI Line 0 and 1 */
|
||||||
|
extern "C" void EXTI2_3_IRQHandler(void){} /* EXTI Line 2 and 3 */
|
||||||
|
extern "C" void EXTI4_15_IRQHandler(void){} /* EXTI Line 4 to 15 */
|
||||||
|
extern "C" void UCPD1_2_IRQHandler(void){} /* UCPD1, UCPD2 */
|
||||||
|
extern "C" void DMA1_Channel1_IRQHandler(void){} /* DMA1 Channel 1 */
|
||||||
|
extern "C" void DMA1_Channel2_3_IRQHandler(void){} /* DMA1 Channel 2 and Channel 3 */
|
||||||
|
extern "C" void DMA1_Ch4_7_DMAMUX1_OVR_IRQHandler(void){} /* DMA1 Channel 4 to Channel 7, DMAMUX1 overrun */
|
||||||
|
extern "C" void ADC1_COMP_IRQHandler(void){} /* ADC1, COMP1 and COMP2 */
|
||||||
|
extern "C" void TIM1_BRK_UP_TRG_COM_IRQHandler(void){} /* TIM1 Break, Update, Trigger and Commutation */
|
||||||
|
extern "C" void TIM1_CC_IRQHandler(void){} /* TIM1 Capture Compare */
|
||||||
|
extern "C" void TIM2_IRQHandler(void){} /* TIM2 */
|
||||||
|
extern "C" void TIM3_IRQHandler(void){} /* TIM3 */
|
||||||
|
extern "C" void TIM6_DAC_LPTIM1_IRQHandler(void){} /* TIM6, DAC and LPTIM1 */
|
||||||
|
extern "C" void TIM7_LPTIM2_IRQHandler(void){} /* TIM7 and LPTIM2 */
|
||||||
|
extern "C" void TIM14_IRQHandler(void){} /* TIM14 */
|
||||||
|
extern "C" void TIM15_IRQHandler(void){} /* TIM15 */
|
||||||
|
extern "C" void TIM16_IRQHandler(void){} /* TIM16 */
|
||||||
|
extern "C" void TIM17_IRQHandler(void){} /* TIM17 */
|
||||||
|
extern "C" void I2C1_IRQHandler(void){} /* I2C1 */
|
||||||
|
extern "C" void I2C2_IRQHandler(void){} /* I2C2 */
|
||||||
|
extern "C" void SPI1_IRQHandler(void){} /* SPI1 */
|
||||||
|
extern "C" void SPI2_IRQHandler(void){} /* SPI2 */
|
||||||
|
extern "C" void USART1_IRQHandler(void){} /* USART1 */
|
||||||
|
extern "C" void USART2_IRQHandler(void){} /* USART2 */
|
||||||
|
extern "C" void CEC_IRQHandler(void){} /* CEC */
|
||||||
|
|
||||||
|
/* This variable is updated in three ways:
|
||||||
|
1) by calling CMSIS function SystemCoreClockUpdate()
|
||||||
|
2) by calling HAL API function HAL_RCC_GetHCLKFreq()
|
||||||
|
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||||
|
Note: If you use this function to configure the system clock; then there
|
||||||
|
is no need to call the 2 first functions listed above, since SystemCoreClock
|
||||||
|
variable is updated automatically.
|
||||||
|
*/
|
||||||
|
uint32_t SystemCoreClock = 8000000;
|
||||||
|
|
||||||
|
extern "C" void SystemInit(void)
|
||||||
|
{
|
||||||
|
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||||
|
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
|
||||||
|
|
||||||
|
LL_FLASH_SetLatency(LL_FLASH_LATENCY_2);
|
||||||
|
while(LL_FLASH_GetLatency() != LL_FLASH_LATENCY_2)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* HSE configuration and activation */
|
||||||
|
LL_RCC_HSE_EnableBypass();
|
||||||
|
LL_RCC_HSE_Enable();
|
||||||
|
while(LL_RCC_HSE_IsReady() != 1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main PLL configuration and activation */
|
||||||
|
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE, LL_RCC_PLLM_DIV_1, 16, LL_RCC_PLLR_DIV_2);
|
||||||
|
LL_RCC_PLL_Enable();
|
||||||
|
LL_RCC_PLL_EnableDomain_SYS();
|
||||||
|
while(LL_RCC_PLL_IsReady() != 1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set AHB prescaler*/
|
||||||
|
LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
|
||||||
|
|
||||||
|
/* Sysclk activation on the main PLL */
|
||||||
|
LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
|
||||||
|
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set APB1 prescaler*/
|
||||||
|
LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
|
||||||
|
|
||||||
|
LL_Init1msTick(64000000);
|
||||||
|
LL_SYSTICK_EnableIT();
|
||||||
|
/* SysTick_IRQn interrupt configuration */
|
||||||
|
NVIC_SetPriority(SysTick_IRQn, 3);
|
||||||
|
/* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
|
||||||
|
LL_SetSystemCoreClock(64000000);
|
||||||
|
|
||||||
|
/* Enable Clocks for all Peripherals*/
|
||||||
|
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
|
||||||
|
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOB);
|
||||||
|
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOC);
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LPUART1);
|
||||||
|
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC);
|
||||||
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_DAC1);
|
||||||
|
}
|
15
Source/STM32G071KBT6.hpp
Normal file
15
Source/STM32G071KBT6.hpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* STM32G071KBT6.hpp
|
||||||
|
*
|
||||||
|
* Created on: Jun 25, 2023
|
||||||
|
* Author: Carst
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef STM32G071KBT6_HPP_
|
||||||
|
#define STM32G071KBT6_HPP_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
extern std::uint32_t systick;
|
||||||
|
|
||||||
|
#endif /* STM32G071KBT6_HPP_ */
|
64
Source/serial.cpp
Normal file
64
Source/serial.cpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* serial.cpp
|
||||||
|
*
|
||||||
|
* Created on: Jun 23, 2023
|
||||||
|
* Author: Carst
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include "stm32g0xx_ll_lpuart.h"
|
||||||
|
|
||||||
|
extern "C" int _write(int file, char *ptr, int len)
|
||||||
|
{
|
||||||
|
(void)file;
|
||||||
|
int DataIdx;
|
||||||
|
|
||||||
|
for (DataIdx = 0; DataIdx < len; DataIdx++)
|
||||||
|
{
|
||||||
|
if(LL_LPUART_IsActiveFlag_TXE_TXFNF(LPUART1))
|
||||||
|
{
|
||||||
|
LL_LPUART_TransmitData8(LPUART1, static_cast<std::uint8_t>(*ptr++));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int _close(int file)
|
||||||
|
{
|
||||||
|
(void)file;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int _lseek(int file, int ptr, int dir)
|
||||||
|
{
|
||||||
|
(void)file;
|
||||||
|
(void)ptr;
|
||||||
|
(void)dir;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int _read(int file, char *ptr, int len)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
(void)file;
|
||||||
|
int DataIdx;
|
||||||
|
|
||||||
|
for (DataIdx = 0; DataIdx < len; DataIdx++)
|
||||||
|
{
|
||||||
|
*ptr++ = __io_getchar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return len;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" void USART3_4_LPUART1_IRQHandler(void)
|
||||||
|
{
|
||||||
|
if(LL_LPUART_IsActiveFlag_RXNE_RXFNE(LPUART1))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user