mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Add RL78 E2Studio project. Code is building, but has not yet been executed.
This commit is contained in:
parent
17bba16fa6
commit
83fa827935
100
FreeRTOS/Demo/RL78_E2Studio_GCC/.HardwareDebuglinker
Normal file
100
FreeRTOS/Demo/RL78_E2Studio_GCC/.HardwareDebuglinker
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
<?xml version="1.0" encoding="ASCII"?>
|
||||||
|
<com.renesas.linkersection.model:SectionContainer xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.renesas.linkersection.model="http:///LinkerSection.ecore" targets="GNU_RL78">
|
||||||
|
<sections name=".vec" isKeep="true">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".vec"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".vects" isKeep="true">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="4"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".vects"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".option_bytes" isKeep="true">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="192"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".option_bytes"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".security_id" isKeep="true">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="196"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".security_id"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".text">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="216"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".text"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".text.*"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="etext"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Keyword" text=". = ALIGN(2)"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".init">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:ReferencedSectionAddress" referencedSection="//@sections.4"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".init"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".fini">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:ReferencedSectionAddress" referencedSection="//@sections.5"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".fini"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".got">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:ReferencedSectionAddress" referencedSection="//@sections.6"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".got"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".got.plt"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".rodata MAX(., 0x3000)">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:ReferencedSectionAddress" referencedSection="//@sections.7"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Keyword" text=". = ALIGN(2)"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".rodata"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".rodata.*"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="_erodata"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".eh_frame_hdr">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:ReferencedSectionAddress" referencedSection="//@sections.8"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".eh_frame_hdr"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".eh_frame">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:ReferencedSectionAddress" referencedSection="//@sections.9"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".eh_frame"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".jcr">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:ReferencedSectionAddress" referencedSection="//@sections.10"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".jcr"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".tors">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:ReferencedSectionAddress" referencedSection="//@sections.11"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="__CTOR_LIST__"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Keyword" text=". = ALIGN(2)"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="___ctors"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".ctors"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="___ctors_end"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="__CTOR_END__"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="__DTOR_LIST__"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="___dtors"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".dtors"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="___dtors_end"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="__DTOR_END__"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Keyword" text=". = ALIGN(2)"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="_mdata"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".data">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="1023744"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Keyword" text=". = ALIGN(2)"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="_data"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".data"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".data.*"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Keyword" text=". = ALIGN(2)"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="_edata"/>
|
||||||
|
<reservedMemAddress xsi:type="com.renesas.linkersection.model:ReferencedLabelAddress" label="//@sections.12/@contents.12"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".bss">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:ReferencedSectionAddress" referencedSection="//@sections.13"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Keyword" text=". = ALIGN(2)"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="_bss"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".bss"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name=".bss.**"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Keyword" text=". = ALIGN(2)"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:WildCardExpression" specificSection="true" name="COMMON"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Keyword" text=". = ALIGN(2)"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="_ebss"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="_end"/>
|
||||||
|
</sections>
|
||||||
|
<sections name=".stack" isNoLoad="true">
|
||||||
|
<sectionAddress xsi:type="com.renesas.linkersection.model:FixedAddress" fixedAddress="1048064"/>
|
||||||
|
<contents xsi:type="com.renesas.linkersection.model:Label" rhs="= .;" lhs="_stack"/>
|
||||||
|
</sections>
|
||||||
|
</com.renesas.linkersection.model:SectionContainer>
|
211
FreeRTOS/Demo/RL78_E2Studio_GCC/.cproject
Normal file
211
FreeRTOS/Demo/RL78_E2Studio_GCC/.cproject
Normal file
|
@ -0,0 +1,211 @@
|
||||||
|
<?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.renesas.cdt.RL78.configuration.hardwaredebug.1462655394">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.renesas.cdt.RL78.configuration.hardwaredebug.1462655394" moduleId="org.eclipse.cdt.core.settings" name="HardwareDebug">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactExtension="mot" artifactName="RTOSDemo" buildArtefactType="com.renesas.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=com.renesas.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf *.lst *.lis *.lpp *.map" description="" id="com.renesas.cdt.RL78.configuration.hardwaredebug.1462655394" name="HardwareDebug" parent="com.renesas.cdt.RL78.configuration.hardwaredebug">
|
||||||
|
<folderInfo id="com.renesas.cdt.RL78.configuration.hardwaredebug.1462655394." name="/" resourcePath="">
|
||||||
|
<toolChain id="com.renesas.cdt.RL78.toolChain.hardwaredebugConf.1486648127" name="KPIT GNURL78-ELF Toolchain" superClass="com.renesas.cdt.RL78.toolChain.hardwaredebugConf">
|
||||||
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE" id="com.renesas.cdt.rl78.hardwaredebug.win32.targetPlatform.458738982" osList="win32" superClass="com.renesas.cdt.rl78.hardwaredebug.win32.targetPlatform"/>
|
||||||
|
<builder buildPath="${workspace_loc:/RTOSDemo/HardwareDebug}" id="com.renesas.cdt.rl78.hardwaredebug.win32.builder.Id.1815542768" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="GNU Make Builder" superClass="com.renesas.cdt.rl78.hardwaredebug.win32.builder.Id"/>
|
||||||
|
<tool command="rl78-elf-libgen" id="com.renesas.cdt.rl78.hardwaredebug.win32.tool.libgen.Id.898204242" name="Library Generator" superClass="com.renesas.cdt.rl78.hardwaredebug.win32.tool.libgen.Id">
|
||||||
|
<option id="com.renesas.cdt.core.LibraryGenerator.option.stdio.1978567981" name="stdio.h : Performs input/oputput handling" superClass="com.renesas.cdt.core.LibraryGenerator.option.stdio" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.LibraryGenerator.option.stdlib.152368107" name="stdlib.h : Performs C program statndard processing such as storage area management" superClass="com.renesas.cdt.core.LibraryGenerator.option.stdlib" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.LibraryGenerator.option.string.596961681" name="string.h : Performs string comparison, copying " superClass="com.renesas.cdt.core.LibraryGenerator.option.string" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.LibraryGenerator.option.selectLibrary.652647554" name="Select library" superClass="com.renesas.cdt.core.LibraryGenerator.option.selectLibrary" value="Optimized" valueType="enumerated"/>
|
||||||
|
<option id="com.renesas.cdt.core.LibraryGenerator.option.libraryType.703164222" name="Library type" superClass="com.renesas.cdt.core.LibraryGenerator.option.libraryType" value="Project-Built" valueType="enumerated"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.renesas.cdt.rl78.hardwaredebug.win32.tool.compiler.Id.323331132" name="Compiler" superClass="com.renesas.cdt.rl78.hardwaredebug.win32.tool.compiler.Id">
|
||||||
|
<option id="com.renesas.cdt.rl78.HardwareDebug.Compiler.option.cpuType.1364542281" name="CPU Type" superClass="com.renesas.cdt.rl78.HardwareDebug.Compiler.option.cpuType" value="com.renesas.cdt.rl78.HardwareDebug.Compiler.option.cpuType.g14" valueType="enumerated"/>
|
||||||
|
<option id="com.renesas.cdt.rl78.HardwareDebug.Compiler.option.mmul.260959197" name="Multiplication code Generation Option" superClass="com.renesas.cdt.rl78.HardwareDebug.Compiler.option.mmul" value="None" valueType="enumerated"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.includeFileDir.1067754383" name="Include file directories" superClass="com.renesas.cdt.core.Compiler.option.includeFileDir" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${TCINSTALL}\rl78-elf\optlibinc""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/Common-Demo-Tasks/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/FreeRTOS_Source/include}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/FreeRTOS_Source/portable/GCC/RL78}""/>
|
||||||
|
</option>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.CPUSeries.880521657" name="Cpu Series" superClass="com.renesas.cdt.core.Compiler.option.CPUSeries" value="R5F10JBC" valueType="string"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning14.2112181183" name="Print extra warning messages(-Wextra)" superClass="com.renesas.cdt.core.Compiler.option.warning14" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.stdWarnings.1766930891" name="Standard Warnings" superClass="com.renesas.cdt.core.Compiler.option.stdWarnings" value="com.renesas.cdt.core.Compiler.option.stdWarnings.enableAll" valueType="enumerated"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning1.1518994610" name="Issue Warning if an array subscript has type char(-Wchar-subscripts)" superClass="com.renesas.cdt.core.Compiler.option.warning1" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning2.180333158" name="Issue Warning if comment appears within comment(-Wcomment)" superClass="com.renesas.cdt.core.Compiler.option.warning2" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning3.658110954" name="Issue Warning if string functions format is incorrect(-Wformat)" superClass="com.renesas.cdt.core.Compiler.option.warning3" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning4.1235459335" name="Issue Warning if a function or parameter is implicitly declare(-Wimplicit)" superClass="com.renesas.cdt.core.Compiler.option.warning4" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning5.1569221265" name="Disable Warning about the use of #import(-Wno-import)" superClass="com.renesas.cdt.core.Compiler.option.warning5" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning6.769740812" name="Issue Warning if parantheses are omitted in certain contexts(-Wparentheses)" superClass="com.renesas.cdt.core.Compiler.option.warning6" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning7.1073639370" name="Issue Warning of possible return type problems(-Wreturn-type)" superClass="com.renesas.cdt.core.Compiler.option.warning7" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning8.1548061643" name="Issue Warning of possible switch statement problems(-Wswitch)" superClass="com.renesas.cdt.core.Compiler.option.warning8" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning9.1851919047" name="Issue Warning if any trigraphs are encountered(-Wtrigraphs)" superClass="com.renesas.cdt.core.Compiler.option.warning9" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning10.649453947" name="Issue Warning if a variable is unused aside from its declaration(-Wunused)" superClass="com.renesas.cdt.core.Compiler.option.warning10" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning11.1438339511" name="Issue Warning if an uninitialised automatic variable is used(-Wuninitialized)" superClass="com.renesas.cdt.core.Compiler.option.warning11" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning12.62902878" name="Issue Warning of member intialisation mismatch(-Wreorder)" superClass="com.renesas.cdt.core.Compiler.option.warning12" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.renesas.cdt.core.Compiler.option.warning13.1346187712" name="Issue Warning of bad sign comparisions(-Wsign-compare)" superClass="com.renesas.cdt.core.Compiler.option.warning13" value="true" valueType="boolean"/>
|
||||||
|
<inputType id="%Base.Compiler.C.InputType.Id.304532987" name="C Input" superClass="%Base.Compiler.C.InputType.Id"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.renesas.cdt.rl78.hardwaredebug.win32.tool.assembler.Id.1483562315" name="Assembler" superClass="com.renesas.cdt.rl78.hardwaredebug.win32.tool.assembler.Id">
|
||||||
|
<option id="com.renesas.cdt.core.Assembler.option.includeFileDirectories.1195749866" name="Include file directories" superClass="com.renesas.cdt.core.Assembler.option.includeFileDirectories" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}\src""/>
|
||||||
|
</option>
|
||||||
|
<inputType id="%Base.Assembler.inputType.Id.1124641218" name="Assembler InputType" superClass="%Base.Assembler.inputType.Id"/>
|
||||||
|
</tool>
|
||||||
|
<tool command="rl78-elf-ld" commandLinePattern="${COMMAND} ${OUTPUT_FLAG}${OUTPUT_PREFIX} ${OUTPUT}${INPUTS} ${FLAGS}" id="com.renesas.cdt.rl78.hardwaredebug.win32.tool.linker.Id.148124689" name="Linker" superClass="com.renesas.cdt.rl78.hardwaredebug.win32.tool.linker.Id">
|
||||||
|
<option id="com.renesas.cdt.rl78.HardwareDebug.Linker.option.archiveSearchDirectories.970009502" name="Archive search directories" superClass="com.renesas.cdt.rl78.HardwareDebug.Linker.option.archiveSearchDirectories" valueType="stringList">
|
||||||
|
<listOptionValue builtIn="false" value=""${CONFIGDIR}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${TCINSTALL}\lib\gcc\rl78-elf\\${GCC_VERSION}""/>
|
||||||
|
</option>
|
||||||
|
<option id="com.renesas.cdt.rl78.HardwareDebug.Linker.option.archiveLibraryFiles.628448046" name="Archive (library) files" superClass="com.renesas.cdt.rl78.HardwareDebug.Linker.option.archiveLibraryFiles" valueType="stringList">
|
||||||
|
<listOptionValue builtIn="false" value="${ProjName}"/>
|
||||||
|
<listOptionValue builtIn="false" value="gcc"/>
|
||||||
|
</option>
|
||||||
|
<option id="com.renesas.cdt.core.Linker.option.userDefinedOptions.1480388571" name="User defined options" superClass="com.renesas.cdt.core.Linker.option.userDefinedOptions" valueType="stringList">
|
||||||
|
<listOptionValue builtIn="false" value="-e_PowerON_Reset"/>
|
||||||
|
</option>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.renesas.cdt.rl78.hardwaredebug.win32.tool.objcopy.Id.1332327082" name="Objcopy" superClass="com.renesas.cdt.rl78.hardwaredebug.win32.tool.objcopy.Id"/>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
<fileInfo id="com.renesas.cdt.RL78.configuration.hardwaredebug.1462655394.1069911675" name="RegTest.S" rcbsApplicability="disable" resourcePath="src/RegTest.S" toolsToInvoke="com.renesas.cdt.rl78.hardwaredebug.win32.tool.compiler.Id.323331132.901443813">
|
||||||
|
<tool id="com.renesas.cdt.rl78.hardwaredebug.win32.tool.compiler.Id.323331132.901443813" name="Compiler" superClass="com.renesas.cdt.rl78.hardwaredebug.win32.tool.compiler.Id.323331132"/>
|
||||||
|
</fileInfo>
|
||||||
|
<sourceEntries>
|
||||||
|
<entry excluding="src/RegTest.S" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||||
|
</sourceEntries>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="scannerConfiguration">
|
||||||
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
<profile id="com.iar.cdt.v850.scanner.IAR_V850_PerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="false" filePath=""/>
|
||||||
|
<parser enabled="false"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="com.iar.cdt.v850.toolchain.scannerInfoProvider1">
|
||||||
|
<runAction arguments="" command="" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="com.iar.cdt.rl78.scanner.IAR_RL78_PerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="false" filePath=""/>
|
||||||
|
<parser enabled="false"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="com.iar.cdt.rl78.toolchain.scannerInfoProviderRL78">
|
||||||
|
<runAction arguments="" command="" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="com.iar.cdt.rx.scanner.IAR_RX_PerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="false" filePath=""/>
|
||||||
|
<parser enabled="false"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="com.iar.cdt.rx.toolchain.scannerInfoProviderRX">
|
||||||
|
<runAction arguments="" command="" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="makefileGenerator">
|
||||||
|
<runAction arguments="-E -P -v -dD" command="" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
|
||||||
|
<buildOutputProvider>
|
||||||
|
<openAction enabled="true" filePath=""/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</buildOutputProvider>
|
||||||
|
<scannerInfoProvider id="specsFile">
|
||||||
|
<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/>
|
||||||
|
<parser enabled="true"/>
|
||||||
|
</scannerInfoProvider>
|
||||||
|
</profile>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||||
|
</cconfiguration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<project id="RTOSDemo.com.renesas.cdt.RL78.projectType.1275970009" name="GNURL78" projectType="com.renesas.cdt.RL78.projectType"/>
|
||||||
|
</storageModule>
|
||||||
|
</cproject>
|
6
FreeRTOS/Demo/RL78_E2Studio_GCC/.info
Normal file
6
FreeRTOS/Demo/RL78_E2Studio_GCC/.info
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
TOOL_CHAIN=KPIT GNURL78-ELF Toolchain
|
||||||
|
VERSION=v13.01
|
||||||
|
TC_INSTALL=C:\devtools\Renesas\e2studio\GNURL7~1.01-\rl78-elf\
|
||||||
|
GCC_STRING=4.8-GNURL78_v13.01
|
||||||
|
VERSION_IDE=3.06.02.080
|
||||||
|
E2STUDIO_VERSION=1.1.1.7
|
83
FreeRTOS/Demo/RL78_E2Studio_GCC/.project
Normal file
83
FreeRTOS/Demo/RL78_E2Studio_GCC/.project
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>RTOSDemo</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.renesas.cdt.core.genmakebuilder</name>
|
||||||
|
<arguments>
|
||||||
|
<dictionary>
|
||||||
|
<key>?name?</key>
|
||||||
|
<value></value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||||
|
<value>all</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||||
|
<value></value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||||
|
<value>make</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||||
|
<value>${workspace_loc:/RTOSDemo/HardwareDebug}</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||||
|
<value>clean</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.contents</key>
|
||||||
|
<value>org.eclipse.cdt.make.core.configurationIds</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||||
|
<value>false</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||||
|
<value>all</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
|
<dictionary>
|
||||||
|
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||||
|
<value>true</value>
|
||||||
|
</dictionary>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>com.renesas.cdt.core.kpitcnature</nature>
|
||||||
|
<nature>com.renesas.cdt.core.kpitccnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,18 @@
|
||||||
|
#Fri Feb 22 15:43:45 GMT 2013
|
||||||
|
Library\ Generator\ Command=rl78-elf-libgen
|
||||||
|
com.renesas.cdt.core.Assembler.option.includeFileDirectories="${workspace_loc\:/${ProjName}}\\src";
|
||||||
|
com.renesas.cdt.core.Compiler.option.includeFileDir.1067754383="${TCINSTALL}\\rl78-elf\\optlibinc";
|
||||||
|
com.renesas.cdt.core.LibraryGenerator.option.ctype=true
|
||||||
|
com.renesas.cdt.core.LibraryGenerator.option.libraryType=Project-Built
|
||||||
|
com.renesas.cdt.core.LibraryGenerator.option.math=false
|
||||||
|
com.renesas.cdt.core.LibraryGenerator.option.selectLibrary=Optimized
|
||||||
|
com.renesas.cdt.core.LibraryGenerator.option.stdio=true
|
||||||
|
com.renesas.cdt.core.LibraryGenerator.option.stdlib=true
|
||||||
|
com.renesas.cdt.core.LibraryGenerator.option.string=true
|
||||||
|
com.renesas.cdt.core.Linker.option.userDefinedOptions=[Ljava.lang.String;@1dfdfb2
|
||||||
|
com.renesas.cdt.rl78.HardwareDebug.Compiler.option.cpuType=RL78 - G1C
|
||||||
|
com.renesas.cdt.rl78.HardwareDebug.Compiler.option.cpuType.1364542281=RL78 - G1C
|
||||||
|
com.renesas.cdt.rl78.HardwareDebug.Compiler.option.mmul=None
|
||||||
|
com.renesas.cdt.rl78.HardwareDebug.Linker.option.archiveLibraryFiles=${ProjName};gcc;
|
||||||
|
com.renesas.cdt.rl78.HardwareDebug.Linker.option.archiveSearchDirectories.970009502="${CONFIGDIR}";"${TCINSTALL}\\lib\\gcc\\rl78-elf\\\\${GCC_VERSION}";
|
||||||
|
eclipse.preferences.version=1
|
|
@ -0,0 +1,3 @@
|
||||||
|
#Fri Feb 22 15:51:32 GMT 2013
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
55
FreeRTOS/Demo/RL78_E2Studio_GCC/RTOSDemo.launch
Normal file
55
FreeRTOS/Demo/RL78_E2Studio_GCC/RTOSDemo.launch
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<launchConfiguration type="com.renesas.cdt.launch.dsf.gdbremote.launchConfigurationType">
|
||||||
|
<intAttribute key="com.renesas.cdt.core.admPortNumber" value="61236"/>
|
||||||
|
<stringAttribute key="com.renesas.cdt.core.initCommands" value=""/>
|
||||||
|
<stringAttribute key="com.renesas.cdt.core.ipAddress" value="localhost"/>
|
||||||
|
<stringAttribute key="com.renesas.cdt.core.jtagDevice" value="E1 (RL78)"/>
|
||||||
|
<booleanAttribute key="com.renesas.cdt.core.loadImage" value="true"/>
|
||||||
|
<stringAttribute key="com.renesas.cdt.core.optionInitCommands" value=""/>
|
||||||
|
<intAttribute key="com.renesas.cdt.core.portNumber" value="61234"/>
|
||||||
|
<stringAttribute key="com.renesas.cdt.core.runCommands" value=""/>
|
||||||
|
<stringAttribute key="com.renesas.cdt.core.serverParam" value="-g E1 -l 0 -t R5F10JBC -p 61234 -d 61236 -umFreq= 0 -usFreq= 0 -umClock= 1 -w 1 -usupplyVoltage= 0 -ucommMethod= 0 -usecurityID= 00000000000000000000 -upermitFlash= 1 -uuseWideVoltageMode= 1 -ueraseRom= 1 -uuseOnChipDebug= 0 -uuseUserOptionByte= 0 -ustopTimerEmu= 0 -ustopSerialEmu= 0 -umaskInternalResetSignal= 0 -umaskTargetResetSignal= 0 -n 0 -uverifyOnWritingMemory= 1"/>
|
||||||
|
<booleanAttribute key="com.renesas.cdt.core.setResume" value="true"/>
|
||||||
|
<booleanAttribute key="com.renesas.cdt.core.setStopAt" value="true"/>
|
||||||
|
<stringAttribute key="com.renesas.cdt.core.stopAt" value="main"/>
|
||||||
|
<stringAttribute key="com.renesas.cdt.core.targetDevice" value="R5F10JBC"/>
|
||||||
|
<booleanAttribute key="com.renesas.cdt.core.useRemoteTarget" value="true"/>
|
||||||
|
<stringAttribute key="com.renesas.cdt.launch.dsf.IO_MAP" value="${eclipse_home}..\internal\IoFiles\RL78\R5F10JBC.sfrx"/>
|
||||||
|
<booleanAttribute key="com.renesas.cdt.launch.dsf.USE_DEFAULT_IO_MAP" value="true"/>
|
||||||
|
<booleanAttribute key="com.renesas.hardwaredebug.e1.le" value="true"/>
|
||||||
|
<booleanAttribute key="com.renesas.hardwaredebug.e1rl78.hw_break" value="false"/>
|
||||||
|
<booleanAttribute key="com.renesas.hardwaredebug.e1rl78.le" value="true"/>
|
||||||
|
<booleanAttribute key="com.renesas.hardwaredebug.e1rl78.stopSerialEmu" value="false"/>
|
||||||
|
<booleanAttribute key="com.renesas.hardwaredebug.e1rl78.stopTimerEmu" value="false"/>
|
||||||
|
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="3"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="false"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="${eclipse_home}../DebugComp/rl78-elf-gdb"/>
|
||||||
|
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="true"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="HardwareDebug\RTOSDemo.x"/>
|
||||||
|
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="RTOSDemo"/>
|
||||||
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||||
|
<listEntry value="/RTOSDemo"/>
|
||||||
|
</listAttribute>
|
||||||
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||||
|
<listEntry value="4"/>
|
||||||
|
</listAttribute>
|
||||||
|
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||||
|
</launchConfiguration>
|
0
FreeRTOS/Demo/RL78_E2Studio_GCC/custom.bat
Normal file
0
FreeRTOS/Demo/RL78_E2Studio_GCC/custom.bat
Normal file
267
FreeRTOS/Demo/RL78_E2Studio_GCC/src/Common-Demo-Tasks/PollQ.c
Normal file
267
FreeRTOS/Demo/RL78_E2Studio_GCC/src/Common-Demo-Tasks/PollQ.c
Normal file
|
@ -0,0 +1,267 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This version of PollQ. c is for use on systems that have limited stack
|
||||||
|
* space and no display facilities. The complete version can be found in
|
||||||
|
* the Demo/Common/Full directory.
|
||||||
|
*
|
||||||
|
* Creates two tasks that communicate over a single queue. One task acts as a
|
||||||
|
* producer, the other a consumer.
|
||||||
|
*
|
||||||
|
* The producer loops for three iteration, posting an incrementing number onto the
|
||||||
|
* queue each cycle. It then delays for a fixed period before doing exactly the
|
||||||
|
* same again.
|
||||||
|
*
|
||||||
|
* The consumer loops emptying the queue. Each item removed from the queue is
|
||||||
|
* checked to ensure it contains the expected value. When the queue is empty it
|
||||||
|
* blocks for a fixed period, then does the same again.
|
||||||
|
*
|
||||||
|
* All queue access is performed without blocking. The consumer completely empties
|
||||||
|
* the queue each time it runs so the producer should never find the queue full.
|
||||||
|
*
|
||||||
|
* An error is flagged if the consumer obtains an unexpected value or the producer
|
||||||
|
* find the queue is full.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Changes from V2.0.0
|
||||||
|
|
||||||
|
+ Delay periods are now specified using variables and constants of
|
||||||
|
portTickType rather than unsigned long.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* Scheduler include files. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
|
/* Demo program include files. */
|
||||||
|
#include "PollQ.h"
|
||||||
|
|
||||||
|
#define pollqSTACK_SIZE configMINIMAL_STACK_SIZE
|
||||||
|
#define pollqQUEUE_SIZE ( 10 )
|
||||||
|
#define pollqPRODUCER_DELAY ( ( portTickType ) 200 / portTICK_RATE_MS )
|
||||||
|
#define pollqCONSUMER_DELAY ( pollqPRODUCER_DELAY - ( portTickType ) ( 20 / portTICK_RATE_MS ) )
|
||||||
|
#define pollqNO_DELAY ( ( portTickType ) 0 )
|
||||||
|
#define pollqVALUES_TO_PRODUCE ( ( signed portBASE_TYPE ) 3 )
|
||||||
|
#define pollqINITIAL_VALUE ( ( signed portBASE_TYPE ) 0 )
|
||||||
|
|
||||||
|
/* The task that posts the incrementing number onto the queue. */
|
||||||
|
static portTASK_FUNCTION_PROTO( vPolledQueueProducer, pvParameters );
|
||||||
|
|
||||||
|
/* The task that empties the queue. */
|
||||||
|
static portTASK_FUNCTION_PROTO( vPolledQueueConsumer, pvParameters );
|
||||||
|
|
||||||
|
/* Variables that are used to check that the tasks are still running with no
|
||||||
|
errors. */
|
||||||
|
static volatile signed portBASE_TYPE xPollingConsumerCount = pollqINITIAL_VALUE, xPollingProducerCount = pollqINITIAL_VALUE;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vStartPolledQueueTasks( unsigned portBASE_TYPE uxPriority )
|
||||||
|
{
|
||||||
|
static xQueueHandle xPolledQueue;
|
||||||
|
|
||||||
|
/* Create the queue used by the producer and consumer. */
|
||||||
|
xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( unsigned portBASE_TYPE ) sizeof( unsigned short ) );
|
||||||
|
|
||||||
|
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||||
|
in use. The queue registry is provided as a means for kernel aware
|
||||||
|
debuggers to locate queues and has no purpose if a kernel aware debugger
|
||||||
|
is not being used. The call to vQueueAddToRegistry() will be removed
|
||||||
|
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
|
||||||
|
defined to be less than 1. */
|
||||||
|
vQueueAddToRegistry( xPolledQueue, ( signed char * ) "Poll_Test_Queue" );
|
||||||
|
|
||||||
|
/* Spawn the producer and consumer. */
|
||||||
|
xTaskCreate( vPolledQueueConsumer, ( signed char * ) "QConsNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( xTaskHandle * ) NULL );
|
||||||
|
xTaskCreate( vPolledQueueProducer, ( signed char * ) "QProdNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( xTaskHandle * ) NULL );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static portTASK_FUNCTION( vPolledQueueProducer, pvParameters )
|
||||||
|
{
|
||||||
|
unsigned short usValue = ( unsigned short ) 0;
|
||||||
|
signed portBASE_TYPE xError = pdFALSE, xLoop;
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
for( xLoop = 0; xLoop < pollqVALUES_TO_PRODUCE; xLoop++ )
|
||||||
|
{
|
||||||
|
/* Send an incrementing number on the queue without blocking. */
|
||||||
|
if( xQueueSend( *( ( xQueueHandle * ) pvParameters ), ( void * ) &usValue, pollqNO_DELAY ) != pdPASS )
|
||||||
|
{
|
||||||
|
/* We should never find the queue full so if we get here there
|
||||||
|
has been an error. */
|
||||||
|
xError = pdTRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( xError == pdFALSE )
|
||||||
|
{
|
||||||
|
/* If an error has ever been recorded we stop incrementing the
|
||||||
|
check variable. */
|
||||||
|
portENTER_CRITICAL();
|
||||||
|
xPollingProducerCount++;
|
||||||
|
portEXIT_CRITICAL();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update the value we are going to post next time around. */
|
||||||
|
usValue++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait before we start posting again to ensure the consumer runs and
|
||||||
|
empties the queue. */
|
||||||
|
vTaskDelay( pollqPRODUCER_DELAY );
|
||||||
|
}
|
||||||
|
} /*lint !e818 Function prototype must conform to API. */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static portTASK_FUNCTION( vPolledQueueConsumer, pvParameters )
|
||||||
|
{
|
||||||
|
unsigned short usData, usExpectedValue = ( unsigned short ) 0;
|
||||||
|
signed portBASE_TYPE xError = pdFALSE;
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
/* Loop until the queue is empty. */
|
||||||
|
while( uxQueueMessagesWaiting( *( ( xQueueHandle * ) pvParameters ) ) )
|
||||||
|
{
|
||||||
|
if( xQueueReceive( *( ( xQueueHandle * ) pvParameters ), &usData, pollqNO_DELAY ) == pdPASS )
|
||||||
|
{
|
||||||
|
if( usData != usExpectedValue )
|
||||||
|
{
|
||||||
|
/* This is not what we expected to receive so an error has
|
||||||
|
occurred. */
|
||||||
|
xError = pdTRUE;
|
||||||
|
|
||||||
|
/* Catch-up to the value we received so our next expected
|
||||||
|
value should again be correct. */
|
||||||
|
usExpectedValue = usData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( xError == pdFALSE )
|
||||||
|
{
|
||||||
|
/* Only increment the check variable if no errors have
|
||||||
|
occurred. */
|
||||||
|
portENTER_CRITICAL();
|
||||||
|
xPollingConsumerCount++;
|
||||||
|
portEXIT_CRITICAL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Next time round we would expect the number to be one higher. */
|
||||||
|
usExpectedValue++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now the queue is empty we block, allowing the producer to place more
|
||||||
|
items in the queue. */
|
||||||
|
vTaskDelay( pollqCONSUMER_DELAY );
|
||||||
|
}
|
||||||
|
} /*lint !e818 Function prototype must conform to API. */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* This is called to check that all the created tasks are still running with no errors. */
|
||||||
|
portBASE_TYPE xArePollingQueuesStillRunning( void )
|
||||||
|
{
|
||||||
|
portBASE_TYPE xReturn;
|
||||||
|
|
||||||
|
/* Check both the consumer and producer poll count to check they have both
|
||||||
|
been changed since out last trip round. We do not need a critical section
|
||||||
|
around the check variables as this is called from a higher priority than
|
||||||
|
the other tasks that access the same variables. */
|
||||||
|
if( ( xPollingConsumerCount == pollqINITIAL_VALUE ) ||
|
||||||
|
( xPollingProducerCount == pollqINITIAL_VALUE )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
xReturn = pdFALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xReturn = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the check variables back down so we know if they have been
|
||||||
|
incremented the next time around. */
|
||||||
|
xPollingConsumerCount = pollqINITIAL_VALUE;
|
||||||
|
xPollingProducerCount = pollqINITIAL_VALUE;
|
||||||
|
|
||||||
|
return xReturn;
|
||||||
|
}
|
514
FreeRTOS/Demo/RL78_E2Studio_GCC/src/Common-Demo-Tasks/blocktim.c
Normal file
514
FreeRTOS/Demo/RL78_E2Studio_GCC/src/Common-Demo-Tasks/blocktim.c
Normal file
|
@ -0,0 +1,514 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file contains some test scenarios that ensure tasks do not exit queue
|
||||||
|
* send or receive functions prematurely. A description of the tests is
|
||||||
|
* included within the code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Kernel includes. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
|
/* Demo includes. */
|
||||||
|
#include "blocktim.h"
|
||||||
|
|
||||||
|
/* Task priorities. Allow these to be overridden. */
|
||||||
|
#ifndef bktPRIMARY_PRIORITY
|
||||||
|
#define bktPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef bktSECONDARY_PRIORITY
|
||||||
|
#define bktSECONDARY_PRIORITY ( configMAX_PRIORITIES - 4 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Task behaviour. */
|
||||||
|
#define bktQUEUE_LENGTH ( 5 )
|
||||||
|
#define bktSHORT_WAIT ( ( ( portTickType ) 20 ) / portTICK_RATE_MS )
|
||||||
|
#define bktPRIMARY_BLOCK_TIME ( 10 )
|
||||||
|
#define bktALLOWABLE_MARGIN ( 15 )
|
||||||
|
#define bktTIME_TO_BLOCK ( 175 )
|
||||||
|
#define bktDONT_BLOCK ( ( portTickType ) 0 )
|
||||||
|
#define bktRUN_INDICATOR ( ( unsigned portBASE_TYPE ) 0x55 )
|
||||||
|
|
||||||
|
/* The queue on which the tasks block. */
|
||||||
|
static xQueueHandle xTestQueue;
|
||||||
|
|
||||||
|
/* Handle to the secondary task is required by the primary task for calls
|
||||||
|
to vTaskSuspend/Resume(). */
|
||||||
|
static xTaskHandle xSecondary;
|
||||||
|
|
||||||
|
/* Used to ensure that tasks are still executing without error. */
|
||||||
|
static volatile portBASE_TYPE xPrimaryCycles = 0, xSecondaryCycles = 0;
|
||||||
|
static volatile portBASE_TYPE xErrorOccurred = pdFALSE;
|
||||||
|
|
||||||
|
/* Provides a simple mechanism for the primary task to know when the
|
||||||
|
secondary task has executed. */
|
||||||
|
static volatile unsigned portBASE_TYPE xRunIndicator;
|
||||||
|
|
||||||
|
/* The two test tasks. Their behaviour is commented within the files. */
|
||||||
|
static void vPrimaryBlockTimeTestTask( void *pvParameters );
|
||||||
|
static void vSecondaryBlockTimeTestTask( void *pvParameters );
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vCreateBlockTimeTasks( void )
|
||||||
|
{
|
||||||
|
/* Create the queue on which the two tasks block. */
|
||||||
|
xTestQueue = xQueueCreate( bktQUEUE_LENGTH, sizeof( portBASE_TYPE ) );
|
||||||
|
|
||||||
|
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||||
|
in use. The queue registry is provided as a means for kernel aware
|
||||||
|
debuggers to locate queues and has no purpose if a kernel aware debugger
|
||||||
|
is not being used. The call to vQueueAddToRegistry() will be removed
|
||||||
|
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
|
||||||
|
defined to be less than 1. */
|
||||||
|
vQueueAddToRegistry( xTestQueue, ( signed char * ) "Block_Time_Queue" );
|
||||||
|
|
||||||
|
/* Create the two test tasks. */
|
||||||
|
xTaskCreate( vPrimaryBlockTimeTestTask, ( signed char * )"BTest1", configMINIMAL_STACK_SIZE, NULL, bktPRIMARY_PRIORITY, NULL );
|
||||||
|
xTaskCreate( vSecondaryBlockTimeTestTask, ( signed char * )"BTest2", configMINIMAL_STACK_SIZE, NULL, bktSECONDARY_PRIORITY, &xSecondary );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void vPrimaryBlockTimeTestTask( void *pvParameters )
|
||||||
|
{
|
||||||
|
portBASE_TYPE xItem, xData;
|
||||||
|
portTickType xTimeWhenBlocking;
|
||||||
|
portTickType xTimeToBlock, xBlockedTime;
|
||||||
|
|
||||||
|
( void ) pvParameters;
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
/*********************************************************************
|
||||||
|
Test 1
|
||||||
|
|
||||||
|
Simple block time wakeup test on queue receives. */
|
||||||
|
for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )
|
||||||
|
{
|
||||||
|
/* The queue is empty. Attempt to read from the queue using a block
|
||||||
|
time. When we wake, ensure the delta in time is as expected. */
|
||||||
|
xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;
|
||||||
|
|
||||||
|
xTimeWhenBlocking = xTaskGetTickCount();
|
||||||
|
|
||||||
|
/* We should unblock after xTimeToBlock having not received
|
||||||
|
anything on the queue. */
|
||||||
|
if( xQueueReceive( xTestQueue, &xData, xTimeToBlock ) != errQUEUE_EMPTY )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* How long were we blocked for? */
|
||||||
|
xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
|
||||||
|
|
||||||
|
if( xBlockedTime < xTimeToBlock )
|
||||||
|
{
|
||||||
|
/* Should not have blocked for less than we requested. */
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) )
|
||||||
|
{
|
||||||
|
/* Should not have blocked for longer than we requested,
|
||||||
|
although we would not necessarily run as soon as we were
|
||||||
|
unblocked so a margin is allowed. */
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
Test 2
|
||||||
|
|
||||||
|
Simple block time wakeup test on queue sends.
|
||||||
|
|
||||||
|
First fill the queue. It should be empty so all sends should pass. */
|
||||||
|
for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )
|
||||||
|
{
|
||||||
|
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if configUSE_PREEMPTION == 0
|
||||||
|
taskYIELD();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )
|
||||||
|
{
|
||||||
|
/* The queue is full. Attempt to write to the queue using a block
|
||||||
|
time. When we wake, ensure the delta in time is as expected. */
|
||||||
|
xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;
|
||||||
|
|
||||||
|
xTimeWhenBlocking = xTaskGetTickCount();
|
||||||
|
|
||||||
|
/* We should unblock after xTimeToBlock having not received
|
||||||
|
anything on the queue. */
|
||||||
|
if( xQueueSend( xTestQueue, &xItem, xTimeToBlock ) != errQUEUE_FULL )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* How long were we blocked for? */
|
||||||
|
xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
|
||||||
|
|
||||||
|
if( xBlockedTime < xTimeToBlock )
|
||||||
|
{
|
||||||
|
/* Should not have blocked for less than we requested. */
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xBlockedTime > ( xTimeToBlock + bktALLOWABLE_MARGIN ) )
|
||||||
|
{
|
||||||
|
/* Should not have blocked for longer than we requested,
|
||||||
|
although we would not necessarily run as soon as we were
|
||||||
|
unblocked so a margin is allowed. */
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
Test 3
|
||||||
|
|
||||||
|
Wake the other task, it will block attempting to post to the queue.
|
||||||
|
When we read from the queue the other task will wake, but before it
|
||||||
|
can run we will post to the queue again. When the other task runs it
|
||||||
|
will find the queue still full, even though it was woken. It should
|
||||||
|
recognise that its block time has not expired and return to block for
|
||||||
|
the remains of its block time.
|
||||||
|
|
||||||
|
Wake the other task so it blocks attempting to post to the already
|
||||||
|
full queue. */
|
||||||
|
xRunIndicator = 0;
|
||||||
|
vTaskResume( xSecondary );
|
||||||
|
|
||||||
|
/* We need to wait a little to ensure the other task executes. */
|
||||||
|
while( xRunIndicator != bktRUN_INDICATOR )
|
||||||
|
{
|
||||||
|
/* The other task has not yet executed. */
|
||||||
|
vTaskDelay( bktSHORT_WAIT );
|
||||||
|
}
|
||||||
|
/* Make sure the other task is blocked on the queue. */
|
||||||
|
vTaskDelay( bktSHORT_WAIT );
|
||||||
|
xRunIndicator = 0;
|
||||||
|
|
||||||
|
for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )
|
||||||
|
{
|
||||||
|
/* Now when we make space on the queue the other task should wake
|
||||||
|
but not execute as this task has higher priority. */
|
||||||
|
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now fill the queue again before the other task gets a chance to
|
||||||
|
execute. If the other task had executed we would find the queue
|
||||||
|
full ourselves, and the other task have set xRunIndicator. */
|
||||||
|
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xRunIndicator == bktRUN_INDICATOR )
|
||||||
|
{
|
||||||
|
/* The other task should not have executed. */
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Raise the priority of the other task so it executes and blocks
|
||||||
|
on the queue again. */
|
||||||
|
vTaskPrioritySet( xSecondary, bktPRIMARY_PRIORITY + 2 );
|
||||||
|
|
||||||
|
/* The other task should now have re-blocked without exiting the
|
||||||
|
queue function. */
|
||||||
|
if( xRunIndicator == bktRUN_INDICATOR )
|
||||||
|
{
|
||||||
|
/* The other task should not have executed outside of the
|
||||||
|
queue function. */
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the priority back down. */
|
||||||
|
vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Let the other task timeout. When it unblockes it will check that it
|
||||||
|
unblocked at the correct time, then suspend itself. */
|
||||||
|
while( xRunIndicator != bktRUN_INDICATOR )
|
||||||
|
{
|
||||||
|
vTaskDelay( bktSHORT_WAIT );
|
||||||
|
}
|
||||||
|
vTaskDelay( bktSHORT_WAIT );
|
||||||
|
xRunIndicator = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
Test 4
|
||||||
|
|
||||||
|
As per test 3 - but with the send and receive the other way around.
|
||||||
|
The other task blocks attempting to read from the queue.
|
||||||
|
|
||||||
|
Empty the queue. We should find that it is full. */
|
||||||
|
for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )
|
||||||
|
{
|
||||||
|
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wake the other task so it blocks attempting to read from the
|
||||||
|
already empty queue. */
|
||||||
|
vTaskResume( xSecondary );
|
||||||
|
|
||||||
|
/* We need to wait a little to ensure the other task executes. */
|
||||||
|
while( xRunIndicator != bktRUN_INDICATOR )
|
||||||
|
{
|
||||||
|
vTaskDelay( bktSHORT_WAIT );
|
||||||
|
}
|
||||||
|
vTaskDelay( bktSHORT_WAIT );
|
||||||
|
xRunIndicator = 0;
|
||||||
|
|
||||||
|
for( xItem = 0; xItem < bktQUEUE_LENGTH; xItem++ )
|
||||||
|
{
|
||||||
|
/* Now when we place an item on the queue the other task should
|
||||||
|
wake but not execute as this task has higher priority. */
|
||||||
|
if( xQueueSend( xTestQueue, &xItem, bktDONT_BLOCK ) != pdPASS )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now empty the queue again before the other task gets a chance to
|
||||||
|
execute. If the other task had executed we would find the queue
|
||||||
|
empty ourselves, and the other task would be suspended. */
|
||||||
|
if( xQueueReceive( xTestQueue, &xData, bktDONT_BLOCK ) != pdPASS )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xRunIndicator == bktRUN_INDICATOR )
|
||||||
|
{
|
||||||
|
/* The other task should not have executed. */
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Raise the priority of the other task so it executes and blocks
|
||||||
|
on the queue again. */
|
||||||
|
vTaskPrioritySet( xSecondary, bktPRIMARY_PRIORITY + 2 );
|
||||||
|
|
||||||
|
/* The other task should now have re-blocked without exiting the
|
||||||
|
queue function. */
|
||||||
|
if( xRunIndicator == bktRUN_INDICATOR )
|
||||||
|
{
|
||||||
|
/* The other task should not have executed outside of the
|
||||||
|
queue function. */
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
vTaskPrioritySet( xSecondary, bktSECONDARY_PRIORITY );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Let the other task timeout. When it unblockes it will check that it
|
||||||
|
unblocked at the correct time, then suspend itself. */
|
||||||
|
while( xRunIndicator != bktRUN_INDICATOR )
|
||||||
|
{
|
||||||
|
vTaskDelay( bktSHORT_WAIT );
|
||||||
|
}
|
||||||
|
vTaskDelay( bktSHORT_WAIT );
|
||||||
|
|
||||||
|
xPrimaryCycles++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void vSecondaryBlockTimeTestTask( void *pvParameters )
|
||||||
|
{
|
||||||
|
portTickType xTimeWhenBlocking, xBlockedTime;
|
||||||
|
portBASE_TYPE xData;
|
||||||
|
|
||||||
|
( void ) pvParameters;
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
/*********************************************************************
|
||||||
|
Test 1 and 2
|
||||||
|
|
||||||
|
This task does does not participate in these tests. */
|
||||||
|
vTaskSuspend( NULL );
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
Test 3
|
||||||
|
|
||||||
|
The first thing we do is attempt to read from the queue. It should be
|
||||||
|
full so we block. Note the time before we block so we can check the
|
||||||
|
wake time is as per that expected. */
|
||||||
|
xTimeWhenBlocking = xTaskGetTickCount();
|
||||||
|
|
||||||
|
/* We should unblock after bktTIME_TO_BLOCK having not sent
|
||||||
|
anything to the queue. */
|
||||||
|
xData = 0;
|
||||||
|
xRunIndicator = bktRUN_INDICATOR;
|
||||||
|
if( xQueueSend( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_FULL )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* How long were we inside the send function? */
|
||||||
|
xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
|
||||||
|
|
||||||
|
/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
|
||||||
|
if( xBlockedTime < bktTIME_TO_BLOCK )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We should of not blocked for much longer than bktALLOWABLE_MARGIN
|
||||||
|
either. A margin is permitted as we would not necessarily run as
|
||||||
|
soon as we unblocked. */
|
||||||
|
if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Suspend ready for test 3. */
|
||||||
|
xRunIndicator = bktRUN_INDICATOR;
|
||||||
|
vTaskSuspend( NULL );
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
Test 4
|
||||||
|
|
||||||
|
As per test three, but with the send and receive reversed. */
|
||||||
|
xTimeWhenBlocking = xTaskGetTickCount();
|
||||||
|
|
||||||
|
/* We should unblock after bktTIME_TO_BLOCK having not received
|
||||||
|
anything on the queue. */
|
||||||
|
xRunIndicator = bktRUN_INDICATOR;
|
||||||
|
if( xQueueReceive( xTestQueue, &xData, bktTIME_TO_BLOCK ) != errQUEUE_EMPTY )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
xBlockedTime = xTaskGetTickCount() - xTimeWhenBlocking;
|
||||||
|
|
||||||
|
/* We should not have blocked for less time than bktTIME_TO_BLOCK. */
|
||||||
|
if( xBlockedTime < bktTIME_TO_BLOCK )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We should of not blocked for much longer than bktALLOWABLE_MARGIN
|
||||||
|
either. A margin is permitted as we would not necessarily run as soon
|
||||||
|
as we unblocked. */
|
||||||
|
if( xBlockedTime > ( bktTIME_TO_BLOCK + bktALLOWABLE_MARGIN ) )
|
||||||
|
{
|
||||||
|
xErrorOccurred = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
xRunIndicator = bktRUN_INDICATOR;
|
||||||
|
|
||||||
|
xSecondaryCycles++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
portBASE_TYPE xAreBlockTimeTestTasksStillRunning( void )
|
||||||
|
{
|
||||||
|
static portBASE_TYPE xLastPrimaryCycleCount = 0, xLastSecondaryCycleCount = 0;
|
||||||
|
portBASE_TYPE xReturn = pdPASS;
|
||||||
|
|
||||||
|
/* Have both tasks performed at least one cycle since this function was
|
||||||
|
last called? */
|
||||||
|
if( xPrimaryCycles == xLastPrimaryCycleCount )
|
||||||
|
{
|
||||||
|
xReturn = pdFAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xSecondaryCycles == xLastSecondaryCycleCount )
|
||||||
|
{
|
||||||
|
xReturn = pdFAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xErrorOccurred == pdTRUE )
|
||||||
|
{
|
||||||
|
xReturn = pdFAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
xLastSecondaryCycleCount = xSecondaryCycles;
|
||||||
|
xLastPrimaryCycleCount = xPrimaryCycles;
|
||||||
|
|
||||||
|
return xReturn;
|
||||||
|
}
|
448
FreeRTOS/Demo/RL78_E2Studio_GCC/src/Common-Demo-Tasks/dynamic.c
Normal file
448
FreeRTOS/Demo/RL78_E2Studio_GCC/src/Common-Demo-Tasks/dynamic.c
Normal file
|
@ -0,0 +1,448 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The first test creates three tasks - two counter tasks (one continuous count
|
||||||
|
* and one limited count) and one controller. A "count" variable is shared
|
||||||
|
* between all three tasks. The two counter tasks should never be in a "ready"
|
||||||
|
* state at the same time. The controller task runs at the same priority as
|
||||||
|
* the continuous count task, and at a lower priority than the limited count
|
||||||
|
* task.
|
||||||
|
*
|
||||||
|
* One counter task loops indefinitely, incrementing the shared count variable
|
||||||
|
* on each iteration. To ensure it has exclusive access to the variable it
|
||||||
|
* raises it's priority above that of the controller task before each
|
||||||
|
* increment, lowering it again to it's original priority before starting the
|
||||||
|
* next iteration.
|
||||||
|
*
|
||||||
|
* The other counter task increments the shared count variable on each
|
||||||
|
* iteration of it's loop until the count has reached a limit of 0xff - at
|
||||||
|
* which point it suspends itself. It will not start a new loop until the
|
||||||
|
* controller task has made it "ready" again by calling vTaskResume ().
|
||||||
|
* This second counter task operates at a higher priority than controller
|
||||||
|
* task so does not need to worry about mutual exclusion of the counter
|
||||||
|
* variable.
|
||||||
|
*
|
||||||
|
* The controller task is in two sections. The first section controls and
|
||||||
|
* monitors the continuous count task. When this section is operational the
|
||||||
|
* limited count task is suspended. Likewise, the second section controls
|
||||||
|
* and monitors the limited count task. When this section is operational the
|
||||||
|
* continuous count task is suspended.
|
||||||
|
*
|
||||||
|
* In the first section the controller task first takes a copy of the shared
|
||||||
|
* count variable. To ensure mutual exclusion on the count variable it
|
||||||
|
* suspends the continuous count task, resuming it again when the copy has been
|
||||||
|
* taken. The controller task then sleeps for a fixed period - during which
|
||||||
|
* the continuous count task will execute and increment the shared variable.
|
||||||
|
* When the controller task wakes it checks that the continuous count task
|
||||||
|
* has executed by comparing the copy of the shared variable with its current
|
||||||
|
* value. This time, to ensure mutual exclusion, the scheduler itself is
|
||||||
|
* suspended with a call to vTaskSuspendAll (). This is for demonstration
|
||||||
|
* purposes only and is not a recommended technique due to its inefficiency.
|
||||||
|
*
|
||||||
|
* After a fixed number of iterations the controller task suspends the
|
||||||
|
* continuous count task, and moves on to its second section.
|
||||||
|
*
|
||||||
|
* At the start of the second section the shared variable is cleared to zero.
|
||||||
|
* The limited count task is then woken from it's suspension by a call to
|
||||||
|
* vTaskResume (). As this counter task operates at a higher priority than
|
||||||
|
* the controller task the controller task should not run again until the
|
||||||
|
* shared variable has been counted up to the limited value causing the counter
|
||||||
|
* task to suspend itself. The next line after vTaskResume () is therefore
|
||||||
|
* a check on the shared variable to ensure everything is as expected.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* The second test consists of a couple of very simple tasks that post onto a
|
||||||
|
* queue while the scheduler is suspended. This test was added to test parts
|
||||||
|
* of the scheduler not exercised by the first test.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* Scheduler include files. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "semphr.h"
|
||||||
|
|
||||||
|
/* Demo app include files. */
|
||||||
|
#include "dynamic.h"
|
||||||
|
|
||||||
|
/* Function that implements the "limited count" task as described above. */
|
||||||
|
static portTASK_FUNCTION_PROTO( vLimitedIncrementTask, pvParameters );
|
||||||
|
|
||||||
|
/* Function that implements the "continuous count" task as described above. */
|
||||||
|
static portTASK_FUNCTION_PROTO( vContinuousIncrementTask, pvParameters );
|
||||||
|
|
||||||
|
/* Function that implements the controller task as described above. */
|
||||||
|
static portTASK_FUNCTION_PROTO( vCounterControlTask, pvParameters );
|
||||||
|
|
||||||
|
static portTASK_FUNCTION_PROTO( vQueueReceiveWhenSuspendedTask, pvParameters );
|
||||||
|
static portTASK_FUNCTION_PROTO( vQueueSendWhenSuspendedTask, pvParameters );
|
||||||
|
|
||||||
|
/* Demo task specific constants. */
|
||||||
|
#define priSTACK_SIZE ( configMINIMAL_STACK_SIZE )
|
||||||
|
#define priSLEEP_TIME ( ( portTickType ) 128 / portTICK_RATE_MS )
|
||||||
|
#define priLOOPS ( 5 )
|
||||||
|
#define priMAX_COUNT ( ( unsigned long ) 0xff )
|
||||||
|
#define priNO_BLOCK ( ( portTickType ) 0 )
|
||||||
|
#define priSUSPENDED_QUEUE_LENGTH ( 1 )
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Handles to the two counter tasks. These could be passed in as parameters
|
||||||
|
to the controller task to prevent them having to be file scope. */
|
||||||
|
static xTaskHandle xContinousIncrementHandle, xLimitedIncrementHandle;
|
||||||
|
|
||||||
|
/* The shared counter variable. This is passed in as a parameter to the two
|
||||||
|
counter variables for demonstration purposes. */
|
||||||
|
static unsigned long ulCounter;
|
||||||
|
|
||||||
|
/* Variables used to check that the tasks are still operating without error.
|
||||||
|
Each complete iteration of the controller task increments this variable
|
||||||
|
provided no errors have been found. The variable maintaining the same value
|
||||||
|
is therefore indication of an error. */
|
||||||
|
static volatile unsigned short usCheckVariable = ( unsigned short ) 0;
|
||||||
|
static volatile portBASE_TYPE xSuspendedQueueSendError = pdFALSE;
|
||||||
|
static volatile portBASE_TYPE xSuspendedQueueReceiveError = pdFALSE;
|
||||||
|
|
||||||
|
/* Queue used by the second test. */
|
||||||
|
xQueueHandle xSuspendedTestQueue;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
/*
|
||||||
|
* Start the three tasks as described at the top of the file.
|
||||||
|
* Note that the limited count task is given a higher priority.
|
||||||
|
*/
|
||||||
|
void vStartDynamicPriorityTasks( void )
|
||||||
|
{
|
||||||
|
xSuspendedTestQueue = xQueueCreate( priSUSPENDED_QUEUE_LENGTH, sizeof( unsigned long ) );
|
||||||
|
|
||||||
|
/* vQueueAddToRegistry() adds the queue to the queue registry, if one is
|
||||||
|
in use. The queue registry is provided as a means for kernel aware
|
||||||
|
debuggers to locate queues and has no purpose if a kernel aware debugger
|
||||||
|
is not being used. The call to vQueueAddToRegistry() will be removed
|
||||||
|
by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is
|
||||||
|
defined to be less than 1. */
|
||||||
|
vQueueAddToRegistry( xSuspendedTestQueue, ( signed char * ) "Suspended_Test_Queue" );
|
||||||
|
|
||||||
|
xTaskCreate( vContinuousIncrementTask, ( signed char * ) "CNT_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY, &xContinousIncrementHandle );
|
||||||
|
xTaskCreate( vLimitedIncrementTask, ( signed char * ) "LIM_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY + 1, &xLimitedIncrementHandle );
|
||||||
|
xTaskCreate( vCounterControlTask, ( signed char * ) "C_CTRL", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
xTaskCreate( vQueueSendWhenSuspendedTask, ( signed char * ) "SUSP_TX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
xTaskCreate( vQueueReceiveWhenSuspendedTask, ( signed char * ) "SUSP_RX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Just loops around incrementing the shared variable until the limit has been
|
||||||
|
* reached. Once the limit has been reached it suspends itself.
|
||||||
|
*/
|
||||||
|
static portTASK_FUNCTION( vLimitedIncrementTask, pvParameters )
|
||||||
|
{
|
||||||
|
unsigned long *pulCounter;
|
||||||
|
|
||||||
|
/* Take a pointer to the shared variable from the parameters passed into
|
||||||
|
the task. */
|
||||||
|
pulCounter = ( unsigned long * ) pvParameters;
|
||||||
|
|
||||||
|
/* This will run before the control task, so the first thing it does is
|
||||||
|
suspend - the control task will resume it when ready. */
|
||||||
|
vTaskSuspend( NULL );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
/* Just count up to a value then suspend. */
|
||||||
|
( *pulCounter )++;
|
||||||
|
|
||||||
|
if( *pulCounter >= priMAX_COUNT )
|
||||||
|
{
|
||||||
|
vTaskSuspend( NULL );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Just keep counting the shared variable up. The control task will suspend
|
||||||
|
* this task when it wants.
|
||||||
|
*/
|
||||||
|
static portTASK_FUNCTION( vContinuousIncrementTask, pvParameters )
|
||||||
|
{
|
||||||
|
unsigned long *pulCounter;
|
||||||
|
unsigned portBASE_TYPE uxOurPriority;
|
||||||
|
|
||||||
|
/* Take a pointer to the shared variable from the parameters passed into
|
||||||
|
the task. */
|
||||||
|
pulCounter = ( unsigned long * ) pvParameters;
|
||||||
|
|
||||||
|
/* Query our priority so we can raise it when exclusive access to the
|
||||||
|
shared variable is required. */
|
||||||
|
uxOurPriority = uxTaskPriorityGet( NULL );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
/* Raise our priority above the controller task to ensure a context
|
||||||
|
switch does not occur while we are accessing this variable. */
|
||||||
|
vTaskPrioritySet( NULL, uxOurPriority + 1 );
|
||||||
|
( *pulCounter )++;
|
||||||
|
vTaskPrioritySet( NULL, uxOurPriority );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Controller task as described above.
|
||||||
|
*/
|
||||||
|
static portTASK_FUNCTION( vCounterControlTask, pvParameters )
|
||||||
|
{
|
||||||
|
unsigned long ulLastCounter;
|
||||||
|
short sLoops;
|
||||||
|
short sError = pdFALSE;
|
||||||
|
|
||||||
|
/* Just to stop warning messages. */
|
||||||
|
( void ) pvParameters;
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
/* Start with the counter at zero. */
|
||||||
|
ulCounter = ( unsigned long ) 0;
|
||||||
|
|
||||||
|
/* First section : */
|
||||||
|
|
||||||
|
/* Check the continuous count task is running. */
|
||||||
|
for( sLoops = 0; sLoops < priLOOPS; sLoops++ )
|
||||||
|
{
|
||||||
|
/* Suspend the continuous count task so we can take a mirror of the
|
||||||
|
shared variable without risk of corruption. */
|
||||||
|
vTaskSuspend( xContinousIncrementHandle );
|
||||||
|
ulLastCounter = ulCounter;
|
||||||
|
vTaskResume( xContinousIncrementHandle );
|
||||||
|
|
||||||
|
/* Now delay to ensure the other task has processor time. */
|
||||||
|
vTaskDelay( priSLEEP_TIME );
|
||||||
|
|
||||||
|
/* Check the shared variable again. This time to ensure mutual
|
||||||
|
exclusion the whole scheduler will be locked. This is just for
|
||||||
|
demo purposes! */
|
||||||
|
vTaskSuspendAll();
|
||||||
|
{
|
||||||
|
if( ulLastCounter == ulCounter )
|
||||||
|
{
|
||||||
|
/* The shared variable has not changed. There is a problem
|
||||||
|
with the continuous count task so flag an error. */
|
||||||
|
sError = pdTRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xTaskResumeAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Second section: */
|
||||||
|
|
||||||
|
/* Suspend the continuous counter task so it stops accessing the shared variable. */
|
||||||
|
vTaskSuspend( xContinousIncrementHandle );
|
||||||
|
|
||||||
|
/* Reset the variable. */
|
||||||
|
ulCounter = ( unsigned long ) 0;
|
||||||
|
|
||||||
|
/* Resume the limited count task which has a higher priority than us.
|
||||||
|
We should therefore not return from this call until the limited count
|
||||||
|
task has suspended itself with a known value in the counter variable. */
|
||||||
|
vTaskResume( xLimitedIncrementHandle );
|
||||||
|
|
||||||
|
/* Does the counter variable have the expected value? */
|
||||||
|
if( ulCounter != priMAX_COUNT )
|
||||||
|
{
|
||||||
|
sError = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( sError == pdFALSE )
|
||||||
|
{
|
||||||
|
/* If no errors have occurred then increment the check variable. */
|
||||||
|
portENTER_CRITICAL();
|
||||||
|
usCheckVariable++;
|
||||||
|
portEXIT_CRITICAL();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Resume the continuous count task and do it all again. */
|
||||||
|
vTaskResume( xContinousIncrementHandle );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static portTASK_FUNCTION( vQueueSendWhenSuspendedTask, pvParameters )
|
||||||
|
{
|
||||||
|
static unsigned long ulValueToSend = ( unsigned long ) 0;
|
||||||
|
|
||||||
|
/* Just to stop warning messages. */
|
||||||
|
( void ) pvParameters;
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
vTaskSuspendAll();
|
||||||
|
{
|
||||||
|
/* We must not block while the scheduler is suspended! */
|
||||||
|
if( xQueueSend( xSuspendedTestQueue, ( void * ) &ulValueToSend, priNO_BLOCK ) != pdTRUE )
|
||||||
|
{
|
||||||
|
xSuspendedQueueSendError = pdTRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xTaskResumeAll();
|
||||||
|
|
||||||
|
vTaskDelay( priSLEEP_TIME );
|
||||||
|
|
||||||
|
++ulValueToSend;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static portTASK_FUNCTION( vQueueReceiveWhenSuspendedTask, pvParameters )
|
||||||
|
{
|
||||||
|
static unsigned long ulExpectedValue = ( unsigned long ) 0, ulReceivedValue;
|
||||||
|
portBASE_TYPE xGotValue;
|
||||||
|
|
||||||
|
/* Just to stop warning messages. */
|
||||||
|
( void ) pvParameters;
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
/* Suspending the scheduler here is fairly pointless and
|
||||||
|
undesirable for a normal application. It is done here purely
|
||||||
|
to test the scheduler. The inner xTaskResumeAll() should
|
||||||
|
never return pdTRUE as the scheduler is still locked by the
|
||||||
|
outer call. */
|
||||||
|
vTaskSuspendAll();
|
||||||
|
{
|
||||||
|
vTaskSuspendAll();
|
||||||
|
{
|
||||||
|
xGotValue = xQueueReceive( xSuspendedTestQueue, ( void * ) &ulReceivedValue, priNO_BLOCK );
|
||||||
|
}
|
||||||
|
if( xTaskResumeAll() )
|
||||||
|
{
|
||||||
|
xSuspendedQueueReceiveError = pdTRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xTaskResumeAll();
|
||||||
|
|
||||||
|
#if configUSE_PREEMPTION == 0
|
||||||
|
{
|
||||||
|
taskYIELD();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} while( xGotValue == pdFALSE );
|
||||||
|
|
||||||
|
if( ulReceivedValue != ulExpectedValue )
|
||||||
|
{
|
||||||
|
xSuspendedQueueReceiveError = pdTRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
++ulExpectedValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Called to check that all the created tasks are still running without error. */
|
||||||
|
portBASE_TYPE xAreDynamicPriorityTasksStillRunning( void )
|
||||||
|
{
|
||||||
|
/* Keep a history of the check variables so we know if it has been incremented
|
||||||
|
since the last call. */
|
||||||
|
static unsigned short usLastTaskCheck = ( unsigned short ) 0;
|
||||||
|
portBASE_TYPE xReturn = pdTRUE;
|
||||||
|
|
||||||
|
/* Check the tasks are still running by ensuring the check variable
|
||||||
|
is still incrementing. */
|
||||||
|
|
||||||
|
if( usCheckVariable == usLastTaskCheck )
|
||||||
|
{
|
||||||
|
/* The check has not incremented so an error exists. */
|
||||||
|
xReturn = pdFALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xSuspendedQueueSendError == pdTRUE )
|
||||||
|
{
|
||||||
|
xReturn = pdFALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xSuspendedQueueReceiveError == pdTRUE )
|
||||||
|
{
|
||||||
|
xReturn = pdFALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
usLastTaskCheck = usCheckVariable;
|
||||||
|
return xReturn;
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
more details. You should have received a copy of the GNU General Public
|
||||||
|
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||||
|
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||||
|
by writing to Richard Barry, contact details for whom are available on the
|
||||||
|
FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, training, latest versions, license
|
||||||
|
and contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||||
|
|
||||||
|
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||||
|
the code with commercial support, indemnification, and middleware, under
|
||||||
|
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||||
|
provide a safety engineered and independently SIL3 certified version under
|
||||||
|
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef POLLED_Q_H
|
||||||
|
#define POLLED_Q_H
|
||||||
|
|
||||||
|
void vStartPolledQueueTasks( unsigned portBASE_TYPE uxPriority );
|
||||||
|
portBASE_TYPE xArePollingQueuesStillRunning( void );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
more details. You should have received a copy of the GNU General Public
|
||||||
|
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||||
|
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||||
|
by writing to Richard Barry, contact details for whom are available on the
|
||||||
|
FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, training, latest versions, license
|
||||||
|
and contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||||
|
|
||||||
|
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||||
|
the code with commercial support, indemnification, and middleware, under
|
||||||
|
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||||
|
provide a safety engineered and independently SIL3 certified version under
|
||||||
|
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BLOCK_TIME_TEST_H
|
||||||
|
#define BLOCK_TIME_TEST_H
|
||||||
|
|
||||||
|
void vCreateBlockTimeTasks( void );
|
||||||
|
portBASE_TYPE xAreBlockTimeTestTasksStillRunning( void );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
more details. You should have received a copy of the GNU General Public
|
||||||
|
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||||
|
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||||
|
by writing to Richard Barry, contact details for whom are available on the
|
||||||
|
FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, training, latest versions, license
|
||||||
|
and contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||||
|
|
||||||
|
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||||
|
the code with commercial support, indemnification, and middleware, under
|
||||||
|
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||||
|
provide a safety engineered and independently SIL3 certified version under
|
||||||
|
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DYNAMIC_MANIPULATION_H
|
||||||
|
#define DYNAMIC_MANIPULATION_H
|
||||||
|
|
||||||
|
void vStartDynamicPriorityTasks( void );
|
||||||
|
portBASE_TYPE xAreDynamicPriorityTasksStillRunning( void );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
167
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOSConfig.h
Normal file
167
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOSConfig.h
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FREERTOS_CONFIG_H
|
||||||
|
#define FREERTOS_CONFIG_H
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* Application specific definitions.
|
||||||
|
*
|
||||||
|
* These definitions should be adjusted for your particular hardware and
|
||||||
|
* application requirements.
|
||||||
|
*
|
||||||
|
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||||
|
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||||
|
*
|
||||||
|
* See http://www.freertos.org/a00110.html.
|
||||||
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* This #ifdef prevents the enclosed code being included from within an
|
||||||
|
asm file. It is valid in a C file, but not valid in an asm file. */
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
|
||||||
|
#pragma language=extended
|
||||||
|
#pragma system_include
|
||||||
|
|
||||||
|
#include <intrinsics.h>
|
||||||
|
|
||||||
|
/* Device specific includes. */
|
||||||
|
#include <ior5f100le.h>
|
||||||
|
#include <ior5f100le_ext.h>
|
||||||
|
|
||||||
|
#endif /* __IAR_SYSTEMS_ICC__ */
|
||||||
|
|
||||||
|
#define configUSE_PREEMPTION 1
|
||||||
|
#define configTICK_RATE_HZ ( ( unsigned short ) 1000 )
|
||||||
|
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 )
|
||||||
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 )
|
||||||
|
#define configMAX_TASK_NAME_LEN ( 10 )
|
||||||
|
#define configUSE_TRACE_FACILITY 0
|
||||||
|
#define configUSE_16_BIT_TICKS 1
|
||||||
|
#define configIDLE_SHOULD_YIELD 1
|
||||||
|
#define configTOTAL_HEAP_SIZE ( (size_t ) ( 3420 ) )
|
||||||
|
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||||
|
#define configUSE_MUTEXES 1
|
||||||
|
|
||||||
|
/* Hook function definitions. */
|
||||||
|
#define configUSE_IDLE_HOOK 1
|
||||||
|
#define configUSE_TICK_HOOK 0
|
||||||
|
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||||
|
|
||||||
|
/* Software timer definitions. */
|
||||||
|
#define configUSE_TIMERS 1
|
||||||
|
#define configTIMER_TASK_PRIORITY ( 2 )
|
||||||
|
#define configTIMER_QUEUE_LENGTH 10
|
||||||
|
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
|
||||||
|
|
||||||
|
/* Co-routine definitions. */
|
||||||
|
#define configUSE_CO_ROUTINES 0
|
||||||
|
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||||
|
|
||||||
|
/* Set the following definitions to 1 to include the API function, or zero
|
||||||
|
to exclude the API function. */
|
||||||
|
#define INCLUDE_vTaskPrioritySet 1
|
||||||
|
#define INCLUDE_uxTaskPriorityGet 1
|
||||||
|
#define INCLUDE_vTaskDelete 0
|
||||||
|
#define INCLUDE_vTaskCleanUpResources 0
|
||||||
|
#define INCLUDE_vTaskSuspend 1
|
||||||
|
#define INCLUDE_vTaskDelayUntil 0
|
||||||
|
#define INCLUDE_vTaskDelay 1
|
||||||
|
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||||
|
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* PORT SPECIFIC CONFIGURATION OPTIONS
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RL78/G13 Clock Source Configuration
|
||||||
|
* 1 = use internal High Speed Clock Source (typically 32Mhz on the RL78/G13)
|
||||||
|
* 0 = use external Clock Source
|
||||||
|
*/
|
||||||
|
#define configCLOCK_SOURCE 1
|
||||||
|
|
||||||
|
#if configCLOCK_SOURCE == 0
|
||||||
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 20000000 ) /* using the external clock source */
|
||||||
|
#else
|
||||||
|
#define configCPU_CLOCK_HZ ( ( unsigned long ) 32000000 ) /* using the internal high speed clock */
|
||||||
|
#endif /* configCLOCK_SOURCE */
|
||||||
|
|
||||||
|
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FREERTOS_CONFIG_H */
|
||||||
|
|
|
@ -0,0 +1,575 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef INC_FREERTOS_H
|
||||||
|
#define INC_FREERTOS_H
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Include the generic headers required for the FreeRTOS port being used.
|
||||||
|
*/
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/* Basic FreeRTOS definitions. */
|
||||||
|
#include "projdefs.h"
|
||||||
|
|
||||||
|
/* Application specific configuration options. */
|
||||||
|
#include "FreeRTOSConfig.h"
|
||||||
|
|
||||||
|
/* configUSE_PORT_OPTIMISED_TASK_SELECTION must be defined before portable.h
|
||||||
|
is included as it is used by the port layer. */
|
||||||
|
#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
|
||||||
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Definitions specific to the port being used. */
|
||||||
|
#include "portable.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Defines the prototype to which the application task hook function must
|
||||||
|
conform. */
|
||||||
|
typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check all the required application specific macros have been defined.
|
||||||
|
* These macros are application specific and (as downloaded) are defined
|
||||||
|
* within FreeRTOSConfig.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef configUSE_PREEMPTION
|
||||||
|
#error Missing definition: configUSE_PREEMPTION should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_IDLE_HOOK
|
||||||
|
#error Missing definition: configUSE_IDLE_HOOK should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_TICK_HOOK
|
||||||
|
#error Missing definition: configUSE_TICK_HOOK should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_CO_ROUTINES
|
||||||
|
#error Missing definition: configUSE_CO_ROUTINES should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_vTaskPrioritySet
|
||||||
|
#error Missing definition: INCLUDE_vTaskPrioritySet should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_uxTaskPriorityGet
|
||||||
|
#error Missing definition: INCLUDE_uxTaskPriorityGet should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_vTaskDelete
|
||||||
|
#error Missing definition: INCLUDE_vTaskDelete should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_vTaskSuspend
|
||||||
|
#error Missing definition: INCLUDE_vTaskSuspend should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_vTaskDelayUntil
|
||||||
|
#error Missing definition: INCLUDE_vTaskDelayUntil should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_vTaskDelay
|
||||||
|
#error Missing definition: INCLUDE_vTaskDelay should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_16_BIT_TICKS
|
||||||
|
#error Missing definition: configUSE_16_BIT_TICKS should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskGetIdleTaskHandle
|
||||||
|
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTimerGetTimerDaemonTaskHandle
|
||||||
|
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xQueueGetMutexHolder
|
||||||
|
#define INCLUDE_xQueueGetMutexHolder 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xSemaphoreGetMutexHolder
|
||||||
|
#define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_pcTaskGetTaskName
|
||||||
|
#define INCLUDE_pcTaskGetTaskName 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_APPLICATION_TASK_TAG
|
||||||
|
#define configUSE_APPLICATION_TASK_TAG 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_uxTaskGetStackHighWaterMark
|
||||||
|
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_eTaskGetState
|
||||||
|
#define INCLUDE_eTaskGetState 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_RECURSIVE_MUTEXES
|
||||||
|
#define configUSE_RECURSIVE_MUTEXES 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_MUTEXES
|
||||||
|
#define configUSE_MUTEXES 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_TIMERS
|
||||||
|
#define configUSE_TIMERS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_COUNTING_SEMAPHORES
|
||||||
|
#define configUSE_COUNTING_SEMAPHORES 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_ALTERNATIVE_API
|
||||||
|
#define configUSE_ALTERNATIVE_API 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portCRITICAL_NESTING_IN_TCB
|
||||||
|
#define portCRITICAL_NESTING_IN_TCB 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configMAX_TASK_NAME_LEN
|
||||||
|
#define configMAX_TASK_NAME_LEN 16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configIDLE_SHOULD_YIELD
|
||||||
|
#define configIDLE_SHOULD_YIELD 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if configMAX_TASK_NAME_LEN < 1
|
||||||
|
#error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskResumeFromISR
|
||||||
|
#define INCLUDE_xTaskResumeFromISR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configASSERT
|
||||||
|
#define configASSERT( x )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portALIGNMENT_ASSERT_pxCurrentTCB
|
||||||
|
#define portALIGNMENT_ASSERT_pxCurrentTCB configASSERT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The timers module relies on xTaskGetSchedulerState(). */
|
||||||
|
#if configUSE_TIMERS == 1
|
||||||
|
|
||||||
|
#ifndef configTIMER_TASK_PRIORITY
|
||||||
|
#error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
|
||||||
|
#endif /* configTIMER_TASK_PRIORITY */
|
||||||
|
|
||||||
|
#ifndef configTIMER_QUEUE_LENGTH
|
||||||
|
#error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
|
||||||
|
#endif /* configTIMER_QUEUE_LENGTH */
|
||||||
|
|
||||||
|
#ifndef configTIMER_TASK_STACK_DEPTH
|
||||||
|
#error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
|
||||||
|
#endif /* configTIMER_TASK_STACK_DEPTH */
|
||||||
|
|
||||||
|
#endif /* configUSE_TIMERS */
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskGetSchedulerState
|
||||||
|
#define INCLUDE_xTaskGetSchedulerState 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INCLUDE_xTaskGetCurrentTaskHandle
|
||||||
|
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef portSET_INTERRUPT_MASK_FROM_ISR
|
||||||
|
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
|
||||||
|
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portCLEAN_UP_TCB
|
||||||
|
#define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portSETUP_TCB
|
||||||
|
#define portSETUP_TCB( pxTCB ) ( void ) pxTCB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configQUEUE_REGISTRY_SIZE
|
||||||
|
#define configQUEUE_REGISTRY_SIZE 0U
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( configQUEUE_REGISTRY_SIZE < 1 )
|
||||||
|
#define vQueueAddToRegistry( xQueue, pcName )
|
||||||
|
#define vQueueUnregisterQueue( xQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portPOINTER_SIZE_TYPE
|
||||||
|
#define portPOINTER_SIZE_TYPE unsigned long
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Remove any unused trace macros. */
|
||||||
|
#ifndef traceSTART
|
||||||
|
/* Used to perform any necessary initialisation - for example, open a file
|
||||||
|
into which trace is to be written. */
|
||||||
|
#define traceSTART()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceEND
|
||||||
|
/* Use to close a trace, for example close a file into which trace has been
|
||||||
|
written. */
|
||||||
|
#define traceEND()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_SWITCHED_IN
|
||||||
|
/* Called after a task has been selected to run. pxCurrentTCB holds a pointer
|
||||||
|
to the task control block of the selected task. */
|
||||||
|
#define traceTASK_SWITCHED_IN()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_SWITCHED_OUT
|
||||||
|
/* Called before a task has been selected to run. pxCurrentTCB holds a pointer
|
||||||
|
to the task control block of the task being switched out. */
|
||||||
|
#define traceTASK_SWITCHED_OUT()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_PRIORITY_INHERIT
|
||||||
|
/* Called when a task attempts to take a mutex that is already held by a
|
||||||
|
lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
|
||||||
|
that holds the mutex. uxInheritedPriority is the priority the mutex holder
|
||||||
|
will inherit (the priority of the task that is attempting to obtain the
|
||||||
|
muted. */
|
||||||
|
#define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_PRIORITY_DISINHERIT
|
||||||
|
/* Called when a task releases a mutex, the holding of which had resulted in
|
||||||
|
the task inheriting the priority of a higher priority task.
|
||||||
|
pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
|
||||||
|
mutex. uxOriginalPriority is the task's configured (base) priority. */
|
||||||
|
#define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceBLOCKING_ON_QUEUE_RECEIVE
|
||||||
|
/* Task is about to block because it cannot read from a
|
||||||
|
queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
|
||||||
|
upon which the read was attempted. pxCurrentTCB points to the TCB of the
|
||||||
|
task that attempted the read. */
|
||||||
|
#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceBLOCKING_ON_QUEUE_SEND
|
||||||
|
/* Task is about to block because it cannot write to a
|
||||||
|
queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
|
||||||
|
upon which the write was attempted. pxCurrentTCB points to the TCB of the
|
||||||
|
task that attempted the write. */
|
||||||
|
#define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configCHECK_FOR_STACK_OVERFLOW
|
||||||
|
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The following event macros are embedded in the kernel API calls. */
|
||||||
|
|
||||||
|
#ifndef traceMOVED_TASK_TO_READY_STATE
|
||||||
|
#define traceMOVED_TASK_TO_READY_STATE( pxTCB )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_CREATE
|
||||||
|
#define traceQUEUE_CREATE( pxNewQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_CREATE_FAILED
|
||||||
|
#define traceQUEUE_CREATE_FAILED( ucQueueType )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceCREATE_MUTEX
|
||||||
|
#define traceCREATE_MUTEX( pxNewQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceCREATE_MUTEX_FAILED
|
||||||
|
#define traceCREATE_MUTEX_FAILED()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceGIVE_MUTEX_RECURSIVE
|
||||||
|
#define traceGIVE_MUTEX_RECURSIVE( pxMutex )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
|
||||||
|
#define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTAKE_MUTEX_RECURSIVE
|
||||||
|
#define traceTAKE_MUTEX_RECURSIVE( pxMutex )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
|
||||||
|
#define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceCREATE_COUNTING_SEMAPHORE
|
||||||
|
#define traceCREATE_COUNTING_SEMAPHORE()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
|
||||||
|
#define traceCREATE_COUNTING_SEMAPHORE_FAILED()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_SEND
|
||||||
|
#define traceQUEUE_SEND( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_SEND_FAILED
|
||||||
|
#define traceQUEUE_SEND_FAILED( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_RECEIVE
|
||||||
|
#define traceQUEUE_RECEIVE( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_PEEK
|
||||||
|
#define traceQUEUE_PEEK( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_RECEIVE_FAILED
|
||||||
|
#define traceQUEUE_RECEIVE_FAILED( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_SEND_FROM_ISR
|
||||||
|
#define traceQUEUE_SEND_FROM_ISR( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_SEND_FROM_ISR_FAILED
|
||||||
|
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_RECEIVE_FROM_ISR
|
||||||
|
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
|
||||||
|
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceQUEUE_DELETE
|
||||||
|
#define traceQUEUE_DELETE( pxQueue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_CREATE
|
||||||
|
#define traceTASK_CREATE( pxNewTCB )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_CREATE_FAILED
|
||||||
|
#define traceTASK_CREATE_FAILED()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_DELETE
|
||||||
|
#define traceTASK_DELETE( pxTaskToDelete )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_DELAY_UNTIL
|
||||||
|
#define traceTASK_DELAY_UNTIL()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_DELAY
|
||||||
|
#define traceTASK_DELAY()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_PRIORITY_SET
|
||||||
|
#define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_SUSPEND
|
||||||
|
#define traceTASK_SUSPEND( pxTaskToSuspend )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_RESUME
|
||||||
|
#define traceTASK_RESUME( pxTaskToResume )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_RESUME_FROM_ISR
|
||||||
|
#define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTASK_INCREMENT_TICK
|
||||||
|
#define traceTASK_INCREMENT_TICK( xTickCount )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTIMER_CREATE
|
||||||
|
#define traceTIMER_CREATE( pxNewTimer )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTIMER_CREATE_FAILED
|
||||||
|
#define traceTIMER_CREATE_FAILED()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTIMER_COMMAND_SEND
|
||||||
|
#define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTIMER_EXPIRED
|
||||||
|
#define traceTIMER_EXPIRED( pxTimer )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef traceTIMER_COMMAND_RECEIVED
|
||||||
|
#define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configGENERATE_RUN_TIME_STATS
|
||||||
|
#define configGENERATE_RUN_TIME_STATS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||||
|
|
||||||
|
#ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
|
||||||
|
#error If configGENERATE_RUN_TIME_STATS is defined then portCONFIGURE_TIMER_FOR_RUN_TIME_STATS must also be defined. portCONFIGURE_TIMER_FOR_RUN_TIME_STATS should call a port layer function to setup a peripheral timer/counter that can then be used as the run time counter time base.
|
||||||
|
#endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
|
||||||
|
|
||||||
|
#ifndef portGET_RUN_TIME_COUNTER_VALUE
|
||||||
|
#ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
|
||||||
|
#error If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined. See the examples provided and the FreeRTOS web site for more information.
|
||||||
|
#endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
|
||||||
|
#endif /* portGET_RUN_TIME_COUNTER_VALUE */
|
||||||
|
|
||||||
|
#endif /* configGENERATE_RUN_TIME_STATS */
|
||||||
|
|
||||||
|
#ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
|
||||||
|
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_MALLOC_FAILED_HOOK
|
||||||
|
#define configUSE_MALLOC_FAILED_HOOK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portPRIVILEGE_BIT
|
||||||
|
#define portPRIVILEGE_BIT ( ( unsigned portBASE_TYPE ) 0x00 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portYIELD_WITHIN_API
|
||||||
|
#define portYIELD_WITHIN_API portYIELD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef pvPortMallocAligned
|
||||||
|
#define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef vPortFreeAligned
|
||||||
|
#define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||||
|
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
|
||||||
|
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
|
||||||
|
#error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_TICKLESS_IDLE
|
||||||
|
#define configUSE_TICKLESS_IDLE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configPRE_SLEEP_PROCESSING
|
||||||
|
#define configPRE_SLEEP_PROCESSING( x )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configPOST_SLEEP_PROCESSING
|
||||||
|
#define configPOST_SLEEP_PROCESSING( x )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef configUSE_QUEUE_SETS
|
||||||
|
#define configUSE_QUEUE_SETS 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For backward compatability. */
|
||||||
|
#define eTaskStateGet eTaskGetState
|
||||||
|
|
||||||
|
#endif /* INC_FREERTOS_H */
|
||||||
|
|
|
@ -0,0 +1,189 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef STACK_MACROS_H
|
||||||
|
#define STACK_MACROS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Call the stack overflow hook function if the stack of the task being swapped
|
||||||
|
* out is currently overflowed, or looks like it might have overflowed in the
|
||||||
|
* past.
|
||||||
|
*
|
||||||
|
* Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check
|
||||||
|
* the current stack state only - comparing the current top of stack value to
|
||||||
|
* the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1
|
||||||
|
* will also cause the last few stack bytes to be checked to ensure the value
|
||||||
|
* to which the bytes were set when the task was created have not been
|
||||||
|
* overwritten. Note this second test does not guarantee that an overflowed
|
||||||
|
* stack will always be recognised.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if( configCHECK_FOR_STACK_OVERFLOW == 0 )
|
||||||
|
|
||||||
|
/* FreeRTOSConfig.h is not set to check for stack overflows. */
|
||||||
|
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW()
|
||||||
|
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW()
|
||||||
|
|
||||||
|
#endif /* configCHECK_FOR_STACK_OVERFLOW == 0 */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if( configCHECK_FOR_STACK_OVERFLOW == 1 )
|
||||||
|
|
||||||
|
/* FreeRTOSConfig.h is only set to use the first method of
|
||||||
|
overflow checking. */
|
||||||
|
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW()
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH < 0 ) )
|
||||||
|
|
||||||
|
/* Only the current stack state is to be checked. */
|
||||||
|
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
|
||||||
|
{ \
|
||||||
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
|
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
|
||||||
|
{ \
|
||||||
|
vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* configCHECK_FOR_STACK_OVERFLOW > 0 */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH > 0 ) )
|
||||||
|
|
||||||
|
/* Only the current stack state is to be checked. */
|
||||||
|
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
|
||||||
|
{ \
|
||||||
|
\
|
||||||
|
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||||
|
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
|
||||||
|
{ \
|
||||||
|
vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
|
||||||
|
|
||||||
|
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
||||||
|
{ \
|
||||||
|
static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
/* Has the extremity of the task stack ever been written over? */ \
|
||||||
|
if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
|
||||||
|
{ \
|
||||||
|
vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
|
||||||
|
|
||||||
|
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
||||||
|
{ \
|
||||||
|
char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \
|
||||||
|
static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||||
|
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
pcEndOfStack -= sizeof( ucExpectedStackBytes ); \
|
||||||
|
\
|
||||||
|
/* Has the extremity of the task stack ever been written over? */ \
|
||||||
|
if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
|
||||||
|
{ \
|
||||||
|
vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif /* STACK_MACROS_H */
|
||||||
|
|
|
@ -0,0 +1,767 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CO_ROUTINE_H
|
||||||
|
#define CO_ROUTINE_H
|
||||||
|
|
||||||
|
#ifndef INC_FREERTOS_H
|
||||||
|
#error "include FreeRTOS.h must appear in source files before include croutine.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Used to hide the implementation of the co-routine control block. The
|
||||||
|
control block structure however has to be included in the header due to
|
||||||
|
the macro implementation of the co-routine functionality. */
|
||||||
|
typedef void * xCoRoutineHandle;
|
||||||
|
|
||||||
|
/* Defines the prototype to which co-routine functions must conform. */
|
||||||
|
typedef void (*crCOROUTINE_CODE)( xCoRoutineHandle, unsigned portBASE_TYPE );
|
||||||
|
|
||||||
|
typedef struct corCoRoutineControlBlock
|
||||||
|
{
|
||||||
|
crCOROUTINE_CODE pxCoRoutineFunction;
|
||||||
|
xListItem xGenericListItem; /*< List item used to place the CRCB in ready and blocked queues. */
|
||||||
|
xListItem xEventListItem; /*< List item used to place the CRCB in event lists. */
|
||||||
|
unsigned portBASE_TYPE uxPriority; /*< The priority of the co-routine in relation to other co-routines. */
|
||||||
|
unsigned portBASE_TYPE uxIndex; /*< Used to distinguish between co-routines when multiple co-routines use the same co-routine function. */
|
||||||
|
unsigned short uxState; /*< Used internally by the co-routine implementation. */
|
||||||
|
} corCRCB; /* Co-routine control block. Note must be identical in size down to uxPriority with tskTCB. */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
*<pre>
|
||||||
|
portBASE_TYPE xCoRoutineCreate(
|
||||||
|
crCOROUTINE_CODE pxCoRoutineCode,
|
||||||
|
unsigned portBASE_TYPE uxPriority,
|
||||||
|
unsigned portBASE_TYPE uxIndex
|
||||||
|
);</pre>
|
||||||
|
*
|
||||||
|
* Create a new co-routine and add it to the list of co-routines that are
|
||||||
|
* ready to run.
|
||||||
|
*
|
||||||
|
* @param pxCoRoutineCode Pointer to the co-routine function. Co-routine
|
||||||
|
* functions require special syntax - see the co-routine section of the WEB
|
||||||
|
* documentation for more information.
|
||||||
|
*
|
||||||
|
* @param uxPriority The priority with respect to other co-routines at which
|
||||||
|
* the co-routine will run.
|
||||||
|
*
|
||||||
|
* @param uxIndex Used to distinguish between different co-routines that
|
||||||
|
* execute the same function. See the example below and the co-routine section
|
||||||
|
* of the WEB documentation for further information.
|
||||||
|
*
|
||||||
|
* @return pdPASS if the co-routine was successfully created and added to a ready
|
||||||
|
* list, otherwise an error code defined with ProjDefs.h.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Co-routine to be created.
|
||||||
|
void vFlashCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
// This may not be necessary for const variables.
|
||||||
|
static const char cLedToFlash[ 2 ] = { 5, 6 };
|
||||||
|
static const portTickType uxFlashRates[ 2 ] = { 200, 400 };
|
||||||
|
|
||||||
|
// Must start every co-routine with a call to crSTART();
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// This co-routine just delays for a fixed period, then toggles
|
||||||
|
// an LED. Two co-routines are created using this function, so
|
||||||
|
// the uxIndex parameter is used to tell the co-routine which
|
||||||
|
// LED to flash and how long to delay. This assumes xQueue has
|
||||||
|
// already been created.
|
||||||
|
vParTestToggleLED( cLedToFlash[ uxIndex ] );
|
||||||
|
crDELAY( xHandle, uxFlashRates[ uxIndex ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must end every co-routine with a call to crEND();
|
||||||
|
crEND();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function that creates two co-routines.
|
||||||
|
void vOtherFunction( void )
|
||||||
|
{
|
||||||
|
unsigned char ucParameterToPass;
|
||||||
|
xTaskHandle xHandle;
|
||||||
|
|
||||||
|
// Create two co-routines at priority 0. The first is given index 0
|
||||||
|
// so (from the code above) toggles LED 5 every 200 ticks. The second
|
||||||
|
// is given index 1 so toggles LED 6 every 400 ticks.
|
||||||
|
for( uxIndex = 0; uxIndex < 2; uxIndex++ )
|
||||||
|
{
|
||||||
|
xCoRoutineCreate( vFlashCoRoutine, 0, uxIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xCoRoutineCreate xCoRoutineCreate
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
signed portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
*<pre>
|
||||||
|
void vCoRoutineSchedule( void );</pre>
|
||||||
|
*
|
||||||
|
* Run a co-routine.
|
||||||
|
*
|
||||||
|
* vCoRoutineSchedule() executes the highest priority co-routine that is able
|
||||||
|
* to run. The co-routine will execute until it either blocks, yields or is
|
||||||
|
* preempted by a task. Co-routines execute cooperatively so one
|
||||||
|
* co-routine cannot be preempted by another, but can be preempted by a task.
|
||||||
|
*
|
||||||
|
* If an application comprises of both tasks and co-routines then
|
||||||
|
* vCoRoutineSchedule should be called from the idle task (in an idle task
|
||||||
|
* hook).
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// This idle task hook will schedule a co-routine each time it is called.
|
||||||
|
// The rest of the idle task will execute between co-routine calls.
|
||||||
|
void vApplicationIdleHook( void )
|
||||||
|
{
|
||||||
|
vCoRoutineSchedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alternatively, if you do not require any other part of the idle task to
|
||||||
|
// execute, the idle task hook can call vCoRoutineScheduler() within an
|
||||||
|
// infinite loop.
|
||||||
|
void vApplicationIdleHook( void )
|
||||||
|
{
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
vCoRoutineSchedule();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup vCoRoutineSchedule vCoRoutineSchedule
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
void vCoRoutineSchedule( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
* <pre>
|
||||||
|
crSTART( xCoRoutineHandle xHandle );</pre>
|
||||||
|
*
|
||||||
|
* This macro MUST always be called at the start of a co-routine function.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Co-routine to be created.
|
||||||
|
void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
static long ulAVariable;
|
||||||
|
|
||||||
|
// Must start every co-routine with a call to crSTART();
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Co-routine functionality goes here.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must end every co-routine with a call to crEND();
|
||||||
|
crEND();
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crSTART crSTART
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crSTART( pxCRCB ) switch( ( ( corCRCB * )( pxCRCB ) )->uxState ) { case 0:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
* <pre>
|
||||||
|
crEND();</pre>
|
||||||
|
*
|
||||||
|
* This macro MUST always be called at the end of a co-routine function.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Co-routine to be created.
|
||||||
|
void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
static long ulAVariable;
|
||||||
|
|
||||||
|
// Must start every co-routine with a call to crSTART();
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Co-routine functionality goes here.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must end every co-routine with a call to crEND();
|
||||||
|
crEND();
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crSTART crSTART
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crEND() }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These macros are intended for internal use by the co-routine implementation
|
||||||
|
* only. The macros should not be used directly by application writers.
|
||||||
|
*/
|
||||||
|
#define crSET_STATE0( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):
|
||||||
|
#define crSET_STATE1( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
*<pre>
|
||||||
|
crDELAY( xCoRoutineHandle xHandle, portTickType xTicksToDelay );</pre>
|
||||||
|
*
|
||||||
|
* Delay a co-routine for a fixed period of time.
|
||||||
|
*
|
||||||
|
* crDELAY can only be called from the co-routine function itself - not
|
||||||
|
* from within a function called by the co-routine function. This is because
|
||||||
|
* co-routines do not maintain their own stack.
|
||||||
|
*
|
||||||
|
* @param xHandle The handle of the co-routine to delay. This is the xHandle
|
||||||
|
* parameter of the co-routine function.
|
||||||
|
*
|
||||||
|
* @param xTickToDelay The number of ticks that the co-routine should delay
|
||||||
|
* for. The actual amount of time this equates to is defined by
|
||||||
|
* configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant portTICK_RATE_MS
|
||||||
|
* can be used to convert ticks to milliseconds.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Co-routine to be created.
|
||||||
|
void vACoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
// This may not be necessary for const variables.
|
||||||
|
// We are to delay for 200ms.
|
||||||
|
static const xTickType xDelayTime = 200 / portTICK_RATE_MS;
|
||||||
|
|
||||||
|
// Must start every co-routine with a call to crSTART();
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Delay for 200ms.
|
||||||
|
crDELAY( xHandle, xDelayTime );
|
||||||
|
|
||||||
|
// Do something here.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must end every co-routine with a call to crEND();
|
||||||
|
crEND();
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crDELAY crDELAY
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crDELAY( xHandle, xTicksToDelay ) \
|
||||||
|
if( ( xTicksToDelay ) > 0 ) \
|
||||||
|
{ \
|
||||||
|
vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL ); \
|
||||||
|
} \
|
||||||
|
crSET_STATE0( ( xHandle ) );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
crQUEUE_SEND(
|
||||||
|
xCoRoutineHandle xHandle,
|
||||||
|
xQueueHandle pxQueue,
|
||||||
|
void *pvItemToQueue,
|
||||||
|
portTickType xTicksToWait,
|
||||||
|
portBASE_TYPE *pxResult
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine
|
||||||
|
* equivalent to the xQueueSend() and xQueueReceive() functions used by tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas
|
||||||
|
* xQueueSend() and xQueueReceive() can only be used from tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND can only be called from the co-routine function itself - not
|
||||||
|
* from within a function called by the co-routine function. This is because
|
||||||
|
* co-routines do not maintain their own stack.
|
||||||
|
*
|
||||||
|
* See the co-routine section of the WEB documentation for information on
|
||||||
|
* passing data between tasks and co-routines and between ISR's and
|
||||||
|
* co-routines.
|
||||||
|
*
|
||||||
|
* @param xHandle The handle of the calling co-routine. This is the xHandle
|
||||||
|
* parameter of the co-routine function.
|
||||||
|
*
|
||||||
|
* @param pxQueue The handle of the queue on which the data will be posted.
|
||||||
|
* The handle is obtained as the return value when the queue is created using
|
||||||
|
* the xQueueCreate() API function.
|
||||||
|
*
|
||||||
|
* @param pvItemToQueue A pointer to the data being posted onto the queue.
|
||||||
|
* The number of bytes of each queued item is specified when the queue is
|
||||||
|
* created. This number of bytes is copied from pvItemToQueue into the queue
|
||||||
|
* itself.
|
||||||
|
*
|
||||||
|
* @param xTickToDelay The number of ticks that the co-routine should block
|
||||||
|
* to wait for space to become available on the queue, should space not be
|
||||||
|
* available immediately. The actual amount of time this equates to is defined
|
||||||
|
* by configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant
|
||||||
|
* portTICK_RATE_MS can be used to convert ticks to milliseconds (see example
|
||||||
|
* below).
|
||||||
|
*
|
||||||
|
* @param pxResult The variable pointed to by pxResult will be set to pdPASS if
|
||||||
|
* data was successfully posted onto the queue, otherwise it will be set to an
|
||||||
|
* error defined within ProjDefs.h.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// Co-routine function that blocks for a fixed period then posts a number onto
|
||||||
|
// a queue.
|
||||||
|
static void prvCoRoutineFlashTask( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
static portBASE_TYPE xNumberToPost = 0;
|
||||||
|
static portBASE_TYPE xResult;
|
||||||
|
|
||||||
|
// Co-routines must begin with a call to crSTART().
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// This assumes the queue has already been created.
|
||||||
|
crQUEUE_SEND( xHandle, xCoRoutineQueue, &xNumberToPost, NO_DELAY, &xResult );
|
||||||
|
|
||||||
|
if( xResult != pdPASS )
|
||||||
|
{
|
||||||
|
// The message was not posted!
|
||||||
|
}
|
||||||
|
|
||||||
|
// Increment the number to be posted onto the queue.
|
||||||
|
xNumberToPost++;
|
||||||
|
|
||||||
|
// Delay for 100 ticks.
|
||||||
|
crDELAY( xHandle, 100 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Co-routines must end with a call to crEND().
|
||||||
|
crEND();
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crQUEUE_SEND crQUEUE_SEND
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult ) \
|
||||||
|
{ \
|
||||||
|
*( pxResult ) = xQueueCRSend( ( pxQueue) , ( pvItemToQueue) , ( xTicksToWait ) ); \
|
||||||
|
if( *( pxResult ) == errQUEUE_BLOCKED ) \
|
||||||
|
{ \
|
||||||
|
crSET_STATE0( ( xHandle ) ); \
|
||||||
|
*pxResult = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), 0 ); \
|
||||||
|
} \
|
||||||
|
if( *pxResult == errQUEUE_YIELD ) \
|
||||||
|
{ \
|
||||||
|
crSET_STATE1( ( xHandle ) ); \
|
||||||
|
*pxResult = pdPASS; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
* <pre>
|
||||||
|
crQUEUE_RECEIVE(
|
||||||
|
xCoRoutineHandle xHandle,
|
||||||
|
xQueueHandle pxQueue,
|
||||||
|
void *pvBuffer,
|
||||||
|
portTickType xTicksToWait,
|
||||||
|
portBASE_TYPE *pxResult
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* The macro's crQUEUE_SEND() and crQUEUE_RECEIVE() are the co-routine
|
||||||
|
* equivalent to the xQueueSend() and xQueueReceive() functions used by tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND and crQUEUE_RECEIVE can only be used from a co-routine whereas
|
||||||
|
* xQueueSend() and xQueueReceive() can only be used from tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_RECEIVE can only be called from the co-routine function itself - not
|
||||||
|
* from within a function called by the co-routine function. This is because
|
||||||
|
* co-routines do not maintain their own stack.
|
||||||
|
*
|
||||||
|
* See the co-routine section of the WEB documentation for information on
|
||||||
|
* passing data between tasks and co-routines and between ISR's and
|
||||||
|
* co-routines.
|
||||||
|
*
|
||||||
|
* @param xHandle The handle of the calling co-routine. This is the xHandle
|
||||||
|
* parameter of the co-routine function.
|
||||||
|
*
|
||||||
|
* @param pxQueue The handle of the queue from which the data will be received.
|
||||||
|
* The handle is obtained as the return value when the queue is created using
|
||||||
|
* the xQueueCreate() API function.
|
||||||
|
*
|
||||||
|
* @param pvBuffer The buffer into which the received item is to be copied.
|
||||||
|
* The number of bytes of each queued item is specified when the queue is
|
||||||
|
* created. This number of bytes is copied into pvBuffer.
|
||||||
|
*
|
||||||
|
* @param xTickToDelay The number of ticks that the co-routine should block
|
||||||
|
* to wait for data to become available from the queue, should data not be
|
||||||
|
* available immediately. The actual amount of time this equates to is defined
|
||||||
|
* by configTICK_RATE_HZ (set in FreeRTOSConfig.h). The constant
|
||||||
|
* portTICK_RATE_MS can be used to convert ticks to milliseconds (see the
|
||||||
|
* crQUEUE_SEND example).
|
||||||
|
*
|
||||||
|
* @param pxResult The variable pointed to by pxResult will be set to pdPASS if
|
||||||
|
* data was successfully retrieved from the queue, otherwise it will be set to
|
||||||
|
* an error code as defined within ProjDefs.h.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// A co-routine receives the number of an LED to flash from a queue. It
|
||||||
|
// blocks on the queue until the number is received.
|
||||||
|
static void prvCoRoutineFlashWorkTask( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
|
{
|
||||||
|
// Variables in co-routines must be declared static if they must maintain value across a blocking call.
|
||||||
|
static portBASE_TYPE xResult;
|
||||||
|
static unsigned portBASE_TYPE uxLEDToFlash;
|
||||||
|
|
||||||
|
// All co-routines must start with a call to crSTART().
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Wait for data to become available on the queue.
|
||||||
|
crQUEUE_RECEIVE( xHandle, xCoRoutineQueue, &uxLEDToFlash, portMAX_DELAY, &xResult );
|
||||||
|
|
||||||
|
if( xResult == pdPASS )
|
||||||
|
{
|
||||||
|
// We received the LED to flash - flash it!
|
||||||
|
vParTestToggleLED( uxLEDToFlash );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
crEND();
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crQUEUE_RECEIVE crQUEUE_RECEIVE
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult ) \
|
||||||
|
{ \
|
||||||
|
*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), ( xTicksToWait ) ); \
|
||||||
|
if( *( pxResult ) == errQUEUE_BLOCKED ) \
|
||||||
|
{ \
|
||||||
|
crSET_STATE0( ( xHandle ) ); \
|
||||||
|
*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), 0 ); \
|
||||||
|
} \
|
||||||
|
if( *( pxResult ) == errQUEUE_YIELD ) \
|
||||||
|
{ \
|
||||||
|
crSET_STATE1( ( xHandle ) ); \
|
||||||
|
*( pxResult ) = pdPASS; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
* <pre>
|
||||||
|
crQUEUE_SEND_FROM_ISR(
|
||||||
|
xQueueHandle pxQueue,
|
||||||
|
void *pvItemToQueue,
|
||||||
|
portBASE_TYPE xCoRoutinePreviouslyWoken
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the
|
||||||
|
* co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR()
|
||||||
|
* functions used by tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() can only be used to
|
||||||
|
* pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and
|
||||||
|
* xQueueReceiveFromISR() can only be used to pass data between a task and and
|
||||||
|
* ISR.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND_FROM_ISR can only be called from an ISR to send data to a queue
|
||||||
|
* that is being used from within a co-routine.
|
||||||
|
*
|
||||||
|
* See the co-routine section of the WEB documentation for information on
|
||||||
|
* passing data between tasks and co-routines and between ISR's and
|
||||||
|
* co-routines.
|
||||||
|
*
|
||||||
|
* @param xQueue The handle to the queue on which the item is to be posted.
|
||||||
|
*
|
||||||
|
* @param pvItemToQueue A pointer to the item that is to be placed on the
|
||||||
|
* queue. The size of the items the queue will hold was defined when the
|
||||||
|
* queue was created, so this many bytes will be copied from pvItemToQueue
|
||||||
|
* into the queue storage area.
|
||||||
|
*
|
||||||
|
* @param xCoRoutinePreviouslyWoken This is included so an ISR can post onto
|
||||||
|
* the same queue multiple times from a single interrupt. The first call
|
||||||
|
* should always pass in pdFALSE. Subsequent calls should pass in
|
||||||
|
* the value returned from the previous call.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if a co-routine was woken by posting onto the queue. This is
|
||||||
|
* used by the ISR to determine if a context switch may be required following
|
||||||
|
* the ISR.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// A co-routine that blocks on a queue waiting for characters to be received.
|
||||||
|
static void vReceivingCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
|
{
|
||||||
|
char cRxedChar;
|
||||||
|
portBASE_TYPE xResult;
|
||||||
|
|
||||||
|
// All co-routines must start with a call to crSTART().
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Wait for data to become available on the queue. This assumes the
|
||||||
|
// queue xCommsRxQueue has already been created!
|
||||||
|
crQUEUE_RECEIVE( xHandle, xCommsRxQueue, &uxLEDToFlash, portMAX_DELAY, &xResult );
|
||||||
|
|
||||||
|
// Was a character received?
|
||||||
|
if( xResult == pdPASS )
|
||||||
|
{
|
||||||
|
// Process the character here.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// All co-routines must end with a call to crEND().
|
||||||
|
crEND();
|
||||||
|
}
|
||||||
|
|
||||||
|
// An ISR that uses a queue to send characters received on a serial port to
|
||||||
|
// a co-routine.
|
||||||
|
void vUART_ISR( void )
|
||||||
|
{
|
||||||
|
char cRxedChar;
|
||||||
|
portBASE_TYPE xCRWokenByPost = pdFALSE;
|
||||||
|
|
||||||
|
// We loop around reading characters until there are none left in the UART.
|
||||||
|
while( UART_RX_REG_NOT_EMPTY() )
|
||||||
|
{
|
||||||
|
// Obtain the character from the UART.
|
||||||
|
cRxedChar = UART_RX_REG;
|
||||||
|
|
||||||
|
// Post the character onto a queue. xCRWokenByPost will be pdFALSE
|
||||||
|
// the first time around the loop. If the post causes a co-routine
|
||||||
|
// to be woken (unblocked) then xCRWokenByPost will be set to pdTRUE.
|
||||||
|
// In this manner we can ensure that if more than one co-routine is
|
||||||
|
// blocked on the queue only one is woken by this ISR no matter how
|
||||||
|
// many characters are posted to the queue.
|
||||||
|
xCRWokenByPost = crQUEUE_SEND_FROM_ISR( xCommsRxQueue, &cRxedChar, xCRWokenByPost );
|
||||||
|
}
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* croutine. h
|
||||||
|
* <pre>
|
||||||
|
crQUEUE_SEND_FROM_ISR(
|
||||||
|
xQueueHandle pxQueue,
|
||||||
|
void *pvBuffer,
|
||||||
|
portBASE_TYPE * pxCoRoutineWoken
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* The macro's crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() are the
|
||||||
|
* co-routine equivalent to the xQueueSendFromISR() and xQueueReceiveFromISR()
|
||||||
|
* functions used by tasks.
|
||||||
|
*
|
||||||
|
* crQUEUE_SEND_FROM_ISR() and crQUEUE_RECEIVE_FROM_ISR() can only be used to
|
||||||
|
* pass data between a co-routine and and ISR, whereas xQueueSendFromISR() and
|
||||||
|
* xQueueReceiveFromISR() can only be used to pass data between a task and and
|
||||||
|
* ISR.
|
||||||
|
*
|
||||||
|
* crQUEUE_RECEIVE_FROM_ISR can only be called from an ISR to receive data
|
||||||
|
* from a queue that is being used from within a co-routine (a co-routine
|
||||||
|
* posted to the queue).
|
||||||
|
*
|
||||||
|
* See the co-routine section of the WEB documentation for information on
|
||||||
|
* passing data between tasks and co-routines and between ISR's and
|
||||||
|
* co-routines.
|
||||||
|
*
|
||||||
|
* @param xQueue The handle to the queue on which the item is to be posted.
|
||||||
|
*
|
||||||
|
* @param pvBuffer A pointer to a buffer into which the received item will be
|
||||||
|
* placed. The size of the items the queue will hold was defined when the
|
||||||
|
* queue was created, so this many bytes will be copied from the queue into
|
||||||
|
* pvBuffer.
|
||||||
|
*
|
||||||
|
* @param pxCoRoutineWoken A co-routine may be blocked waiting for space to become
|
||||||
|
* available on the queue. If crQUEUE_RECEIVE_FROM_ISR causes such a
|
||||||
|
* co-routine to unblock *pxCoRoutineWoken will get set to pdTRUE, otherwise
|
||||||
|
* *pxCoRoutineWoken will remain unchanged.
|
||||||
|
*
|
||||||
|
* @return pdTRUE an item was successfully received from the queue, otherwise
|
||||||
|
* pdFALSE.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
// A co-routine that posts a character to a queue then blocks for a fixed
|
||||||
|
// period. The character is incremented each time.
|
||||||
|
static void vSendingCoRoutine( xCoRoutineHandle xHandle, unsigned portBASE_TYPE uxIndex )
|
||||||
|
{
|
||||||
|
// cChar holds its value while this co-routine is blocked and must therefore
|
||||||
|
// be declared static.
|
||||||
|
static char cCharToTx = 'a';
|
||||||
|
portBASE_TYPE xResult;
|
||||||
|
|
||||||
|
// All co-routines must start with a call to crSTART().
|
||||||
|
crSTART( xHandle );
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// Send the next character to the queue.
|
||||||
|
crQUEUE_SEND( xHandle, xCoRoutineQueue, &cCharToTx, NO_DELAY, &xResult );
|
||||||
|
|
||||||
|
if( xResult == pdPASS )
|
||||||
|
{
|
||||||
|
// The character was successfully posted to the queue.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Could not post the character to the queue.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable the UART Tx interrupt to cause an interrupt in this
|
||||||
|
// hypothetical UART. The interrupt will obtain the character
|
||||||
|
// from the queue and send it.
|
||||||
|
ENABLE_RX_INTERRUPT();
|
||||||
|
|
||||||
|
// Increment to the next character then block for a fixed period.
|
||||||
|
// cCharToTx will maintain its value across the delay as it is
|
||||||
|
// declared static.
|
||||||
|
cCharToTx++;
|
||||||
|
if( cCharToTx > 'x' )
|
||||||
|
{
|
||||||
|
cCharToTx = 'a';
|
||||||
|
}
|
||||||
|
crDELAY( 100 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// All co-routines must end with a call to crEND().
|
||||||
|
crEND();
|
||||||
|
}
|
||||||
|
|
||||||
|
// An ISR that uses a queue to receive characters to send on a UART.
|
||||||
|
void vUART_ISR( void )
|
||||||
|
{
|
||||||
|
char cCharToTx;
|
||||||
|
portBASE_TYPE xCRWokenByPost = pdFALSE;
|
||||||
|
|
||||||
|
while( UART_TX_REG_EMPTY() )
|
||||||
|
{
|
||||||
|
// Are there any characters in the queue waiting to be sent?
|
||||||
|
// xCRWokenByPost will automatically be set to pdTRUE if a co-routine
|
||||||
|
// is woken by the post - ensuring that only a single co-routine is
|
||||||
|
// woken no matter how many times we go around this loop.
|
||||||
|
if( crQUEUE_RECEIVE_FROM_ISR( pxQueue, &cCharToTx, &xCRWokenByPost ) )
|
||||||
|
{
|
||||||
|
SEND_CHARACTER( cCharToTx );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}</pre>
|
||||||
|
* \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR
|
||||||
|
* \ingroup Tasks
|
||||||
|
*/
|
||||||
|
#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function is intended for internal use by the co-routine macros only.
|
||||||
|
* The macro nature of the co-routine implementation requires that the
|
||||||
|
* prototype appears here. The function should not be used by application
|
||||||
|
* writers.
|
||||||
|
*
|
||||||
|
* Removes the current co-routine from its ready list and places it in the
|
||||||
|
* appropriate delayed list.
|
||||||
|
*/
|
||||||
|
void vCoRoutineAddToDelayedList( portTickType xTicksToDelay, xList *pxEventList );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function is intended for internal use by the queue implementation only.
|
||||||
|
* The function should not be used by application writers.
|
||||||
|
*
|
||||||
|
* Removes the highest priority co-routine from the event list and places it in
|
||||||
|
* the pending ready list.
|
||||||
|
*/
|
||||||
|
signed portBASE_TYPE xCoRoutineRemoveFromEventList( const xList *pxEventList );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* CO_ROUTINE_H */
|
|
@ -0,0 +1,356 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the list implementation used by the scheduler. While it is tailored
|
||||||
|
* heavily for the schedulers needs, it is also available for use by
|
||||||
|
* application code.
|
||||||
|
*
|
||||||
|
* xLists can only store pointers to xListItems. Each xListItem contains a
|
||||||
|
* numeric value (xItemValue). Most of the time the lists are sorted in
|
||||||
|
* descending item value order.
|
||||||
|
*
|
||||||
|
* Lists are created already containing one list item. The value of this
|
||||||
|
* item is the maximum possible that can be stored, it is therefore always at
|
||||||
|
* the end of the list and acts as a marker. The list member pxHead always
|
||||||
|
* points to this marker - even though it is at the tail of the list. This
|
||||||
|
* is because the tail contains a wrap back pointer to the true head of
|
||||||
|
* the list.
|
||||||
|
*
|
||||||
|
* In addition to it's value, each list item contains a pointer to the next
|
||||||
|
* item in the list (pxNext), a pointer to the list it is in (pxContainer)
|
||||||
|
* and a pointer to back to the object that contains it. These later two
|
||||||
|
* pointers are included for efficiency of list manipulation. There is
|
||||||
|
* effectively a two way link between the object containing the list item and
|
||||||
|
* the list item itself.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* \page ListIntroduction List Implementation
|
||||||
|
* \ingroup FreeRTOSIntro
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef LIST_H
|
||||||
|
#define LIST_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* Definition of the only type of object that a list can contain.
|
||||||
|
*/
|
||||||
|
struct xLIST_ITEM
|
||||||
|
{
|
||||||
|
portTickType xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
|
||||||
|
volatile struct xLIST_ITEM * pxNext; /*< Pointer to the next xListItem in the list. */
|
||||||
|
volatile struct xLIST_ITEM * pxPrevious;/*< Pointer to the previous xListItem in the list. */
|
||||||
|
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
|
||||||
|
void * pvContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
||||||
|
};
|
||||||
|
typedef struct xLIST_ITEM xListItem; /* For some reason lint wants this as two separate definitions. */
|
||||||
|
|
||||||
|
struct xMINI_LIST_ITEM
|
||||||
|
{
|
||||||
|
portTickType xItemValue;
|
||||||
|
volatile struct xLIST_ITEM *pxNext;
|
||||||
|
volatile struct xLIST_ITEM *pxPrevious;
|
||||||
|
};
|
||||||
|
typedef struct xMINI_LIST_ITEM xMiniListItem;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Definition of the type of queue used by the scheduler.
|
||||||
|
*/
|
||||||
|
typedef struct xLIST
|
||||||
|
{
|
||||||
|
volatile unsigned portBASE_TYPE uxNumberOfItems;
|
||||||
|
volatile xListItem * pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to pvListGetOwnerOfNextEntry (). */
|
||||||
|
volatile xMiniListItem xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
||||||
|
} xList;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to set the owner of a list item. The owner of a list item
|
||||||
|
* is the object (usually a TCB) that contains the list item.
|
||||||
|
*
|
||||||
|
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner ) ( pxListItem )->pvOwner = ( void * ) ( pxOwner )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to get the owner of a list item. The owner of a list item
|
||||||
|
* is the object (usually a TCB) that contains the list item.
|
||||||
|
*
|
||||||
|
* \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_LIST_ITEM_OWNER( pxListItem ) ( pxListItem )->pvOwner
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to set the value of the list item. In most cases the value is
|
||||||
|
* used to sort the list in descending order.
|
||||||
|
*
|
||||||
|
* \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listSET_LIST_ITEM_VALUE( pxListItem, xValue ) ( pxListItem )->xItemValue = ( xValue )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to retrieve the value of the list item. The value can
|
||||||
|
* represent anything - for example a the priority of a task, or the time at
|
||||||
|
* which a task should be unblocked.
|
||||||
|
*
|
||||||
|
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro the retrieve the value of the list item at the head of a given
|
||||||
|
* list.
|
||||||
|
*
|
||||||
|
* \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxList ) ( (&( ( pxList )->xListEnd ))->pxNext->xItemValue )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to determine if a list contains any items. The macro will
|
||||||
|
* only have the value true if the list is empty.
|
||||||
|
*
|
||||||
|
* \page listLIST_IS_EMPTY listLIST_IS_EMPTY
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listLIST_IS_EMPTY( pxList ) ( ( pxList )->uxNumberOfItems == ( unsigned portBASE_TYPE ) 0 )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access macro to return the number of items in the list.
|
||||||
|
*/
|
||||||
|
#define listCURRENT_LIST_LENGTH( pxList ) ( ( pxList )->uxNumberOfItems )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access function to obtain the owner of the next entry in a list.
|
||||||
|
*
|
||||||
|
* The list member pxIndex is used to walk through a list. Calling
|
||||||
|
* listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list
|
||||||
|
* and returns that entries pxOwner parameter. Using multiple calls to this
|
||||||
|
* function it is therefore possible to move through every item contained in
|
||||||
|
* a list.
|
||||||
|
*
|
||||||
|
* The pxOwner parameter of a list item is a pointer to the object that owns
|
||||||
|
* the list item. In the scheduler this is normally a task control block.
|
||||||
|
* The pxOwner parameter effectively creates a two way link between the list
|
||||||
|
* item and its owner.
|
||||||
|
*
|
||||||
|
* @param pxList The list from which the next item owner is to be returned.
|
||||||
|
*
|
||||||
|
* \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList ) \
|
||||||
|
{ \
|
||||||
|
xList * const pxConstList = ( pxList ); \
|
||||||
|
/* Increment the index to the next item and return the item, ensuring */ \
|
||||||
|
/* we don't return the marker used at the end of the list. */ \
|
||||||
|
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||||
|
if( ( pxConstList )->pxIndex == ( xListItem * ) &( ( pxConstList )->xListEnd ) ) \
|
||||||
|
{ \
|
||||||
|
( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext; \
|
||||||
|
} \
|
||||||
|
( pxTCB ) = ( pxConstList )->pxIndex->pvOwner; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Access function to obtain the owner of the first entry in a list. Lists
|
||||||
|
* are normally sorted in ascending item value order.
|
||||||
|
*
|
||||||
|
* This function returns the pxOwner member of the first item in the list.
|
||||||
|
* The pxOwner parameter of a list item is a pointer to the object that owns
|
||||||
|
* the list item. In the scheduler this is normally a task control block.
|
||||||
|
* The pxOwner parameter effectively creates a two way link between the list
|
||||||
|
* item and its owner.
|
||||||
|
*
|
||||||
|
* @param pxList The list from which the owner of the head item is to be
|
||||||
|
* returned.
|
||||||
|
*
|
||||||
|
* \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
#define listGET_OWNER_OF_HEAD_ENTRY( pxList ) ( (&( ( pxList )->xListEnd ))->pxNext->pvOwner )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check to see if a list item is within a list. The list item maintains a
|
||||||
|
* "container" pointer that points to the list it is in. All this macro does
|
||||||
|
* is check to see if the container and the list match.
|
||||||
|
*
|
||||||
|
* @param pxList The list we want to know if the list item is within.
|
||||||
|
* @param pxListItem The list item we want to know if is in the list.
|
||||||
|
* @return pdTRUE is the list item is in the list, otherwise pdFALSE.
|
||||||
|
* pointer against
|
||||||
|
*/
|
||||||
|
#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the list a list item is contained within (referenced from).
|
||||||
|
*
|
||||||
|
* @param pxListItem The list item being queried.
|
||||||
|
* @return A pointer to the xList object that references the pxListItem
|
||||||
|
*/
|
||||||
|
#define listLIST_ITEM_CONTAINER( pxListItem ) ( ( pxListItem )->pvContainer )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This provides a crude means of knowing if a list has been initialised, as
|
||||||
|
* pxList->xListEnd.xItemValue is set to portMAX_DELAY by the vListInitialise()
|
||||||
|
* function.
|
||||||
|
*/
|
||||||
|
#define listLIST_IS_INITIALISED( pxList ) ( ( pxList )->xListEnd.xItemValue == portMAX_DELAY )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Must be called before a list is used! This initialises all the members
|
||||||
|
* of the list structure and inserts the xListEnd item into the list as a
|
||||||
|
* marker to the back of the list.
|
||||||
|
*
|
||||||
|
* @param pxList Pointer to the list being initialised.
|
||||||
|
*
|
||||||
|
* \page vListInitialise vListInitialise
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
void vListInitialise( xList *pxList );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Must be called before a list item is used. This sets the list container to
|
||||||
|
* null so the item does not think that it is already contained in a list.
|
||||||
|
*
|
||||||
|
* @param pxItem Pointer to the list item being initialised.
|
||||||
|
*
|
||||||
|
* \page vListInitialiseItem vListInitialiseItem
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
void vListInitialiseItem( xListItem *pxItem );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Insert a list item into a list. The item will be inserted into the list in
|
||||||
|
* a position determined by its item value (descending item value order).
|
||||||
|
*
|
||||||
|
* @param pxList The list into which the item is to be inserted.
|
||||||
|
*
|
||||||
|
* @param pxNewListItem The item to that is to be placed in the list.
|
||||||
|
*
|
||||||
|
* \page vListInsert vListInsert
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
void vListInsert( xList *pxList, xListItem *pxNewListItem );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Insert a list item into a list. The item will be inserted in a position
|
||||||
|
* such that it will be the last item within the list returned by multiple
|
||||||
|
* calls to listGET_OWNER_OF_NEXT_ENTRY.
|
||||||
|
*
|
||||||
|
* The list member pvIndex is used to walk through a list. Calling
|
||||||
|
* listGET_OWNER_OF_NEXT_ENTRY increments pvIndex to the next item in the list.
|
||||||
|
* Placing an item in a list using vListInsertEnd effectively places the item
|
||||||
|
* in the list position pointed to by pvIndex. This means that every other
|
||||||
|
* item within the list will be returned by listGET_OWNER_OF_NEXT_ENTRY before
|
||||||
|
* the pvIndex parameter again points to the item being inserted.
|
||||||
|
*
|
||||||
|
* @param pxList The list into which the item is to be inserted.
|
||||||
|
*
|
||||||
|
* @param pxNewListItem The list item to be inserted into the list.
|
||||||
|
*
|
||||||
|
* \page vListInsertEnd vListInsertEnd
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
void vListInsertEnd( xList *pxList, xListItem *pxNewListItem );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove an item from a list. The list item has a pointer to the list that
|
||||||
|
* it is in, so only the list item need be passed into the function.
|
||||||
|
*
|
||||||
|
* @param uxListRemove The item to be removed. The item will remove itself from
|
||||||
|
* the list pointed to by it's pxContainer parameter.
|
||||||
|
*
|
||||||
|
* @return The number of items that remain in the list after the list item has
|
||||||
|
* been removed.
|
||||||
|
*
|
||||||
|
* \page uxListRemove uxListRemove
|
||||||
|
* \ingroup LinkedList
|
||||||
|
*/
|
||||||
|
unsigned portBASE_TYPE uxListRemove( xListItem *pxItemToRemove );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,161 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MPU_WRAPPERS_H
|
||||||
|
#define MPU_WRAPPERS_H
|
||||||
|
|
||||||
|
/* This file redefines API functions to be called through a wrapper macro, but
|
||||||
|
only for ports that are using the MPU. */
|
||||||
|
#ifdef portUSING_MPU_WRAPPERS
|
||||||
|
|
||||||
|
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is
|
||||||
|
included from queue.c or task.c to prevent it from having an effect within
|
||||||
|
those files. */
|
||||||
|
#ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
|
||||||
|
#define xTaskGenericCreate MPU_xTaskGenericCreate
|
||||||
|
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
|
||||||
|
#define vTaskDelete MPU_vTaskDelete
|
||||||
|
#define vTaskDelayUntil MPU_vTaskDelayUntil
|
||||||
|
#define vTaskDelay MPU_vTaskDelay
|
||||||
|
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
|
||||||
|
#define vTaskPrioritySet MPU_vTaskPrioritySet
|
||||||
|
#define eTaskGetState MPU_eTaskGetState
|
||||||
|
#define vTaskSuspend MPU_vTaskSuspend
|
||||||
|
#define xTaskIsTaskSuspended MPU_xTaskIsTaskSuspended
|
||||||
|
#define vTaskResume MPU_vTaskResume
|
||||||
|
#define vTaskSuspendAll MPU_vTaskSuspendAll
|
||||||
|
#define xTaskResumeAll MPU_xTaskResumeAll
|
||||||
|
#define xTaskGetTickCount MPU_xTaskGetTickCount
|
||||||
|
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
|
||||||
|
#define vTaskList MPU_vTaskList
|
||||||
|
#define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
|
||||||
|
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
|
||||||
|
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
|
||||||
|
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
|
||||||
|
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
|
||||||
|
#define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
|
||||||
|
#define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
|
||||||
|
#define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
|
||||||
|
|
||||||
|
#define xQueueGenericCreate MPU_xQueueGenericCreate
|
||||||
|
#define xQueueCreateMutex MPU_xQueueCreateMutex
|
||||||
|
#define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
|
||||||
|
#define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
|
||||||
|
#define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
|
||||||
|
#define xQueueGenericSend MPU_xQueueGenericSend
|
||||||
|
#define xQueueAltGenericSend MPU_xQueueAltGenericSend
|
||||||
|
#define xQueueAltGenericReceive MPU_xQueueAltGenericReceive
|
||||||
|
#define xQueueGenericReceive MPU_xQueueGenericReceive
|
||||||
|
#define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
|
||||||
|
#define vQueueDelete MPU_vQueueDelete
|
||||||
|
#define xQueueGenericReset MPU_xQueueGenericReset
|
||||||
|
#define xQueueCreateSet MPU_xQueueCreateSet
|
||||||
|
#define xQueueSelectFromSet MPU_xQueueSelectFromSet
|
||||||
|
#define xQueueAddToSet MPU_xQueueAddToSet
|
||||||
|
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
|
||||||
|
|
||||||
|
#define pvPortMalloc MPU_pvPortMalloc
|
||||||
|
#define vPortFree MPU_vPortFree
|
||||||
|
#define xPortGetFreeHeapSize MPU_xPortGetFreeHeapSize
|
||||||
|
#define vPortInitialiseBlocks MPU_vPortInitialiseBlocks
|
||||||
|
|
||||||
|
#if configQUEUE_REGISTRY_SIZE > 0
|
||||||
|
#define vQueueAddToRegistry MPU_vQueueAddToRegistry
|
||||||
|
#define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Remove the privileged function macro. */
|
||||||
|
#define PRIVILEGED_FUNCTION
|
||||||
|
|
||||||
|
#else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||||
|
|
||||||
|
/* Ensure API functions go in the privileged execution section. */
|
||||||
|
#define PRIVILEGED_FUNCTION __attribute__((section("privileged_functions")))
|
||||||
|
#define PRIVILEGED_DATA __attribute__((section("privileged_data")))
|
||||||
|
//#define PRIVILEGED_DATA
|
||||||
|
|
||||||
|
#endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
|
||||||
|
|
||||||
|
#else /* portUSING_MPU_WRAPPERS */
|
||||||
|
|
||||||
|
#define PRIVILEGED_FUNCTION
|
||||||
|
#define PRIVILEGED_DATA
|
||||||
|
#define portUSING_MPU_WRAPPERS 0
|
||||||
|
|
||||||
|
#endif /* portUSING_MPU_WRAPPERS */
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* MPU_WRAPPERS_H */
|
||||||
|
|
|
@ -0,0 +1,411 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* Portable layer API. Each function must be defined for each port.
|
||||||
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef PORTABLE_H
|
||||||
|
#define PORTABLE_H
|
||||||
|
|
||||||
|
/* Include the macro file relevant to the port being used. */
|
||||||
|
|
||||||
|
#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT
|
||||||
|
#include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"
|
||||||
|
typedef void ( __interrupt __far *pxISR )();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef OPEN_WATCOM_FLASH_LITE_186_PORT
|
||||||
|
#include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"
|
||||||
|
typedef void ( __interrupt __far *pxISR )();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_MEGA_AVR
|
||||||
|
#include "../portable/GCC/ATMega323/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IAR_MEGA_AVR
|
||||||
|
#include "../portable/IAR/ATMega323/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MPLAB_PIC24_PORT
|
||||||
|
#include "..\..\Source\portable\MPLAB\PIC24_dsPIC\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MPLAB_DSPIC_PORT
|
||||||
|
#include "..\..\Source\portable\MPLAB\PIC24_dsPIC\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MPLAB_PIC18F_PORT
|
||||||
|
#include "..\..\Source\portable\MPLAB\PIC18F\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MPLAB_PIC32MX_PORT
|
||||||
|
#include "..\..\Source\portable\MPLAB\PIC32MX\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _FEDPICC
|
||||||
|
#include "libFreeRTOS/Include/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SDCC_CYGNAL
|
||||||
|
#include "../../Source/portable/SDCC/Cygnal/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_ARM7
|
||||||
|
#include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_ARM7_ECLIPSE
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ROWLEY_LPC23xx
|
||||||
|
#include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IAR_MSP430
|
||||||
|
#include "..\..\Source\portable\IAR\MSP430\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_MSP430
|
||||||
|
#include "../../Source/portable/GCC/MSP430F449/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ROWLEY_MSP430
|
||||||
|
#include "../../Source/portable/Rowley/MSP430F449/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARM7_LPC21xx_KEIL_RVDS
|
||||||
|
#include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SAM7_GCC
|
||||||
|
#include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SAM7_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SAM9XE_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LPC2000_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\LPC2000\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STR71X_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\STR71x\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STR75X_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\STR75x\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STR75X_GCC
|
||||||
|
#include "..\..\Source\portable\GCC\STR75x\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef STR91X_IAR
|
||||||
|
#include "..\..\Source\portable\IAR\STR91x\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_H8S
|
||||||
|
#include "../../Source/portable/GCC/H8S2329/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_AT91FR40008
|
||||||
|
#include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RVDS_ARMCM3_LM3S102
|
||||||
|
#include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_ARMCM3_LM3S102
|
||||||
|
#include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_ARMCM3
|
||||||
|
#include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IAR_ARM_CM3
|
||||||
|
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IAR_ARMCM3_LM
|
||||||
|
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HCS12_CODE_WARRIOR
|
||||||
|
#include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MICROBLAZE_GCC
|
||||||
|
#include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TERN_EE
|
||||||
|
#include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_HCS12
|
||||||
|
#include "../../Source/portable/GCC/HCS12/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_MCF5235
|
||||||
|
#include "../../Source/portable/GCC/MCF5235/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COLDFIRE_V2_GCC
|
||||||
|
#include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef COLDFIRE_V2_CODEWARRIOR
|
||||||
|
#include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_PPC405
|
||||||
|
#include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GCC_PPC440
|
||||||
|
#include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _16FX_SOFTUNE
|
||||||
|
#include "..\..\Source\portable\Softune\MB96340\portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BCC_INDUSTRIAL_PC_PORT
|
||||||
|
/* A short file name has to be used in place of the normal
|
||||||
|
FreeRTOSConfig.h when using the Borland compiler. */
|
||||||
|
#include "frconfig.h"
|
||||||
|
#include "..\portable\BCC\16BitDOS\PC\prtmacro.h"
|
||||||
|
typedef void ( __interrupt __far *pxISR )();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BCC_FLASH_LITE_186_PORT
|
||||||
|
/* A short file name has to be used in place of the normal
|
||||||
|
FreeRTOSConfig.h when using the Borland compiler. */
|
||||||
|
#include "frconfig.h"
|
||||||
|
#include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"
|
||||||
|
typedef void ( __interrupt __far *pxISR )();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#ifdef __AVR32_AVR32A__
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ICCAVR32__
|
||||||
|
#ifdef __CORE__
|
||||||
|
#if __CORE__ == __AVR32A__
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __91467D
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __96340
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __IAR_V850ES_Fx3__
|
||||||
|
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_V850ES_Jx3__
|
||||||
|
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_V850ES_Jx3_L__
|
||||||
|
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_V850ES_Jx2__
|
||||||
|
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_V850ES_Hx2__
|
||||||
|
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_78K0R_Kx3__
|
||||||
|
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __IAR_78K0R_Kx3L__
|
||||||
|
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Catch all to ensure portmacro.h is included in the build. Newer demos
|
||||||
|
have the path as part of the project options, rather than as relative from
|
||||||
|
the project location. If portENTER_CRITICAL() has not been defined then
|
||||||
|
portmacro.h has not yet been included - as every portmacro.h provides a
|
||||||
|
portENTER_CRITICAL() definition. Check the demo application for your demo
|
||||||
|
to find the path to the correct portmacro.h file. */
|
||||||
|
#ifndef portENTER_CRITICAL
|
||||||
|
#include "portmacro.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 8
|
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0007 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 4
|
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0003 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 2
|
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0001 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if portBYTE_ALIGNMENT == 1
|
||||||
|
#define portBYTE_ALIGNMENT_MASK ( 0x0000 )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portBYTE_ALIGNMENT_MASK
|
||||||
|
#error "Invalid portBYTE_ALIGNMENT definition"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef portNUM_CONFIGURABLE_REGIONS
|
||||||
|
#define portNUM_CONFIGURABLE_REGIONS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "mpu_wrappers.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup the stack of a new task so it is ready to be placed under the
|
||||||
|
* scheduler control. The registers have to be placed on the stack in
|
||||||
|
* the order that the port expects to find them.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||||
|
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;
|
||||||
|
#else
|
||||||
|
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Map to the memory management routines required for the port.
|
||||||
|
*/
|
||||||
|
void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION;
|
||||||
|
void vPortFree( void *pv ) PRIVILEGED_FUNCTION;
|
||||||
|
void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
|
||||||
|
size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup the hardware ready for the scheduler to take control. This generally
|
||||||
|
* sets up a tick interrupt and sets timers for the correct tick frequency.
|
||||||
|
*/
|
||||||
|
portBASE_TYPE xPortStartScheduler( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Undo any hardware/ISR setup that was performed by xPortStartScheduler() so
|
||||||
|
* the hardware is left in its original condition after the scheduler stops
|
||||||
|
* executing.
|
||||||
|
*/
|
||||||
|
void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The structures and methods of manipulating the MPU are contained within the
|
||||||
|
* port layer.
|
||||||
|
*
|
||||||
|
* Fills the xMPUSettings structure with the memory region information
|
||||||
|
* contained in xRegions.
|
||||||
|
*/
|
||||||
|
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||||
|
struct xMEMORY_REGION;
|
||||||
|
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PORTABLE_H */
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PROJDEFS_H
|
||||||
|
#define PROJDEFS_H
|
||||||
|
|
||||||
|
/* Defines the prototype to which task functions must conform. */
|
||||||
|
typedef void (*pdTASK_CODE)( void * );
|
||||||
|
|
||||||
|
#define pdTRUE ( 1 )
|
||||||
|
#define pdFALSE ( 0 )
|
||||||
|
|
||||||
|
#define pdPASS ( 1 )
|
||||||
|
#define pdFAIL ( 0 )
|
||||||
|
#define errQUEUE_EMPTY ( 0 )
|
||||||
|
#define errQUEUE_FULL ( 0 )
|
||||||
|
|
||||||
|
/* Error definitions. */
|
||||||
|
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
|
||||||
|
#define errNO_TASK_TO_RUN ( -2 )
|
||||||
|
#define errQUEUE_BLOCKED ( -4 )
|
||||||
|
#define errQUEUE_YIELD ( -5 )
|
||||||
|
|
||||||
|
#endif /* PROJDEFS_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
1458
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/include/queue.h
Normal file
1458
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/include/queue.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,795 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SEMAPHORE_H
|
||||||
|
#define SEMAPHORE_H
|
||||||
|
|
||||||
|
#ifndef INC_FREERTOS_H
|
||||||
|
#error "include FreeRTOS.h" must appear in source files before "include semphr.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "queue.h"
|
||||||
|
|
||||||
|
typedef xQueueHandle xSemaphoreHandle;
|
||||||
|
|
||||||
|
#define semBINARY_SEMAPHORE_QUEUE_LENGTH ( ( unsigned char ) 1U )
|
||||||
|
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( unsigned char ) 0U )
|
||||||
|
#define semGIVE_BLOCK_TIME ( ( portTickType ) 0U )
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>vSemaphoreCreateBinary( xSemaphoreHandle xSemaphore )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> that implements a semaphore by using the existing queue mechanism.
|
||||||
|
* The queue length is 1 as this is a binary semaphore. The data size is 0
|
||||||
|
* as we don't want to actually store any data - we just want to know if the
|
||||||
|
* queue is empty or full.
|
||||||
|
*
|
||||||
|
* This type of semaphore can be used for pure synchronisation between tasks or
|
||||||
|
* between an interrupt and a task. The semaphore need not be given back once
|
||||||
|
* obtained, so one task/interrupt can continuously 'give' the semaphore while
|
||||||
|
* another continuously 'takes' the semaphore. For this reason this type of
|
||||||
|
* semaphore does not use a priority inheritance mechanism. For an alternative
|
||||||
|
* that does use priority inheritance see xSemaphoreCreateMutex().
|
||||||
|
*
|
||||||
|
* @param xSemaphore Handle to the created semaphore. Should be of type xSemaphoreHandle.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
xSemaphoreHandle xSemaphore;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Semaphore cannot be used before a call to vSemaphoreCreateBinary ().
|
||||||
|
// This is a macro so pass the variable in directly.
|
||||||
|
vSemaphoreCreateBinary( xSemaphore );
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// The semaphore was created successfully.
|
||||||
|
// The semaphore can now be used.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define vSemaphoreCreateBinary( xSemaphore ) \
|
||||||
|
{ \
|
||||||
|
( xSemaphore ) = xQueueGenericCreate( ( unsigned portBASE_TYPE ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE ); \
|
||||||
|
if( ( xSemaphore ) != NULL ) \
|
||||||
|
{ \
|
||||||
|
xSemaphoreGive( ( xSemaphore ) ); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>xSemaphoreTake(
|
||||||
|
* xSemaphoreHandle xSemaphore,
|
||||||
|
* portTickType xBlockTime
|
||||||
|
* )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to obtain a semaphore. The semaphore must have previously been
|
||||||
|
* created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
|
||||||
|
* xSemaphoreCreateCounting().
|
||||||
|
*
|
||||||
|
* @param xSemaphore A handle to the semaphore being taken - obtained when
|
||||||
|
* the semaphore was created.
|
||||||
|
*
|
||||||
|
* @param xBlockTime The time in ticks to wait for the semaphore to become
|
||||||
|
* available. The macro portTICK_RATE_MS can be used to convert this to a
|
||||||
|
* real time. A block time of zero can be used to poll the semaphore. A block
|
||||||
|
* time of portMAX_DELAY can be used to block indefinitely (provided
|
||||||
|
* INCLUDE_vTaskSuspend is set to 1 in FreeRTOSConfig.h).
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was obtained. pdFALSE
|
||||||
|
* if xBlockTime expired without the semaphore becoming available.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
xSemaphoreHandle xSemaphore = NULL;
|
||||||
|
|
||||||
|
// A task that creates a semaphore.
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Create the semaphore to guard a shared resource.
|
||||||
|
vSemaphoreCreateBinary( xSemaphore );
|
||||||
|
}
|
||||||
|
|
||||||
|
// A task that uses the semaphore.
|
||||||
|
void vAnotherTask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// ... Do other things.
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// See if we can obtain the semaphore. If the semaphore is not available
|
||||||
|
// wait 10 ticks to see if it becomes free.
|
||||||
|
if( xSemaphoreTake( xSemaphore, ( portTickType ) 10 ) == pdTRUE )
|
||||||
|
{
|
||||||
|
// We were able to obtain the semaphore and can now access the
|
||||||
|
// shared resource.
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// We have finished accessing the shared resource. Release the
|
||||||
|
// semaphore.
|
||||||
|
xSemaphoreGive( xSemaphore );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We could not obtain the semaphore and can therefore not access
|
||||||
|
// the shared resource safely.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreTake xSemaphoreTake
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreTake( xSemaphore, xBlockTime ) xQueueGenericReceive( ( xQueueHandle ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* xSemaphoreTakeRecursive(
|
||||||
|
* xSemaphoreHandle xMutex,
|
||||||
|
* portTickType xBlockTime
|
||||||
|
* )
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to recursively obtain, or 'take', a mutex type semaphore.
|
||||||
|
* The mutex must have previously been created using a call to
|
||||||
|
* xSemaphoreCreateRecursiveMutex();
|
||||||
|
*
|
||||||
|
* configUSE_RECURSIVE_MUTEXES must be set to 1 in FreeRTOSConfig.h for this
|
||||||
|
* macro to be available.
|
||||||
|
*
|
||||||
|
* This macro must not be used on mutexes created using xSemaphoreCreateMutex().
|
||||||
|
*
|
||||||
|
* A mutex used recursively can be 'taken' repeatedly by the owner. The mutex
|
||||||
|
* doesn't become available again until the owner has called
|
||||||
|
* xSemaphoreGiveRecursive() for each successful 'take' request. For example,
|
||||||
|
* if a task successfully 'takes' the same mutex 5 times then the mutex will
|
||||||
|
* not be available to any other task until it has also 'given' the mutex back
|
||||||
|
* exactly five times.
|
||||||
|
*
|
||||||
|
* @param xMutex A handle to the mutex being obtained. This is the
|
||||||
|
* handle returned by xSemaphoreCreateRecursiveMutex();
|
||||||
|
*
|
||||||
|
* @param xBlockTime The time in ticks to wait for the semaphore to become
|
||||||
|
* available. The macro portTICK_RATE_MS can be used to convert this to a
|
||||||
|
* real time. A block time of zero can be used to poll the semaphore. If
|
||||||
|
* the task already owns the semaphore then xSemaphoreTakeRecursive() will
|
||||||
|
* return immediately no matter what the value of xBlockTime.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was obtained. pdFALSE if xBlockTime
|
||||||
|
* expired without the semaphore becoming available.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
xSemaphoreHandle xMutex = NULL;
|
||||||
|
|
||||||
|
// A task that creates a mutex.
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Create the mutex to guard a shared resource.
|
||||||
|
xMutex = xSemaphoreCreateRecursiveMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
// A task that uses the mutex.
|
||||||
|
void vAnotherTask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// ... Do other things.
|
||||||
|
|
||||||
|
if( xMutex != NULL )
|
||||||
|
{
|
||||||
|
// See if we can obtain the mutex. If the mutex is not available
|
||||||
|
// wait 10 ticks to see if it becomes free.
|
||||||
|
if( xSemaphoreTakeRecursive( xSemaphore, ( portTickType ) 10 ) == pdTRUE )
|
||||||
|
{
|
||||||
|
// We were able to obtain the mutex and can now access the
|
||||||
|
// shared resource.
|
||||||
|
|
||||||
|
// ...
|
||||||
|
// For some reason due to the nature of the code further calls to
|
||||||
|
// xSemaphoreTakeRecursive() are made on the same mutex. In real
|
||||||
|
// code these would not be just sequential calls as this would make
|
||||||
|
// no sense. Instead the calls are likely to be buried inside
|
||||||
|
// a more complex call structure.
|
||||||
|
xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
|
||||||
|
xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
|
||||||
|
|
||||||
|
// The mutex has now been 'taken' three times, so will not be
|
||||||
|
// available to another task until it has also been given back
|
||||||
|
// three times. Again it is unlikely that real code would have
|
||||||
|
// these calls sequentially, but instead buried in a more complex
|
||||||
|
// call structure. This is just for illustrative purposes.
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
|
||||||
|
// Now the mutex can be taken by other tasks.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We could not obtain the mutex and can therefore not access
|
||||||
|
// the shared resource safely.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreTakeRecursive( xMutex, xBlockTime ) xQueueTakeMutexRecursive( ( xMutex ), ( xBlockTime ) )
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* xSemaphoreAltTake() is an alternative version of xSemaphoreTake().
|
||||||
|
*
|
||||||
|
* The source code that implements the alternative (Alt) API is much
|
||||||
|
* simpler because it executes everything from within a critical section.
|
||||||
|
* This is the approach taken by many other RTOSes, but FreeRTOS.org has the
|
||||||
|
* preferred fully featured API too. The fully featured API has more
|
||||||
|
* complex code that takes longer to execute, but makes much less use of
|
||||||
|
* critical sections. Therefore the alternative API sacrifices interrupt
|
||||||
|
* responsiveness to gain execution speed, whereas the fully featured API
|
||||||
|
* sacrifices execution speed to ensure better interrupt responsiveness.
|
||||||
|
*/
|
||||||
|
#define xSemaphoreAltTake( xSemaphore, xBlockTime ) xQueueAltGenericReceive( ( xQueueHandle ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>xSemaphoreGive( xSemaphoreHandle xSemaphore )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
|
||||||
|
* created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
|
||||||
|
* xSemaphoreCreateCounting(). and obtained using sSemaphoreTake().
|
||||||
|
*
|
||||||
|
* This macro must not be used from an ISR. See xSemaphoreGiveFromISR () for
|
||||||
|
* an alternative which can be used from an ISR.
|
||||||
|
*
|
||||||
|
* This macro must also not be used on semaphores created using
|
||||||
|
* xSemaphoreCreateRecursiveMutex().
|
||||||
|
*
|
||||||
|
* @param xSemaphore A handle to the semaphore being released. This is the
|
||||||
|
* handle returned when the semaphore was created.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was released. pdFALSE if an error occurred.
|
||||||
|
* Semaphores are implemented using queues. An error can occur if there is
|
||||||
|
* no space on the queue to post a message - indicating that the
|
||||||
|
* semaphore was not first obtained correctly.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
xSemaphoreHandle xSemaphore = NULL;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Create the semaphore to guard a shared resource.
|
||||||
|
vSemaphoreCreateBinary( xSemaphore );
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
if( xSemaphoreGive( xSemaphore ) != pdTRUE )
|
||||||
|
{
|
||||||
|
// We would expect this call to fail because we cannot give
|
||||||
|
// a semaphore without first "taking" it!
|
||||||
|
}
|
||||||
|
|
||||||
|
// Obtain the semaphore - don't block if the semaphore is not
|
||||||
|
// immediately available.
|
||||||
|
if( xSemaphoreTake( xSemaphore, ( portTickType ) 0 ) )
|
||||||
|
{
|
||||||
|
// We now have the semaphore and can access the shared resource.
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// We have finished accessing the shared resource so can free the
|
||||||
|
// semaphore.
|
||||||
|
if( xSemaphoreGive( xSemaphore ) != pdTRUE )
|
||||||
|
{
|
||||||
|
// We would not expect this call to fail because we must have
|
||||||
|
// obtained the semaphore to get here.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreGive xSemaphoreGive
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreGive( xSemaphore ) xQueueGenericSend( ( xQueueHandle ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>xSemaphoreGiveRecursive( xSemaphoreHandle xMutex )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to recursively release, or 'give', a mutex type semaphore.
|
||||||
|
* The mutex must have previously been created using a call to
|
||||||
|
* xSemaphoreCreateRecursiveMutex();
|
||||||
|
*
|
||||||
|
* configUSE_RECURSIVE_MUTEXES must be set to 1 in FreeRTOSConfig.h for this
|
||||||
|
* macro to be available.
|
||||||
|
*
|
||||||
|
* This macro must not be used on mutexes created using xSemaphoreCreateMutex().
|
||||||
|
*
|
||||||
|
* A mutex used recursively can be 'taken' repeatedly by the owner. The mutex
|
||||||
|
* doesn't become available again until the owner has called
|
||||||
|
* xSemaphoreGiveRecursive() for each successful 'take' request. For example,
|
||||||
|
* if a task successfully 'takes' the same mutex 5 times then the mutex will
|
||||||
|
* not be available to any other task until it has also 'given' the mutex back
|
||||||
|
* exactly five times.
|
||||||
|
*
|
||||||
|
* @param xMutex A handle to the mutex being released, or 'given'. This is the
|
||||||
|
* handle returned by xSemaphoreCreateMutex();
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was given.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
xSemaphoreHandle xMutex = NULL;
|
||||||
|
|
||||||
|
// A task that creates a mutex.
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Create the mutex to guard a shared resource.
|
||||||
|
xMutex = xSemaphoreCreateRecursiveMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
// A task that uses the mutex.
|
||||||
|
void vAnotherTask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// ... Do other things.
|
||||||
|
|
||||||
|
if( xMutex != NULL )
|
||||||
|
{
|
||||||
|
// See if we can obtain the mutex. If the mutex is not available
|
||||||
|
// wait 10 ticks to see if it becomes free.
|
||||||
|
if( xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 ) == pdTRUE )
|
||||||
|
{
|
||||||
|
// We were able to obtain the mutex and can now access the
|
||||||
|
// shared resource.
|
||||||
|
|
||||||
|
// ...
|
||||||
|
// For some reason due to the nature of the code further calls to
|
||||||
|
// xSemaphoreTakeRecursive() are made on the same mutex. In real
|
||||||
|
// code these would not be just sequential calls as this would make
|
||||||
|
// no sense. Instead the calls are likely to be buried inside
|
||||||
|
// a more complex call structure.
|
||||||
|
xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
|
||||||
|
xSemaphoreTakeRecursive( xMutex, ( portTickType ) 10 );
|
||||||
|
|
||||||
|
// The mutex has now been 'taken' three times, so will not be
|
||||||
|
// available to another task until it has also been given back
|
||||||
|
// three times. Again it is unlikely that real code would have
|
||||||
|
// these calls sequentially, it would be more likely that the calls
|
||||||
|
// to xSemaphoreGiveRecursive() would be called as a call stack
|
||||||
|
// unwound. This is just for demonstrative purposes.
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
xSemaphoreGiveRecursive( xMutex );
|
||||||
|
|
||||||
|
// Now the mutex can be taken by other tasks.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We could not obtain the mutex and can therefore not access
|
||||||
|
// the shared resource safely.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreGiveRecursive xSemaphoreGiveRecursive
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreGiveRecursive( xMutex ) xQueueGiveMutexRecursive( ( xMutex ) )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* xSemaphoreAltGive() is an alternative version of xSemaphoreGive().
|
||||||
|
*
|
||||||
|
* The source code that implements the alternative (Alt) API is much
|
||||||
|
* simpler because it executes everything from within a critical section.
|
||||||
|
* This is the approach taken by many other RTOSes, but FreeRTOS.org has the
|
||||||
|
* preferred fully featured API too. The fully featured API has more
|
||||||
|
* complex code that takes longer to execute, but makes much less use of
|
||||||
|
* critical sections. Therefore the alternative API sacrifices interrupt
|
||||||
|
* responsiveness to gain execution speed, whereas the fully featured API
|
||||||
|
* sacrifices execution speed to ensure better interrupt responsiveness.
|
||||||
|
*/
|
||||||
|
#define xSemaphoreAltGive( xSemaphore ) xQueueAltGenericSend( ( xQueueHandle ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>
|
||||||
|
xSemaphoreGiveFromISR(
|
||||||
|
xSemaphoreHandle xSemaphore,
|
||||||
|
signed portBASE_TYPE *pxHigherPriorityTaskWoken
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
|
||||||
|
* created with a call to vSemaphoreCreateBinary() or xSemaphoreCreateCounting().
|
||||||
|
*
|
||||||
|
* Mutex type semaphores (those created using a call to xSemaphoreCreateMutex())
|
||||||
|
* must not be used with this macro.
|
||||||
|
*
|
||||||
|
* This macro can be used from an ISR.
|
||||||
|
*
|
||||||
|
* @param xSemaphore A handle to the semaphore being released. This is the
|
||||||
|
* handle returned when the semaphore was created.
|
||||||
|
*
|
||||||
|
* @param pxHigherPriorityTaskWoken xSemaphoreGiveFromISR() will set
|
||||||
|
* *pxHigherPriorityTaskWoken to pdTRUE if giving the semaphore caused a task
|
||||||
|
* to unblock, and the unblocked task has a priority higher than the currently
|
||||||
|
* running task. If xSemaphoreGiveFromISR() sets this value to pdTRUE then
|
||||||
|
* a context switch should be requested before the interrupt is exited.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was successfully given, otherwise errQUEUE_FULL.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
\#define LONG_TIME 0xffff
|
||||||
|
\#define TICKS_TO_WAIT 10
|
||||||
|
xSemaphoreHandle xSemaphore = NULL;
|
||||||
|
|
||||||
|
// Repetitive task.
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
// We want this task to run every 10 ticks of a timer. The semaphore
|
||||||
|
// was created before this task was started.
|
||||||
|
|
||||||
|
// Block waiting for the semaphore to become available.
|
||||||
|
if( xSemaphoreTake( xSemaphore, LONG_TIME ) == pdTRUE )
|
||||||
|
{
|
||||||
|
// It is time to execute.
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
// We have finished our task. Return to the top of the loop where
|
||||||
|
// we will block on the semaphore until it is time to execute
|
||||||
|
// again. Note when using the semaphore for synchronisation with an
|
||||||
|
// ISR in this manner there is no need to 'give' the semaphore back.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Timer ISR
|
||||||
|
void vTimerISR( void * pvParameters )
|
||||||
|
{
|
||||||
|
static unsigned char ucLocalTickCount = 0;
|
||||||
|
static signed portBASE_TYPE xHigherPriorityTaskWoken;
|
||||||
|
|
||||||
|
// A timer tick has occurred.
|
||||||
|
|
||||||
|
// ... Do other time functions.
|
||||||
|
|
||||||
|
// Is it time for vATask () to run?
|
||||||
|
xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
ucLocalTickCount++;
|
||||||
|
if( ucLocalTickCount >= TICKS_TO_WAIT )
|
||||||
|
{
|
||||||
|
// Unblock the task by releasing the semaphore.
|
||||||
|
xSemaphoreGiveFromISR( xSemaphore, &xHigherPriorityTaskWoken );
|
||||||
|
|
||||||
|
// Reset the count so we release the semaphore again in 10 ticks time.
|
||||||
|
ucLocalTickCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xHigherPriorityTaskWoken != pdFALSE )
|
||||||
|
{
|
||||||
|
// We can force a context switch here. Context switching from an
|
||||||
|
// ISR uses port specific syntax. Check the demo task for your port
|
||||||
|
// to find the syntax required.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( xQueueHandle ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>
|
||||||
|
xSemaphoreTakeFromISR(
|
||||||
|
xSemaphoreHandle xSemaphore,
|
||||||
|
signed portBASE_TYPE *pxHigherPriorityTaskWoken
|
||||||
|
)</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> to take a semaphore from an ISR. The semaphore must have
|
||||||
|
* previously been created with a call to vSemaphoreCreateBinary() or
|
||||||
|
* xSemaphoreCreateCounting().
|
||||||
|
*
|
||||||
|
* Mutex type semaphores (those created using a call to xSemaphoreCreateMutex())
|
||||||
|
* must not be used with this macro.
|
||||||
|
*
|
||||||
|
* This macro can be used from an ISR, however taking a semaphore from an ISR
|
||||||
|
* is not a common operation. It is likely to only be useful when taking a
|
||||||
|
* counting semaphore when an interrupt is obtaining an object from a resource
|
||||||
|
* pool (when the semaphore count indicates the number of resources available).
|
||||||
|
*
|
||||||
|
* @param xSemaphore A handle to the semaphore being taken. This is the
|
||||||
|
* handle returned when the semaphore was created.
|
||||||
|
*
|
||||||
|
* @param pxHigherPriorityTaskWoken xSemaphoreTakeFromISR() will set
|
||||||
|
* *pxHigherPriorityTaskWoken to pdTRUE if taking the semaphore caused a task
|
||||||
|
* to unblock, and the unblocked task has a priority higher than the currently
|
||||||
|
* running task. If xSemaphoreTakeFromISR() sets this value to pdTRUE then
|
||||||
|
* a context switch should be requested before the interrupt is exited.
|
||||||
|
*
|
||||||
|
* @return pdTRUE if the semaphore was successfully taken, otherwise
|
||||||
|
* pdFALSE
|
||||||
|
*/
|
||||||
|
#define xSemaphoreTakeFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueReceiveFromISR( ( xQueueHandle ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>xSemaphoreHandle xSemaphoreCreateMutex( void )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> that implements a mutex semaphore by using the existing queue
|
||||||
|
* mechanism.
|
||||||
|
*
|
||||||
|
* Mutexes created using this macro can be accessed using the xSemaphoreTake()
|
||||||
|
* and xSemaphoreGive() macros. The xSemaphoreTakeRecursive() and
|
||||||
|
* xSemaphoreGiveRecursive() macros should not be used.
|
||||||
|
*
|
||||||
|
* This type of semaphore uses a priority inheritance mechanism so a task
|
||||||
|
* 'taking' a semaphore MUST ALWAYS 'give' the semaphore back once the
|
||||||
|
* semaphore it is no longer required.
|
||||||
|
*
|
||||||
|
* Mutex type semaphores cannot be used from within interrupt service routines.
|
||||||
|
*
|
||||||
|
* See vSemaphoreCreateBinary() for an alternative implementation that can be
|
||||||
|
* used for pure synchronisation (where one task or interrupt always 'gives' the
|
||||||
|
* semaphore and another always 'takes' the semaphore) and from within interrupt
|
||||||
|
* service routines.
|
||||||
|
*
|
||||||
|
* @return xSemaphore Handle to the created mutex semaphore. Should be of type
|
||||||
|
* xSemaphoreHandle.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
xSemaphoreHandle xSemaphore;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Semaphore cannot be used before a call to xSemaphoreCreateMutex().
|
||||||
|
// This is a macro so pass the variable in directly.
|
||||||
|
xSemaphore = xSemaphoreCreateMutex();
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// The semaphore was created successfully.
|
||||||
|
// The semaphore can now be used.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup vSemaphoreCreateMutex vSemaphoreCreateMutex
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>xSemaphoreHandle xSemaphoreCreateRecursiveMutex( void )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> that implements a recursive mutex by using the existing queue
|
||||||
|
* mechanism.
|
||||||
|
*
|
||||||
|
* Mutexes created using this macro can be accessed using the
|
||||||
|
* xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive() macros. The
|
||||||
|
* xSemaphoreTake() and xSemaphoreGive() macros should not be used.
|
||||||
|
*
|
||||||
|
* A mutex used recursively can be 'taken' repeatedly by the owner. The mutex
|
||||||
|
* doesn't become available again until the owner has called
|
||||||
|
* xSemaphoreGiveRecursive() for each successful 'take' request. For example,
|
||||||
|
* if a task successfully 'takes' the same mutex 5 times then the mutex will
|
||||||
|
* not be available to any other task until it has also 'given' the mutex back
|
||||||
|
* exactly five times.
|
||||||
|
*
|
||||||
|
* This type of semaphore uses a priority inheritance mechanism so a task
|
||||||
|
* 'taking' a semaphore MUST ALWAYS 'give' the semaphore back once the
|
||||||
|
* semaphore it is no longer required.
|
||||||
|
*
|
||||||
|
* Mutex type semaphores cannot be used from within interrupt service routines.
|
||||||
|
*
|
||||||
|
* See vSemaphoreCreateBinary() for an alternative implementation that can be
|
||||||
|
* used for pure synchronisation (where one task or interrupt always 'gives' the
|
||||||
|
* semaphore and another always 'takes' the semaphore) and from within interrupt
|
||||||
|
* service routines.
|
||||||
|
*
|
||||||
|
* @return xSemaphore Handle to the created mutex semaphore. Should be of type
|
||||||
|
* xSemaphoreHandle.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
xSemaphoreHandle xSemaphore;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
// Semaphore cannot be used before a call to xSemaphoreCreateMutex().
|
||||||
|
// This is a macro so pass the variable in directly.
|
||||||
|
xSemaphore = xSemaphoreCreateRecursiveMutex();
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// The semaphore was created successfully.
|
||||||
|
// The semaphore can now be used.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup vSemaphoreCreateMutex vSemaphoreCreateMutex
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreCreateRecursiveMutex() xQueueCreateMutex( queueQUEUE_TYPE_RECURSIVE_MUTEX )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>xSemaphoreHandle xSemaphoreCreateCounting( unsigned portBASE_TYPE uxMaxCount, unsigned portBASE_TYPE uxInitialCount )</pre>
|
||||||
|
*
|
||||||
|
* <i>Macro</i> that creates a counting semaphore by using the existing
|
||||||
|
* queue mechanism.
|
||||||
|
*
|
||||||
|
* Counting semaphores are typically used for two things:
|
||||||
|
*
|
||||||
|
* 1) Counting events.
|
||||||
|
*
|
||||||
|
* In this usage scenario an event handler will 'give' a semaphore each time
|
||||||
|
* an event occurs (incrementing the semaphore count value), and a handler
|
||||||
|
* task will 'take' a semaphore each time it processes an event
|
||||||
|
* (decrementing the semaphore count value). The count value is therefore
|
||||||
|
* the difference between the number of events that have occurred and the
|
||||||
|
* number that have been processed. In this case it is desirable for the
|
||||||
|
* initial count value to be zero.
|
||||||
|
*
|
||||||
|
* 2) Resource management.
|
||||||
|
*
|
||||||
|
* In this usage scenario the count value indicates the number of resources
|
||||||
|
* available. To obtain control of a resource a task must first obtain a
|
||||||
|
* semaphore - decrementing the semaphore count value. When the count value
|
||||||
|
* reaches zero there are no free resources. When a task finishes with the
|
||||||
|
* resource it 'gives' the semaphore back - incrementing the semaphore count
|
||||||
|
* value. In this case it is desirable for the initial count value to be
|
||||||
|
* equal to the maximum count value, indicating that all resources are free.
|
||||||
|
*
|
||||||
|
* @param uxMaxCount The maximum count value that can be reached. When the
|
||||||
|
* semaphore reaches this value it can no longer be 'given'.
|
||||||
|
*
|
||||||
|
* @param uxInitialCount The count value assigned to the semaphore when it is
|
||||||
|
* created.
|
||||||
|
*
|
||||||
|
* @return Handle to the created semaphore. Null if the semaphore could not be
|
||||||
|
* created.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
<pre>
|
||||||
|
xSemaphoreHandle xSemaphore;
|
||||||
|
|
||||||
|
void vATask( void * pvParameters )
|
||||||
|
{
|
||||||
|
xSemaphoreHandle xSemaphore = NULL;
|
||||||
|
|
||||||
|
// Semaphore cannot be used before a call to xSemaphoreCreateCounting().
|
||||||
|
// The max value to which the semaphore can count should be 10, and the
|
||||||
|
// initial value assigned to the count should be 0.
|
||||||
|
xSemaphore = xSemaphoreCreateCounting( 10, 0 );
|
||||||
|
|
||||||
|
if( xSemaphore != NULL )
|
||||||
|
{
|
||||||
|
// The semaphore was created successfully.
|
||||||
|
// The semaphore can now be used.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
* \defgroup xSemaphoreCreateCounting xSemaphoreCreateCounting
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ) xQueueCreateCountingSemaphore( ( uxMaxCount ), ( uxInitialCount ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr. h
|
||||||
|
* <pre>void vSemaphoreDelete( xSemaphoreHandle xSemaphore );</pre>
|
||||||
|
*
|
||||||
|
* Delete a semaphore. This function must be used with care. For example,
|
||||||
|
* do not delete a mutex type semaphore if the mutex is held by a task.
|
||||||
|
*
|
||||||
|
* @param xSemaphore A handle to the semaphore to be deleted.
|
||||||
|
*
|
||||||
|
* \page vSemaphoreDelete vSemaphoreDelete
|
||||||
|
* \ingroup Semaphores
|
||||||
|
*/
|
||||||
|
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( xQueueHandle ) ( xSemaphore ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* semphr.h
|
||||||
|
* <pre>xTaskHandle xSemaphoreGetMutexHolder( xSemaphoreHandle xMutex );</pre>
|
||||||
|
*
|
||||||
|
* If xMutex is indeed a mutex type semaphore, return the current mutex holder.
|
||||||
|
* If xMutex is not a mutex type semaphore, or the mutex is available (not held
|
||||||
|
* by a task), return NULL.
|
||||||
|
*
|
||||||
|
* Note: This Is is a good way of determining if the calling task is the mutex
|
||||||
|
* holder, but not a good way of determining the identity of the mutex holder as
|
||||||
|
* the holder may change between the function exiting and the returned value
|
||||||
|
* being tested.
|
||||||
|
*/
|
||||||
|
#define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) )
|
||||||
|
|
||||||
|
#endif /* SEMAPHORE_H */
|
||||||
|
|
||||||
|
|
1369
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/include/task.h
Normal file
1369
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/include/task.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,960 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef TIMERS_H
|
||||||
|
#define TIMERS_H
|
||||||
|
|
||||||
|
#ifndef INC_FREERTOS_H
|
||||||
|
#error "include FreeRTOS.h must appear in source files before include timers.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "portable.h"
|
||||||
|
#include "list.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* IDs for commands that can be sent/received on the timer queue. These are to
|
||||||
|
be used solely through the macros that make up the public software timer API,
|
||||||
|
as defined below. */
|
||||||
|
#define tmrCOMMAND_START 0
|
||||||
|
#define tmrCOMMAND_STOP 1
|
||||||
|
#define tmrCOMMAND_CHANGE_PERIOD 2
|
||||||
|
#define tmrCOMMAND_DELETE 3
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* MACROS AND DEFINITIONS
|
||||||
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type by which software timers are referenced. For example, a call to
|
||||||
|
* xTimerCreate() returns an xTimerHandle variable that can then be used to
|
||||||
|
* reference the subject timer in calls to other software timer API functions
|
||||||
|
* (for example, xTimerStart(), xTimerReset(), etc.).
|
||||||
|
*/
|
||||||
|
typedef void * xTimerHandle;
|
||||||
|
|
||||||
|
/* Define the prototype to which timer callback functions must conform. */
|
||||||
|
typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xTimerHandle xTimerCreate( const signed char *pcTimerName,
|
||||||
|
* portTickType xTimerPeriodInTicks,
|
||||||
|
* unsigned portBASE_TYPE uxAutoReload,
|
||||||
|
* void * pvTimerID,
|
||||||
|
* tmrTIMER_CALLBACK pxCallbackFunction );
|
||||||
|
*
|
||||||
|
* Creates a new software timer instance. This allocates the storage required
|
||||||
|
* by the new timer, initialises the new timers internal state, and returns a
|
||||||
|
* handle by which the new timer can be referenced.
|
||||||
|
*
|
||||||
|
* Timers are created in the dormant state. The xTimerStart(), xTimerReset(),
|
||||||
|
* xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and
|
||||||
|
* xTimerChangePeriodFromISR() API functions can all be used to transition a timer into the
|
||||||
|
* active state.
|
||||||
|
*
|
||||||
|
* @param pcTimerName A text name that is assigned to the timer. This is done
|
||||||
|
* purely to assist debugging. The kernel itself only ever references a timer by
|
||||||
|
* its handle, and never by its name.
|
||||||
|
*
|
||||||
|
* @param xTimerPeriodInTicks The timer period. The time is defined in tick periods so
|
||||||
|
* the constant portTICK_RATE_MS can be used to convert a time that has been
|
||||||
|
* specified in milliseconds. For example, if the timer must expire after 100
|
||||||
|
* ticks, then xTimerPeriodInTicks should be set to 100. Alternatively, if the timer
|
||||||
|
* must expire after 500ms, then xPeriod can be set to ( 500 / portTICK_RATE_MS )
|
||||||
|
* provided configTICK_RATE_HZ is less than or equal to 1000.
|
||||||
|
*
|
||||||
|
* @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will
|
||||||
|
* expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter. If
|
||||||
|
* uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and
|
||||||
|
* enter the dormant state after it expires.
|
||||||
|
*
|
||||||
|
* @param pvTimerID An identifier that is assigned to the timer being created.
|
||||||
|
* Typically this would be used in the timer callback function to identify which
|
||||||
|
* timer expired when the same callback function is assigned to more than one
|
||||||
|
* timer.
|
||||||
|
*
|
||||||
|
* @param pxCallbackFunction The function to call when the timer expires.
|
||||||
|
* Callback functions must have the prototype defined by tmrTIMER_CALLBACK,
|
||||||
|
* which is "void vCallbackFunction( xTimerHandle xTimer );".
|
||||||
|
*
|
||||||
|
* @return If the timer is successfully create then a handle to the newly
|
||||||
|
* created timer is returned. If the timer cannot be created (because either
|
||||||
|
* there is insufficient FreeRTOS heap remaining to allocate the timer
|
||||||
|
* structures, or the timer period was set to 0) then 0 is returned.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* #define NUM_TIMERS 5
|
||||||
|
*
|
||||||
|
* // An array to hold handles to the created timers.
|
||||||
|
* xTimerHandle xTimers[ NUM_TIMERS ];
|
||||||
|
*
|
||||||
|
* // An array to hold a count of the number of times each timer expires.
|
||||||
|
* long lExpireCounters[ NUM_TIMERS ] = { 0 };
|
||||||
|
*
|
||||||
|
* // Define a callback function that will be used by multiple timer instances.
|
||||||
|
* // The callback function does nothing but count the number of times the
|
||||||
|
* // associated timer expires, and stop the timer once the timer has expired
|
||||||
|
* // 10 times.
|
||||||
|
* void vTimerCallback( xTimerHandle pxTimer )
|
||||||
|
* {
|
||||||
|
* long lArrayIndex;
|
||||||
|
* const long xMaxExpiryCountBeforeStopping = 10;
|
||||||
|
*
|
||||||
|
* // Optionally do something if the pxTimer parameter is NULL.
|
||||||
|
* configASSERT( pxTimer );
|
||||||
|
*
|
||||||
|
* // Which timer expired?
|
||||||
|
* lArrayIndex = ( long ) pvTimerGetTimerID( pxTimer );
|
||||||
|
*
|
||||||
|
* // Increment the number of times that pxTimer has expired.
|
||||||
|
* lExpireCounters[ lArrayIndex ] += 1;
|
||||||
|
*
|
||||||
|
* // If the timer has expired 10 times then stop it from running.
|
||||||
|
* if( lExpireCounters[ lArrayIndex ] == xMaxExpiryCountBeforeStopping )
|
||||||
|
* {
|
||||||
|
* // Do not use a block time if calling a timer API function from a
|
||||||
|
* // timer callback function, as doing so could cause a deadlock!
|
||||||
|
* xTimerStop( pxTimer, 0 );
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* void main( void )
|
||||||
|
* {
|
||||||
|
* long x;
|
||||||
|
*
|
||||||
|
* // Create then start some timers. Starting the timers before the scheduler
|
||||||
|
* // has been started means the timers will start running immediately that
|
||||||
|
* // the scheduler starts.
|
||||||
|
* for( x = 0; x < NUM_TIMERS; x++ )
|
||||||
|
* {
|
||||||
|
* xTimers[ x ] = xTimerCreate( "Timer", // Just a text name, not used by the kernel.
|
||||||
|
* ( 100 * x ), // The timer period in ticks.
|
||||||
|
* pdTRUE, // The timers will auto-reload themselves when they expire.
|
||||||
|
* ( void * ) x, // Assign each timer a unique id equal to its array index.
|
||||||
|
* vTimerCallback // Each timer calls the same callback when it expires.
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* if( xTimers[ x ] == NULL )
|
||||||
|
* {
|
||||||
|
* // The timer was not created.
|
||||||
|
* }
|
||||||
|
* else
|
||||||
|
* {
|
||||||
|
* // Start the timer. No block time is specified, and even if one was
|
||||||
|
* // it would be ignored because the scheduler has not yet been
|
||||||
|
* // started.
|
||||||
|
* if( xTimerStart( xTimers[ x ], 0 ) != pdPASS )
|
||||||
|
* {
|
||||||
|
* // The timer could not be set into the Active state.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // ...
|
||||||
|
* // Create tasks here.
|
||||||
|
* // ...
|
||||||
|
*
|
||||||
|
* // Starting the scheduler will start the timers running as they have already
|
||||||
|
* // been set into the active state.
|
||||||
|
* xTaskStartScheduler();
|
||||||
|
*
|
||||||
|
* // Should not reach here.
|
||||||
|
* for( ;; );
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
xTimerHandle xTimerCreate( const signed char * const pcTimerName, portTickType xTimerPeriodInTicks, unsigned portBASE_TYPE uxAutoReload, void * pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* void *pvTimerGetTimerID( xTimerHandle xTimer );
|
||||||
|
*
|
||||||
|
* Returns the ID assigned to the timer.
|
||||||
|
*
|
||||||
|
* IDs are assigned to timers using the pvTimerID parameter of the call to
|
||||||
|
* xTimerCreated() that was used to create the timer.
|
||||||
|
*
|
||||||
|
* If the same callback function is assigned to multiple timers then the timer
|
||||||
|
* ID can be used within the callback function to identify which timer actually
|
||||||
|
* expired.
|
||||||
|
*
|
||||||
|
* @param xTimer The timer being queried.
|
||||||
|
*
|
||||||
|
* @return The ID assigned to the timer being queried.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* See the xTimerCreate() API function example usage scenario.
|
||||||
|
*/
|
||||||
|
void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer );
|
||||||
|
*
|
||||||
|
* Queries a timer to see if it is active or dormant.
|
||||||
|
*
|
||||||
|
* A timer will be dormant if:
|
||||||
|
* 1) It has been created but not started, or
|
||||||
|
* 2) It is an expired on-shot timer that has not been restarted.
|
||||||
|
*
|
||||||
|
* Timers are created in the dormant state. The xTimerStart(), xTimerReset(),
|
||||||
|
* xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and
|
||||||
|
* xTimerChangePeriodFromISR() API functions can all be used to transition a timer into the
|
||||||
|
* active state.
|
||||||
|
*
|
||||||
|
* @param xTimer The timer being queried.
|
||||||
|
*
|
||||||
|
* @return pdFALSE will be returned if the timer is dormant. A value other than
|
||||||
|
* pdFALSE will be returned if the timer is active.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* // This function assumes xTimer has already been created.
|
||||||
|
* void vAFunction( xTimerHandle xTimer )
|
||||||
|
* {
|
||||||
|
* if( xTimerIsTimerActive( xTimer ) != pdFALSE ) // or more simply and equivalently "if( xTimerIsTimerActive( xTimer ) )"
|
||||||
|
* {
|
||||||
|
* // xTimer is active, do something.
|
||||||
|
* }
|
||||||
|
* else
|
||||||
|
* {
|
||||||
|
* // xTimer is not active, do something else.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xTimerGetTimerDaemonTaskHandle() is only available if
|
||||||
|
* INCLUDE_xTimerGetTimerDaemonTaskHandle is set to 1 in FreeRTOSConfig.h.
|
||||||
|
*
|
||||||
|
* Simply returns the handle of the timer service/daemon task. It it not valid
|
||||||
|
* to call xTimerGetTimerDaemonTaskHandle() before the scheduler has been started.
|
||||||
|
*/
|
||||||
|
xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* portBASE_TYPE xTimerStart( xTimerHandle xTimer, portTickType xBlockTime );
|
||||||
|
*
|
||||||
|
* Timer functionality is provided by a timer service/daemon task. Many of the
|
||||||
|
* public FreeRTOS timer API functions send commands to the timer service task
|
||||||
|
* though a queue called the timer command queue. The timer command queue is
|
||||||
|
* private to the kernel itself and is not directly accessible to application
|
||||||
|
* code. The length of the timer command queue is set by the
|
||||||
|
* configTIMER_QUEUE_LENGTH configuration constant.
|
||||||
|
*
|
||||||
|
* xTimerStart() starts a timer that was previously created using the
|
||||||
|
* xTimerCreate() API function. If the timer had already been started and was
|
||||||
|
* already in the active state, then xTimerStart() has equivalent functionality
|
||||||
|
* to the xTimerReset() API function.
|
||||||
|
*
|
||||||
|
* Starting a timer ensures the timer is in the active state. If the timer
|
||||||
|
* is not stopped, deleted, or reset in the mean time, the callback function
|
||||||
|
* associated with the timer will get called 'n' ticks after xTimerStart() was
|
||||||
|
* called, where 'n' is the timers defined period.
|
||||||
|
*
|
||||||
|
* It is valid to call xTimerStart() before the scheduler has been started, but
|
||||||
|
* when this is done the timer will not actually start until the scheduler is
|
||||||
|
* started, and the timers expiry time will be relative to when the scheduler is
|
||||||
|
* started, not relative to when xTimerStart() was called.
|
||||||
|
*
|
||||||
|
* The configUSE_TIMERS configuration constant must be set to 1 for xTimerStart()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
|
* @param xTimer The handle of the timer being started/restarted.
|
||||||
|
*
|
||||||
|
* @param xBlockTime Specifies the time, in ticks, that the calling task should
|
||||||
|
* be held in the Blocked state to wait for the start command to be successfully
|
||||||
|
* sent to the timer command queue, should the queue already be full when
|
||||||
|
* xTimerStart() was called. xBlockTime is ignored if xTimerStart() is called
|
||||||
|
* before the scheduler is started.
|
||||||
|
*
|
||||||
|
* @return pdFAIL will be returned if the start command could not be sent to
|
||||||
|
* the timer command queue even after xBlockTime ticks had passed. pdPASS will
|
||||||
|
* be returned if the command was successfully sent to the timer command queue.
|
||||||
|
* When the command is actually processed will depend on the priority of the
|
||||||
|
* timer service/daemon task relative to other tasks in the system, although the
|
||||||
|
* timers expiry time is relative to when xTimerStart() is actually called. The
|
||||||
|
* timer service/daemon task priority is set by the configTIMER_TASK_PRIORITY
|
||||||
|
* configuration constant.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* See the xTimerCreate() API function example usage scenario.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define xTimerStart( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xBlockTime ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* portBASE_TYPE xTimerStop( xTimerHandle xTimer, portTickType xBlockTime );
|
||||||
|
*
|
||||||
|
* Timer functionality is provided by a timer service/daemon task. Many of the
|
||||||
|
* public FreeRTOS timer API functions send commands to the timer service task
|
||||||
|
* though a queue called the timer command queue. The timer command queue is
|
||||||
|
* private to the kernel itself and is not directly accessible to application
|
||||||
|
* code. The length of the timer command queue is set by the
|
||||||
|
* configTIMER_QUEUE_LENGTH configuration constant.
|
||||||
|
*
|
||||||
|
* xTimerStop() stops a timer that was previously started using either of the
|
||||||
|
* The xTimerStart(), xTimerReset(), xTimerStartFromISR(), xTimerResetFromISR(),
|
||||||
|
* xTimerChangePeriod() or xTimerChangePeriodFromISR() API functions.
|
||||||
|
*
|
||||||
|
* Stopping a timer ensures the timer is not in the active state.
|
||||||
|
*
|
||||||
|
* The configUSE_TIMERS configuration constant must be set to 1 for xTimerStop()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
|
* @param xTimer The handle of the timer being stopped.
|
||||||
|
*
|
||||||
|
* @param xBlockTime Specifies the time, in ticks, that the calling task should
|
||||||
|
* be held in the Blocked state to wait for the stop command to be successfully
|
||||||
|
* sent to the timer command queue, should the queue already be full when
|
||||||
|
* xTimerStop() was called. xBlockTime is ignored if xTimerStop() is called
|
||||||
|
* before the scheduler is started.
|
||||||
|
*
|
||||||
|
* @return pdFAIL will be returned if the stop command could not be sent to
|
||||||
|
* the timer command queue even after xBlockTime ticks had passed. pdPASS will
|
||||||
|
* be returned if the command was successfully sent to the timer command queue.
|
||||||
|
* When the command is actually processed will depend on the priority of the
|
||||||
|
* timer service/daemon task relative to other tasks in the system. The timer
|
||||||
|
* service/daemon task priority is set by the configTIMER_TASK_PRIORITY
|
||||||
|
* configuration constant.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* See the xTimerCreate() API function example usage scenario.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define xTimerStop( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0U, NULL, ( xBlockTime ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* portBASE_TYPE xTimerChangePeriod( xTimerHandle xTimer,
|
||||||
|
* portTickType xNewPeriod,
|
||||||
|
* portTickType xBlockTime );
|
||||||
|
*
|
||||||
|
* Timer functionality is provided by a timer service/daemon task. Many of the
|
||||||
|
* public FreeRTOS timer API functions send commands to the timer service task
|
||||||
|
* though a queue called the timer command queue. The timer command queue is
|
||||||
|
* private to the kernel itself and is not directly accessible to application
|
||||||
|
* code. The length of the timer command queue is set by the
|
||||||
|
* configTIMER_QUEUE_LENGTH configuration constant.
|
||||||
|
*
|
||||||
|
* xTimerChangePeriod() changes the period of a timer that was previously
|
||||||
|
* created using the xTimerCreate() API function.
|
||||||
|
*
|
||||||
|
* xTimerChangePeriod() can be called to change the period of an active or
|
||||||
|
* dormant state timer.
|
||||||
|
*
|
||||||
|
* The configUSE_TIMERS configuration constant must be set to 1 for
|
||||||
|
* xTimerChangePeriod() to be available.
|
||||||
|
*
|
||||||
|
* @param xTimer The handle of the timer that is having its period changed.
|
||||||
|
*
|
||||||
|
* @param xNewPeriod The new period for xTimer. Timer periods are specified in
|
||||||
|
* tick periods, so the constant portTICK_RATE_MS can be used to convert a time
|
||||||
|
* that has been specified in milliseconds. For example, if the timer must
|
||||||
|
* expire after 100 ticks, then xNewPeriod should be set to 100. Alternatively,
|
||||||
|
* if the timer must expire after 500ms, then xNewPeriod can be set to
|
||||||
|
* ( 500 / portTICK_RATE_MS ) provided configTICK_RATE_HZ is less than
|
||||||
|
* or equal to 1000.
|
||||||
|
*
|
||||||
|
* @param xBlockTime Specifies the time, in ticks, that the calling task should
|
||||||
|
* be held in the Blocked state to wait for the change period command to be
|
||||||
|
* successfully sent to the timer command queue, should the queue already be
|
||||||
|
* full when xTimerChangePeriod() was called. xBlockTime is ignored if
|
||||||
|
* xTimerChangePeriod() is called before the scheduler is started.
|
||||||
|
*
|
||||||
|
* @return pdFAIL will be returned if the change period command could not be
|
||||||
|
* sent to the timer command queue even after xBlockTime ticks had passed.
|
||||||
|
* pdPASS will be returned if the command was successfully sent to the timer
|
||||||
|
* command queue. When the command is actually processed will depend on the
|
||||||
|
* priority of the timer service/daemon task relative to other tasks in the
|
||||||
|
* system. The timer service/daemon task priority is set by the
|
||||||
|
* configTIMER_TASK_PRIORITY configuration constant.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* // This function assumes xTimer has already been created. If the timer
|
||||||
|
* // referenced by xTimer is already active when it is called, then the timer
|
||||||
|
* // is deleted. If the timer referenced by xTimer is not active when it is
|
||||||
|
* // called, then the period of the timer is set to 500ms and the timer is
|
||||||
|
* // started.
|
||||||
|
* void vAFunction( xTimerHandle xTimer )
|
||||||
|
* {
|
||||||
|
* if( xTimerIsTimerActive( xTimer ) != pdFALSE ) // or more simply and equivalently "if( xTimerIsTimerActive( xTimer ) )"
|
||||||
|
* {
|
||||||
|
* // xTimer is already active - delete it.
|
||||||
|
* xTimerDelete( xTimer );
|
||||||
|
* }
|
||||||
|
* else
|
||||||
|
* {
|
||||||
|
* // xTimer is not active, change its period to 500ms. This will also
|
||||||
|
* // cause the timer to start. Block for a maximum of 100 ticks if the
|
||||||
|
* // change period command cannot immediately be sent to the timer
|
||||||
|
* // command queue.
|
||||||
|
* if( xTimerChangePeriod( xTimer, 500 / portTICK_RATE_MS, 100 ) == pdPASS )
|
||||||
|
* {
|
||||||
|
* // The command was successfully sent.
|
||||||
|
* }
|
||||||
|
* else
|
||||||
|
* {
|
||||||
|
* // The command could not be sent, even after waiting for 100 ticks
|
||||||
|
* // to pass. Take appropriate action here.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
#define xTimerChangePeriod( xTimer, xNewPeriod, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD, ( xNewPeriod ), NULL, ( xBlockTime ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* portBASE_TYPE xTimerDelete( xTimerHandle xTimer, portTickType xBlockTime );
|
||||||
|
*
|
||||||
|
* Timer functionality is provided by a timer service/daemon task. Many of the
|
||||||
|
* public FreeRTOS timer API functions send commands to the timer service task
|
||||||
|
* though a queue called the timer command queue. The timer command queue is
|
||||||
|
* private to the kernel itself and is not directly accessible to application
|
||||||
|
* code. The length of the timer command queue is set by the
|
||||||
|
* configTIMER_QUEUE_LENGTH configuration constant.
|
||||||
|
*
|
||||||
|
* xTimerDelete() deletes a timer that was previously created using the
|
||||||
|
* xTimerCreate() API function.
|
||||||
|
*
|
||||||
|
* The configUSE_TIMERS configuration constant must be set to 1 for
|
||||||
|
* xTimerDelete() to be available.
|
||||||
|
*
|
||||||
|
* @param xTimer The handle of the timer being deleted.
|
||||||
|
*
|
||||||
|
* @param xBlockTime Specifies the time, in ticks, that the calling task should
|
||||||
|
* be held in the Blocked state to wait for the delete command to be
|
||||||
|
* successfully sent to the timer command queue, should the queue already be
|
||||||
|
* full when xTimerDelete() was called. xBlockTime is ignored if xTimerDelete()
|
||||||
|
* is called before the scheduler is started.
|
||||||
|
*
|
||||||
|
* @return pdFAIL will be returned if the delete command could not be sent to
|
||||||
|
* the timer command queue even after xBlockTime ticks had passed. pdPASS will
|
||||||
|
* be returned if the command was successfully sent to the timer command queue.
|
||||||
|
* When the command is actually processed will depend on the priority of the
|
||||||
|
* timer service/daemon task relative to other tasks in the system. The timer
|
||||||
|
* service/daemon task priority is set by the configTIMER_TASK_PRIORITY
|
||||||
|
* configuration constant.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* See the xTimerChangePeriod() API function example usage scenario.
|
||||||
|
*/
|
||||||
|
#define xTimerDelete( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_DELETE, 0U, NULL, ( xBlockTime ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* portBASE_TYPE xTimerReset( xTimerHandle xTimer, portTickType xBlockTime );
|
||||||
|
*
|
||||||
|
* Timer functionality is provided by a timer service/daemon task. Many of the
|
||||||
|
* public FreeRTOS timer API functions send commands to the timer service task
|
||||||
|
* though a queue called the timer command queue. The timer command queue is
|
||||||
|
* private to the kernel itself and is not directly accessible to application
|
||||||
|
* code. The length of the timer command queue is set by the
|
||||||
|
* configTIMER_QUEUE_LENGTH configuration constant.
|
||||||
|
*
|
||||||
|
* xTimerReset() re-starts a timer that was previously created using the
|
||||||
|
* xTimerCreate() API function. If the timer had already been started and was
|
||||||
|
* already in the active state, then xTimerReset() will cause the timer to
|
||||||
|
* re-evaluate its expiry time so that it is relative to when xTimerReset() was
|
||||||
|
* called. If the timer was in the dormant state then xTimerReset() has
|
||||||
|
* equivalent functionality to the xTimerStart() API function.
|
||||||
|
*
|
||||||
|
* Resetting a timer ensures the timer is in the active state. If the timer
|
||||||
|
* is not stopped, deleted, or reset in the mean time, the callback function
|
||||||
|
* associated with the timer will get called 'n' ticks after xTimerReset() was
|
||||||
|
* called, where 'n' is the timers defined period.
|
||||||
|
*
|
||||||
|
* It is valid to call xTimerReset() before the scheduler has been started, but
|
||||||
|
* when this is done the timer will not actually start until the scheduler is
|
||||||
|
* started, and the timers expiry time will be relative to when the scheduler is
|
||||||
|
* started, not relative to when xTimerReset() was called.
|
||||||
|
*
|
||||||
|
* The configUSE_TIMERS configuration constant must be set to 1 for xTimerReset()
|
||||||
|
* to be available.
|
||||||
|
*
|
||||||
|
* @param xTimer The handle of the timer being reset/started/restarted.
|
||||||
|
*
|
||||||
|
* @param xBlockTime Specifies the time, in ticks, that the calling task should
|
||||||
|
* be held in the Blocked state to wait for the reset command to be successfully
|
||||||
|
* sent to the timer command queue, should the queue already be full when
|
||||||
|
* xTimerReset() was called. xBlockTime is ignored if xTimerReset() is called
|
||||||
|
* before the scheduler is started.
|
||||||
|
*
|
||||||
|
* @return pdFAIL will be returned if the reset command could not be sent to
|
||||||
|
* the timer command queue even after xBlockTime ticks had passed. pdPASS will
|
||||||
|
* be returned if the command was successfully sent to the timer command queue.
|
||||||
|
* When the command is actually processed will depend on the priority of the
|
||||||
|
* timer service/daemon task relative to other tasks in the system, although the
|
||||||
|
* timers expiry time is relative to when xTimerStart() is actually called. The
|
||||||
|
* timer service/daemon task priority is set by the configTIMER_TASK_PRIORITY
|
||||||
|
* configuration constant.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* // When a key is pressed, an LCD back-light is switched on. If 5 seconds pass
|
||||||
|
* // without a key being pressed, then the LCD back-light is switched off. In
|
||||||
|
* // this case, the timer is a one-shot timer.
|
||||||
|
*
|
||||||
|
* xTimerHandle xBacklightTimer = NULL;
|
||||||
|
*
|
||||||
|
* // The callback function assigned to the one-shot timer. In this case the
|
||||||
|
* // parameter is not used.
|
||||||
|
* void vBacklightTimerCallback( xTimerHandle pxTimer )
|
||||||
|
* {
|
||||||
|
* // The timer expired, therefore 5 seconds must have passed since a key
|
||||||
|
* // was pressed. Switch off the LCD back-light.
|
||||||
|
* vSetBacklightState( BACKLIGHT_OFF );
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // The key press event handler.
|
||||||
|
* void vKeyPressEventHandler( char cKey )
|
||||||
|
* {
|
||||||
|
* // Ensure the LCD back-light is on, then reset the timer that is
|
||||||
|
* // responsible for turning the back-light off after 5 seconds of
|
||||||
|
* // key inactivity. Wait 10 ticks for the command to be successfully sent
|
||||||
|
* // if it cannot be sent immediately.
|
||||||
|
* vSetBacklightState( BACKLIGHT_ON );
|
||||||
|
* if( xTimerReset( xBacklightTimer, 100 ) != pdPASS )
|
||||||
|
* {
|
||||||
|
* // The reset command was not executed successfully. Take appropriate
|
||||||
|
* // action here.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Perform the rest of the key processing here.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* void main( void )
|
||||||
|
* {
|
||||||
|
* long x;
|
||||||
|
*
|
||||||
|
* // Create then start the one-shot timer that is responsible for turning
|
||||||
|
* // the back-light off if no keys are pressed within a 5 second period.
|
||||||
|
* xBacklightTimer = xTimerCreate( "BacklightTimer", // Just a text name, not used by the kernel.
|
||||||
|
* ( 5000 / portTICK_RATE_MS), // The timer period in ticks.
|
||||||
|
* pdFALSE, // The timer is a one-shot timer.
|
||||||
|
* 0, // The id is not used by the callback so can take any value.
|
||||||
|
* vBacklightTimerCallback // The callback function that switches the LCD back-light off.
|
||||||
|
* );
|
||||||
|
*
|
||||||
|
* if( xBacklightTimer == NULL )
|
||||||
|
* {
|
||||||
|
* // The timer was not created.
|
||||||
|
* }
|
||||||
|
* else
|
||||||
|
* {
|
||||||
|
* // Start the timer. No block time is specified, and even if one was
|
||||||
|
* // it would be ignored because the scheduler has not yet been
|
||||||
|
* // started.
|
||||||
|
* if( xTimerStart( xBacklightTimer, 0 ) != pdPASS )
|
||||||
|
* {
|
||||||
|
* // The timer could not be set into the Active state.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // ...
|
||||||
|
* // Create tasks here.
|
||||||
|
* // ...
|
||||||
|
*
|
||||||
|
* // Starting the scheduler will start the timer running as it has already
|
||||||
|
* // been set into the active state.
|
||||||
|
* xTaskStartScheduler();
|
||||||
|
*
|
||||||
|
* // Should not reach here.
|
||||||
|
* for( ;; );
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
#define xTimerReset( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xBlockTime ) )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* portBASE_TYPE xTimerStartFromISR( xTimerHandle xTimer,
|
||||||
|
* portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||||
|
*
|
||||||
|
* A version of xTimerStart() that can be called from an interrupt service
|
||||||
|
* routine.
|
||||||
|
*
|
||||||
|
* @param xTimer The handle of the timer being started/restarted.
|
||||||
|
*
|
||||||
|
* @param pxHigherPriorityTaskWoken The timer service/daemon task spends most
|
||||||
|
* of its time in the Blocked state, waiting for messages to arrive on the timer
|
||||||
|
* command queue. Calling xTimerStartFromISR() writes a message to the timer
|
||||||
|
* command queue, so has the potential to transition the timer service/daemon
|
||||||
|
* task out of the Blocked state. If calling xTimerStartFromISR() causes the
|
||||||
|
* timer service/daemon task to leave the Blocked state, and the timer service/
|
||||||
|
* daemon task has a priority equal to or greater than the currently executing
|
||||||
|
* task (the task that was interrupted), then *pxHigherPriorityTaskWoken will
|
||||||
|
* get set to pdTRUE internally within the xTimerStartFromISR() function. If
|
||||||
|
* xTimerStartFromISR() sets this value to pdTRUE then a context switch should
|
||||||
|
* be performed before the interrupt exits.
|
||||||
|
*
|
||||||
|
* @return pdFAIL will be returned if the start command could not be sent to
|
||||||
|
* the timer command queue. pdPASS will be returned if the command was
|
||||||
|
* successfully sent to the timer command queue. When the command is actually
|
||||||
|
* processed will depend on the priority of the timer service/daemon task
|
||||||
|
* relative to other tasks in the system, although the timers expiry time is
|
||||||
|
* relative to when xTimerStartFromISR() is actually called. The timer service/daemon
|
||||||
|
* task priority is set by the configTIMER_TASK_PRIORITY configuration constant.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* // This scenario assumes xBacklightTimer has already been created. When a
|
||||||
|
* // key is pressed, an LCD back-light is switched on. If 5 seconds pass
|
||||||
|
* // without a key being pressed, then the LCD back-light is switched off. In
|
||||||
|
* // this case, the timer is a one-shot timer, and unlike the example given for
|
||||||
|
* // the xTimerReset() function, the key press event handler is an interrupt
|
||||||
|
* // service routine.
|
||||||
|
*
|
||||||
|
* // The callback function assigned to the one-shot timer. In this case the
|
||||||
|
* // parameter is not used.
|
||||||
|
* void vBacklightTimerCallback( xTimerHandle pxTimer )
|
||||||
|
* {
|
||||||
|
* // The timer expired, therefore 5 seconds must have passed since a key
|
||||||
|
* // was pressed. Switch off the LCD back-light.
|
||||||
|
* vSetBacklightState( BACKLIGHT_OFF );
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // The key press interrupt service routine.
|
||||||
|
* void vKeyPressEventInterruptHandler( void )
|
||||||
|
* {
|
||||||
|
* portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
*
|
||||||
|
* // Ensure the LCD back-light is on, then restart the timer that is
|
||||||
|
* // responsible for turning the back-light off after 5 seconds of
|
||||||
|
* // key inactivity. This is an interrupt service routine so can only
|
||||||
|
* // call FreeRTOS API functions that end in "FromISR".
|
||||||
|
* vSetBacklightState( BACKLIGHT_ON );
|
||||||
|
*
|
||||||
|
* // xTimerStartFromISR() or xTimerResetFromISR() could be called here
|
||||||
|
* // as both cause the timer to re-calculate its expiry time.
|
||||||
|
* // xHigherPriorityTaskWoken was initialised to pdFALSE when it was
|
||||||
|
* // declared (in this function).
|
||||||
|
* if( xTimerStartFromISR( xBacklightTimer, &xHigherPriorityTaskWoken ) != pdPASS )
|
||||||
|
* {
|
||||||
|
* // The start command was not executed successfully. Take appropriate
|
||||||
|
* // action here.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Perform the rest of the key processing here.
|
||||||
|
*
|
||||||
|
* // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch
|
||||||
|
* // should be performed. The syntax required to perform a context switch
|
||||||
|
* // from inside an ISR varies from port to port, and from compiler to
|
||||||
|
* // compiler. Inspect the demos for the port you are using to find the
|
||||||
|
* // actual syntax required.
|
||||||
|
* if( xHigherPriorityTaskWoken != pdFALSE )
|
||||||
|
* {
|
||||||
|
* // Call the interrupt safe yield function here (actual function
|
||||||
|
* // depends on the FreeRTOS port being used.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
#define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* portBASE_TYPE xTimerStopFromISR( xTimerHandle xTimer,
|
||||||
|
* portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||||
|
*
|
||||||
|
* A version of xTimerStop() that can be called from an interrupt service
|
||||||
|
* routine.
|
||||||
|
*
|
||||||
|
* @param xTimer The handle of the timer being stopped.
|
||||||
|
*
|
||||||
|
* @param pxHigherPriorityTaskWoken The timer service/daemon task spends most
|
||||||
|
* of its time in the Blocked state, waiting for messages to arrive on the timer
|
||||||
|
* command queue. Calling xTimerStopFromISR() writes a message to the timer
|
||||||
|
* command queue, so has the potential to transition the timer service/daemon
|
||||||
|
* task out of the Blocked state. If calling xTimerStopFromISR() causes the
|
||||||
|
* timer service/daemon task to leave the Blocked state, and the timer service/
|
||||||
|
* daemon task has a priority equal to or greater than the currently executing
|
||||||
|
* task (the task that was interrupted), then *pxHigherPriorityTaskWoken will
|
||||||
|
* get set to pdTRUE internally within the xTimerStopFromISR() function. If
|
||||||
|
* xTimerStopFromISR() sets this value to pdTRUE then a context switch should
|
||||||
|
* be performed before the interrupt exits.
|
||||||
|
*
|
||||||
|
* @return pdFAIL will be returned if the stop command could not be sent to
|
||||||
|
* the timer command queue. pdPASS will be returned if the command was
|
||||||
|
* successfully sent to the timer command queue. When the command is actually
|
||||||
|
* processed will depend on the priority of the timer service/daemon task
|
||||||
|
* relative to other tasks in the system. The timer service/daemon task
|
||||||
|
* priority is set by the configTIMER_TASK_PRIORITY configuration constant.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* // This scenario assumes xTimer has already been created and started. When
|
||||||
|
* // an interrupt occurs, the timer should be simply stopped.
|
||||||
|
*
|
||||||
|
* // The interrupt service routine that stops the timer.
|
||||||
|
* void vAnExampleInterruptServiceRoutine( void )
|
||||||
|
* {
|
||||||
|
* portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
*
|
||||||
|
* // The interrupt has occurred - simply stop the timer.
|
||||||
|
* // xHigherPriorityTaskWoken was set to pdFALSE where it was defined
|
||||||
|
* // (within this function). As this is an interrupt service routine, only
|
||||||
|
* // FreeRTOS API functions that end in "FromISR" can be used.
|
||||||
|
* if( xTimerStopFromISR( xTimer, &xHigherPriorityTaskWoken ) != pdPASS )
|
||||||
|
* {
|
||||||
|
* // The stop command was not executed successfully. Take appropriate
|
||||||
|
* // action here.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch
|
||||||
|
* // should be performed. The syntax required to perform a context switch
|
||||||
|
* // from inside an ISR varies from port to port, and from compiler to
|
||||||
|
* // compiler. Inspect the demos for the port you are using to find the
|
||||||
|
* // actual syntax required.
|
||||||
|
* if( xHigherPriorityTaskWoken != pdFALSE )
|
||||||
|
* {
|
||||||
|
* // Call the interrupt safe yield function here (actual function
|
||||||
|
* // depends on the FreeRTOS port being used.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
#define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0, ( pxHigherPriorityTaskWoken ), 0U )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* portBASE_TYPE xTimerChangePeriodFromISR( xTimerHandle xTimer,
|
||||||
|
* portTickType xNewPeriod,
|
||||||
|
* portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||||
|
*
|
||||||
|
* A version of xTimerChangePeriod() that can be called from an interrupt
|
||||||
|
* service routine.
|
||||||
|
*
|
||||||
|
* @param xTimer The handle of the timer that is having its period changed.
|
||||||
|
*
|
||||||
|
* @param xNewPeriod The new period for xTimer. Timer periods are specified in
|
||||||
|
* tick periods, so the constant portTICK_RATE_MS can be used to convert a time
|
||||||
|
* that has been specified in milliseconds. For example, if the timer must
|
||||||
|
* expire after 100 ticks, then xNewPeriod should be set to 100. Alternatively,
|
||||||
|
* if the timer must expire after 500ms, then xNewPeriod can be set to
|
||||||
|
* ( 500 / portTICK_RATE_MS ) provided configTICK_RATE_HZ is less than
|
||||||
|
* or equal to 1000.
|
||||||
|
*
|
||||||
|
* @param pxHigherPriorityTaskWoken The timer service/daemon task spends most
|
||||||
|
* of its time in the Blocked state, waiting for messages to arrive on the timer
|
||||||
|
* command queue. Calling xTimerChangePeriodFromISR() writes a message to the
|
||||||
|
* timer command queue, so has the potential to transition the timer service/
|
||||||
|
* daemon task out of the Blocked state. If calling xTimerChangePeriodFromISR()
|
||||||
|
* causes the timer service/daemon task to leave the Blocked state, and the
|
||||||
|
* timer service/daemon task has a priority equal to or greater than the
|
||||||
|
* currently executing task (the task that was interrupted), then
|
||||||
|
* *pxHigherPriorityTaskWoken will get set to pdTRUE internally within the
|
||||||
|
* xTimerChangePeriodFromISR() function. If xTimerChangePeriodFromISR() sets
|
||||||
|
* this value to pdTRUE then a context switch should be performed before the
|
||||||
|
* interrupt exits.
|
||||||
|
*
|
||||||
|
* @return pdFAIL will be returned if the command to change the timers period
|
||||||
|
* could not be sent to the timer command queue. pdPASS will be returned if the
|
||||||
|
* command was successfully sent to the timer command queue. When the command
|
||||||
|
* is actually processed will depend on the priority of the timer service/daemon
|
||||||
|
* task relative to other tasks in the system. The timer service/daemon task
|
||||||
|
* priority is set by the configTIMER_TASK_PRIORITY configuration constant.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* // This scenario assumes xTimer has already been created and started. When
|
||||||
|
* // an interrupt occurs, the period of xTimer should be changed to 500ms.
|
||||||
|
*
|
||||||
|
* // The interrupt service routine that changes the period of xTimer.
|
||||||
|
* void vAnExampleInterruptServiceRoutine( void )
|
||||||
|
* {
|
||||||
|
* portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
*
|
||||||
|
* // The interrupt has occurred - change the period of xTimer to 500ms.
|
||||||
|
* // xHigherPriorityTaskWoken was set to pdFALSE where it was defined
|
||||||
|
* // (within this function). As this is an interrupt service routine, only
|
||||||
|
* // FreeRTOS API functions that end in "FromISR" can be used.
|
||||||
|
* if( xTimerChangePeriodFromISR( xTimer, &xHigherPriorityTaskWoken ) != pdPASS )
|
||||||
|
* {
|
||||||
|
* // The command to change the timers period was not executed
|
||||||
|
* // successfully. Take appropriate action here.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch
|
||||||
|
* // should be performed. The syntax required to perform a context switch
|
||||||
|
* // from inside an ISR varies from port to port, and from compiler to
|
||||||
|
* // compiler. Inspect the demos for the port you are using to find the
|
||||||
|
* // actual syntax required.
|
||||||
|
* if( xHigherPriorityTaskWoken != pdFALSE )
|
||||||
|
* {
|
||||||
|
* // Call the interrupt safe yield function here (actual function
|
||||||
|
* // depends on the FreeRTOS port being used.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
#define xTimerChangePeriodFromISR( xTimer, xNewPeriod, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_CHANGE_PERIOD, ( xNewPeriod ), ( pxHigherPriorityTaskWoken ), 0U )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* portBASE_TYPE xTimerResetFromISR( xTimerHandle xTimer,
|
||||||
|
* portBASE_TYPE *pxHigherPriorityTaskWoken );
|
||||||
|
*
|
||||||
|
* A version of xTimerReset() that can be called from an interrupt service
|
||||||
|
* routine.
|
||||||
|
*
|
||||||
|
* @param xTimer The handle of the timer that is to be started, reset, or
|
||||||
|
* restarted.
|
||||||
|
*
|
||||||
|
* @param pxHigherPriorityTaskWoken The timer service/daemon task spends most
|
||||||
|
* of its time in the Blocked state, waiting for messages to arrive on the timer
|
||||||
|
* command queue. Calling xTimerResetFromISR() writes a message to the timer
|
||||||
|
* command queue, so has the potential to transition the timer service/daemon
|
||||||
|
* task out of the Blocked state. If calling xTimerResetFromISR() causes the
|
||||||
|
* timer service/daemon task to leave the Blocked state, and the timer service/
|
||||||
|
* daemon task has a priority equal to or greater than the currently executing
|
||||||
|
* task (the task that was interrupted), then *pxHigherPriorityTaskWoken will
|
||||||
|
* get set to pdTRUE internally within the xTimerResetFromISR() function. If
|
||||||
|
* xTimerResetFromISR() sets this value to pdTRUE then a context switch should
|
||||||
|
* be performed before the interrupt exits.
|
||||||
|
*
|
||||||
|
* @return pdFAIL will be returned if the reset command could not be sent to
|
||||||
|
* the timer command queue. pdPASS will be returned if the command was
|
||||||
|
* successfully sent to the timer command queue. When the command is actually
|
||||||
|
* processed will depend on the priority of the timer service/daemon task
|
||||||
|
* relative to other tasks in the system, although the timers expiry time is
|
||||||
|
* relative to when xTimerResetFromISR() is actually called. The timer service/daemon
|
||||||
|
* task priority is set by the configTIMER_TASK_PRIORITY configuration constant.
|
||||||
|
*
|
||||||
|
* Example usage:
|
||||||
|
*
|
||||||
|
* // This scenario assumes xBacklightTimer has already been created. When a
|
||||||
|
* // key is pressed, an LCD back-light is switched on. If 5 seconds pass
|
||||||
|
* // without a key being pressed, then the LCD back-light is switched off. In
|
||||||
|
* // this case, the timer is a one-shot timer, and unlike the example given for
|
||||||
|
* // the xTimerReset() function, the key press event handler is an interrupt
|
||||||
|
* // service routine.
|
||||||
|
*
|
||||||
|
* // The callback function assigned to the one-shot timer. In this case the
|
||||||
|
* // parameter is not used.
|
||||||
|
* void vBacklightTimerCallback( xTimerHandle pxTimer )
|
||||||
|
* {
|
||||||
|
* // The timer expired, therefore 5 seconds must have passed since a key
|
||||||
|
* // was pressed. Switch off the LCD back-light.
|
||||||
|
* vSetBacklightState( BACKLIGHT_OFF );
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // The key press interrupt service routine.
|
||||||
|
* void vKeyPressEventInterruptHandler( void )
|
||||||
|
* {
|
||||||
|
* portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
*
|
||||||
|
* // Ensure the LCD back-light is on, then reset the timer that is
|
||||||
|
* // responsible for turning the back-light off after 5 seconds of
|
||||||
|
* // key inactivity. This is an interrupt service routine so can only
|
||||||
|
* // call FreeRTOS API functions that end in "FromISR".
|
||||||
|
* vSetBacklightState( BACKLIGHT_ON );
|
||||||
|
*
|
||||||
|
* // xTimerStartFromISR() or xTimerResetFromISR() could be called here
|
||||||
|
* // as both cause the timer to re-calculate its expiry time.
|
||||||
|
* // xHigherPriorityTaskWoken was initialised to pdFALSE when it was
|
||||||
|
* // declared (in this function).
|
||||||
|
* if( xTimerResetFromISR( xBacklightTimer, &xHigherPriorityTaskWoken ) != pdPASS )
|
||||||
|
* {
|
||||||
|
* // The reset command was not executed successfully. Take appropriate
|
||||||
|
* // action here.
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* // Perform the rest of the key processing here.
|
||||||
|
*
|
||||||
|
* // If xHigherPriorityTaskWoken equals pdTRUE, then a context switch
|
||||||
|
* // should be performed. The syntax required to perform a context switch
|
||||||
|
* // from inside an ISR varies from port to port, and from compiler to
|
||||||
|
* // compiler. Inspect the demos for the port you are using to find the
|
||||||
|
* // actual syntax required.
|
||||||
|
* if( xHigherPriorityTaskWoken != pdFALSE )
|
||||||
|
* {
|
||||||
|
* // Call the interrupt safe yield function here (actual function
|
||||||
|
* // depends on the FreeRTOS port being used.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
#define xTimerResetFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions beyond this part are not part of the public API and are intended
|
||||||
|
* for use by the kernel only.
|
||||||
|
*/
|
||||||
|
portBASE_TYPE xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;
|
||||||
|
portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif /* TIMERS_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
214
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/list.c
Normal file
214
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/list.c
Normal file
|
@ -0,0 +1,214 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* PUBLIC LIST API documented in list.h
|
||||||
|
*----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vListInitialise( xList *pxList )
|
||||||
|
{
|
||||||
|
/* The list structure contains a list item which is used to mark the
|
||||||
|
end of the list. To initialise the list the list end is inserted
|
||||||
|
as the only list entry. */
|
||||||
|
pxList->pxIndex = ( xListItem * ) &( pxList->xListEnd );
|
||||||
|
|
||||||
|
/* The list end value is the highest possible value in the list to
|
||||||
|
ensure it remains at the end of the list. */
|
||||||
|
pxList->xListEnd.xItemValue = portMAX_DELAY;
|
||||||
|
|
||||||
|
/* The list end next and previous pointers point to itself so we know
|
||||||
|
when the list is empty. */
|
||||||
|
pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd );
|
||||||
|
pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );
|
||||||
|
|
||||||
|
pxList->uxNumberOfItems = ( unsigned portBASE_TYPE ) 0U;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vListInitialiseItem( xListItem *pxItem )
|
||||||
|
{
|
||||||
|
/* Make sure the list item is not recorded as being on a list. */
|
||||||
|
pxItem->pvContainer = NULL;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vListInsertEnd( xList *pxList, xListItem *pxNewListItem )
|
||||||
|
{
|
||||||
|
volatile xListItem * pxIndex;
|
||||||
|
|
||||||
|
/* Insert a new list item into pxList, but rather than sort the list,
|
||||||
|
makes the new list item the last item to be removed by a call to
|
||||||
|
pvListGetOwnerOfNextEntry. This means it has to be the item pointed to by
|
||||||
|
the pxIndex member. */
|
||||||
|
pxIndex = pxList->pxIndex;
|
||||||
|
|
||||||
|
pxNewListItem->pxNext = pxIndex->pxNext;
|
||||||
|
pxNewListItem->pxPrevious = pxList->pxIndex;
|
||||||
|
pxIndex->pxNext->pxPrevious = ( volatile xListItem * ) pxNewListItem;
|
||||||
|
pxIndex->pxNext = ( volatile xListItem * ) pxNewListItem;
|
||||||
|
pxList->pxIndex = ( volatile xListItem * ) pxNewListItem;
|
||||||
|
|
||||||
|
/* Remember which list the item is in. */
|
||||||
|
pxNewListItem->pvContainer = ( void * ) pxList;
|
||||||
|
|
||||||
|
( pxList->uxNumberOfItems )++;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vListInsert( xList *pxList, xListItem *pxNewListItem )
|
||||||
|
{
|
||||||
|
volatile xListItem *pxIterator;
|
||||||
|
portTickType xValueOfInsertion;
|
||||||
|
|
||||||
|
/* Insert the new list item into the list, sorted in ulListItem order. */
|
||||||
|
xValueOfInsertion = pxNewListItem->xItemValue;
|
||||||
|
|
||||||
|
/* If the list already contains a list item with the same item value then
|
||||||
|
the new list item should be placed after it. This ensures that TCB's which
|
||||||
|
are stored in ready lists (all of which have the same ulListItem value)
|
||||||
|
get an equal share of the CPU. However, if the xItemValue is the same as
|
||||||
|
the back marker the iteration loop below will not end. This means we need
|
||||||
|
to guard against this by checking the value first and modifying the
|
||||||
|
algorithm slightly if necessary. */
|
||||||
|
if( xValueOfInsertion == portMAX_DELAY )
|
||||||
|
{
|
||||||
|
pxIterator = pxList->xListEnd.pxPrevious;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* *** NOTE ***********************************************************
|
||||||
|
If you find your application is crashing here then likely causes are:
|
||||||
|
1) Stack overflow -
|
||||||
|
see http://www.freertos.org/Stacks-and-stack-overflow-checking.html
|
||||||
|
2) Incorrect interrupt priority assignment, especially on Cortex-M3
|
||||||
|
parts where numerically high priority values denote low actual
|
||||||
|
interrupt priories, which can seem counter intuitive. See
|
||||||
|
configMAX_SYSCALL_INTERRUPT_PRIORITY on http://www.freertos.org/a00110.html
|
||||||
|
3) Calling an API function from within a critical section or when
|
||||||
|
the scheduler is suspended.
|
||||||
|
4) Using a queue or semaphore before it has been initialised or
|
||||||
|
before the scheduler has been started (are interrupts firing
|
||||||
|
before vTaskStartScheduler() has been called?).
|
||||||
|
See http://www.freertos.org/FAQHelp.html for more tips.
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
|
||||||
|
{
|
||||||
|
/* There is nothing to do here, we are just iterating to the
|
||||||
|
wanted insertion position. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pxNewListItem->pxNext = pxIterator->pxNext;
|
||||||
|
pxNewListItem->pxNext->pxPrevious = ( volatile xListItem * ) pxNewListItem;
|
||||||
|
pxNewListItem->pxPrevious = pxIterator;
|
||||||
|
pxIterator->pxNext = ( volatile xListItem * ) pxNewListItem;
|
||||||
|
|
||||||
|
/* Remember which list the item is in. This allows fast removal of the
|
||||||
|
item later. */
|
||||||
|
pxNewListItem->pvContainer = ( void * ) pxList;
|
||||||
|
|
||||||
|
( pxList->uxNumberOfItems )++;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
unsigned portBASE_TYPE uxListRemove( xListItem *pxItemToRemove )
|
||||||
|
{
|
||||||
|
xList * pxList;
|
||||||
|
|
||||||
|
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
|
||||||
|
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
|
||||||
|
|
||||||
|
/* The list item knows which list it is in. Obtain the list from the list
|
||||||
|
item. */
|
||||||
|
pxList = ( xList * ) pxItemToRemove->pvContainer;
|
||||||
|
|
||||||
|
/* Make sure the index is left pointing to a valid item. */
|
||||||
|
if( pxList->pxIndex == pxItemToRemove )
|
||||||
|
{
|
||||||
|
pxList->pxIndex = pxItemToRemove->pxPrevious;
|
||||||
|
}
|
||||||
|
|
||||||
|
pxItemToRemove->pvContainer = NULL;
|
||||||
|
( pxList->uxNumberOfItems )--;
|
||||||
|
|
||||||
|
return pxList->uxNumberOfItems;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
|
@ -0,0 +1,155 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*_RB_ #include "FreeRTOSConfig.h" */
|
||||||
|
|
||||||
|
/* Variables used by scheduler */
|
||||||
|
.extern _pxCurrentTCB
|
||||||
|
.extern _usCriticalNesting
|
||||||
|
|
||||||
|
/*
|
||||||
|
* portSAVE_CONTEXT MACRO
|
||||||
|
* Saves the context of the general purpose registers, CS and ES (only in far
|
||||||
|
* memory mode) registers the usCriticalNesting Value and the Stack Pointer
|
||||||
|
* of the active Task onto the task stack
|
||||||
|
*/
|
||||||
|
.macro portSAVE_CONTEXT
|
||||||
|
|
||||||
|
/* Save AX Register to stack. */
|
||||||
|
PUSH AX
|
||||||
|
PUSH HL
|
||||||
|
#if __DATA_MODEL__ == __DATA_MODEL_FAR__
|
||||||
|
/* Save CS register. */
|
||||||
|
MOV A, CS
|
||||||
|
XCH A, X
|
||||||
|
/* Save ES register. */
|
||||||
|
MOV A, ES
|
||||||
|
PUSH AX
|
||||||
|
#else
|
||||||
|
/* Save CS register. */
|
||||||
|
MOV A, CS
|
||||||
|
PUSH AX
|
||||||
|
#endif
|
||||||
|
/* Save the remaining general purpose registers. */
|
||||||
|
PUSH DE
|
||||||
|
PUSH BC
|
||||||
|
/* Save the usCriticalNesting value. */
|
||||||
|
MOVW AX, !_usCriticalNesting
|
||||||
|
PUSH AX
|
||||||
|
/* Save the Stack pointer. */
|
||||||
|
MOVW AX, !_pxCurrentTCB
|
||||||
|
MOVW HL, AX
|
||||||
|
MOVW AX, SP
|
||||||
|
MOVW [HL], AX
|
||||||
|
|
||||||
|
.endm
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* portRESTORE_CONTEXT MACRO
|
||||||
|
* Restores the task Stack Pointer then use this to restore usCriticalNesting,
|
||||||
|
* general purpose registers and the CS and ES (only in far memory mode)
|
||||||
|
* of the selected task from the task stack
|
||||||
|
*/
|
||||||
|
.macro portRESTORE_CONTEXT MACRO
|
||||||
|
/* Restore the Stack pointer. */
|
||||||
|
MOVW AX, !_pxCurrentTCB
|
||||||
|
MOVW HL, AX
|
||||||
|
MOVW AX, [HL]
|
||||||
|
MOVW SP, AX
|
||||||
|
/* Restore usCriticalNesting value. */
|
||||||
|
POP AX
|
||||||
|
MOVW !_usCriticalNesting, AX
|
||||||
|
/* Restore the necessary general purpose registers. */
|
||||||
|
POP BC
|
||||||
|
POP DE
|
||||||
|
#if __DATA_MODEL__ == __DATA_MODEL_FAR__
|
||||||
|
/* Restore the ES register. */
|
||||||
|
POP AX
|
||||||
|
MOV ES, A
|
||||||
|
/* Restore the CS register. */
|
||||||
|
XCH A, X
|
||||||
|
MOV CS, A
|
||||||
|
#else
|
||||||
|
POP AX
|
||||||
|
/* Restore the CS register. */
|
||||||
|
MOV CS, A
|
||||||
|
#endif
|
||||||
|
/* Restore general purpose register HL. */
|
||||||
|
POP HL
|
||||||
|
/* Restore AX. */
|
||||||
|
POP AX
|
||||||
|
|
||||||
|
.endm
|
||||||
|
|
|
@ -0,0 +1,265 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Scheduler includes. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
/* Hardware includes. */
|
||||||
|
#include "port_iodefine.h"
|
||||||
|
#include "port_iodefine_ext.h"
|
||||||
|
|
||||||
|
/* The critical nesting value is initialised to a non zero value to ensure
|
||||||
|
interrupts don't accidentally become enabled before the scheduler is started. */
|
||||||
|
#define portINITIAL_CRITICAL_NESTING ( ( unsigned short ) 10 )
|
||||||
|
|
||||||
|
/* Initial PSW value allocated to a newly created task.
|
||||||
|
* 1100011000000000
|
||||||
|
* ||||||||-------------- Fill byte
|
||||||
|
* |||||||--------------- Carry Flag cleared
|
||||||
|
* |||||----------------- In-service priority Flags set to low level
|
||||||
|
* ||||------------------ Register bank Select 0 Flag cleared
|
||||||
|
* |||------------------- Auxiliary Carry Flag cleared
|
||||||
|
* ||-------------------- Register bank Select 1 Flag cleared
|
||||||
|
* |--------------------- Zero Flag set
|
||||||
|
* ---------------------- Global Interrupt Flag set (enabled)
|
||||||
|
*/
|
||||||
|
#define portPSW ( 0xc6UL )
|
||||||
|
|
||||||
|
/* The address of the pxCurrentTCB variable, but don't know or need to know its
|
||||||
|
type. */
|
||||||
|
typedef void tskTCB;
|
||||||
|
extern volatile tskTCB * volatile pxCurrentTCB;
|
||||||
|
|
||||||
|
/* Each task maintains a count of the critical section nesting depth. Each time
|
||||||
|
a critical section is entered the count is incremented. Each time a critical
|
||||||
|
section is exited the count is decremented - with interrupts only being
|
||||||
|
re-enabled if the count is zero.
|
||||||
|
|
||||||
|
usCriticalNesting will get set to zero when the scheduler starts, but must
|
||||||
|
not be initialised to zero as that could cause problems during the startup
|
||||||
|
sequence. */
|
||||||
|
volatile unsigned short usCriticalNesting = portINITIAL_CRITICAL_NESTING;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets up the periodic ISR used for the RTOS tick.
|
||||||
|
*/
|
||||||
|
static void prvSetupTimerInterrupt( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Starts the scheduler by loading the context of the first task to run.
|
||||||
|
* (defined in portasm.S).
|
||||||
|
*/
|
||||||
|
extern void vPortStartFirstTask( void );
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialise the stack of a task to look exactly as if a call to
|
||||||
|
* portSAVE_CONTEXT had been called.
|
||||||
|
*
|
||||||
|
* See the header file portable.h.
|
||||||
|
*/
|
||||||
|
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
|
||||||
|
{
|
||||||
|
unsigned long *pulLocal;
|
||||||
|
|
||||||
|
#if __DATA_MODEL__ == __DATA_MODEL_FAR__
|
||||||
|
{
|
||||||
|
/* Parameters are passed in on the stack, and written using a 32bit value
|
||||||
|
hence a space is left for the second two bytes. */
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* Write in the parameter value. */
|
||||||
|
pulLocal = ( unsigned long * ) pxTopOfStack;
|
||||||
|
*pulLocal = ( unsigned long ) pvParameters;
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* These values are just spacers. The return address of the function
|
||||||
|
would normally be written here. */
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) 0xcdcd;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) 0xcdcd;
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* The start address / PSW value is also written in as a 32bit value,
|
||||||
|
so leave a space for the second two bytes. */
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* Task function start address combined with the PSW. */
|
||||||
|
pulLocal = ( unsigned long * ) pxTopOfStack;
|
||||||
|
*pulLocal = ( ( ( unsigned long ) pxCode ) | ( portPSW << 24UL ) );
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* An initial value for the AX register. */
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x1111;
|
||||||
|
pxTopOfStack--;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
/* Task function address is written to the stack first. As it is
|
||||||
|
written as a 32bit value a space is left on the stack for the second
|
||||||
|
two bytes. */
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* Task function start address combined with the PSW. */
|
||||||
|
pulLocal = ( unsigned long * ) pxTopOfStack;
|
||||||
|
*pulLocal = ( ( ( unsigned long ) pxCode ) | ( portPSW << 24UL ) );
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* The parameter is passed in AX. */
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;
|
||||||
|
pxTopOfStack--;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* An initial value for the HL register. */
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x2222;
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* CS and ES registers. */
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) 0x0F00;
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* Finally the remaining general purpose registers DE and BC */
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) 0xDEDE;
|
||||||
|
pxTopOfStack--;
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) 0xBCBC;
|
||||||
|
pxTopOfStack--;
|
||||||
|
|
||||||
|
/* Finally the critical section nesting count is set to zero when the task
|
||||||
|
first starts. */
|
||||||
|
*pxTopOfStack = ( portSTACK_TYPE ) portNO_CRITICAL_SECTION_NESTING;
|
||||||
|
|
||||||
|
/* Return a pointer to the top of the stack that has beene generated so it
|
||||||
|
can be stored in the task control block for the task. */
|
||||||
|
return pxTopOfStack;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
portBASE_TYPE xPortStartScheduler( void )
|
||||||
|
{
|
||||||
|
/* Setup the hardware to generate the tick. Interrupts are disabled when
|
||||||
|
this function is called. */
|
||||||
|
prvSetupTimerInterrupt();
|
||||||
|
|
||||||
|
/* Restore the context of the first task that is going to run. */
|
||||||
|
vPortStartFirstTask();
|
||||||
|
|
||||||
|
/* Execution should not reach here as the tasks are now running! */
|
||||||
|
return pdTRUE;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vPortEndScheduler( void )
|
||||||
|
{
|
||||||
|
/* It is unlikely that the RL78 port will get stopped. */
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvSetupTimerInterrupt( void )
|
||||||
|
{
|
||||||
|
const unsigned short usClockHz = 15000UL; /* Internal clock. */
|
||||||
|
const unsigned short usCompareMatch = ( usClockHz / configTICK_RATE_HZ ) + 1UL;
|
||||||
|
|
||||||
|
/* Use the internal 15K clock. */
|
||||||
|
OSMC = ( unsigned char ) 0x16;
|
||||||
|
|
||||||
|
/* Supply the RTC clock. */
|
||||||
|
RTCEN = ( unsigned char ) 1U;
|
||||||
|
|
||||||
|
/* Disable ITMC operation. */
|
||||||
|
ITMC = ( unsigned char ) 0x0000;
|
||||||
|
|
||||||
|
/* Disable INTIT interrupt. */
|
||||||
|
ITMK = ( unsigned char ) 1;
|
||||||
|
|
||||||
|
/* Set INTIT high priority */
|
||||||
|
ITPR1 = ( unsigned char ) 1;
|
||||||
|
ITPR0 = ( unsigned char ) 1;
|
||||||
|
|
||||||
|
/* Clear INIT interrupt. */
|
||||||
|
ITIF = ( unsigned char ) 0;
|
||||||
|
|
||||||
|
/* Set interval and enable interrupt operation. */
|
||||||
|
ITMC = usCompareMatch | 0x8000U;
|
||||||
|
|
||||||
|
/* Enable INTIT interrupt. */
|
||||||
|
ITMK = ( unsigned char ) 0;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,874 @@
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PROJECT NAME : RTOSDemo */
|
||||||
|
/* FILE : iodefine.h */
|
||||||
|
/* DESCRIPTION : Definition of I/O Registers */
|
||||||
|
/* CPU SERIES : RL78 - G1C */
|
||||||
|
/* CPU TYPE : R5F10JBC */
|
||||||
|
/* */
|
||||||
|
/* This file is generated by e2studio. */
|
||||||
|
/* */
|
||||||
|
/***********************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************/
|
||||||
|
/* Header file generated from device file: */
|
||||||
|
/* DR5F10JBC.DVF */
|
||||||
|
/* Copyright(C) 2012 Renesas */
|
||||||
|
/* File Version V1.00 */
|
||||||
|
/* Tool Version 1.9.7121 */
|
||||||
|
/* Date Generated 13/11/2012 */
|
||||||
|
/************************************************************************/
|
||||||
|
|
||||||
|
#include "port_iodefine_ext.h"
|
||||||
|
|
||||||
|
#ifndef __IOREG_BIT_STRUCTURES
|
||||||
|
#define __IOREG_BIT_STRUCTURES
|
||||||
|
typedef struct {
|
||||||
|
unsigned char no0 :1;
|
||||||
|
unsigned char no1 :1;
|
||||||
|
unsigned char no2 :1;
|
||||||
|
unsigned char no3 :1;
|
||||||
|
unsigned char no4 :1;
|
||||||
|
unsigned char no5 :1;
|
||||||
|
unsigned char no6 :1;
|
||||||
|
unsigned char no7 :1;
|
||||||
|
} __BITS8;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned short no0 :1;
|
||||||
|
unsigned short no1 :1;
|
||||||
|
unsigned short no2 :1;
|
||||||
|
unsigned short no3 :1;
|
||||||
|
unsigned short no4 :1;
|
||||||
|
unsigned short no5 :1;
|
||||||
|
unsigned short no6 :1;
|
||||||
|
unsigned short no7 :1;
|
||||||
|
unsigned short no8 :1;
|
||||||
|
unsigned short no9 :1;
|
||||||
|
unsigned short no10 :1;
|
||||||
|
unsigned short no11 :1;
|
||||||
|
unsigned short no12 :1;
|
||||||
|
unsigned short no13 :1;
|
||||||
|
unsigned short no14 :1;
|
||||||
|
unsigned short no15 :1;
|
||||||
|
} __BITS16;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IODEFINE_H
|
||||||
|
#define IODEFINE_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
IO Registers
|
||||||
|
*/
|
||||||
|
union un_p0 {
|
||||||
|
unsigned char p0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p1 {
|
||||||
|
unsigned char p1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p2 {
|
||||||
|
unsigned char p2;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p3 {
|
||||||
|
unsigned char p3;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p4 {
|
||||||
|
unsigned char p4;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p5 {
|
||||||
|
unsigned char p5;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p6 {
|
||||||
|
unsigned char p6;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p7 {
|
||||||
|
unsigned char p7;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p12 {
|
||||||
|
unsigned char p12;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p13 {
|
||||||
|
unsigned char p13;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm0 {
|
||||||
|
unsigned char pm0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm1 {
|
||||||
|
unsigned char pm1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm2 {
|
||||||
|
unsigned char pm2;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm3 {
|
||||||
|
unsigned char pm3;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm4 {
|
||||||
|
unsigned char pm4;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm5 {
|
||||||
|
unsigned char pm5;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm6 {
|
||||||
|
unsigned char pm6;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm7 {
|
||||||
|
unsigned char pm7;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm12 {
|
||||||
|
unsigned char pm12;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_adm0 {
|
||||||
|
unsigned char adm0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_ads {
|
||||||
|
unsigned char ads;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_adm1 {
|
||||||
|
unsigned char adm1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_egp0 {
|
||||||
|
unsigned char egp0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_egn0 {
|
||||||
|
unsigned char egn0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_egp1 {
|
||||||
|
unsigned char egp1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_egn1 {
|
||||||
|
unsigned char egn1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_iics0 {
|
||||||
|
unsigned char iics0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_iicf0 {
|
||||||
|
unsigned char iicf0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_flars {
|
||||||
|
unsigned char flars;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_fssq {
|
||||||
|
unsigned char fssq;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_flrst {
|
||||||
|
unsigned char flrst;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_fsastl {
|
||||||
|
unsigned char fsastl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_fsasth {
|
||||||
|
unsigned char fsasth;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_rtcc0 {
|
||||||
|
unsigned char rtcc0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_rtcc1 {
|
||||||
|
unsigned char rtcc1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_csc {
|
||||||
|
unsigned char csc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_ostc {
|
||||||
|
unsigned char ostc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_ckc {
|
||||||
|
unsigned char ckc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_cks0 {
|
||||||
|
unsigned char cks0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_cks1 {
|
||||||
|
unsigned char cks1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_lvim {
|
||||||
|
unsigned char lvim;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_lvis {
|
||||||
|
unsigned char lvis;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_monsta0 {
|
||||||
|
unsigned char monsta0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_asim {
|
||||||
|
unsigned char asim;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_dmc0 {
|
||||||
|
unsigned char dmc0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_dmc1 {
|
||||||
|
unsigned char dmc1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_drc0 {
|
||||||
|
unsigned char drc0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_drc1 {
|
||||||
|
unsigned char drc1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if2 {
|
||||||
|
unsigned short if2;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_if2l {
|
||||||
|
unsigned char if2l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if2h {
|
||||||
|
unsigned char if2h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk2 {
|
||||||
|
unsigned short mk2;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_mk2l {
|
||||||
|
unsigned char mk2l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk2h {
|
||||||
|
unsigned char mk2h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr02 {
|
||||||
|
unsigned short pr02;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr02l {
|
||||||
|
unsigned char pr02l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr02h {
|
||||||
|
unsigned char pr02h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr12 {
|
||||||
|
unsigned short pr12;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr12l {
|
||||||
|
unsigned char pr12l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr12h {
|
||||||
|
unsigned char pr12h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if0 {
|
||||||
|
unsigned short if0;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_if0l {
|
||||||
|
unsigned char if0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if0h {
|
||||||
|
unsigned char if0h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if1 {
|
||||||
|
unsigned short if1;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_if1l {
|
||||||
|
unsigned char if1l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if1h {
|
||||||
|
unsigned char if1h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk0 {
|
||||||
|
unsigned short mk0;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_mk0l {
|
||||||
|
unsigned char mk0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk0h {
|
||||||
|
unsigned char mk0h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk1 {
|
||||||
|
unsigned short mk1;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_mk1l {
|
||||||
|
unsigned char mk1l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk1h {
|
||||||
|
unsigned char mk1h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr00 {
|
||||||
|
unsigned short pr00;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr00l {
|
||||||
|
unsigned char pr00l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr00h {
|
||||||
|
unsigned char pr00h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr01 {
|
||||||
|
unsigned short pr01;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr01l {
|
||||||
|
unsigned char pr01l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr01h {
|
||||||
|
unsigned char pr01h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr10 {
|
||||||
|
unsigned short pr10;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr10l {
|
||||||
|
unsigned char pr10l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr10h {
|
||||||
|
unsigned char pr10h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr11 {
|
||||||
|
unsigned short pr11;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr11l {
|
||||||
|
unsigned char pr11l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr11h {
|
||||||
|
unsigned char pr11h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pmc {
|
||||||
|
unsigned char pmc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define P0 (*(volatile union un_p0 *)0xFFF00).p0
|
||||||
|
#define P0_bit (*(volatile union un_p0 *)0xFFF00).BIT
|
||||||
|
#define P1 (*(volatile union un_p1 *)0xFFF01).p1
|
||||||
|
#define P1_bit (*(volatile union un_p1 *)0xFFF01).BIT
|
||||||
|
#define P2 (*(volatile union un_p2 *)0xFFF02).p2
|
||||||
|
#define P2_bit (*(volatile union un_p2 *)0xFFF02).BIT
|
||||||
|
#define P3 (*(volatile union un_p3 *)0xFFF03).p3
|
||||||
|
#define P3_bit (*(volatile union un_p3 *)0xFFF03).BIT
|
||||||
|
#define P4 (*(volatile union un_p4 *)0xFFF04).p4
|
||||||
|
#define P4_bit (*(volatile union un_p4 *)0xFFF04).BIT
|
||||||
|
#define P5 (*(volatile union un_p5 *)0xFFF05).p5
|
||||||
|
#define P5_bit (*(volatile union un_p5 *)0xFFF05).BIT
|
||||||
|
#define P6 (*(volatile union un_p6 *)0xFFF06).p6
|
||||||
|
#define P6_bit (*(volatile union un_p6 *)0xFFF06).BIT
|
||||||
|
#define P7 (*(volatile union un_p7 *)0xFFF07).p7
|
||||||
|
#define P7_bit (*(volatile union un_p7 *)0xFFF07).BIT
|
||||||
|
#define P12 (*(volatile union un_p12 *)0xFFF0C).p12
|
||||||
|
#define P12_bit (*(volatile union un_p12 *)0xFFF0C).BIT
|
||||||
|
#define P13 (*(volatile union un_p13 *)0xFFF0D).p13
|
||||||
|
#define P13_bit (*(volatile union un_p13 *)0xFFF0D).BIT
|
||||||
|
#define SDR00 (*(volatile unsigned short *)0xFFF10)
|
||||||
|
#define SIO00 (*(volatile unsigned char *)0xFFF10)
|
||||||
|
#define TXD0 (*(volatile unsigned char *)0xFFF10)
|
||||||
|
#define SDR01 (*(volatile unsigned short *)0xFFF12)
|
||||||
|
#define RXD0 (*(volatile unsigned char *)0xFFF12)
|
||||||
|
#define SIO01 (*(volatile unsigned char *)0xFFF12)
|
||||||
|
#define TDR00 (*(volatile unsigned short *)0xFFF18)
|
||||||
|
#define TDR01 (*(volatile unsigned short *)0xFFF1A)
|
||||||
|
#define TDR01L (*(volatile unsigned char *)0xFFF1A)
|
||||||
|
#define TDR01H (*(volatile unsigned char *)0xFFF1B)
|
||||||
|
#define ADCR (*(volatile unsigned short *)0xFFF1E)
|
||||||
|
#define ADCRH (*(volatile unsigned char *)0xFFF1F)
|
||||||
|
#define PM0 (*(volatile union un_pm0 *)0xFFF20).pm0
|
||||||
|
#define PM0_bit (*(volatile union un_pm0 *)0xFFF20).BIT
|
||||||
|
#define PM1 (*(volatile union un_pm1 *)0xFFF21).pm1
|
||||||
|
#define PM1_bit (*(volatile union un_pm1 *)0xFFF21).BIT
|
||||||
|
#define PM2 (*(volatile union un_pm2 *)0xFFF22).pm2
|
||||||
|
#define PM2_bit (*(volatile union un_pm2 *)0xFFF22).BIT
|
||||||
|
#define PM3 (*(volatile union un_pm3 *)0xFFF23).pm3
|
||||||
|
#define PM3_bit (*(volatile union un_pm3 *)0xFFF23).BIT
|
||||||
|
#define PM4 (*(volatile union un_pm4 *)0xFFF24).pm4
|
||||||
|
#define PM4_bit (*(volatile union un_pm4 *)0xFFF24).BIT
|
||||||
|
#define PM5 (*(volatile union un_pm5 *)0xFFF25).pm5
|
||||||
|
#define PM5_bit (*(volatile union un_pm5 *)0xFFF25).BIT
|
||||||
|
#define PM6 (*(volatile union un_pm6 *)0xFFF26).pm6
|
||||||
|
#define PM6_bit (*(volatile union un_pm6 *)0xFFF26).BIT
|
||||||
|
#define PM7 (*(volatile union un_pm7 *)0xFFF27).pm7
|
||||||
|
#define PM7_bit (*(volatile union un_pm7 *)0xFFF27).BIT
|
||||||
|
#define PM12 (*(volatile union un_pm12 *)0xFFF2C).pm12
|
||||||
|
#define PM12_bit (*(volatile union un_pm12 *)0xFFF2C).BIT
|
||||||
|
#define ADM0 (*(volatile union un_adm0 *)0xFFF30).adm0
|
||||||
|
#define ADM0_bit (*(volatile union un_adm0 *)0xFFF30).BIT
|
||||||
|
#define ADS (*(volatile union un_ads *)0xFFF31).ads
|
||||||
|
#define ADS_bit (*(volatile union un_ads *)0xFFF31).BIT
|
||||||
|
#define ADM1 (*(volatile union un_adm1 *)0xFFF32).adm1
|
||||||
|
#define ADM1_bit (*(volatile union un_adm1 *)0xFFF32).BIT
|
||||||
|
#define EGP0 (*(volatile union un_egp0 *)0xFFF38).egp0
|
||||||
|
#define EGP0_bit (*(volatile union un_egp0 *)0xFFF38).BIT
|
||||||
|
#define EGN0 (*(volatile union un_egn0 *)0xFFF39).egn0
|
||||||
|
#define EGN0_bit (*(volatile union un_egn0 *)0xFFF39).BIT
|
||||||
|
#define EGP1 (*(volatile union un_egp1 *)0xFFF3A).egp1
|
||||||
|
#define EGP1_bit (*(volatile union un_egp1 *)0xFFF3A).BIT
|
||||||
|
#define EGN1 (*(volatile union un_egn1 *)0xFFF3B).egn1
|
||||||
|
#define EGN1_bit (*(volatile union un_egn1 *)0xFFF3B).BIT
|
||||||
|
#define IICA0 (*(volatile unsigned char *)0xFFF50)
|
||||||
|
#define IICS0 (*(volatile union un_iics0 *)0xFFF51).iics0
|
||||||
|
#define IICS0_bit (*(volatile union un_iics0 *)0xFFF51).BIT
|
||||||
|
#define IICF0 (*(volatile union un_iicf0 *)0xFFF52).iicf0
|
||||||
|
#define IICF0_bit (*(volatile union un_iicf0 *)0xFFF52).BIT
|
||||||
|
#define CFIFO (*(volatile unsigned short *)0xFFF54)
|
||||||
|
#define CFIFOL (*(volatile unsigned char *)0xFFF54)
|
||||||
|
#define D0FIFO (*(volatile unsigned short *)0xFFF58)
|
||||||
|
#define D0FIFOL (*(volatile unsigned char *)0xFFF58)
|
||||||
|
#define D1FIFO (*(volatile unsigned short *)0xFFF5C)
|
||||||
|
#define D1FIFOL (*(volatile unsigned char *)0xFFF5C)
|
||||||
|
#define TDR02 (*(volatile unsigned short *)0xFFF64)
|
||||||
|
#define TDR03 (*(volatile unsigned short *)0xFFF66)
|
||||||
|
#define TDR03L (*(volatile unsigned char *)0xFFF66)
|
||||||
|
#define TDR03H (*(volatile unsigned char *)0xFFF67)
|
||||||
|
#define FLPMC (*(volatile unsigned char *)0xFFF80)
|
||||||
|
#define FLARS (*(volatile union un_flars *)0xFFF81).flars
|
||||||
|
#define FLARS_bit (*(volatile union un_flars *)0xFFF81).BIT
|
||||||
|
#define FLAPL (*(volatile unsigned short *)0xFFF82)
|
||||||
|
#define FLAPH (*(volatile unsigned char *)0xFFF84)
|
||||||
|
#define FSSQ (*(volatile union un_fssq *)0xFFF85).fssq
|
||||||
|
#define FSSQ_bit (*(volatile union un_fssq *)0xFFF85).BIT
|
||||||
|
#define FLSEDL (*(volatile unsigned short *)0xFFF86)
|
||||||
|
#define FLSEDH (*(volatile unsigned char *)0xFFF88)
|
||||||
|
#define FLRST (*(volatile union un_flrst *)0xFFF89).flrst
|
||||||
|
#define FLRST_bit (*(volatile union un_flrst *)0xFFF89).BIT
|
||||||
|
#define FSASTL (*(volatile union un_fsastl *)0xFFF8A).fsastl
|
||||||
|
#define FSASTL_bit (*(volatile union un_fsastl *)0xFFF8A).BIT
|
||||||
|
#define FSASTH (*(volatile union un_fsasth *)0xFFF8B).fsasth
|
||||||
|
#define FSASTH_bit (*(volatile union un_fsasth *)0xFFF8B).BIT
|
||||||
|
#define FLWL (*(volatile unsigned short *)0xFFF8C)
|
||||||
|
#define FLWH (*(volatile unsigned short *)0xFFF8E)
|
||||||
|
#define ITMC (*(volatile unsigned short *)0xFFF90)
|
||||||
|
#define SEC (*(volatile unsigned char *)0xFFF92)
|
||||||
|
#define MIN (*(volatile unsigned char *)0xFFF93)
|
||||||
|
#define HOUR (*(volatile unsigned char *)0xFFF94)
|
||||||
|
#define WEEK (*(volatile unsigned char *)0xFFF95)
|
||||||
|
#define DAY (*(volatile unsigned char *)0xFFF96)
|
||||||
|
#define MONTH (*(volatile unsigned char *)0xFFF97)
|
||||||
|
#define YEAR (*(volatile unsigned char *)0xFFF98)
|
||||||
|
#define SUBCUD (*(volatile unsigned char *)0xFFF99)
|
||||||
|
#define ALARMWM (*(volatile unsigned char *)0xFFF9A)
|
||||||
|
#define ALARMWH (*(volatile unsigned char *)0xFFF9B)
|
||||||
|
#define ALARMWW (*(volatile unsigned char *)0xFFF9C)
|
||||||
|
#define RTCC0 (*(volatile union un_rtcc0 *)0xFFF9D).rtcc0
|
||||||
|
#define RTCC0_bit (*(volatile union un_rtcc0 *)0xFFF9D).BIT
|
||||||
|
#define RTCC1 (*(volatile union un_rtcc1 *)0xFFF9E).rtcc1
|
||||||
|
#define RTCC1_bit (*(volatile union un_rtcc1 *)0xFFF9E).BIT
|
||||||
|
#define CMC (*(volatile unsigned char *)0xFFFA0)
|
||||||
|
#define CSC (*(volatile union un_csc *)0xFFFA1).csc
|
||||||
|
#define CSC_bit (*(volatile union un_csc *)0xFFFA1).BIT
|
||||||
|
#define OSTC (*(volatile union un_ostc *)0xFFFA2).ostc
|
||||||
|
#define OSTC_bit (*(volatile union un_ostc *)0xFFFA2).BIT
|
||||||
|
#define OSTS (*(volatile unsigned char *)0xFFFA3)
|
||||||
|
#define CKC (*(volatile union un_ckc *)0xFFFA4).ckc
|
||||||
|
#define CKC_bit (*(volatile union un_ckc *)0xFFFA4).BIT
|
||||||
|
#define CKS0 (*(volatile union un_cks0 *)0xFFFA5).cks0
|
||||||
|
#define CKS0_bit (*(volatile union un_cks0 *)0xFFFA5).BIT
|
||||||
|
#define CKS1 (*(volatile union un_cks1 *)0xFFFA6).cks1
|
||||||
|
#define CKS1_bit (*(volatile union un_cks1 *)0xFFFA6).BIT
|
||||||
|
#define RESF (*(volatile unsigned char *)0xFFFA8)
|
||||||
|
#define LVIM (*(volatile union un_lvim *)0xFFFA9).lvim
|
||||||
|
#define LVIM_bit (*(volatile union un_lvim *)0xFFFA9).BIT
|
||||||
|
#define LVIS (*(volatile union un_lvis *)0xFFFAA).lvis
|
||||||
|
#define LVIS_bit (*(volatile union un_lvis *)0xFFFAA).BIT
|
||||||
|
#define WDTE (*(volatile unsigned char *)0xFFFAB)
|
||||||
|
#define CRCIN (*(volatile unsigned char *)0xFFFAC)
|
||||||
|
#define RXB (*(volatile unsigned char *)0xFFFAD)
|
||||||
|
#define TXS (*(volatile unsigned char *)0xFFFAD)
|
||||||
|
#define MONSTA0 (*(volatile union un_monsta0 *)0xFFFAE).monsta0
|
||||||
|
#define MONSTA0_bit (*(volatile union un_monsta0 *)0xFFFAE).BIT
|
||||||
|
#define ASIM (*(volatile union un_asim *)0xFFFAF).asim
|
||||||
|
#define ASIM_bit (*(volatile union un_asim *)0xFFFAF).BIT
|
||||||
|
#define DSA0 (*(volatile unsigned char *)0xFFFB0)
|
||||||
|
#define DSA1 (*(volatile unsigned char *)0xFFFB1)
|
||||||
|
#define DRA0 (*(volatile unsigned short *)0xFFFB2)
|
||||||
|
#define DRA0L (*(volatile unsigned char *)0xFFFB2)
|
||||||
|
#define DRA0H (*(volatile unsigned char *)0xFFFB3)
|
||||||
|
#define DRA1 (*(volatile unsigned short *)0xFFFB4)
|
||||||
|
#define DRA1L (*(volatile unsigned char *)0xFFFB4)
|
||||||
|
#define DRA1H (*(volatile unsigned char *)0xFFFB5)
|
||||||
|
#define DBC0 (*(volatile unsigned short *)0xFFFB6)
|
||||||
|
#define DBC0L (*(volatile unsigned char *)0xFFFB6)
|
||||||
|
#define DBC0H (*(volatile unsigned char *)0xFFFB7)
|
||||||
|
#define DBC1 (*(volatile unsigned short *)0xFFFB8)
|
||||||
|
#define DBC1L (*(volatile unsigned char *)0xFFFB8)
|
||||||
|
#define DBC1H (*(volatile unsigned char *)0xFFFB9)
|
||||||
|
#define DMC0 (*(volatile union un_dmc0 *)0xFFFBA).dmc0
|
||||||
|
#define DMC0_bit (*(volatile union un_dmc0 *)0xFFFBA).BIT
|
||||||
|
#define DMC1 (*(volatile union un_dmc1 *)0xFFFBB).dmc1
|
||||||
|
#define DMC1_bit (*(volatile union un_dmc1 *)0xFFFBB).BIT
|
||||||
|
#define DRC0 (*(volatile union un_drc0 *)0xFFFBC).drc0
|
||||||
|
#define DRC0_bit (*(volatile union un_drc0 *)0xFFFBC).BIT
|
||||||
|
#define DRC1 (*(volatile union un_drc1 *)0xFFFBD).drc1
|
||||||
|
#define DRC1_bit (*(volatile union un_drc1 *)0xFFFBD).BIT
|
||||||
|
#define IF2 (*(volatile union un_if2 *)0xFFFD0).if2
|
||||||
|
#define IF2_bit (*(volatile union un_if2 *)0xFFFD0).BIT
|
||||||
|
#define IF2L (*(volatile union un_if2l *)0xFFFD0).if2l
|
||||||
|
#define IF2L_bit (*(volatile union un_if2l *)0xFFFD0).BIT
|
||||||
|
#define IF2H (*(volatile union un_if2h *)0xFFFD1).if2h
|
||||||
|
#define IF2H_bit (*(volatile union un_if2h *)0xFFFD1).BIT
|
||||||
|
#define MK2 (*(volatile union un_mk2 *)0xFFFD4).mk2
|
||||||
|
#define MK2_bit (*(volatile union un_mk2 *)0xFFFD4).BIT
|
||||||
|
#define MK2L (*(volatile union un_mk2l *)0xFFFD4).mk2l
|
||||||
|
#define MK2L_bit (*(volatile union un_mk2l *)0xFFFD4).BIT
|
||||||
|
#define MK2H (*(volatile union un_mk2h *)0xFFFD5).mk2h
|
||||||
|
#define MK2H_bit (*(volatile union un_mk2h *)0xFFFD5).BIT
|
||||||
|
#define PR02 (*(volatile union un_pr02 *)0xFFFD8).pr02
|
||||||
|
#define PR02_bit (*(volatile union un_pr02 *)0xFFFD8).BIT
|
||||||
|
#define PR02L (*(volatile union un_pr02l *)0xFFFD8).pr02l
|
||||||
|
#define PR02L_bit (*(volatile union un_pr02l *)0xFFFD8).BIT
|
||||||
|
#define PR02H (*(volatile union un_pr02h *)0xFFFD9).pr02h
|
||||||
|
#define PR02H_bit (*(volatile union un_pr02h *)0xFFFD9).BIT
|
||||||
|
#define PR12 (*(volatile union un_pr12 *)0xFFFDC).pr12
|
||||||
|
#define PR12_bit (*(volatile union un_pr12 *)0xFFFDC).BIT
|
||||||
|
#define PR12L (*(volatile union un_pr12l *)0xFFFDC).pr12l
|
||||||
|
#define PR12L_bit (*(volatile union un_pr12l *)0xFFFDC).BIT
|
||||||
|
#define PR12H (*(volatile union un_pr12h *)0xFFFDD).pr12h
|
||||||
|
#define PR12H_bit (*(volatile union un_pr12h *)0xFFFDD).BIT
|
||||||
|
#define IF0 (*(volatile union un_if0 *)0xFFFE0).if0
|
||||||
|
#define IF0_bit (*(volatile union un_if0 *)0xFFFE0).BIT
|
||||||
|
#define IF0L (*(volatile union un_if0l *)0xFFFE0).if0l
|
||||||
|
#define IF0L_bit (*(volatile union un_if0l *)0xFFFE0).BIT
|
||||||
|
#define IF0H (*(volatile union un_if0h *)0xFFFE1).if0h
|
||||||
|
#define IF0H_bit (*(volatile union un_if0h *)0xFFFE1).BIT
|
||||||
|
#define IF1 (*(volatile union un_if1 *)0xFFFE2).if1
|
||||||
|
#define IF1_bit (*(volatile union un_if1 *)0xFFFE2).BIT
|
||||||
|
#define IF1L (*(volatile union un_if1l *)0xFFFE2).if1l
|
||||||
|
#define IF1L_bit (*(volatile union un_if1l *)0xFFFE2).BIT
|
||||||
|
#define IF1H (*(volatile union un_if1h *)0xFFFE3).if1h
|
||||||
|
#define IF1H_bit (*(volatile union un_if1h *)0xFFFE3).BIT
|
||||||
|
#define MK0 (*(volatile union un_mk0 *)0xFFFE4).mk0
|
||||||
|
#define MK0_bit (*(volatile union un_mk0 *)0xFFFE4).BIT
|
||||||
|
#define MK0L (*(volatile union un_mk0l *)0xFFFE4).mk0l
|
||||||
|
#define MK0L_bit (*(volatile union un_mk0l *)0xFFFE4).BIT
|
||||||
|
#define MK0H (*(volatile union un_mk0h *)0xFFFE5).mk0h
|
||||||
|
#define MK0H_bit (*(volatile union un_mk0h *)0xFFFE5).BIT
|
||||||
|
#define MK1 (*(volatile union un_mk1 *)0xFFFE6).mk1
|
||||||
|
#define MK1_bit (*(volatile union un_mk1 *)0xFFFE6).BIT
|
||||||
|
#define MK1L (*(volatile union un_mk1l *)0xFFFE6).mk1l
|
||||||
|
#define MK1L_bit (*(volatile union un_mk1l *)0xFFFE6).BIT
|
||||||
|
#define MK1H (*(volatile union un_mk1h *)0xFFFE7).mk1h
|
||||||
|
#define MK1H_bit (*(volatile union un_mk1h *)0xFFFE7).BIT
|
||||||
|
#define PR00 (*(volatile union un_pr00 *)0xFFFE8).pr00
|
||||||
|
#define PR00_bit (*(volatile union un_pr00 *)0xFFFE8).BIT
|
||||||
|
#define PR00L (*(volatile union un_pr00l *)0xFFFE8).pr00l
|
||||||
|
#define PR00L_bit (*(volatile union un_pr00l *)0xFFFE8).BIT
|
||||||
|
#define PR00H (*(volatile union un_pr00h *)0xFFFE9).pr00h
|
||||||
|
#define PR00H_bit (*(volatile union un_pr00h *)0xFFFE9).BIT
|
||||||
|
#define PR01 (*(volatile union un_pr01 *)0xFFFEA).pr01
|
||||||
|
#define PR01_bit (*(volatile union un_pr01 *)0xFFFEA).BIT
|
||||||
|
#define PR01L (*(volatile union un_pr01l *)0xFFFEA).pr01l
|
||||||
|
#define PR01L_bit (*(volatile union un_pr01l *)0xFFFEA).BIT
|
||||||
|
#define PR01H (*(volatile union un_pr01h *)0xFFFEB).pr01h
|
||||||
|
#define PR01H_bit (*(volatile union un_pr01h *)0xFFFEB).BIT
|
||||||
|
#define PR10 (*(volatile union un_pr10 *)0xFFFEC).pr10
|
||||||
|
#define PR10_bit (*(volatile union un_pr10 *)0xFFFEC).BIT
|
||||||
|
#define PR10L (*(volatile union un_pr10l *)0xFFFEC).pr10l
|
||||||
|
#define PR10L_bit (*(volatile union un_pr10l *)0xFFFEC).BIT
|
||||||
|
#define PR10H (*(volatile union un_pr10h *)0xFFFED).pr10h
|
||||||
|
#define PR10H_bit (*(volatile union un_pr10h *)0xFFFED).BIT
|
||||||
|
#define PR11 (*(volatile union un_pr11 *)0xFFFEE).pr11
|
||||||
|
#define PR11_bit (*(volatile union un_pr11 *)0xFFFEE).BIT
|
||||||
|
#define PR11L (*(volatile union un_pr11l *)0xFFFEE).pr11l
|
||||||
|
#define PR11L_bit (*(volatile union un_pr11l *)0xFFFEE).BIT
|
||||||
|
#define PR11H (*(volatile union un_pr11h *)0xFFFEF).pr11h
|
||||||
|
#define PR11H_bit (*(volatile union un_pr11h *)0xFFFEF).BIT
|
||||||
|
#define MDAL (*(volatile unsigned short *)0xFFFF0)
|
||||||
|
#define MULA (*(volatile unsigned short *)0xFFFF0)
|
||||||
|
#define MDAH (*(volatile unsigned short *)0xFFFF2)
|
||||||
|
#define MULB (*(volatile unsigned short *)0xFFFF2)
|
||||||
|
#define MDBH (*(volatile unsigned short *)0xFFFF4)
|
||||||
|
#define MULOH (*(volatile unsigned short *)0xFFFF4)
|
||||||
|
#define MDBL (*(volatile unsigned short *)0xFFFF6)
|
||||||
|
#define MULOL (*(volatile unsigned short *)0xFFFF6)
|
||||||
|
#define PMC (*(volatile union un_pmc *)0xFFFFE).pmc
|
||||||
|
#define PMC_bit (*(volatile union un_pmc *)0xFFFFE).BIT
|
||||||
|
|
||||||
|
/*
|
||||||
|
Sfr bits
|
||||||
|
*/
|
||||||
|
#define ADCE ADM0_bit.no0
|
||||||
|
#define ADCS ADM0_bit.no7
|
||||||
|
#define SPD0 IICS0_bit.no0
|
||||||
|
#define STD0 IICS0_bit.no1
|
||||||
|
#define ACKD0 IICS0_bit.no2
|
||||||
|
#define TRC0 IICS0_bit.no3
|
||||||
|
#define COI0 IICS0_bit.no4
|
||||||
|
#define EXC0 IICS0_bit.no5
|
||||||
|
#define ALD0 IICS0_bit.no6
|
||||||
|
#define MSTS0 IICS0_bit.no7
|
||||||
|
#define IICRSV0 IICF0_bit.no0
|
||||||
|
#define STCEN0 IICF0_bit.no1
|
||||||
|
#define IICBSY0 IICF0_bit.no6
|
||||||
|
#define STCF0 IICF0_bit.no7
|
||||||
|
#define FSSTP FSSQ_bit.no6
|
||||||
|
#define SQST FSSQ_bit.no7
|
||||||
|
#define SQEND FSASTH_bit.no6
|
||||||
|
#define ESQEND FSASTH_bit.no7
|
||||||
|
#define RTCE RTCC0_bit.no7
|
||||||
|
#define RWAIT RTCC1_bit.no0
|
||||||
|
#define RWST RTCC1_bit.no1
|
||||||
|
#define RIFG RTCC1_bit.no3
|
||||||
|
#define WAFG RTCC1_bit.no4
|
||||||
|
#define WALIE RTCC1_bit.no6
|
||||||
|
#define WALE RTCC1_bit.no7
|
||||||
|
#define HIOSTOP CSC_bit.no0
|
||||||
|
#define XTSTOP CSC_bit.no6
|
||||||
|
#define MSTOP CSC_bit.no7
|
||||||
|
#define MCM0 CKC_bit.no4
|
||||||
|
#define MCS CKC_bit.no5
|
||||||
|
#define CSS CKC_bit.no6
|
||||||
|
#define PCLOE0 CKS0_bit.no7
|
||||||
|
#define PCLOE1 CKS1_bit.no7
|
||||||
|
#define LVIF LVIM_bit.no0
|
||||||
|
#define LVIOMSK LVIM_bit.no1
|
||||||
|
#define LVISEN LVIM_bit.no7
|
||||||
|
#define LVILV LVIS_bit.no0
|
||||||
|
#define LVIMD LVIS_bit.no7
|
||||||
|
#define DWAIT0 DMC0_bit.no4
|
||||||
|
#define DS0 DMC0_bit.no5
|
||||||
|
#define DRS0 DMC0_bit.no6
|
||||||
|
#define STG0 DMC0_bit.no7
|
||||||
|
#define DWAIT1 DMC1_bit.no4
|
||||||
|
#define DS1 DMC1_bit.no5
|
||||||
|
#define DRS1 DMC1_bit.no6
|
||||||
|
#define STG1 DMC1_bit.no7
|
||||||
|
#define DST0 DRC0_bit.no0
|
||||||
|
#define DEN0 DRC0_bit.no7
|
||||||
|
#define DST1 DRC1_bit.no0
|
||||||
|
#define DEN1 DRC1_bit.no7
|
||||||
|
#define PIF8 IF2_bit.no5
|
||||||
|
#define PIF9 IF2_bit.no6
|
||||||
|
#define MDIF IF2H_bit.no5
|
||||||
|
#define FLIF IF2H_bit.no7
|
||||||
|
#define PMK8 MK2_bit.no5
|
||||||
|
#define PMK9 MK2_bit.no6
|
||||||
|
#define MDMK MK2H_bit.no5
|
||||||
|
#define FLMK MK2H_bit.no7
|
||||||
|
#define PPR08 PR02_bit.no5
|
||||||
|
#define PPR09 PR02_bit.no6
|
||||||
|
#define MDPR0 PR02H_bit.no5
|
||||||
|
#define FLPR0 PR02H_bit.no7
|
||||||
|
#define PPR18 PR12_bit.no5
|
||||||
|
#define PPR19 PR12_bit.no6
|
||||||
|
#define MDPR1 PR12H_bit.no5
|
||||||
|
#define FLPR1 PR12H_bit.no7
|
||||||
|
#define WDTIIF IF0_bit.no0
|
||||||
|
#define LVIIF IF0_bit.no1
|
||||||
|
#define PIF0 IF0_bit.no2
|
||||||
|
#define PIF1 IF0_bit.no3
|
||||||
|
#define PIF2 IF0_bit.no4
|
||||||
|
#define PIF3 IF0_bit.no5
|
||||||
|
#define PIF4 IF0_bit.no6
|
||||||
|
#define PIF5 IF0_bit.no7
|
||||||
|
#define DMAIF0 IF0H_bit.no3
|
||||||
|
#define DMAIF1 IF0H_bit.no4
|
||||||
|
#define CSIIF00 IF0H_bit.no5
|
||||||
|
#define IICIF00 IF0H_bit.no5
|
||||||
|
#define STIF0 IF0H_bit.no5
|
||||||
|
#define TMIF00 IF0H_bit.no6
|
||||||
|
#define CSIIF01 IF0H_bit.no7
|
||||||
|
#define IICIF01 IF0H_bit.no7
|
||||||
|
#define SRIF0 IF0H_bit.no7
|
||||||
|
#define SREIF0 IF1_bit.no0
|
||||||
|
#define TMIF01H IF1_bit.no0
|
||||||
|
#define TMIF03H IF1_bit.no3
|
||||||
|
#define IICAIF0 IF1_bit.no4
|
||||||
|
#define TMIF01 IF1_bit.no5
|
||||||
|
#define TMIF02 IF1_bit.no6
|
||||||
|
#define TMIF03 IF1_bit.no7
|
||||||
|
#define ADIF IF1H_bit.no0
|
||||||
|
#define RTCIF IF1H_bit.no1
|
||||||
|
#define ITIF IF1H_bit.no2
|
||||||
|
#define USBIF IF1H_bit.no4
|
||||||
|
#define RSUIF IF1H_bit.no5
|
||||||
|
#define WDTIMK MK0_bit.no0
|
||||||
|
#define LVIMK MK0_bit.no1
|
||||||
|
#define PMK0 MK0_bit.no2
|
||||||
|
#define PMK1 MK0_bit.no3
|
||||||
|
#define PMK2 MK0_bit.no4
|
||||||
|
#define PMK3 MK0_bit.no5
|
||||||
|
#define PMK4 MK0_bit.no6
|
||||||
|
#define PMK5 MK0_bit.no7
|
||||||
|
#define DMAMK0 MK0H_bit.no3
|
||||||
|
#define DMAMK1 MK0H_bit.no4
|
||||||
|
#define CSIMK00 MK0H_bit.no5
|
||||||
|
#define IICMK00 MK0H_bit.no5
|
||||||
|
#define STMK0 MK0H_bit.no5
|
||||||
|
#define TMMK00 MK0H_bit.no6
|
||||||
|
#define CSIMK01 MK0H_bit.no7
|
||||||
|
#define IICMK01 MK0H_bit.no7
|
||||||
|
#define SRMK0 MK0H_bit.no7
|
||||||
|
#define SREMK0 MK1_bit.no0
|
||||||
|
#define TMMK01H MK1_bit.no0
|
||||||
|
#define TMMK03H MK1_bit.no3
|
||||||
|
#define IICAMK0 MK1_bit.no4
|
||||||
|
#define TMMK01 MK1_bit.no5
|
||||||
|
#define TMMK02 MK1_bit.no6
|
||||||
|
#define TMMK03 MK1_bit.no7
|
||||||
|
#define ADMK MK1H_bit.no0
|
||||||
|
#define RTCMK MK1H_bit.no1
|
||||||
|
#define ITMK MK1H_bit.no2
|
||||||
|
#define USBMK MK1H_bit.no4
|
||||||
|
#define RSUMK MK1H_bit.no5
|
||||||
|
#define WDTIPR0 PR00_bit.no0
|
||||||
|
#define LVIPR0 PR00_bit.no1
|
||||||
|
#define PPR00 PR00_bit.no2
|
||||||
|
#define PPR01 PR00_bit.no3
|
||||||
|
#define PPR02 PR00_bit.no4
|
||||||
|
#define PPR03 PR00_bit.no5
|
||||||
|
#define PPR04 PR00_bit.no6
|
||||||
|
#define PPR05 PR00_bit.no7
|
||||||
|
#define DMAPR00 PR00H_bit.no3
|
||||||
|
#define DMAPR01 PR00H_bit.no4
|
||||||
|
#define CSIPR000 PR00H_bit.no5
|
||||||
|
#define IICPR000 PR00H_bit.no5
|
||||||
|
#define STPR00 PR00H_bit.no5
|
||||||
|
#define TMPR000 PR00H_bit.no6
|
||||||
|
#define CSIPR001 PR00H_bit.no7
|
||||||
|
#define IICPR001 PR00H_bit.no7
|
||||||
|
#define SRPR00 PR00H_bit.no7
|
||||||
|
#define SREPR00 PR01_bit.no0
|
||||||
|
#define TMPR001H PR01_bit.no0
|
||||||
|
#define TMPR003H PR01_bit.no3
|
||||||
|
#define IICAPR00 PR01_bit.no4
|
||||||
|
#define TMPR001 PR01_bit.no5
|
||||||
|
#define TMPR002 PR01_bit.no6
|
||||||
|
#define TMPR003 PR01_bit.no7
|
||||||
|
#define ADPR0 PR01H_bit.no0
|
||||||
|
#define RTCPR0 PR01H_bit.no1
|
||||||
|
#define ITPR0 PR01H_bit.no2
|
||||||
|
#define USBPR0 PR01H_bit.no4
|
||||||
|
#define RSUPR0 PR01H_bit.no5
|
||||||
|
#define WDTIPR1 PR10_bit.no0
|
||||||
|
#define LVIPR1 PR10_bit.no1
|
||||||
|
#define PPR10 PR10_bit.no2
|
||||||
|
#define PPR11 PR10_bit.no3
|
||||||
|
#define PPR12 PR10_bit.no4
|
||||||
|
#define PPR13 PR10_bit.no5
|
||||||
|
#define PPR14 PR10_bit.no6
|
||||||
|
#define PPR15 PR10_bit.no7
|
||||||
|
#define DMAPR10 PR10H_bit.no3
|
||||||
|
#define DMAPR11 PR10H_bit.no4
|
||||||
|
#define CSIPR100 PR10H_bit.no5
|
||||||
|
#define IICPR100 PR10H_bit.no5
|
||||||
|
#define STPR10 PR10H_bit.no5
|
||||||
|
#define TMPR100 PR10H_bit.no6
|
||||||
|
#define CSIPR101 PR10H_bit.no7
|
||||||
|
#define IICPR101 PR10H_bit.no7
|
||||||
|
#define SRPR10 PR10H_bit.no7
|
||||||
|
#define SREPR10 PR11_bit.no0
|
||||||
|
#define TMPR101H PR11_bit.no0
|
||||||
|
#define TMPR103H PR11_bit.no3
|
||||||
|
#define IICAPR10 PR11_bit.no4
|
||||||
|
#define TMPR101 PR11_bit.no5
|
||||||
|
#define TMPR102 PR11_bit.no6
|
||||||
|
#define TMPR103 PR11_bit.no7
|
||||||
|
#define ADPR1 PR11H_bit.no0
|
||||||
|
#define RTCPR1 PR11H_bit.no1
|
||||||
|
#define ITPR1 PR11H_bit.no2
|
||||||
|
#define USBPR1 PR11H_bit.no4
|
||||||
|
#define RSUPR1 PR11H_bit.no5
|
||||||
|
#define MAA PMC_bit.no0
|
||||||
|
|
||||||
|
/*
|
||||||
|
Interrupt vector addresses
|
||||||
|
*/
|
||||||
|
#define RST_vect (0x0)
|
||||||
|
#define INTDBG_vect (0x2)
|
||||||
|
#define INTSRO_vect (0x4)
|
||||||
|
#define INTWDTI_vect (0x4)
|
||||||
|
#define INTLVI_vect (0x6)
|
||||||
|
#define INTP0_vect (0x8)
|
||||||
|
#define INTP1_vect (0xA)
|
||||||
|
#define INTP2_vect (0xC)
|
||||||
|
#define INTP3_vect (0xE)
|
||||||
|
#define INTP4_vect (0x10)
|
||||||
|
#define INTP5_vect (0x12)
|
||||||
|
#define INTDMA0_vect (0x1A)
|
||||||
|
#define INTDMA1_vect (0x1C)
|
||||||
|
#define INTCSI00_vect (0x1E)
|
||||||
|
#define INTIIC00_vect (0x1E)
|
||||||
|
#define INTST0_vect (0x1E)
|
||||||
|
#define INTTM00_vect (0x20)
|
||||||
|
#define INTCSI01_vect (0x22)
|
||||||
|
#define INTIIC01_vect (0x22)
|
||||||
|
#define INTSR0_vect (0x22)
|
||||||
|
#define INTSRE0_vect (0x24)
|
||||||
|
#define INTTM01H_vect (0x24)
|
||||||
|
#define INTTM03H_vect (0x2A)
|
||||||
|
#define INTIICA0_vect (0x2C)
|
||||||
|
#define INTTM01_vect (0x2E)
|
||||||
|
#define INTTM02_vect (0x30)
|
||||||
|
#define INTTM03_vect (0x32)
|
||||||
|
#define INTAD_vect (0x34)
|
||||||
|
#define INTRTC_vect (0x36)
|
||||||
|
#define INTIT_vect (0x38)
|
||||||
|
#define INTUSB_vect (0x3C)
|
||||||
|
#define INTRSUM_vect (0x3E)
|
||||||
|
#define INTP8_vect (0x4E)
|
||||||
|
#define INTP9_vect (0x50)
|
||||||
|
#define INTMD_vect (0x5E)
|
||||||
|
#define INTFL_vect (0x62)
|
||||||
|
#define BRK_I_vect (0x7E)
|
||||||
|
#endif
|
|
@ -0,0 +1,524 @@
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PROJECT NAME : RTOSDemo */
|
||||||
|
/* FILE : iodefine_ext.h */
|
||||||
|
/* DESCRIPTION : Definition of Extended SFRs */
|
||||||
|
/* CPU SERIES : RL78 - G1C */
|
||||||
|
/* CPU TYPE : R5F10JBC */
|
||||||
|
/* */
|
||||||
|
/* This file is generated by e2studio. */
|
||||||
|
/* */
|
||||||
|
/***********************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************/
|
||||||
|
/* Header file generated from device file: */
|
||||||
|
/* DR5F10JBC.DVF */
|
||||||
|
/* Copyright(C) 2012 Renesas */
|
||||||
|
/* File Version V1.00 */
|
||||||
|
/* Tool Version 1.9.7121 */
|
||||||
|
/* Date Generated 13/11/2012 */
|
||||||
|
/************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __IOREG_BIT_STRUCTURES
|
||||||
|
#define __IOREG_BIT_STRUCTURES
|
||||||
|
typedef struct {
|
||||||
|
unsigned char no0 :1;
|
||||||
|
unsigned char no1 :1;
|
||||||
|
unsigned char no2 :1;
|
||||||
|
unsigned char no3 :1;
|
||||||
|
unsigned char no4 :1;
|
||||||
|
unsigned char no5 :1;
|
||||||
|
unsigned char no6 :1;
|
||||||
|
unsigned char no7 :1;
|
||||||
|
} __BITS8;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned short no0 :1;
|
||||||
|
unsigned short no1 :1;
|
||||||
|
unsigned short no2 :1;
|
||||||
|
unsigned short no3 :1;
|
||||||
|
unsigned short no4 :1;
|
||||||
|
unsigned short no5 :1;
|
||||||
|
unsigned short no6 :1;
|
||||||
|
unsigned short no7 :1;
|
||||||
|
unsigned short no8 :1;
|
||||||
|
unsigned short no9 :1;
|
||||||
|
unsigned short no10 :1;
|
||||||
|
unsigned short no11 :1;
|
||||||
|
unsigned short no12 :1;
|
||||||
|
unsigned short no13 :1;
|
||||||
|
unsigned short no14 :1;
|
||||||
|
unsigned short no15 :1;
|
||||||
|
} __BITS16;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IODEFINE_EXT_H
|
||||||
|
#define IODEFINE_EXT_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
IO Registers
|
||||||
|
*/
|
||||||
|
union un_adm2 {
|
||||||
|
unsigned char adm2;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pms {
|
||||||
|
unsigned char pms;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu0 {
|
||||||
|
unsigned char pu0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu1 {
|
||||||
|
unsigned char pu1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu3 {
|
||||||
|
unsigned char pu3;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu4 {
|
||||||
|
unsigned char pu4;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu5 {
|
||||||
|
unsigned char pu5;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu7 {
|
||||||
|
unsigned char pu7;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu12 {
|
||||||
|
unsigned char pu12;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pim0 {
|
||||||
|
unsigned char pim0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pim3 {
|
||||||
|
unsigned char pim3;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pim5 {
|
||||||
|
unsigned char pim5;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pom0 {
|
||||||
|
unsigned char pom0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pom3 {
|
||||||
|
unsigned char pom3;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pom5 {
|
||||||
|
unsigned char pom5;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pmc0 {
|
||||||
|
unsigned char pmc0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pmc12 {
|
||||||
|
unsigned char pmc12;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_nfen0 {
|
||||||
|
unsigned char nfen0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_nfen1 {
|
||||||
|
unsigned char nfen1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_isc {
|
||||||
|
unsigned char isc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_dflctl {
|
||||||
|
unsigned char dflctl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_bectl {
|
||||||
|
unsigned char bectl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_fsse {
|
||||||
|
unsigned char fsse;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pfs {
|
||||||
|
unsigned char pfs;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mduc {
|
||||||
|
unsigned char mduc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_per0 {
|
||||||
|
unsigned char per0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_rmc {
|
||||||
|
unsigned char rmc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_rpectl {
|
||||||
|
unsigned char rpectl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_se0l {
|
||||||
|
unsigned char se0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_ss0l {
|
||||||
|
unsigned char ss0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_st0l {
|
||||||
|
unsigned char st0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_soe0l {
|
||||||
|
unsigned char soe0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_te0l {
|
||||||
|
unsigned char te0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_ts0l {
|
||||||
|
unsigned char ts0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_tt0l {
|
||||||
|
unsigned char tt0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_toe0l {
|
||||||
|
unsigned char toe0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_iicctl00 {
|
||||||
|
unsigned char iicctl00;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_iicctl01 {
|
||||||
|
unsigned char iicctl01;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_dscctl {
|
||||||
|
unsigned char dscctl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mckc {
|
||||||
|
unsigned char mckc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_crc0ctl {
|
||||||
|
unsigned char crc0ctl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define ADM2 (*(volatile union un_adm2 *)0xF0010).adm2
|
||||||
|
#define ADM2_bit (*(volatile union un_adm2 *)0xF0010).BIT
|
||||||
|
#define ADUL (*(volatile unsigned char *)0xF0011)
|
||||||
|
#define ADLL (*(volatile unsigned char *)0xF0012)
|
||||||
|
#define ADTES (*(volatile unsigned char *)0xF0013)
|
||||||
|
#define PMS (*(volatile union un_pms *)0xF0018).pms
|
||||||
|
#define PMS_bit (*(volatile union un_pms *)0xF0018).BIT
|
||||||
|
#define PIOR (*(volatile unsigned char *)0xF001A)
|
||||||
|
#define PU0 (*(volatile union un_pu0 *)0xF0030).pu0
|
||||||
|
#define PU0_bit (*(volatile union un_pu0 *)0xF0030).BIT
|
||||||
|
#define PU1 (*(volatile union un_pu1 *)0xF0031).pu1
|
||||||
|
#define PU1_bit (*(volatile union un_pu1 *)0xF0031).BIT
|
||||||
|
#define PU3 (*(volatile union un_pu3 *)0xF0033).pu3
|
||||||
|
#define PU3_bit (*(volatile union un_pu3 *)0xF0033).BIT
|
||||||
|
#define PU4 (*(volatile union un_pu4 *)0xF0034).pu4
|
||||||
|
#define PU4_bit (*(volatile union un_pu4 *)0xF0034).BIT
|
||||||
|
#define PU5 (*(volatile union un_pu5 *)0xF0035).pu5
|
||||||
|
#define PU5_bit (*(volatile union un_pu5 *)0xF0035).BIT
|
||||||
|
#define PU7 (*(volatile union un_pu7 *)0xF0037).pu7
|
||||||
|
#define PU7_bit (*(volatile union un_pu7 *)0xF0037).BIT
|
||||||
|
#define PU12 (*(volatile union un_pu12 *)0xF003C).pu12
|
||||||
|
#define PU12_bit (*(volatile union un_pu12 *)0xF003C).BIT
|
||||||
|
#define PIM0 (*(volatile union un_pim0 *)0xF0040).pim0
|
||||||
|
#define PIM0_bit (*(volatile union un_pim0 *)0xF0040).BIT
|
||||||
|
#define PIM3 (*(volatile union un_pim3 *)0xF0043).pim3
|
||||||
|
#define PIM3_bit (*(volatile union un_pim3 *)0xF0043).BIT
|
||||||
|
#define PIM5 (*(volatile union un_pim5 *)0xF0045).pim5
|
||||||
|
#define PIM5_bit (*(volatile union un_pim5 *)0xF0045).BIT
|
||||||
|
#define POM0 (*(volatile union un_pom0 *)0xF0050).pom0
|
||||||
|
#define POM0_bit (*(volatile union un_pom0 *)0xF0050).BIT
|
||||||
|
#define POM3 (*(volatile union un_pom3 *)0xF0053).pom3
|
||||||
|
#define POM3_bit (*(volatile union un_pom3 *)0xF0053).BIT
|
||||||
|
#define POM5 (*(volatile union un_pom5 *)0xF0055).pom5
|
||||||
|
#define POM5_bit (*(volatile union un_pom5 *)0xF0055).BIT
|
||||||
|
#define PMC0 (*(volatile union un_pmc0 *)0xF0060).pmc0
|
||||||
|
#define PMC0_bit (*(volatile union un_pmc0 *)0xF0060).BIT
|
||||||
|
#define PMC12 (*(volatile union un_pmc12 *)0xF006C).pmc12
|
||||||
|
#define PMC12_bit (*(volatile union un_pmc12 *)0xF006C).BIT
|
||||||
|
#define NFEN0 (*(volatile union un_nfen0 *)0xF0070).nfen0
|
||||||
|
#define NFEN0_bit (*(volatile union un_nfen0 *)0xF0070).BIT
|
||||||
|
#define NFEN1 (*(volatile union un_nfen1 *)0xF0071).nfen1
|
||||||
|
#define NFEN1_bit (*(volatile union un_nfen1 *)0xF0071).BIT
|
||||||
|
#define ISC (*(volatile union un_isc *)0xF0073).isc
|
||||||
|
#define ISC_bit (*(volatile union un_isc *)0xF0073).BIT
|
||||||
|
#define TIS0 (*(volatile unsigned char *)0xF0074)
|
||||||
|
#define ADPC (*(volatile unsigned char *)0xF0076)
|
||||||
|
#define IAWCTL (*(volatile unsigned char *)0xF0077)
|
||||||
|
#define PRDSEL (*(volatile unsigned short *)0xF007E)
|
||||||
|
#define TOOLEN (*(volatile unsigned char *)0xF0080)
|
||||||
|
#define BPAL0 (*(volatile unsigned char *)0xF0081)
|
||||||
|
#define BPAH0 (*(volatile unsigned char *)0xF0082)
|
||||||
|
#define BPAS0 (*(volatile unsigned char *)0xF0083)
|
||||||
|
#define BACDVL0 (*(volatile unsigned char *)0xF0084)
|
||||||
|
#define BACDVH0 (*(volatile unsigned char *)0xF0085)
|
||||||
|
#define BACDML0 (*(volatile unsigned char *)0xF0086)
|
||||||
|
#define BACDMH0 (*(volatile unsigned char *)0xF0087)
|
||||||
|
#define MONMOD (*(volatile unsigned char *)0xF0088)
|
||||||
|
#define DFLCTL (*(volatile union un_dflctl *)0xF0090).dflctl
|
||||||
|
#define DFLCTL_bit (*(volatile union un_dflctl *)0xF0090).BIT
|
||||||
|
#define HIOTRM (*(volatile unsigned char *)0xF00A0)
|
||||||
|
#define BECTL (*(volatile union un_bectl *)0xF00A1).bectl
|
||||||
|
#define BECTL_bit (*(volatile union un_bectl *)0xF00A1).BIT
|
||||||
|
#define HOCODIV (*(volatile unsigned char *)0xF00A8)
|
||||||
|
#define TEMPCAL0 (*(volatile unsigned char *)0xF00AC)
|
||||||
|
#define TEMPCAL1 (*(volatile unsigned char *)0xF00AD)
|
||||||
|
#define TEMPCAL2 (*(volatile unsigned char *)0xF00AE)
|
||||||
|
#define TEMPCAL3 (*(volatile unsigned char *)0xF00AF)
|
||||||
|
#define FLSEC (*(volatile unsigned short *)0xF00B0)
|
||||||
|
#define FLFSWS (*(volatile unsigned short *)0xF00B2)
|
||||||
|
#define FLFSWE (*(volatile unsigned short *)0xF00B4)
|
||||||
|
#define FSSET (*(volatile unsigned char *)0xF00B6)
|
||||||
|
#define FSSE (*(volatile union un_fsse *)0xF00B7).fsse
|
||||||
|
#define FSSE_bit (*(volatile union un_fsse *)0xF00B7).BIT
|
||||||
|
#define FLFADL (*(volatile unsigned short *)0xF00B8)
|
||||||
|
#define FLFADH (*(volatile unsigned char *)0xF00BA)
|
||||||
|
#define PFCMD (*(volatile unsigned char *)0xF00C0)
|
||||||
|
#define PFS (*(volatile union un_pfs *)0xF00C1).pfs
|
||||||
|
#define PFS_bit (*(volatile union un_pfs *)0xF00C1).BIT
|
||||||
|
#define FLRL (*(volatile unsigned short *)0xF00C2)
|
||||||
|
#define FLRH (*(volatile unsigned short *)0xF00C4)
|
||||||
|
#define FLWE (*(volatile unsigned char *)0xF00C6)
|
||||||
|
#define FLRE (*(volatile unsigned char *)0xF00C7)
|
||||||
|
#define FLTMS (*(volatile unsigned short *)0xF00C8)
|
||||||
|
#define DFLMC (*(volatile unsigned short *)0xF00CA)
|
||||||
|
#define FLMCL (*(volatile unsigned short *)0xF00CC)
|
||||||
|
#define FLMCH (*(volatile unsigned char *)0xF00CE)
|
||||||
|
#define FSCTL (*(volatile unsigned char *)0xF00CF)
|
||||||
|
#define ICEADR (*(volatile unsigned short *)0xF00D0)
|
||||||
|
#define ICEDAT (*(volatile unsigned short *)0xF00D2)
|
||||||
|
#define MDCL (*(volatile unsigned short *)0xF00E0)
|
||||||
|
#define MDCH (*(volatile unsigned short *)0xF00E2)
|
||||||
|
#define MDUC (*(volatile union un_mduc *)0xF00E8).mduc
|
||||||
|
#define MDUC_bit (*(volatile union un_mduc *)0xF00E8).BIT
|
||||||
|
#define PER0 (*(volatile union un_per0 *)0xF00F0).per0
|
||||||
|
#define PER0_bit (*(volatile union un_per0 *)0xF00F0).BIT
|
||||||
|
#define OSMC (*(volatile unsigned char *)0xF00F3)
|
||||||
|
#define RMC (*(volatile union un_rmc *)0xF00F4).rmc
|
||||||
|
#define RMC_bit (*(volatile union un_rmc *)0xF00F4).BIT
|
||||||
|
#define RPECTL (*(volatile union un_rpectl *)0xF00F5).rpectl
|
||||||
|
#define RPECTL_bit (*(volatile union un_rpectl *)0xF00F5).BIT
|
||||||
|
#define BCDADJ (*(volatile unsigned char *)0xF00FE)
|
||||||
|
#define VECTCTRL (*(volatile unsigned char *)0xF00FF)
|
||||||
|
#define SSR00 (*(volatile unsigned short *)0xF0100)
|
||||||
|
#define SSR00L (*(volatile unsigned char *)0xF0100)
|
||||||
|
#define SSR01 (*(volatile unsigned short *)0xF0102)
|
||||||
|
#define SSR01L (*(volatile unsigned char *)0xF0102)
|
||||||
|
#define SIR00 (*(volatile unsigned short *)0xF0108)
|
||||||
|
#define SIR00L (*(volatile unsigned char *)0xF0108)
|
||||||
|
#define SIR01 (*(volatile unsigned short *)0xF010A)
|
||||||
|
#define SIR01L (*(volatile unsigned char *)0xF010A)
|
||||||
|
#define SMR00 (*(volatile unsigned short *)0xF0110)
|
||||||
|
#define SMR01 (*(volatile unsigned short *)0xF0112)
|
||||||
|
#define SCR00 (*(volatile unsigned short *)0xF0118)
|
||||||
|
#define SCR01 (*(volatile unsigned short *)0xF011A)
|
||||||
|
#define SE0 (*(volatile unsigned short *)0xF0120)
|
||||||
|
#define SE0L (*(volatile union un_se0l *)0xF0120).se0l
|
||||||
|
#define SE0L_bit (*(volatile union un_se0l *)0xF0120).BIT
|
||||||
|
#define SS0 (*(volatile unsigned short *)0xF0122)
|
||||||
|
#define SS0L (*(volatile union un_ss0l *)0xF0122).ss0l
|
||||||
|
#define SS0L_bit (*(volatile union un_ss0l *)0xF0122).BIT
|
||||||
|
#define ST0 (*(volatile unsigned short *)0xF0124)
|
||||||
|
#define ST0L (*(volatile union un_st0l *)0xF0124).st0l
|
||||||
|
#define ST0L_bit (*(volatile union un_st0l *)0xF0124).BIT
|
||||||
|
#define SPS0 (*(volatile unsigned short *)0xF0126)
|
||||||
|
#define SPS0L (*(volatile unsigned char *)0xF0126)
|
||||||
|
#define SO0 (*(volatile unsigned short *)0xF0128)
|
||||||
|
#define SOE0 (*(volatile unsigned short *)0xF012A)
|
||||||
|
#define SOE0L (*(volatile union un_soe0l *)0xF012A).soe0l
|
||||||
|
#define SOE0L_bit (*(volatile union un_soe0l *)0xF012A).BIT
|
||||||
|
#define EDR00 (*(volatile unsigned short *)0xF012C)
|
||||||
|
#define EDR00L (*(volatile unsigned char *)0xF012C)
|
||||||
|
#define EDR01 (*(volatile unsigned short *)0xF012E)
|
||||||
|
#define EDR01L (*(volatile unsigned char *)0xF012E)
|
||||||
|
#define SOL0 (*(volatile unsigned short *)0xF0134)
|
||||||
|
#define SOL0L (*(volatile unsigned char *)0xF0134)
|
||||||
|
#define SSC0 (*(volatile unsigned short *)0xF0138)
|
||||||
|
#define SSC0L (*(volatile unsigned char *)0xF0138)
|
||||||
|
#define TCR00 (*(volatile unsigned short *)0xF0180)
|
||||||
|
#define TCR01 (*(volatile unsigned short *)0xF0182)
|
||||||
|
#define TCR02 (*(volatile unsigned short *)0xF0184)
|
||||||
|
#define TCR03 (*(volatile unsigned short *)0xF0186)
|
||||||
|
#define TMR00 (*(volatile unsigned short *)0xF0190)
|
||||||
|
#define TMR01 (*(volatile unsigned short *)0xF0192)
|
||||||
|
#define TMR02 (*(volatile unsigned short *)0xF0194)
|
||||||
|
#define TMR03 (*(volatile unsigned short *)0xF0196)
|
||||||
|
#define TSR00 (*(volatile unsigned short *)0xF01A0)
|
||||||
|
#define TSR00L (*(volatile unsigned char *)0xF01A0)
|
||||||
|
#define TSR01 (*(volatile unsigned short *)0xF01A2)
|
||||||
|
#define TSR01L (*(volatile unsigned char *)0xF01A2)
|
||||||
|
#define TSR02 (*(volatile unsigned short *)0xF01A4)
|
||||||
|
#define TSR02L (*(volatile unsigned char *)0xF01A4)
|
||||||
|
#define TSR03 (*(volatile unsigned short *)0xF01A6)
|
||||||
|
#define TSR03L (*(volatile unsigned char *)0xF01A6)
|
||||||
|
#define TE0 (*(volatile unsigned short *)0xF01B0)
|
||||||
|
#define TE0L (*(volatile union un_te0l *)0xF01B0).te0l
|
||||||
|
#define TE0L_bit (*(volatile union un_te0l *)0xF01B0).BIT
|
||||||
|
#define TS0 (*(volatile unsigned short *)0xF01B2)
|
||||||
|
#define TS0L (*(volatile union un_ts0l *)0xF01B2).ts0l
|
||||||
|
#define TS0L_bit (*(volatile union un_ts0l *)0xF01B2).BIT
|
||||||
|
#define TT0 (*(volatile unsigned short *)0xF01B4)
|
||||||
|
#define TT0L (*(volatile union un_tt0l *)0xF01B4).tt0l
|
||||||
|
#define TT0L_bit (*(volatile union un_tt0l *)0xF01B4).BIT
|
||||||
|
#define TPS0 (*(volatile unsigned short *)0xF01B6)
|
||||||
|
#define TO0 (*(volatile unsigned short *)0xF01B8)
|
||||||
|
#define TO0L (*(volatile unsigned char *)0xF01B8)
|
||||||
|
#define TOE0 (*(volatile unsigned short *)0xF01BA)
|
||||||
|
#define TOE0L (*(volatile union un_toe0l *)0xF01BA).toe0l
|
||||||
|
#define TOE0L_bit (*(volatile union un_toe0l *)0xF01BA).BIT
|
||||||
|
#define TOL0 (*(volatile unsigned short *)0xF01BC)
|
||||||
|
#define TOL0L (*(volatile unsigned char *)0xF01BC)
|
||||||
|
#define TOM0 (*(volatile unsigned short *)0xF01BE)
|
||||||
|
#define TOM0L (*(volatile unsigned char *)0xF01BE)
|
||||||
|
#define IICCTL00 (*(volatile union un_iicctl00 *)0xF0230).iicctl00
|
||||||
|
#define IICCTL00_bit (*(volatile union un_iicctl00 *)0xF0230).BIT
|
||||||
|
#define IICCTL01 (*(volatile union un_iicctl01 *)0xF0231).iicctl01
|
||||||
|
#define IICCTL01_bit (*(volatile union un_iicctl01 *)0xF0231).BIT
|
||||||
|
#define IICWL0 (*(volatile unsigned char *)0xF0232)
|
||||||
|
#define IICWH0 (*(volatile unsigned char *)0xF0233)
|
||||||
|
#define SVA0 (*(volatile unsigned char *)0xF0234)
|
||||||
|
#define IICSE0 (*(volatile unsigned char *)0xF0235)
|
||||||
|
#define DSCCTL (*(volatile union un_dscctl *)0xF02E5).dscctl
|
||||||
|
#define DSCCTL_bit (*(volatile union un_dscctl *)0xF02E5).BIT
|
||||||
|
#define MCKC (*(volatile union un_mckc *)0xF02E6).mckc
|
||||||
|
#define MCKC_bit (*(volatile union un_mckc *)0xF02E6).BIT
|
||||||
|
#define CRC0CTL (*(volatile union un_crc0ctl *)0xF02F0).crc0ctl
|
||||||
|
#define CRC0CTL_bit (*(volatile union un_crc0ctl *)0xF02F0).BIT
|
||||||
|
#define PGCRCL (*(volatile unsigned short *)0xF02F2)
|
||||||
|
#define CRCD (*(volatile unsigned short *)0xF02FA)
|
||||||
|
#define SYSCFG (*(volatile unsigned short *)0xF0400)
|
||||||
|
#define SYSCFG1 (*(volatile unsigned short *)0xF0402)
|
||||||
|
#define SYSSTS0 (*(volatile unsigned short *)0xF0404)
|
||||||
|
#define SYSSTS1 (*(volatile unsigned short *)0xF0406)
|
||||||
|
#define DVSTCTR0 (*(volatile unsigned short *)0xF0408)
|
||||||
|
#define DVSTCTR1 (*(volatile unsigned short *)0xF040A)
|
||||||
|
#define DMA0PCFG (*(volatile unsigned short *)0xF0410)
|
||||||
|
#define DMA1PCFG (*(volatile unsigned short *)0xF0412)
|
||||||
|
#define CFIFOM (*(volatile unsigned short *)0xF0414)
|
||||||
|
#define CFIFOML (*(volatile unsigned char *)0xF0414)
|
||||||
|
#define D0FIFOM (*(volatile unsigned short *)0xF0418)
|
||||||
|
#define D0FIFOML (*(volatile unsigned char *)0xF0418)
|
||||||
|
#define D1FIFOM (*(volatile unsigned short *)0xF041C)
|
||||||
|
#define D1FIFOML (*(volatile unsigned char *)0xF041C)
|
||||||
|
#define CFIFOSEL (*(volatile unsigned short *)0xF0420)
|
||||||
|
#define CFIFOCTR (*(volatile unsigned short *)0xF0422)
|
||||||
|
#define D0FIFOSEL (*(volatile unsigned short *)0xF0428)
|
||||||
|
#define D0FIFOCTR (*(volatile unsigned short *)0xF042A)
|
||||||
|
#define D1FIFOSEL (*(volatile unsigned short *)0xF042C)
|
||||||
|
#define D1FIFOCTR (*(volatile unsigned short *)0xF042E)
|
||||||
|
#define INTENB0 (*(volatile unsigned short *)0xF0430)
|
||||||
|
#define INTENB1 (*(volatile unsigned short *)0xF0432)
|
||||||
|
#define INTENB2 (*(volatile unsigned short *)0xF0434)
|
||||||
|
#define BRDYENB (*(volatile unsigned short *)0xF0436)
|
||||||
|
#define NRDYENB (*(volatile unsigned short *)0xF0438)
|
||||||
|
#define BEMPENB (*(volatile unsigned short *)0xF043A)
|
||||||
|
#define SOFCFG (*(volatile unsigned short *)0xF043C)
|
||||||
|
#define INTSTS0 (*(volatile unsigned short *)0xF0440)
|
||||||
|
#define INTSTS1 (*(volatile unsigned short *)0xF0442)
|
||||||
|
#define INTSTS2 (*(volatile unsigned short *)0xF0444)
|
||||||
|
#define BRDYSTS (*(volatile unsigned short *)0xF0446)
|
||||||
|
#define NRDYSTS (*(volatile unsigned short *)0xF0448)
|
||||||
|
#define BEMPSTS (*(volatile unsigned short *)0xF044A)
|
||||||
|
#define FRMNUM (*(volatile unsigned short *)0xF044C)
|
||||||
|
#define USBADDR (*(volatile unsigned short *)0xF0450)
|
||||||
|
#define USBREQ (*(volatile unsigned short *)0xF0454)
|
||||||
|
#define USBVAL (*(volatile unsigned short *)0xF0456)
|
||||||
|
#define USBINDX (*(volatile unsigned short *)0xF0458)
|
||||||
|
#define USBLENG (*(volatile unsigned short *)0xF045A)
|
||||||
|
#define DCPCFG (*(volatile unsigned short *)0xF045C)
|
||||||
|
#define DCPMAXP (*(volatile unsigned short *)0xF045E)
|
||||||
|
#define DCPCTR (*(volatile unsigned short *)0xF0460)
|
||||||
|
#define PIPESEL (*(volatile unsigned short *)0xF0464)
|
||||||
|
#define PIPECFG (*(volatile unsigned short *)0xF0468)
|
||||||
|
#define PIPEMAXP (*(volatile unsigned short *)0xF046C)
|
||||||
|
#define PIPEPERI (*(volatile unsigned short *)0xF046E)
|
||||||
|
#define PIPE4CTR (*(volatile unsigned short *)0xF0476)
|
||||||
|
#define PIPE5CTR (*(volatile unsigned short *)0xF0478)
|
||||||
|
#define PIPE6CTR (*(volatile unsigned short *)0xF047A)
|
||||||
|
#define PIPE7CTR (*(volatile unsigned short *)0xF047C)
|
||||||
|
#define PIPE4TRE (*(volatile unsigned short *)0xF049C)
|
||||||
|
#define PIPE4TRN (*(volatile unsigned short *)0xF049E)
|
||||||
|
#define PIPE5TRE (*(volatile unsigned short *)0xF04A0)
|
||||||
|
#define PIPE5TRN (*(volatile unsigned short *)0xF04A2)
|
||||||
|
#define USBBCCTRL0 (*(volatile unsigned short *)0xF04B0)
|
||||||
|
#define USBBCCTRL1 (*(volatile unsigned short *)0xF04B4)
|
||||||
|
#define USBBCOPT0 (*(volatile unsigned short *)0xF04B8)
|
||||||
|
#define USBBCOPT1 (*(volatile unsigned short *)0xF04BC)
|
||||||
|
#define USBMC (*(volatile unsigned short *)0xF04CC)
|
||||||
|
#define DEVADD0 (*(volatile unsigned short *)0xF04D0)
|
||||||
|
#define DEVADD1 (*(volatile unsigned short *)0xF04D2)
|
||||||
|
#define DEVADD2 (*(volatile unsigned short *)0xF04D4)
|
||||||
|
#define DEVADD3 (*(volatile unsigned short *)0xF04D6)
|
||||||
|
#define DEVADD4 (*(volatile unsigned short *)0xF04D8)
|
||||||
|
#define DEVADD5 (*(volatile unsigned short *)0xF04DA)
|
||||||
|
|
||||||
|
/*
|
||||||
|
Sfr bits
|
||||||
|
*/
|
||||||
|
#define ADTYP ADM2_bit.no0
|
||||||
|
#define AWC ADM2_bit.no2
|
||||||
|
#define ADRCK ADM2_bit.no3
|
||||||
|
#define DFLEN DFLCTL_bit.no0
|
||||||
|
#define BRSAM BECTL_bit.no0
|
||||||
|
#define ESQST FSSE_bit.no7
|
||||||
|
#define DIVST MDUC_bit.no0
|
||||||
|
#define MACSF MDUC_bit.no1
|
||||||
|
#define MACOF MDUC_bit.no2
|
||||||
|
#define MDSM MDUC_bit.no3
|
||||||
|
#define MACMODE MDUC_bit.no6
|
||||||
|
#define DIVMODE MDUC_bit.no7
|
||||||
|
#define TAU0EN PER0_bit.no0
|
||||||
|
#define SAU0EN PER0_bit.no2
|
||||||
|
#define IICA0EN PER0_bit.no4
|
||||||
|
#define ADCEN PER0_bit.no5
|
||||||
|
#define RTCEN PER0_bit.no7
|
||||||
|
#define PAENB RMC_bit.no0
|
||||||
|
#define WDVOL RMC_bit.no7
|
||||||
|
#define RPEF RPECTL_bit.no0
|
||||||
|
#define RPERDIS RPECTL_bit.no7
|
||||||
|
#define SPT0 IICCTL00_bit.no0
|
||||||
|
#define STT0 IICCTL00_bit.no1
|
||||||
|
#define ACKE0 IICCTL00_bit.no2
|
||||||
|
#define WTIM0 IICCTL00_bit.no3
|
||||||
|
#define SPIE0 IICCTL00_bit.no4
|
||||||
|
#define WREL0 IICCTL00_bit.no5
|
||||||
|
#define LREL0 IICCTL00_bit.no6
|
||||||
|
#define IICE0 IICCTL00_bit.no7
|
||||||
|
#define PRS0 IICCTL01_bit.no0
|
||||||
|
#define DFC0 IICCTL01_bit.no2
|
||||||
|
#define SMC0 IICCTL01_bit.no3
|
||||||
|
#define DAD0 IICCTL01_bit.no4
|
||||||
|
#define CLD0 IICCTL01_bit.no5
|
||||||
|
#define WUP0 IICCTL01_bit.no7
|
||||||
|
#define CRC0EN CRC0CTL_bit.no7
|
||||||
|
|
||||||
|
/*
|
||||||
|
Interrupt vector addresses
|
||||||
|
*/
|
||||||
|
#endif
|
|
@ -0,0 +1,132 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ISR_Support.h"
|
||||||
|
|
||||||
|
#define CS 0xFFFFC
|
||||||
|
#define ES 0xFFFFD
|
||||||
|
|
||||||
|
.global _vPortYield
|
||||||
|
.global _vPortStartFirstTask
|
||||||
|
.global _vPortTickISR
|
||||||
|
|
||||||
|
.extern _vTaskSwitchContext
|
||||||
|
.extern _vTaskIncrementTick
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
/* FreeRTOS yield handler. This is installed as the BRK software interrupt
|
||||||
|
handler. */
|
||||||
|
_vPortYield:
|
||||||
|
/* Save the context of the current task. */
|
||||||
|
portSAVE_CONTEXT
|
||||||
|
/* Call the scheduler to select the next task. */
|
||||||
|
call !!_vTaskSwitchContext
|
||||||
|
/*portRESTORE_CONTEXT ; Restore the context of the next task to run.*/
|
||||||
|
retb
|
||||||
|
|
||||||
|
|
||||||
|
/* Starts the scheduler by restoring the context of the task that will execute
|
||||||
|
first. */
|
||||||
|
_vPortStartFirstTask:
|
||||||
|
/* portRESTORE_CONTEXT ; Restore the context of whichever task the ... */
|
||||||
|
reti /*An interrupt stack frame is used so the task */
|
||||||
|
/* is started using a RETI instruction. */
|
||||||
|
|
||||||
|
/* FreeRTOS tick handler. This is installed as the interval timer interrupt
|
||||||
|
handler. */
|
||||||
|
_vPortTickISR:
|
||||||
|
|
||||||
|
/* portSAVE_CONTEXT ; Save the context of the current task. */
|
||||||
|
call !!_vTaskIncrementTick /* Call the timer tick function. */
|
||||||
|
#if configUSE_PREEMPTION == 1
|
||||||
|
call !!_vTaskSwitchContext /* Call the scheduler to select the next task. */
|
||||||
|
#endif
|
||||||
|
/* portRESTORE_CONTEXT ; Restore the context of the next task to run. */
|
||||||
|
reti
|
||||||
|
|
||||||
|
|
||||||
|
/* Install the interrupt handlers
|
||||||
|
|
||||||
|
COMMON INTVEC:CODE:ROOT(1)
|
||||||
|
ORG 56
|
||||||
|
DW vPortTickISR
|
||||||
|
|
||||||
|
COMMON INTVEC:CODE:ROOT(1)
|
||||||
|
ORG 126
|
||||||
|
DW vPortYield */
|
||||||
|
|
||||||
|
|
||||||
|
.end
|
||||||
|
|
|
@ -0,0 +1,178 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PORTMACRO_H
|
||||||
|
#define PORTMACRO_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------
|
||||||
|
* Port specific definitions.
|
||||||
|
*
|
||||||
|
* The settings in this file configure FreeRTOS correctly for the
|
||||||
|
* given hardware and compiler.
|
||||||
|
*
|
||||||
|
* These settings should not be altered.
|
||||||
|
*-----------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Type definitions. */
|
||||||
|
|
||||||
|
#define portCHAR char
|
||||||
|
#define portFLOAT float
|
||||||
|
#define portDOUBLE double
|
||||||
|
#define portLONG long
|
||||||
|
#define portSHORT short
|
||||||
|
#define portSTACK_TYPE unsigned short
|
||||||
|
#define portBASE_TYPE short
|
||||||
|
|
||||||
|
#if __DATA_MODEL__ == __DATA_MODEL_FAR__
|
||||||
|
#define portPOINTER_SIZE_TYPE unsigned long
|
||||||
|
#else
|
||||||
|
#define portPOINTER_SIZE_TYPE unsigned short
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if ( configUSE_16_BIT_TICKS == 1 )
|
||||||
|
typedef unsigned int portTickType;
|
||||||
|
#define portMAX_DELAY ( portTickType ) 0xffff
|
||||||
|
#else
|
||||||
|
typedef unsigned long portTickType;
|
||||||
|
#define portMAX_DELAY ( portTickType ) 0xffffffff
|
||||||
|
#endif
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Interrupt control macros. */
|
||||||
|
#define portDISABLE_INTERRUPTS() __asm volatile ( "DI" )
|
||||||
|
#define portENABLE_INTERRUPTS() __asm volatile ( "EI" )
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Critical section control macros. */
|
||||||
|
#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned portSHORT ) 0 )
|
||||||
|
|
||||||
|
#define portENTER_CRITICAL() \
|
||||||
|
{ \
|
||||||
|
extern volatile unsigned short usCriticalNesting; \
|
||||||
|
\
|
||||||
|
portDISABLE_INTERRUPTS(); \
|
||||||
|
\
|
||||||
|
/* Now interrupts are disabled ulCriticalNesting can be accessed */ \
|
||||||
|
/* directly. Increment ulCriticalNesting to keep a count of how many */ \
|
||||||
|
/* times portENTER_CRITICAL() has been called. */ \
|
||||||
|
usCriticalNesting++; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define portEXIT_CRITICAL() \
|
||||||
|
{ \
|
||||||
|
extern volatile unsigned short usCriticalNesting; \
|
||||||
|
\
|
||||||
|
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
|
||||||
|
{ \
|
||||||
|
/* Decrement the nesting count as we are leaving a critical section. */ \
|
||||||
|
usCriticalNesting--; \
|
||||||
|
\
|
||||||
|
/* If the nesting level has reached zero then interrupts should be */ \
|
||||||
|
/* re-enabled. */ \
|
||||||
|
if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING ) \
|
||||||
|
{ \
|
||||||
|
portENABLE_INTERRUPTS(); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Task utilities. */
|
||||||
|
#define portYIELD() __asm volatile ( "BRK" )
|
||||||
|
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) if( xHigherPriorityTaskWoken ) vTaskSwitchContext()
|
||||||
|
#define portNOP() __asm volatile ( "NOP" )
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Hardwware specifics. */
|
||||||
|
#define portBYTE_ALIGNMENT 2
|
||||||
|
#define portSTACK_GROWTH ( -1 )
|
||||||
|
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||||
|
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||||
|
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PORTMACRO_H */
|
||||||
|
|
|
@ -0,0 +1,359 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A sample implementation of pvPortMalloc() and vPortFree() that combines
|
||||||
|
* (coalescences) adjacent memory blocks as they are freed, and in so doing
|
||||||
|
* limits memory fragmentation.
|
||||||
|
*
|
||||||
|
* See heap_1.c, heap_2.c and heap_3.c for alternative implementations, and the
|
||||||
|
* memory management pages of http://www.FreeRTOS.org for more information.
|
||||||
|
*/
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
|
||||||
|
all the API functions to use the MPU wrappers. That should only be done when
|
||||||
|
task.h is included from an application file. */
|
||||||
|
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
|
||||||
|
/* Block sizes must not get too small. */
|
||||||
|
#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( heapSTRUCT_SIZE * 2 ) )
|
||||||
|
|
||||||
|
/* A few bytes might be lost to byte aligning the heap start address. */
|
||||||
|
#define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT )
|
||||||
|
|
||||||
|
/* Allocate the memory for the heap. */
|
||||||
|
static unsigned char ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||||
|
|
||||||
|
/* Define the linked list structure. This is used to link free blocks in order
|
||||||
|
of their memory address. */
|
||||||
|
typedef struct A_BLOCK_LINK
|
||||||
|
{
|
||||||
|
struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */
|
||||||
|
size_t xBlockSize; /*<< The size of the free block. */
|
||||||
|
} xBlockLink;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Inserts a block of memory that is being freed into the correct position in
|
||||||
|
* the list of free memory blocks. The block being freed will be merged with
|
||||||
|
* the block in front it and/or the block behind it if the memory blocks are
|
||||||
|
* adjacent to each other.
|
||||||
|
*/
|
||||||
|
static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called automatically to setup the required heap structures the first time
|
||||||
|
* pvPortMalloc() is called.
|
||||||
|
*/
|
||||||
|
static void prvHeapInit( void );
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* The size of the structure placed at the beginning of each allocated memory
|
||||||
|
block must by correctly byte aligned. */
|
||||||
|
static const unsigned short heapSTRUCT_SIZE = ( sizeof( xBlockLink ) + portBYTE_ALIGNMENT - ( sizeof( xBlockLink ) % portBYTE_ALIGNMENT ) );
|
||||||
|
|
||||||
|
/* Ensure the pxEnd pointer will end up on the correct byte alignment. */
|
||||||
|
static const size_t xTotalHeapSize = ( ( size_t ) configADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK );
|
||||||
|
|
||||||
|
/* Create a couple of list links to mark the start and end of the list. */
|
||||||
|
static xBlockLink xStart, *pxEnd = NULL;
|
||||||
|
|
||||||
|
/* Keeps track of the number of free bytes remaining, but says nothing about
|
||||||
|
fragmentation. */
|
||||||
|
static size_t xFreeBytesRemaining = ( ( size_t ) configADJUSTED_HEAP_SIZE ) & ( ( size_t ) ~portBYTE_ALIGNMENT_MASK );
|
||||||
|
|
||||||
|
/* STATIC FUNCTIONS ARE DEFINED AS MACROS TO MINIMIZE THE FUNCTION CALL DEPTH. */
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void *pvPortMalloc( size_t xWantedSize )
|
||||||
|
{
|
||||||
|
xBlockLink *pxBlock, *pxPreviousBlock, *pxNewBlockLink;
|
||||||
|
void *pvReturn = NULL;
|
||||||
|
|
||||||
|
vTaskSuspendAll();
|
||||||
|
{
|
||||||
|
/* If this is the first call to malloc then the heap will require
|
||||||
|
initialisation to setup the list of free blocks. */
|
||||||
|
if( pxEnd == NULL )
|
||||||
|
{
|
||||||
|
prvHeapInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The wanted size is increased so it can contain a xBlockLink
|
||||||
|
structure in addition to the requested amount of bytes. */
|
||||||
|
if( xWantedSize > 0 )
|
||||||
|
{
|
||||||
|
xWantedSize += heapSTRUCT_SIZE;
|
||||||
|
|
||||||
|
/* Ensure that blocks are always aligned to the required number of
|
||||||
|
bytes. */
|
||||||
|
if( xWantedSize & portBYTE_ALIGNMENT_MASK )
|
||||||
|
{
|
||||||
|
/* Byte alignment required. */
|
||||||
|
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( xWantedSize > 0 ) && ( xWantedSize < xTotalHeapSize ) )
|
||||||
|
{
|
||||||
|
/* Traverse the list from the start (lowest address) block until one
|
||||||
|
of adequate size is found. */
|
||||||
|
pxPreviousBlock = &xStart;
|
||||||
|
pxBlock = xStart.pxNextFreeBlock;
|
||||||
|
while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) )
|
||||||
|
{
|
||||||
|
pxPreviousBlock = pxBlock;
|
||||||
|
pxBlock = pxBlock->pxNextFreeBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the end marker was reached then a block of adequate size was
|
||||||
|
not found. */
|
||||||
|
if( pxBlock != pxEnd )
|
||||||
|
{
|
||||||
|
/* Return the memory space - jumping over the xBlockLink structure
|
||||||
|
at its start. */
|
||||||
|
pvReturn = ( void * ) ( ( ( unsigned char * ) pxPreviousBlock->pxNextFreeBlock ) + heapSTRUCT_SIZE );
|
||||||
|
|
||||||
|
/* This block is being returned for use so must be taken out of
|
||||||
|
the list of free blocks. */
|
||||||
|
pxPreviousBlock->pxNextFreeBlock = pxBlock->pxNextFreeBlock;
|
||||||
|
|
||||||
|
/* If the block is larger than required it can be split into two. */
|
||||||
|
if( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE )
|
||||||
|
{
|
||||||
|
/* This block is to be split into two. Create a new block
|
||||||
|
following the number of bytes requested. The void cast is
|
||||||
|
used to prevent byte alignment warnings from the compiler. */
|
||||||
|
pxNewBlockLink = ( void * ) ( ( ( unsigned char * ) pxBlock ) + xWantedSize );
|
||||||
|
|
||||||
|
/* Calculate the sizes of two blocks split from the single
|
||||||
|
block. */
|
||||||
|
pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize;
|
||||||
|
pxBlock->xBlockSize = xWantedSize;
|
||||||
|
|
||||||
|
/* Insert the new block into the list of free blocks. */
|
||||||
|
prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
xFreeBytesRemaining -= pxBlock->xBlockSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xTaskResumeAll();
|
||||||
|
|
||||||
|
#if( configUSE_MALLOC_FAILED_HOOK == 1 )
|
||||||
|
{
|
||||||
|
if( pvReturn == NULL )
|
||||||
|
{
|
||||||
|
extern void vApplicationMallocFailedHook( void );
|
||||||
|
vApplicationMallocFailedHook();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return pvReturn;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vPortFree( void *pv )
|
||||||
|
{
|
||||||
|
unsigned char *puc = ( unsigned char * ) pv;
|
||||||
|
xBlockLink *pxLink;
|
||||||
|
|
||||||
|
if( pv != NULL )
|
||||||
|
{
|
||||||
|
/* The memory being freed will have an xBlockLink structure immediately
|
||||||
|
before it. */
|
||||||
|
puc -= heapSTRUCT_SIZE;
|
||||||
|
|
||||||
|
/* This casting is to keep the compiler from issuing warnings. */
|
||||||
|
pxLink = ( void * ) puc;
|
||||||
|
|
||||||
|
vTaskSuspendAll();
|
||||||
|
{
|
||||||
|
/* Add this block to the list of free blocks. */
|
||||||
|
xFreeBytesRemaining += pxLink->xBlockSize;
|
||||||
|
prvInsertBlockIntoFreeList( ( ( xBlockLink * ) pxLink ) );
|
||||||
|
}
|
||||||
|
xTaskResumeAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
size_t xPortGetFreeHeapSize( void )
|
||||||
|
{
|
||||||
|
return xFreeBytesRemaining;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vPortInitialiseBlocks( void )
|
||||||
|
{
|
||||||
|
/* This just exists to keep the linker quiet. */
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvHeapInit( void )
|
||||||
|
{
|
||||||
|
xBlockLink *pxFirstFreeBlock;
|
||||||
|
unsigned char *pucHeapEnd, *pucAlignedHeap;
|
||||||
|
|
||||||
|
/* Ensure the heap starts on a correctly aligned boundary. */
|
||||||
|
pucAlignedHeap = ( unsigned char * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) );
|
||||||
|
|
||||||
|
/* xStart is used to hold a pointer to the first item in the list of free
|
||||||
|
blocks. The void cast is used to prevent compiler warnings. */
|
||||||
|
xStart.pxNextFreeBlock = ( void * ) pucAlignedHeap;
|
||||||
|
xStart.xBlockSize = ( size_t ) 0;
|
||||||
|
|
||||||
|
/* pxEnd is used to mark the end of the list of free blocks and is inserted
|
||||||
|
at the end of the heap space. */
|
||||||
|
pucHeapEnd = pucAlignedHeap + xTotalHeapSize;
|
||||||
|
pucHeapEnd -= heapSTRUCT_SIZE;
|
||||||
|
pxEnd = ( void * ) pucHeapEnd;
|
||||||
|
configASSERT( ( ( ( unsigned long ) pxEnd ) & ( ( unsigned long ) portBYTE_ALIGNMENT_MASK ) ) == 0UL );
|
||||||
|
pxEnd->xBlockSize = 0;
|
||||||
|
pxEnd->pxNextFreeBlock = NULL;
|
||||||
|
|
||||||
|
/* To start with there is a single free block that is sized to take up the
|
||||||
|
entire heap space, minus the space taken by pxEnd. */
|
||||||
|
pxFirstFreeBlock = ( void * ) pucAlignedHeap;
|
||||||
|
pxFirstFreeBlock->xBlockSize = xTotalHeapSize - heapSTRUCT_SIZE;
|
||||||
|
pxFirstFreeBlock->pxNextFreeBlock = pxEnd;
|
||||||
|
|
||||||
|
/* The heap now contains pxEnd. */
|
||||||
|
xFreeBytesRemaining -= heapSTRUCT_SIZE;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvInsertBlockIntoFreeList( xBlockLink *pxBlockToInsert )
|
||||||
|
{
|
||||||
|
xBlockLink *pxIterator;
|
||||||
|
unsigned char *puc;
|
||||||
|
|
||||||
|
/* Iterate through the list until a block is found that has a higher address
|
||||||
|
than the block being inserted. */
|
||||||
|
for( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock )
|
||||||
|
{
|
||||||
|
/* Nothing to do here, just iterate to the right position. */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do the block being inserted, and the block it is being inserted after
|
||||||
|
make a contiguous block of memory? */
|
||||||
|
puc = ( unsigned char * ) pxIterator;
|
||||||
|
if( ( puc + pxIterator->xBlockSize ) == ( unsigned char * ) pxBlockToInsert )
|
||||||
|
{
|
||||||
|
pxIterator->xBlockSize += pxBlockToInsert->xBlockSize;
|
||||||
|
pxBlockToInsert = pxIterator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do the block being inserted, and the block it is being inserted before
|
||||||
|
make a contiguous block of memory? */
|
||||||
|
puc = ( unsigned char * ) pxBlockToInsert;
|
||||||
|
if( ( puc + pxBlockToInsert->xBlockSize ) == ( unsigned char * ) pxIterator->pxNextFreeBlock )
|
||||||
|
{
|
||||||
|
if( pxIterator->pxNextFreeBlock != pxEnd )
|
||||||
|
{
|
||||||
|
/* Form one big block from the two blocks. */
|
||||||
|
pxBlockToInsert->xBlockSize += pxIterator->pxNextFreeBlock->xBlockSize;
|
||||||
|
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock->pxNextFreeBlock;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pxBlockToInsert->pxNextFreeBlock = pxEnd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the block being inserted plugged a gab, so was merged with the block
|
||||||
|
before and the block after, then it's pxNextFreeBlock pointer will have
|
||||||
|
already been set, and should not be set here as that would make it point
|
||||||
|
to itself. */
|
||||||
|
if( pxIterator != pxBlockToInsert )
|
||||||
|
{
|
||||||
|
pxIterator->pxNextFreeBlock = pxBlockToInsert;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
1969
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/queue.c
Normal file
1969
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/queue.c
Normal file
File diff suppressed because it is too large
Load diff
2761
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/tasks.c
Normal file
2761
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/tasks.c
Normal file
File diff suppressed because it is too large
Load diff
695
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/timers.c
Normal file
695
FreeRTOS/Demo/RL78_E2Studio_GCC/src/FreeRTOS_Source/timers.c
Normal file
|
@ -0,0 +1,695 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
|
||||||
|
all the API functions to use the MPU wrappers. That should only be done when
|
||||||
|
task.h is included from an application file. */
|
||||||
|
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "queue.h"
|
||||||
|
#include "timers.h"
|
||||||
|
|
||||||
|
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||||
|
|
||||||
|
/* This entire source file will be skipped if the application is not configured
|
||||||
|
to include software timer functionality. This #if is closed at the very bottom
|
||||||
|
of this file. If you want to include software timer functionality then ensure
|
||||||
|
configUSE_TIMERS is set to 1 in FreeRTOSConfig.h. */
|
||||||
|
#if ( configUSE_TIMERS == 1 )
|
||||||
|
|
||||||
|
/* Misc definitions. */
|
||||||
|
#define tmrNO_DELAY ( portTickType ) 0U
|
||||||
|
|
||||||
|
/* The definition of the timers themselves. */
|
||||||
|
typedef struct tmrTimerControl
|
||||||
|
{
|
||||||
|
const signed char *pcTimerName; /*<< Text name. This is not used by the kernel, it is included simply to make debugging easier. */
|
||||||
|
xListItem xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */
|
||||||
|
portTickType xTimerPeriodInTicks;/*<< How quickly and often the timer expires. */
|
||||||
|
unsigned portBASE_TYPE uxAutoReload; /*<< Set to pdTRUE if the timer should be automatically restarted once expired. Set to pdFALSE if the timer is, in effect, a one shot timer. */
|
||||||
|
void *pvTimerID; /*<< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */
|
||||||
|
tmrTIMER_CALLBACK pxCallbackFunction; /*<< The function that will be called when the timer expires. */
|
||||||
|
} xTIMER;
|
||||||
|
|
||||||
|
/* The definition of messages that can be sent and received on the timer
|
||||||
|
queue. */
|
||||||
|
typedef struct tmrTimerQueueMessage
|
||||||
|
{
|
||||||
|
portBASE_TYPE xMessageID; /*<< The command being sent to the timer service task. */
|
||||||
|
portTickType xMessageValue; /*<< An optional value used by a subset of commands, for example, when changing the period of a timer. */
|
||||||
|
xTIMER * pxTimer; /*<< The timer to which the command will be applied. */
|
||||||
|
} xTIMER_MESSAGE;
|
||||||
|
|
||||||
|
|
||||||
|
/* The list in which active timers are stored. Timers are referenced in expire
|
||||||
|
time order, with the nearest expiry time at the front of the list. Only the
|
||||||
|
timer service task is allowed to access xActiveTimerList. */
|
||||||
|
PRIVILEGED_DATA static xList xActiveTimerList1;
|
||||||
|
PRIVILEGED_DATA static xList xActiveTimerList2;
|
||||||
|
PRIVILEGED_DATA static xList *pxCurrentTimerList;
|
||||||
|
PRIVILEGED_DATA static xList *pxOverflowTimerList;
|
||||||
|
|
||||||
|
/* A queue that is used to send commands to the timer service task. */
|
||||||
|
PRIVILEGED_DATA static xQueueHandle xTimerQueue = NULL;
|
||||||
|
|
||||||
|
#if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 )
|
||||||
|
|
||||||
|
PRIVILEGED_DATA static xTaskHandle xTimerTaskHandle = NULL;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialise the infrastructure used by the timer service task if it has not
|
||||||
|
* been initialised already.
|
||||||
|
*/
|
||||||
|
static void prvCheckForValidListAndQueue( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The timer service task (daemon). Timer functionality is controlled by this
|
||||||
|
* task. Other tasks communicate with the timer service task using the
|
||||||
|
* xTimerQueue queue.
|
||||||
|
*/
|
||||||
|
static void prvTimerTask( void *pvParameters ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called by the timer service task to interpret and process a command it
|
||||||
|
* received on the timer queue.
|
||||||
|
*/
|
||||||
|
static void prvProcessReceivedCommands( void ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Insert the timer into either xActiveTimerList1, or xActiveTimerList2,
|
||||||
|
* depending on if the expire time causes a timer counter overflow.
|
||||||
|
*/
|
||||||
|
static portBASE_TYPE prvInsertTimerInActiveList( xTIMER *pxTimer, portTickType xNextExpiryTime, portTickType xTimeNow, portTickType xCommandTime ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* An active timer has reached its expire time. Reload the timer if it is an
|
||||||
|
* auto reload timer, then call its callback.
|
||||||
|
*/
|
||||||
|
static void prvProcessExpiredTimer( portTickType xNextExpireTime, portTickType xTimeNow ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The tick count has overflowed. Switch the timer lists after ensuring the
|
||||||
|
* current timer list does not still reference some timers.
|
||||||
|
*/
|
||||||
|
static void prvSwitchTimerLists( portTickType xLastTime ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Obtain the current tick count, setting *pxTimerListsWereSwitched to pdTRUE
|
||||||
|
* if a tick count overflow occurred since prvSampleTimeNow() was last called.
|
||||||
|
*/
|
||||||
|
static portTickType prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the timer list contains any active timers then return the expire time of
|
||||||
|
* the timer that will expire first and set *pxListWasEmpty to false. If the
|
||||||
|
* timer list does not contain any timers then return 0 and set *pxListWasEmpty
|
||||||
|
* to pdTRUE.
|
||||||
|
*/
|
||||||
|
static portTickType prvGetNextExpireTime( portBASE_TYPE *pxListWasEmpty ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a timer has expired, process it. Otherwise, block the timer service task
|
||||||
|
* until either a timer does expire or a command is received.
|
||||||
|
*/
|
||||||
|
static void prvProcessTimerOrBlockTask( portTickType xNextExpireTime, portBASE_TYPE xListWasEmpty ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
portBASE_TYPE xTimerCreateTimerTask( void )
|
||||||
|
{
|
||||||
|
portBASE_TYPE xReturn = pdFAIL;
|
||||||
|
|
||||||
|
/* This function is called when the scheduler is started if
|
||||||
|
configUSE_TIMERS is set to 1. Check that the infrastructure used by the
|
||||||
|
timer service task has been created/initialised. If timers have already
|
||||||
|
been created then the initialisation will already have been performed. */
|
||||||
|
prvCheckForValidListAndQueue();
|
||||||
|
|
||||||
|
if( xTimerQueue != NULL )
|
||||||
|
{
|
||||||
|
#if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 )
|
||||||
|
{
|
||||||
|
/* Create the timer task, storing its handle in xTimerTaskHandle so
|
||||||
|
it can be returned by the xTimerGetTimerDaemonTaskHandle() function. */
|
||||||
|
xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
/* Create the timer task without storing its handle. */
|
||||||
|
xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
configASSERT( xReturn );
|
||||||
|
return xReturn;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
xTimerHandle xTimerCreate( const signed char * const pcTimerName, portTickType xTimerPeriodInTicks, unsigned portBASE_TYPE uxAutoReload, void *pvTimerID, tmrTIMER_CALLBACK pxCallbackFunction )
|
||||||
|
{
|
||||||
|
xTIMER *pxNewTimer;
|
||||||
|
|
||||||
|
/* Allocate the timer structure. */
|
||||||
|
if( xTimerPeriodInTicks == ( portTickType ) 0U )
|
||||||
|
{
|
||||||
|
pxNewTimer = NULL;
|
||||||
|
configASSERT( ( xTimerPeriodInTicks > 0 ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pxNewTimer = ( xTIMER * ) pvPortMalloc( sizeof( xTIMER ) );
|
||||||
|
if( pxNewTimer != NULL )
|
||||||
|
{
|
||||||
|
/* Ensure the infrastructure used by the timer service task has been
|
||||||
|
created/initialised. */
|
||||||
|
prvCheckForValidListAndQueue();
|
||||||
|
|
||||||
|
/* Initialise the timer structure members using the function parameters. */
|
||||||
|
pxNewTimer->pcTimerName = pcTimerName;
|
||||||
|
pxNewTimer->xTimerPeriodInTicks = xTimerPeriodInTicks;
|
||||||
|
pxNewTimer->uxAutoReload = uxAutoReload;
|
||||||
|
pxNewTimer->pvTimerID = pvTimerID;
|
||||||
|
pxNewTimer->pxCallbackFunction = pxCallbackFunction;
|
||||||
|
vListInitialiseItem( &( pxNewTimer->xTimerListItem ) );
|
||||||
|
|
||||||
|
traceTIMER_CREATE( pxNewTimer );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
traceTIMER_CREATE_FAILED();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( xTimerHandle ) pxNewTimer;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime )
|
||||||
|
{
|
||||||
|
portBASE_TYPE xReturn = pdFAIL;
|
||||||
|
xTIMER_MESSAGE xMessage;
|
||||||
|
|
||||||
|
/* Send a message to the timer service task to perform a particular action
|
||||||
|
on a particular timer definition. */
|
||||||
|
if( xTimerQueue != NULL )
|
||||||
|
{
|
||||||
|
/* Send a command to the timer service task to start the xTimer timer. */
|
||||||
|
xMessage.xMessageID = xCommandID;
|
||||||
|
xMessage.xMessageValue = xOptionalValue;
|
||||||
|
xMessage.pxTimer = ( xTIMER * ) xTimer;
|
||||||
|
|
||||||
|
if( pxHigherPriorityTaskWoken == NULL )
|
||||||
|
{
|
||||||
|
if( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )
|
||||||
|
{
|
||||||
|
xReturn = xQueueSendToBack( xTimerQueue, &xMessage, xBlockTime );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xReturn = xQueueSendToBack( xTimerQueue, &xMessage, tmrNO_DELAY );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xReturn = xQueueSendToBackFromISR( xTimerQueue, &xMessage, pxHigherPriorityTaskWoken );
|
||||||
|
}
|
||||||
|
|
||||||
|
traceTIMER_COMMAND_SEND( xTimer, xCommandID, xOptionalValue, xReturn );
|
||||||
|
}
|
||||||
|
|
||||||
|
return xReturn;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 )
|
||||||
|
|
||||||
|
xTaskHandle xTimerGetTimerDaemonTaskHandle( void )
|
||||||
|
{
|
||||||
|
/* If xTimerGetTimerDaemonTaskHandle() is called before the scheduler has been
|
||||||
|
started, then xTimerTaskHandle will be NULL. */
|
||||||
|
configASSERT( ( xTimerTaskHandle != NULL ) );
|
||||||
|
return xTimerTaskHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvProcessExpiredTimer( portTickType xNextExpireTime, portTickType xTimeNow )
|
||||||
|
{
|
||||||
|
xTIMER *pxTimer;
|
||||||
|
portBASE_TYPE xResult;
|
||||||
|
|
||||||
|
/* Remove the timer from the list of active timers. A check has already
|
||||||
|
been performed to ensure the list is not empty. */
|
||||||
|
pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );
|
||||||
|
uxListRemove( &( pxTimer->xTimerListItem ) );
|
||||||
|
traceTIMER_EXPIRED( pxTimer );
|
||||||
|
|
||||||
|
/* If the timer is an auto reload timer then calculate the next
|
||||||
|
expiry time and re-insert the timer in the list of active timers. */
|
||||||
|
if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE )
|
||||||
|
{
|
||||||
|
/* This is the only time a timer is inserted into a list using
|
||||||
|
a time relative to anything other than the current time. It
|
||||||
|
will therefore be inserted into the correct list relative to
|
||||||
|
the time this task thinks it is now, even if a command to
|
||||||
|
switch lists due to a tick count overflow is already waiting in
|
||||||
|
the timer queue. */
|
||||||
|
if( prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime ) == pdTRUE )
|
||||||
|
{
|
||||||
|
/* The timer expired before it was added to the active timer
|
||||||
|
list. Reload it now. */
|
||||||
|
xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );
|
||||||
|
configASSERT( xResult );
|
||||||
|
( void ) xResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Call the timer callback. */
|
||||||
|
pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvTimerTask( void *pvParameters )
|
||||||
|
{
|
||||||
|
portTickType xNextExpireTime;
|
||||||
|
portBASE_TYPE xListWasEmpty;
|
||||||
|
|
||||||
|
/* Just to avoid compiler warnings. */
|
||||||
|
( void ) pvParameters;
|
||||||
|
|
||||||
|
for( ;; )
|
||||||
|
{
|
||||||
|
/* Query the timers list to see if it contains any timers, and if so,
|
||||||
|
obtain the time at which the next timer will expire. */
|
||||||
|
xNextExpireTime = prvGetNextExpireTime( &xListWasEmpty );
|
||||||
|
|
||||||
|
/* If a timer has expired, process it. Otherwise, block this task
|
||||||
|
until either a timer does expire, or a command is received. */
|
||||||
|
prvProcessTimerOrBlockTask( xNextExpireTime, xListWasEmpty );
|
||||||
|
|
||||||
|
/* Empty the command queue. */
|
||||||
|
prvProcessReceivedCommands();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvProcessTimerOrBlockTask( portTickType xNextExpireTime, portBASE_TYPE xListWasEmpty )
|
||||||
|
{
|
||||||
|
portTickType xTimeNow;
|
||||||
|
portBASE_TYPE xTimerListsWereSwitched;
|
||||||
|
|
||||||
|
vTaskSuspendAll();
|
||||||
|
{
|
||||||
|
/* Obtain the time now to make an assessment as to whether the timer
|
||||||
|
has expired or not. If obtaining the time causes the lists to switch
|
||||||
|
then don't process this timer as any timers that remained in the list
|
||||||
|
when the lists were switched will have been processed within the
|
||||||
|
prvSampelTimeNow() function. */
|
||||||
|
xTimeNow = prvSampleTimeNow( &xTimerListsWereSwitched );
|
||||||
|
if( xTimerListsWereSwitched == pdFALSE )
|
||||||
|
{
|
||||||
|
/* The tick count has not overflowed, has the timer expired? */
|
||||||
|
if( ( xListWasEmpty == pdFALSE ) && ( xNextExpireTime <= xTimeNow ) )
|
||||||
|
{
|
||||||
|
xTaskResumeAll();
|
||||||
|
prvProcessExpiredTimer( xNextExpireTime, xTimeNow );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The tick count has not overflowed, and the next expire
|
||||||
|
time has not been reached yet. This task should therefore
|
||||||
|
block to wait for the next expire time or a command to be
|
||||||
|
received - whichever comes first. The following line cannot
|
||||||
|
be reached unless xNextExpireTime > xTimeNow, except in the
|
||||||
|
case when the current timer list is empty. */
|
||||||
|
vQueueWaitForMessageRestricted( xTimerQueue, ( xNextExpireTime - xTimeNow ) );
|
||||||
|
|
||||||
|
if( xTaskResumeAll() == pdFALSE )
|
||||||
|
{
|
||||||
|
/* Yield to wait for either a command to arrive, or the block time
|
||||||
|
to expire. If a command arrived between the critical section being
|
||||||
|
exited and this yield then the yield will not cause the task
|
||||||
|
to block. */
|
||||||
|
portYIELD_WITHIN_API();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xTaskResumeAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static portTickType prvGetNextExpireTime( portBASE_TYPE *pxListWasEmpty )
|
||||||
|
{
|
||||||
|
portTickType xNextExpireTime;
|
||||||
|
|
||||||
|
/* Timers are listed in expiry time order, with the head of the list
|
||||||
|
referencing the task that will expire first. Obtain the time at which
|
||||||
|
the timer with the nearest expiry time will expire. If there are no
|
||||||
|
active timers then just set the next expire time to 0. That will cause
|
||||||
|
this task to unblock when the tick count overflows, at which point the
|
||||||
|
timer lists will be switched and the next expiry time can be
|
||||||
|
re-assessed. */
|
||||||
|
*pxListWasEmpty = listLIST_IS_EMPTY( pxCurrentTimerList );
|
||||||
|
if( *pxListWasEmpty == pdFALSE )
|
||||||
|
{
|
||||||
|
xNextExpireTime = listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxCurrentTimerList );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Ensure the task unblocks when the tick count rolls over. */
|
||||||
|
xNextExpireTime = ( portTickType ) 0U;
|
||||||
|
}
|
||||||
|
|
||||||
|
return xNextExpireTime;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static portTickType prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched )
|
||||||
|
{
|
||||||
|
portTickType xTimeNow;
|
||||||
|
PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U;
|
||||||
|
|
||||||
|
xTimeNow = xTaskGetTickCount();
|
||||||
|
|
||||||
|
if( xTimeNow < xLastTime )
|
||||||
|
{
|
||||||
|
prvSwitchTimerLists( xLastTime );
|
||||||
|
*pxTimerListsWereSwitched = pdTRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*pxTimerListsWereSwitched = pdFALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
xLastTime = xTimeNow;
|
||||||
|
|
||||||
|
return xTimeNow;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static portBASE_TYPE prvInsertTimerInActiveList( xTIMER *pxTimer, portTickType xNextExpiryTime, portTickType xTimeNow, portTickType xCommandTime )
|
||||||
|
{
|
||||||
|
portBASE_TYPE xProcessTimerNow = pdFALSE;
|
||||||
|
|
||||||
|
listSET_LIST_ITEM_VALUE( &( pxTimer->xTimerListItem ), xNextExpiryTime );
|
||||||
|
listSET_LIST_ITEM_OWNER( &( pxTimer->xTimerListItem ), pxTimer );
|
||||||
|
|
||||||
|
if( xNextExpiryTime <= xTimeNow )
|
||||||
|
{
|
||||||
|
/* Has the expiry time elapsed between the command to start/reset a
|
||||||
|
timer was issued, and the time the command was processed? */
|
||||||
|
if( ( ( portTickType ) ( xTimeNow - xCommandTime ) ) >= pxTimer->xTimerPeriodInTicks )
|
||||||
|
{
|
||||||
|
/* The time between a command being issued and the command being
|
||||||
|
processed actually exceeds the timers period. */
|
||||||
|
xProcessTimerNow = pdTRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vListInsert( pxOverflowTimerList, &( pxTimer->xTimerListItem ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( ( xTimeNow < xCommandTime ) && ( xNextExpiryTime >= xCommandTime ) )
|
||||||
|
{
|
||||||
|
/* If, since the command was issued, the tick count has overflowed
|
||||||
|
but the expiry time has not, then the timer must have already passed
|
||||||
|
its expiry time and should be processed immediately. */
|
||||||
|
xProcessTimerNow = pdTRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vListInsert( pxCurrentTimerList, &( pxTimer->xTimerListItem ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return xProcessTimerNow;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvProcessReceivedCommands( void )
|
||||||
|
{
|
||||||
|
xTIMER_MESSAGE xMessage;
|
||||||
|
xTIMER *pxTimer;
|
||||||
|
portBASE_TYPE xTimerListsWereSwitched, xResult;
|
||||||
|
portTickType xTimeNow;
|
||||||
|
|
||||||
|
while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL )
|
||||||
|
{
|
||||||
|
pxTimer = xMessage.pxTimer;
|
||||||
|
|
||||||
|
if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE )
|
||||||
|
{
|
||||||
|
/* The timer is in a list, remove it. */
|
||||||
|
uxListRemove( &( pxTimer->xTimerListItem ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
traceTIMER_COMMAND_RECEIVED( pxTimer, xMessage.xMessageID, xMessage.xMessageValue );
|
||||||
|
|
||||||
|
/* In this case the xTimerListsWereSwitched parameter is not used, but
|
||||||
|
it must be present in the function call. prvSampleTimeNow() must be
|
||||||
|
called after the message is received from xTimerQueue so there is no
|
||||||
|
possibility of a higher priority task adding a message to the message
|
||||||
|
queue with a time that is ahead of the timer daemon task (because it
|
||||||
|
pre-empted the timer daemon task after the xTimeNow value was set). */
|
||||||
|
xTimeNow = prvSampleTimeNow( &xTimerListsWereSwitched );
|
||||||
|
|
||||||
|
switch( xMessage.xMessageID )
|
||||||
|
{
|
||||||
|
case tmrCOMMAND_START :
|
||||||
|
/* Start or restart a timer. */
|
||||||
|
if( prvInsertTimerInActiveList( pxTimer, xMessage.xMessageValue + pxTimer->xTimerPeriodInTicks, xTimeNow, xMessage.xMessageValue ) == pdTRUE )
|
||||||
|
{
|
||||||
|
/* The timer expired before it was added to the active timer
|
||||||
|
list. Process it now. */
|
||||||
|
pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );
|
||||||
|
|
||||||
|
if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE )
|
||||||
|
{
|
||||||
|
xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xMessage.xMessageValue + pxTimer->xTimerPeriodInTicks, NULL, tmrNO_DELAY );
|
||||||
|
configASSERT( xResult );
|
||||||
|
( void ) xResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tmrCOMMAND_STOP :
|
||||||
|
/* The timer has already been removed from the active list.
|
||||||
|
There is nothing to do here. */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tmrCOMMAND_CHANGE_PERIOD :
|
||||||
|
pxTimer->xTimerPeriodInTicks = xMessage.xMessageValue;
|
||||||
|
configASSERT( ( pxTimer->xTimerPeriodInTicks > 0 ) );
|
||||||
|
prvInsertTimerInActiveList( pxTimer, ( xTimeNow + pxTimer->xTimerPeriodInTicks ), xTimeNow, xTimeNow );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case tmrCOMMAND_DELETE :
|
||||||
|
/* The timer has already been removed from the active list,
|
||||||
|
just free up the memory. */
|
||||||
|
vPortFree( pxTimer );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
/* Don't expect to get here. */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvSwitchTimerLists( portTickType xLastTime )
|
||||||
|
{
|
||||||
|
portTickType xNextExpireTime, xReloadTime;
|
||||||
|
xList *pxTemp;
|
||||||
|
xTIMER *pxTimer;
|
||||||
|
portBASE_TYPE xResult;
|
||||||
|
|
||||||
|
/* Remove compiler warnings if configASSERT() is not defined. */
|
||||||
|
( void ) xLastTime;
|
||||||
|
|
||||||
|
/* The tick count has overflowed. The timer lists must be switched.
|
||||||
|
If there are any timers still referenced from the current timer list
|
||||||
|
then they must have expired and should be processed before the lists
|
||||||
|
are switched. */
|
||||||
|
while( listLIST_IS_EMPTY( pxCurrentTimerList ) == pdFALSE )
|
||||||
|
{
|
||||||
|
xNextExpireTime = listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxCurrentTimerList );
|
||||||
|
|
||||||
|
/* Remove the timer from the list. */
|
||||||
|
pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );
|
||||||
|
uxListRemove( &( pxTimer->xTimerListItem ) );
|
||||||
|
|
||||||
|
/* Execute its callback, then send a command to restart the timer if
|
||||||
|
it is an auto-reload timer. It cannot be restarted here as the lists
|
||||||
|
have not yet been switched. */
|
||||||
|
pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );
|
||||||
|
|
||||||
|
if( pxTimer->uxAutoReload == ( unsigned portBASE_TYPE ) pdTRUE )
|
||||||
|
{
|
||||||
|
/* Calculate the reload value, and if the reload value results in
|
||||||
|
the timer going into the same timer list then it has already expired
|
||||||
|
and the timer should be re-inserted into the current list so it is
|
||||||
|
processed again within this loop. Otherwise a command should be sent
|
||||||
|
to restart the timer to ensure it is only inserted into a list after
|
||||||
|
the lists have been swapped. */
|
||||||
|
xReloadTime = ( xNextExpireTime + pxTimer->xTimerPeriodInTicks );
|
||||||
|
if( xReloadTime > xNextExpireTime )
|
||||||
|
{
|
||||||
|
listSET_LIST_ITEM_VALUE( &( pxTimer->xTimerListItem ), xReloadTime );
|
||||||
|
listSET_LIST_ITEM_OWNER( &( pxTimer->xTimerListItem ), pxTimer );
|
||||||
|
vListInsert( pxCurrentTimerList, &( pxTimer->xTimerListItem ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );
|
||||||
|
configASSERT( xResult );
|
||||||
|
( void ) xResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pxTemp = pxCurrentTimerList;
|
||||||
|
pxCurrentTimerList = pxOverflowTimerList;
|
||||||
|
pxOverflowTimerList = pxTemp;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvCheckForValidListAndQueue( void )
|
||||||
|
{
|
||||||
|
/* Check that the list from which active timers are referenced, and the
|
||||||
|
queue used to communicate with the timer service, have been
|
||||||
|
initialised. */
|
||||||
|
taskENTER_CRITICAL();
|
||||||
|
{
|
||||||
|
if( xTimerQueue == NULL )
|
||||||
|
{
|
||||||
|
vListInitialise( &xActiveTimerList1 );
|
||||||
|
vListInitialise( &xActiveTimerList2 );
|
||||||
|
pxCurrentTimerList = &xActiveTimerList1;
|
||||||
|
pxOverflowTimerList = &xActiveTimerList2;
|
||||||
|
xTimerQueue = xQueueCreate( ( unsigned portBASE_TYPE ) configTIMER_QUEUE_LENGTH, sizeof( xTIMER_MESSAGE ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taskEXIT_CRITICAL();
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer )
|
||||||
|
{
|
||||||
|
portBASE_TYPE xTimerIsInActiveList;
|
||||||
|
xTIMER *pxTimer = ( xTIMER * ) xTimer;
|
||||||
|
|
||||||
|
/* Is the timer in the list of active timers? */
|
||||||
|
taskENTER_CRITICAL();
|
||||||
|
{
|
||||||
|
/* Checking to see if it is in the NULL list in effect checks to see if
|
||||||
|
it is referenced from either the current or the overflow timer lists in
|
||||||
|
one go, but the logic has to be reversed, hence the '!'. */
|
||||||
|
xTimerIsInActiveList = !( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) );
|
||||||
|
}
|
||||||
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
|
return xTimerIsInActiveList;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void *pvTimerGetTimerID( xTimerHandle xTimer )
|
||||||
|
{
|
||||||
|
xTIMER *pxTimer = ( xTIMER * ) xTimer;
|
||||||
|
|
||||||
|
return pxTimer->pvTimerID;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* This entire source file will be skipped if the application is not configured
|
||||||
|
to include software timer functionality. If you want to include software timer
|
||||||
|
functionality then ensure configUSE_TIMERS is set to 1 in FreeRTOSConfig.h. */
|
||||||
|
#endif /* configUSE_TIMERS == 1 */
|
||||||
|
|
||||||
|
|
||||||
|
|
218
FreeRTOS/Demo/RL78_E2Studio_GCC/src/RegTest.S
Normal file
218
FreeRTOS/Demo/RL78_E2Studio_GCC/src/RegTest.S
Normal file
|
@ -0,0 +1,218 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file defines the RegTest tasks as described at the top of main.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
.global vRegTest1
|
||||||
|
.global vRegTest2
|
||||||
|
|
||||||
|
.extern _vRegTestError
|
||||||
|
.extern _usRegTest1LoopCounter
|
||||||
|
.extern _usRegTest2LoopCounter
|
||||||
|
|
||||||
|
.text
|
||||||
|
/*
|
||||||
|
* Fill all the registers with known values, then check that the registers
|
||||||
|
* contain the expected value. An incorrect value being indicative of an
|
||||||
|
* error in the context switch mechanism.
|
||||||
|
*/
|
||||||
|
vRegTest1:
|
||||||
|
|
||||||
|
/* First fill the registers. */
|
||||||
|
MOVW AX, #0x1122
|
||||||
|
MOVW BC, #0x3344
|
||||||
|
MOVW DE, #0x5566
|
||||||
|
MOVW HL, #0x7788
|
||||||
|
MOV CS, #0x01
|
||||||
|
|
||||||
|
#if __DATA_MODEL__ == __DATA_MODEL_FAR__
|
||||||
|
|
||||||
|
; ES is not saved or restored when using the near memory model so only
|
||||||
|
; test it when using the far model.
|
||||||
|
MOV ES, #0x02
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_loop1:
|
||||||
|
|
||||||
|
/* Continuously check that the register values remain at their expected
|
||||||
|
values. The BRK is to test the yield. This task runs at low priority
|
||||||
|
so will also regularly get preempted. */
|
||||||
|
BRK
|
||||||
|
|
||||||
|
/* Compare with the expected value. */
|
||||||
|
CMPW AX, #0x1122
|
||||||
|
BZ $5
|
||||||
|
|
||||||
|
/* Jump over the branch to vRegTestError() if the register contained the
|
||||||
|
expected value - otherwise flag an error by executing vRegTestError(). */
|
||||||
|
BR !_vRegTestError
|
||||||
|
|
||||||
|
/* Repeat for all the registers. */
|
||||||
|
MOVW AX, BC
|
||||||
|
CMPW AX, #0x3344
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
MOVW AX, DE
|
||||||
|
CMPW AX, #0x5566
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
MOVW AX, HL
|
||||||
|
CMPW AX, #0x7788
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
MOV A, CS
|
||||||
|
CMP A, #0x01
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
|
||||||
|
#if __DATA_MODEL__ == __DATA_MODEL_FAR__
|
||||||
|
|
||||||
|
/* ES is not saved or restored when using the near memory model so only
|
||||||
|
test it when using the far model. */
|
||||||
|
MOV A, ES
|
||||||
|
CMP A, #0x02
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Indicate that this task is still cycling. */
|
||||||
|
INCW !_usRegTest1LoopCounter
|
||||||
|
|
||||||
|
MOVW AX, #0x1122
|
||||||
|
BR !_loop1
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fill all the registers with known values, then check that the registers
|
||||||
|
* contain the expected value. An incorrect value being indicative of an
|
||||||
|
* error in the context switch mechanism.
|
||||||
|
*/
|
||||||
|
vRegTest2:
|
||||||
|
|
||||||
|
MOVW AX, #0x99aa
|
||||||
|
MOVW BC, #0xbbcc
|
||||||
|
MOVW DE, #0xddee
|
||||||
|
MOVW HL, #0xff12
|
||||||
|
MOV CS, #0x03
|
||||||
|
|
||||||
|
#if __DATA_MODEL__ == __DATA_MODEL_FAR__
|
||||||
|
|
||||||
|
MOV ES, #0x04
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_loop2:
|
||||||
|
CMPW AX, #0x99aa
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
MOVW AX, BC
|
||||||
|
CMPW AX, #0xbbcc
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
MOVW AX, DE
|
||||||
|
CMPW AX, #0xddee
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
MOVW AX, HL
|
||||||
|
CMPW AX, #0xff12
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
MOV A, CS
|
||||||
|
CMP A, #0x03
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
|
||||||
|
#if __DATA_MODEL__ == __DATA_MODEL_FAR__
|
||||||
|
|
||||||
|
MOV A, ES
|
||||||
|
CMP A, #0x04
|
||||||
|
BZ $5
|
||||||
|
BR !_vRegTestError
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Indicate that this task is still cycling. */
|
||||||
|
INCW !_usRegTest2LoopCounter
|
||||||
|
|
||||||
|
MOVW AX, #0x99aa
|
||||||
|
BR !_loop2
|
||||||
|
|
||||||
|
|
||||||
|
.end
|
||||||
|
|
26
FreeRTOS/Demo/RL78_E2Studio_GCC/src/hardware_setup.c
Normal file
26
FreeRTOS/Demo/RL78_E2Studio_GCC/src/hardware_setup.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PROJECT NAME : RTOSDemo */
|
||||||
|
/* FILE : hardware_setup.c */
|
||||||
|
/* DESCRIPTION : Hardware Initialization */
|
||||||
|
/* CPU SERIES : RL78 - G1C */
|
||||||
|
/* CPU TYPE : R5F10JBC */
|
||||||
|
/* */
|
||||||
|
/* This file is generated by e2studio. */
|
||||||
|
/* */
|
||||||
|
/***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
extern void HardwareSetup(void);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
void HardwareSetup(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
164
FreeRTOS/Demo/RL78_E2Studio_GCC/src/interrupt_handlers.c
Normal file
164
FreeRTOS/Demo/RL78_E2Studio_GCC/src/interrupt_handlers.c
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PROJECT NAME : RTOSDemo */
|
||||||
|
/* FILE : interrupt_handlers.c */
|
||||||
|
/* DESCRIPTION : Interrupt Handler */
|
||||||
|
/* CPU SERIES : RL78 - G1C */
|
||||||
|
/* CPU TYPE : R5F10JBC */
|
||||||
|
/* */
|
||||||
|
/* This file is generated by e2studio. */
|
||||||
|
/* */
|
||||||
|
/***********************************************************************/
|
||||||
|
|
||||||
|
#include "interrupt_handlers.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_SRO/INT_WDTI (0x4)
|
||||||
|
*/
|
||||||
|
void INT_WDTI (void) { }
|
||||||
|
//void INT_SRO (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_LVI (0x6)
|
||||||
|
*/
|
||||||
|
void INT_LVI (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P0 (0x8)
|
||||||
|
*/
|
||||||
|
void INT_P0 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P1 (0xA)
|
||||||
|
*/
|
||||||
|
void INT_P1 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P2 (0xC)
|
||||||
|
*/
|
||||||
|
void INT_P2 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P3 (0xE)
|
||||||
|
*/
|
||||||
|
void INT_P3 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P4 (0x10)
|
||||||
|
*/
|
||||||
|
void INT_P4 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P5 (0x12)
|
||||||
|
*/
|
||||||
|
void INT_P5 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_DMA0 (0x1A)
|
||||||
|
*/
|
||||||
|
void INT_DMA0 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_DMA1 (0x1C)
|
||||||
|
*/
|
||||||
|
void INT_DMA1 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_CSI00/INT_IIC00/INT_ST0 (0x1E)
|
||||||
|
*/
|
||||||
|
void INT_ST0 (void) { }
|
||||||
|
//void INT_CSI00 (void) { }
|
||||||
|
//void INT_IIC00 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_TM00 (0x20)
|
||||||
|
*/
|
||||||
|
void INT_TM00 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_CSI01/INT_IIC01/INT_SR0 (0x22)
|
||||||
|
*/
|
||||||
|
void INT_SR0 (void) { }
|
||||||
|
//void INT_CSI01 (void) { }
|
||||||
|
//void INT_IIC01 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_SRE0/INT_TM01H (0x24)
|
||||||
|
*/
|
||||||
|
void INT_TM01H (void) { }
|
||||||
|
//void INT_SRE0 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_TM03H (0x2A)
|
||||||
|
*/
|
||||||
|
void INT_TM03H (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_IICA0 (0x2C)
|
||||||
|
*/
|
||||||
|
void INT_IICA0 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_TM01 (0x2E)
|
||||||
|
*/
|
||||||
|
void INT_TM01 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_TM02 (0x30)
|
||||||
|
*/
|
||||||
|
void INT_TM02 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_TM03 (0x32)
|
||||||
|
*/
|
||||||
|
void INT_TM03 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_AD (0x34)
|
||||||
|
*/
|
||||||
|
void INT_AD (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_RTC (0x36)
|
||||||
|
*/
|
||||||
|
void INT_RTC (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_IT (0x38)
|
||||||
|
*/
|
||||||
|
void INT_IT (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_USB (0x3C)
|
||||||
|
*/
|
||||||
|
void INT_USB (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_RSUM (0x3E)
|
||||||
|
*/
|
||||||
|
void INT_RSUM (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P8 (0x4E)
|
||||||
|
*/
|
||||||
|
void INT_P8 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P9 (0x50)
|
||||||
|
*/
|
||||||
|
void INT_P9 (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_MD (0x5E)
|
||||||
|
*/
|
||||||
|
void INT_MD (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_FL (0x62)
|
||||||
|
*/
|
||||||
|
void INT_FL (void) { }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_BRK_I (0x7E)
|
||||||
|
*/
|
||||||
|
void INT_BRK_I (void) { }
|
170
FreeRTOS/Demo/RL78_E2Studio_GCC/src/interrupt_handlers.h
Normal file
170
FreeRTOS/Demo/RL78_E2Studio_GCC/src/interrupt_handlers.h
Normal file
|
@ -0,0 +1,170 @@
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PROJECT NAME : RTOSDemo */
|
||||||
|
/* FILE : interrupt_handlers.h */
|
||||||
|
/* DESCRIPTION : Interrupt Handler Declarations */
|
||||||
|
/* CPU SERIES : RL78 - G1C */
|
||||||
|
/* CPU TYPE : R5F10JBC */
|
||||||
|
/* */
|
||||||
|
/* This file is generated by e2studio. */
|
||||||
|
/* */
|
||||||
|
/***********************************************************************/
|
||||||
|
|
||||||
|
#ifndef INTERRUPT_HANDLERS_H
|
||||||
|
#define INTERRUPT_HANDLERS_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_SRO/INT_WDTI (0x4)
|
||||||
|
*/
|
||||||
|
void INT_WDTI(void) __attribute__ ((interrupt));
|
||||||
|
//void INT_SRO(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_LVI (0x6)
|
||||||
|
*/
|
||||||
|
void INT_LVI(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P0 (0x8)
|
||||||
|
*/
|
||||||
|
void INT_P0(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P1 (0xA)
|
||||||
|
*/
|
||||||
|
void INT_P1(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P2 (0xC)
|
||||||
|
*/
|
||||||
|
void INT_P2(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P3 (0xE)
|
||||||
|
*/
|
||||||
|
void INT_P3(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P4 (0x10)
|
||||||
|
*/
|
||||||
|
void INT_P4(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P5 (0x12)
|
||||||
|
*/
|
||||||
|
void INT_P5(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_DMA0 (0x1A)
|
||||||
|
*/
|
||||||
|
void INT_DMA0(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_DMA1 (0x1C)
|
||||||
|
*/
|
||||||
|
void INT_DMA1(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_CSI00/INT_IIC00/INT_ST0 (0x1E)
|
||||||
|
*/
|
||||||
|
void INT_ST0(void) __attribute__ ((interrupt));
|
||||||
|
//void INT_CSI00(void) __attribute__ ((interrupt));
|
||||||
|
//void INT_IIC00(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_TM00 (0x20)
|
||||||
|
*/
|
||||||
|
void INT_TM00(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_CSI01/INT_IIC01/INT_SR0 (0x22)
|
||||||
|
*/
|
||||||
|
void INT_SR0(void) __attribute__ ((interrupt));
|
||||||
|
//void INT_CSI01(void) __attribute__ ((interrupt));
|
||||||
|
//void INT_IIC01(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_SRE0/INT_TM01H (0x24)
|
||||||
|
*/
|
||||||
|
void INT_TM01H(void) __attribute__ ((interrupt));
|
||||||
|
//void INT_SRE0(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_TM03H (0x2A)
|
||||||
|
*/
|
||||||
|
void INT_TM03H(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_IICA0 (0x2C)
|
||||||
|
*/
|
||||||
|
void INT_IICA0(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_TM01 (0x2E)
|
||||||
|
*/
|
||||||
|
void INT_TM01(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_TM02 (0x30)
|
||||||
|
*/
|
||||||
|
void INT_TM02(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_TM03 (0x32)
|
||||||
|
*/
|
||||||
|
void INT_TM03(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_AD (0x34)
|
||||||
|
*/
|
||||||
|
void INT_AD(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_RTC (0x36)
|
||||||
|
*/
|
||||||
|
void INT_RTC(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_IT (0x38)
|
||||||
|
*/
|
||||||
|
void INT_IT(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_USB (0x3C)
|
||||||
|
*/
|
||||||
|
void INT_USB(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_RSUM (0x3E)
|
||||||
|
*/
|
||||||
|
void INT_RSUM(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P8 (0x4E)
|
||||||
|
*/
|
||||||
|
void INT_P8(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_P9 (0x50)
|
||||||
|
*/
|
||||||
|
void INT_P9(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_MD (0x5E)
|
||||||
|
*/
|
||||||
|
void INT_MD(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_FL (0x62)
|
||||||
|
*/
|
||||||
|
void INT_FL(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* INT_BRK_I (0x7E)
|
||||||
|
*/
|
||||||
|
void INT_BRK_I(void) __attribute__ ((interrupt));
|
||||||
|
|
||||||
|
//Hardware Vectors
|
||||||
|
//PowerON_Reset (0x0)
|
||||||
|
void PowerON_Reset(void) __attribute__ ((interrupt));
|
||||||
|
#endif
|
870
FreeRTOS/Demo/RL78_E2Studio_GCC/src/iodefine.h
Normal file
870
FreeRTOS/Demo/RL78_E2Studio_GCC/src/iodefine.h
Normal file
|
@ -0,0 +1,870 @@
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PROJECT NAME : RTOSDemo */
|
||||||
|
/* FILE : iodefine.h */
|
||||||
|
/* DESCRIPTION : Definition of I/O Registers */
|
||||||
|
/* CPU SERIES : RL78 - G1C */
|
||||||
|
/* CPU TYPE : R5F10JBC */
|
||||||
|
/* */
|
||||||
|
/* This file is generated by e2studio. */
|
||||||
|
/* */
|
||||||
|
/***********************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************/
|
||||||
|
/* Header file generated from device file: */
|
||||||
|
/* DR5F10JBC.DVF */
|
||||||
|
/* Copyright(C) 2012 Renesas */
|
||||||
|
/* File Version V1.00 */
|
||||||
|
/* Tool Version 1.9.7121 */
|
||||||
|
/* Date Generated 13/11/2012 */
|
||||||
|
/************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __IOREG_BIT_STRUCTURES
|
||||||
|
#define __IOREG_BIT_STRUCTURES
|
||||||
|
typedef struct {
|
||||||
|
unsigned char no0 :1;
|
||||||
|
unsigned char no1 :1;
|
||||||
|
unsigned char no2 :1;
|
||||||
|
unsigned char no3 :1;
|
||||||
|
unsigned char no4 :1;
|
||||||
|
unsigned char no5 :1;
|
||||||
|
unsigned char no6 :1;
|
||||||
|
unsigned char no7 :1;
|
||||||
|
} __BITS8;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned short no0 :1;
|
||||||
|
unsigned short no1 :1;
|
||||||
|
unsigned short no2 :1;
|
||||||
|
unsigned short no3 :1;
|
||||||
|
unsigned short no4 :1;
|
||||||
|
unsigned short no5 :1;
|
||||||
|
unsigned short no6 :1;
|
||||||
|
unsigned short no7 :1;
|
||||||
|
unsigned short no8 :1;
|
||||||
|
unsigned short no9 :1;
|
||||||
|
unsigned short no10 :1;
|
||||||
|
unsigned short no11 :1;
|
||||||
|
unsigned short no12 :1;
|
||||||
|
unsigned short no13 :1;
|
||||||
|
unsigned short no14 :1;
|
||||||
|
unsigned short no15 :1;
|
||||||
|
} __BITS16;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IODEFINE_H
|
||||||
|
#define IODEFINE_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
IO Registers
|
||||||
|
*/
|
||||||
|
union un_p0 {
|
||||||
|
unsigned char p0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p1 {
|
||||||
|
unsigned char p1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p2 {
|
||||||
|
unsigned char p2;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p3 {
|
||||||
|
unsigned char p3;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p4 {
|
||||||
|
unsigned char p4;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p5 {
|
||||||
|
unsigned char p5;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p6 {
|
||||||
|
unsigned char p6;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p7 {
|
||||||
|
unsigned char p7;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p12 {
|
||||||
|
unsigned char p12;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_p13 {
|
||||||
|
unsigned char p13;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm0 {
|
||||||
|
unsigned char pm0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm1 {
|
||||||
|
unsigned char pm1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm2 {
|
||||||
|
unsigned char pm2;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm3 {
|
||||||
|
unsigned char pm3;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm4 {
|
||||||
|
unsigned char pm4;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm5 {
|
||||||
|
unsigned char pm5;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm6 {
|
||||||
|
unsigned char pm6;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm7 {
|
||||||
|
unsigned char pm7;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pm12 {
|
||||||
|
unsigned char pm12;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_adm0 {
|
||||||
|
unsigned char adm0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_ads {
|
||||||
|
unsigned char ads;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_adm1 {
|
||||||
|
unsigned char adm1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_egp0 {
|
||||||
|
unsigned char egp0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_egn0 {
|
||||||
|
unsigned char egn0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_egp1 {
|
||||||
|
unsigned char egp1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_egn1 {
|
||||||
|
unsigned char egn1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_iics0 {
|
||||||
|
unsigned char iics0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_iicf0 {
|
||||||
|
unsigned char iicf0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_flars {
|
||||||
|
unsigned char flars;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_fssq {
|
||||||
|
unsigned char fssq;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_flrst {
|
||||||
|
unsigned char flrst;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_fsastl {
|
||||||
|
unsigned char fsastl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_fsasth {
|
||||||
|
unsigned char fsasth;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_rtcc0 {
|
||||||
|
unsigned char rtcc0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_rtcc1 {
|
||||||
|
unsigned char rtcc1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_csc {
|
||||||
|
unsigned char csc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_ostc {
|
||||||
|
unsigned char ostc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_ckc {
|
||||||
|
unsigned char ckc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_cks0 {
|
||||||
|
unsigned char cks0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_cks1 {
|
||||||
|
unsigned char cks1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_lvim {
|
||||||
|
unsigned char lvim;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_lvis {
|
||||||
|
unsigned char lvis;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_monsta0 {
|
||||||
|
unsigned char monsta0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_asim {
|
||||||
|
unsigned char asim;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_dmc0 {
|
||||||
|
unsigned char dmc0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_dmc1 {
|
||||||
|
unsigned char dmc1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_drc0 {
|
||||||
|
unsigned char drc0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_drc1 {
|
||||||
|
unsigned char drc1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if2 {
|
||||||
|
unsigned short if2;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_if2l {
|
||||||
|
unsigned char if2l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if2h {
|
||||||
|
unsigned char if2h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk2 {
|
||||||
|
unsigned short mk2;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_mk2l {
|
||||||
|
unsigned char mk2l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk2h {
|
||||||
|
unsigned char mk2h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr02 {
|
||||||
|
unsigned short pr02;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr02l {
|
||||||
|
unsigned char pr02l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr02h {
|
||||||
|
unsigned char pr02h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr12 {
|
||||||
|
unsigned short pr12;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr12l {
|
||||||
|
unsigned char pr12l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr12h {
|
||||||
|
unsigned char pr12h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if0 {
|
||||||
|
unsigned short if0;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_if0l {
|
||||||
|
unsigned char if0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if0h {
|
||||||
|
unsigned char if0h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if1 {
|
||||||
|
unsigned short if1;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_if1l {
|
||||||
|
unsigned char if1l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_if1h {
|
||||||
|
unsigned char if1h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk0 {
|
||||||
|
unsigned short mk0;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_mk0l {
|
||||||
|
unsigned char mk0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk0h {
|
||||||
|
unsigned char mk0h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk1 {
|
||||||
|
unsigned short mk1;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_mk1l {
|
||||||
|
unsigned char mk1l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mk1h {
|
||||||
|
unsigned char mk1h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr00 {
|
||||||
|
unsigned short pr00;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr00l {
|
||||||
|
unsigned char pr00l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr00h {
|
||||||
|
unsigned char pr00h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr01 {
|
||||||
|
unsigned short pr01;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr01l {
|
||||||
|
unsigned char pr01l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr01h {
|
||||||
|
unsigned char pr01h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr10 {
|
||||||
|
unsigned short pr10;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr10l {
|
||||||
|
unsigned char pr10l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr10h {
|
||||||
|
unsigned char pr10h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr11 {
|
||||||
|
unsigned short pr11;
|
||||||
|
__BITS16 BIT;
|
||||||
|
};
|
||||||
|
union un_pr11l {
|
||||||
|
unsigned char pr11l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pr11h {
|
||||||
|
unsigned char pr11h;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pmc {
|
||||||
|
unsigned char pmc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define P0 (*(volatile union un_p0 *)0xFFF00).p0
|
||||||
|
#define P0_bit (*(volatile union un_p0 *)0xFFF00).BIT
|
||||||
|
#define P1 (*(volatile union un_p1 *)0xFFF01).p1
|
||||||
|
#define P1_bit (*(volatile union un_p1 *)0xFFF01).BIT
|
||||||
|
#define P2 (*(volatile union un_p2 *)0xFFF02).p2
|
||||||
|
#define P2_bit (*(volatile union un_p2 *)0xFFF02).BIT
|
||||||
|
#define P3 (*(volatile union un_p3 *)0xFFF03).p3
|
||||||
|
#define P3_bit (*(volatile union un_p3 *)0xFFF03).BIT
|
||||||
|
#define P4 (*(volatile union un_p4 *)0xFFF04).p4
|
||||||
|
#define P4_bit (*(volatile union un_p4 *)0xFFF04).BIT
|
||||||
|
#define P5 (*(volatile union un_p5 *)0xFFF05).p5
|
||||||
|
#define P5_bit (*(volatile union un_p5 *)0xFFF05).BIT
|
||||||
|
#define P6 (*(volatile union un_p6 *)0xFFF06).p6
|
||||||
|
#define P6_bit (*(volatile union un_p6 *)0xFFF06).BIT
|
||||||
|
#define P7 (*(volatile union un_p7 *)0xFFF07).p7
|
||||||
|
#define P7_bit (*(volatile union un_p7 *)0xFFF07).BIT
|
||||||
|
#define P12 (*(volatile union un_p12 *)0xFFF0C).p12
|
||||||
|
#define P12_bit (*(volatile union un_p12 *)0xFFF0C).BIT
|
||||||
|
#define P13 (*(volatile union un_p13 *)0xFFF0D).p13
|
||||||
|
#define P13_bit (*(volatile union un_p13 *)0xFFF0D).BIT
|
||||||
|
#define SDR00 (*(volatile unsigned short *)0xFFF10)
|
||||||
|
#define SIO00 (*(volatile unsigned char *)0xFFF10)
|
||||||
|
#define TXD0 (*(volatile unsigned char *)0xFFF10)
|
||||||
|
#define SDR01 (*(volatile unsigned short *)0xFFF12)
|
||||||
|
#define RXD0 (*(volatile unsigned char *)0xFFF12)
|
||||||
|
#define SIO01 (*(volatile unsigned char *)0xFFF12)
|
||||||
|
#define TDR00 (*(volatile unsigned short *)0xFFF18)
|
||||||
|
#define TDR01 (*(volatile unsigned short *)0xFFF1A)
|
||||||
|
#define TDR01L (*(volatile unsigned char *)0xFFF1A)
|
||||||
|
#define TDR01H (*(volatile unsigned char *)0xFFF1B)
|
||||||
|
#define ADCR (*(volatile unsigned short *)0xFFF1E)
|
||||||
|
#define ADCRH (*(volatile unsigned char *)0xFFF1F)
|
||||||
|
#define PM0 (*(volatile union un_pm0 *)0xFFF20).pm0
|
||||||
|
#define PM0_bit (*(volatile union un_pm0 *)0xFFF20).BIT
|
||||||
|
#define PM1 (*(volatile union un_pm1 *)0xFFF21).pm1
|
||||||
|
#define PM1_bit (*(volatile union un_pm1 *)0xFFF21).BIT
|
||||||
|
#define PM2 (*(volatile union un_pm2 *)0xFFF22).pm2
|
||||||
|
#define PM2_bit (*(volatile union un_pm2 *)0xFFF22).BIT
|
||||||
|
#define PM3 (*(volatile union un_pm3 *)0xFFF23).pm3
|
||||||
|
#define PM3_bit (*(volatile union un_pm3 *)0xFFF23).BIT
|
||||||
|
#define PM4 (*(volatile union un_pm4 *)0xFFF24).pm4
|
||||||
|
#define PM4_bit (*(volatile union un_pm4 *)0xFFF24).BIT
|
||||||
|
#define PM5 (*(volatile union un_pm5 *)0xFFF25).pm5
|
||||||
|
#define PM5_bit (*(volatile union un_pm5 *)0xFFF25).BIT
|
||||||
|
#define PM6 (*(volatile union un_pm6 *)0xFFF26).pm6
|
||||||
|
#define PM6_bit (*(volatile union un_pm6 *)0xFFF26).BIT
|
||||||
|
#define PM7 (*(volatile union un_pm7 *)0xFFF27).pm7
|
||||||
|
#define PM7_bit (*(volatile union un_pm7 *)0xFFF27).BIT
|
||||||
|
#define PM12 (*(volatile union un_pm12 *)0xFFF2C).pm12
|
||||||
|
#define PM12_bit (*(volatile union un_pm12 *)0xFFF2C).BIT
|
||||||
|
#define ADM0 (*(volatile union un_adm0 *)0xFFF30).adm0
|
||||||
|
#define ADM0_bit (*(volatile union un_adm0 *)0xFFF30).BIT
|
||||||
|
#define ADS (*(volatile union un_ads *)0xFFF31).ads
|
||||||
|
#define ADS_bit (*(volatile union un_ads *)0xFFF31).BIT
|
||||||
|
#define ADM1 (*(volatile union un_adm1 *)0xFFF32).adm1
|
||||||
|
#define ADM1_bit (*(volatile union un_adm1 *)0xFFF32).BIT
|
||||||
|
#define EGP0 (*(volatile union un_egp0 *)0xFFF38).egp0
|
||||||
|
#define EGP0_bit (*(volatile union un_egp0 *)0xFFF38).BIT
|
||||||
|
#define EGN0 (*(volatile union un_egn0 *)0xFFF39).egn0
|
||||||
|
#define EGN0_bit (*(volatile union un_egn0 *)0xFFF39).BIT
|
||||||
|
#define EGP1 (*(volatile union un_egp1 *)0xFFF3A).egp1
|
||||||
|
#define EGP1_bit (*(volatile union un_egp1 *)0xFFF3A).BIT
|
||||||
|
#define EGN1 (*(volatile union un_egn1 *)0xFFF3B).egn1
|
||||||
|
#define EGN1_bit (*(volatile union un_egn1 *)0xFFF3B).BIT
|
||||||
|
#define IICA0 (*(volatile unsigned char *)0xFFF50)
|
||||||
|
#define IICS0 (*(volatile union un_iics0 *)0xFFF51).iics0
|
||||||
|
#define IICS0_bit (*(volatile union un_iics0 *)0xFFF51).BIT
|
||||||
|
#define IICF0 (*(volatile union un_iicf0 *)0xFFF52).iicf0
|
||||||
|
#define IICF0_bit (*(volatile union un_iicf0 *)0xFFF52).BIT
|
||||||
|
#define CFIFO (*(volatile unsigned short *)0xFFF54)
|
||||||
|
#define CFIFOL (*(volatile unsigned char *)0xFFF54)
|
||||||
|
#define D0FIFO (*(volatile unsigned short *)0xFFF58)
|
||||||
|
#define D0FIFOL (*(volatile unsigned char *)0xFFF58)
|
||||||
|
#define D1FIFO (*(volatile unsigned short *)0xFFF5C)
|
||||||
|
#define D1FIFOL (*(volatile unsigned char *)0xFFF5C)
|
||||||
|
#define TDR02 (*(volatile unsigned short *)0xFFF64)
|
||||||
|
#define TDR03 (*(volatile unsigned short *)0xFFF66)
|
||||||
|
#define TDR03L (*(volatile unsigned char *)0xFFF66)
|
||||||
|
#define TDR03H (*(volatile unsigned char *)0xFFF67)
|
||||||
|
#define FLPMC (*(volatile unsigned char *)0xFFF80)
|
||||||
|
#define FLARS (*(volatile union un_flars *)0xFFF81).flars
|
||||||
|
#define FLARS_bit (*(volatile union un_flars *)0xFFF81).BIT
|
||||||
|
#define FLAPL (*(volatile unsigned short *)0xFFF82)
|
||||||
|
#define FLAPH (*(volatile unsigned char *)0xFFF84)
|
||||||
|
#define FSSQ (*(volatile union un_fssq *)0xFFF85).fssq
|
||||||
|
#define FSSQ_bit (*(volatile union un_fssq *)0xFFF85).BIT
|
||||||
|
#define FLSEDL (*(volatile unsigned short *)0xFFF86)
|
||||||
|
#define FLSEDH (*(volatile unsigned char *)0xFFF88)
|
||||||
|
#define FLRST (*(volatile union un_flrst *)0xFFF89).flrst
|
||||||
|
#define FLRST_bit (*(volatile union un_flrst *)0xFFF89).BIT
|
||||||
|
#define FSASTL (*(volatile union un_fsastl *)0xFFF8A).fsastl
|
||||||
|
#define FSASTL_bit (*(volatile union un_fsastl *)0xFFF8A).BIT
|
||||||
|
#define FSASTH (*(volatile union un_fsasth *)0xFFF8B).fsasth
|
||||||
|
#define FSASTH_bit (*(volatile union un_fsasth *)0xFFF8B).BIT
|
||||||
|
#define FLWL (*(volatile unsigned short *)0xFFF8C)
|
||||||
|
#define FLWH (*(volatile unsigned short *)0xFFF8E)
|
||||||
|
#define ITMC (*(volatile unsigned short *)0xFFF90)
|
||||||
|
#define SEC (*(volatile unsigned char *)0xFFF92)
|
||||||
|
#define MIN (*(volatile unsigned char *)0xFFF93)
|
||||||
|
#define HOUR (*(volatile unsigned char *)0xFFF94)
|
||||||
|
#define WEEK (*(volatile unsigned char *)0xFFF95)
|
||||||
|
#define DAY (*(volatile unsigned char *)0xFFF96)
|
||||||
|
#define MONTH (*(volatile unsigned char *)0xFFF97)
|
||||||
|
#define YEAR (*(volatile unsigned char *)0xFFF98)
|
||||||
|
#define SUBCUD (*(volatile unsigned char *)0xFFF99)
|
||||||
|
#define ALARMWM (*(volatile unsigned char *)0xFFF9A)
|
||||||
|
#define ALARMWH (*(volatile unsigned char *)0xFFF9B)
|
||||||
|
#define ALARMWW (*(volatile unsigned char *)0xFFF9C)
|
||||||
|
#define RTCC0 (*(volatile union un_rtcc0 *)0xFFF9D).rtcc0
|
||||||
|
#define RTCC0_bit (*(volatile union un_rtcc0 *)0xFFF9D).BIT
|
||||||
|
#define RTCC1 (*(volatile union un_rtcc1 *)0xFFF9E).rtcc1
|
||||||
|
#define RTCC1_bit (*(volatile union un_rtcc1 *)0xFFF9E).BIT
|
||||||
|
#define CMC (*(volatile unsigned char *)0xFFFA0)
|
||||||
|
#define CSC (*(volatile union un_csc *)0xFFFA1).csc
|
||||||
|
#define CSC_bit (*(volatile union un_csc *)0xFFFA1).BIT
|
||||||
|
#define OSTC (*(volatile union un_ostc *)0xFFFA2).ostc
|
||||||
|
#define OSTC_bit (*(volatile union un_ostc *)0xFFFA2).BIT
|
||||||
|
#define OSTS (*(volatile unsigned char *)0xFFFA3)
|
||||||
|
#define CKC (*(volatile union un_ckc *)0xFFFA4).ckc
|
||||||
|
#define CKC_bit (*(volatile union un_ckc *)0xFFFA4).BIT
|
||||||
|
#define CKS0 (*(volatile union un_cks0 *)0xFFFA5).cks0
|
||||||
|
#define CKS0_bit (*(volatile union un_cks0 *)0xFFFA5).BIT
|
||||||
|
#define CKS1 (*(volatile union un_cks1 *)0xFFFA6).cks1
|
||||||
|
#define CKS1_bit (*(volatile union un_cks1 *)0xFFFA6).BIT
|
||||||
|
#define RESF (*(volatile unsigned char *)0xFFFA8)
|
||||||
|
#define LVIM (*(volatile union un_lvim *)0xFFFA9).lvim
|
||||||
|
#define LVIM_bit (*(volatile union un_lvim *)0xFFFA9).BIT
|
||||||
|
#define LVIS (*(volatile union un_lvis *)0xFFFAA).lvis
|
||||||
|
#define LVIS_bit (*(volatile union un_lvis *)0xFFFAA).BIT
|
||||||
|
#define WDTE (*(volatile unsigned char *)0xFFFAB)
|
||||||
|
#define CRCIN (*(volatile unsigned char *)0xFFFAC)
|
||||||
|
#define RXB (*(volatile unsigned char *)0xFFFAD)
|
||||||
|
#define TXS (*(volatile unsigned char *)0xFFFAD)
|
||||||
|
#define MONSTA0 (*(volatile union un_monsta0 *)0xFFFAE).monsta0
|
||||||
|
#define MONSTA0_bit (*(volatile union un_monsta0 *)0xFFFAE).BIT
|
||||||
|
#define ASIM (*(volatile union un_asim *)0xFFFAF).asim
|
||||||
|
#define ASIM_bit (*(volatile union un_asim *)0xFFFAF).BIT
|
||||||
|
#define DSA0 (*(volatile unsigned char *)0xFFFB0)
|
||||||
|
#define DSA1 (*(volatile unsigned char *)0xFFFB1)
|
||||||
|
#define DRA0 (*(volatile unsigned short *)0xFFFB2)
|
||||||
|
#define DRA0L (*(volatile unsigned char *)0xFFFB2)
|
||||||
|
#define DRA0H (*(volatile unsigned char *)0xFFFB3)
|
||||||
|
#define DRA1 (*(volatile unsigned short *)0xFFFB4)
|
||||||
|
#define DRA1L (*(volatile unsigned char *)0xFFFB4)
|
||||||
|
#define DRA1H (*(volatile unsigned char *)0xFFFB5)
|
||||||
|
#define DBC0 (*(volatile unsigned short *)0xFFFB6)
|
||||||
|
#define DBC0L (*(volatile unsigned char *)0xFFFB6)
|
||||||
|
#define DBC0H (*(volatile unsigned char *)0xFFFB7)
|
||||||
|
#define DBC1 (*(volatile unsigned short *)0xFFFB8)
|
||||||
|
#define DBC1L (*(volatile unsigned char *)0xFFFB8)
|
||||||
|
#define DBC1H (*(volatile unsigned char *)0xFFFB9)
|
||||||
|
#define DMC0 (*(volatile union un_dmc0 *)0xFFFBA).dmc0
|
||||||
|
#define DMC0_bit (*(volatile union un_dmc0 *)0xFFFBA).BIT
|
||||||
|
#define DMC1 (*(volatile union un_dmc1 *)0xFFFBB).dmc1
|
||||||
|
#define DMC1_bit (*(volatile union un_dmc1 *)0xFFFBB).BIT
|
||||||
|
#define DRC0 (*(volatile union un_drc0 *)0xFFFBC).drc0
|
||||||
|
#define DRC0_bit (*(volatile union un_drc0 *)0xFFFBC).BIT
|
||||||
|
#define DRC1 (*(volatile union un_drc1 *)0xFFFBD).drc1
|
||||||
|
#define DRC1_bit (*(volatile union un_drc1 *)0xFFFBD).BIT
|
||||||
|
#define IF2 (*(volatile union un_if2 *)0xFFFD0).if2
|
||||||
|
#define IF2_bit (*(volatile union un_if2 *)0xFFFD0).BIT
|
||||||
|
#define IF2L (*(volatile union un_if2l *)0xFFFD0).if2l
|
||||||
|
#define IF2L_bit (*(volatile union un_if2l *)0xFFFD0).BIT
|
||||||
|
#define IF2H (*(volatile union un_if2h *)0xFFFD1).if2h
|
||||||
|
#define IF2H_bit (*(volatile union un_if2h *)0xFFFD1).BIT
|
||||||
|
#define MK2 (*(volatile union un_mk2 *)0xFFFD4).mk2
|
||||||
|
#define MK2_bit (*(volatile union un_mk2 *)0xFFFD4).BIT
|
||||||
|
#define MK2L (*(volatile union un_mk2l *)0xFFFD4).mk2l
|
||||||
|
#define MK2L_bit (*(volatile union un_mk2l *)0xFFFD4).BIT
|
||||||
|
#define MK2H (*(volatile union un_mk2h *)0xFFFD5).mk2h
|
||||||
|
#define MK2H_bit (*(volatile union un_mk2h *)0xFFFD5).BIT
|
||||||
|
#define PR02 (*(volatile union un_pr02 *)0xFFFD8).pr02
|
||||||
|
#define PR02_bit (*(volatile union un_pr02 *)0xFFFD8).BIT
|
||||||
|
#define PR02L (*(volatile union un_pr02l *)0xFFFD8).pr02l
|
||||||
|
#define PR02L_bit (*(volatile union un_pr02l *)0xFFFD8).BIT
|
||||||
|
#define PR02H (*(volatile union un_pr02h *)0xFFFD9).pr02h
|
||||||
|
#define PR02H_bit (*(volatile union un_pr02h *)0xFFFD9).BIT
|
||||||
|
#define PR12 (*(volatile union un_pr12 *)0xFFFDC).pr12
|
||||||
|
#define PR12_bit (*(volatile union un_pr12 *)0xFFFDC).BIT
|
||||||
|
#define PR12L (*(volatile union un_pr12l *)0xFFFDC).pr12l
|
||||||
|
#define PR12L_bit (*(volatile union un_pr12l *)0xFFFDC).BIT
|
||||||
|
#define PR12H (*(volatile union un_pr12h *)0xFFFDD).pr12h
|
||||||
|
#define PR12H_bit (*(volatile union un_pr12h *)0xFFFDD).BIT
|
||||||
|
#define IF0 (*(volatile union un_if0 *)0xFFFE0).if0
|
||||||
|
#define IF0_bit (*(volatile union un_if0 *)0xFFFE0).BIT
|
||||||
|
#define IF0L (*(volatile union un_if0l *)0xFFFE0).if0l
|
||||||
|
#define IF0L_bit (*(volatile union un_if0l *)0xFFFE0).BIT
|
||||||
|
#define IF0H (*(volatile union un_if0h *)0xFFFE1).if0h
|
||||||
|
#define IF0H_bit (*(volatile union un_if0h *)0xFFFE1).BIT
|
||||||
|
#define IF1 (*(volatile union un_if1 *)0xFFFE2).if1
|
||||||
|
#define IF1_bit (*(volatile union un_if1 *)0xFFFE2).BIT
|
||||||
|
#define IF1L (*(volatile union un_if1l *)0xFFFE2).if1l
|
||||||
|
#define IF1L_bit (*(volatile union un_if1l *)0xFFFE2).BIT
|
||||||
|
#define IF1H (*(volatile union un_if1h *)0xFFFE3).if1h
|
||||||
|
#define IF1H_bit (*(volatile union un_if1h *)0xFFFE3).BIT
|
||||||
|
#define MK0 (*(volatile union un_mk0 *)0xFFFE4).mk0
|
||||||
|
#define MK0_bit (*(volatile union un_mk0 *)0xFFFE4).BIT
|
||||||
|
#define MK0L (*(volatile union un_mk0l *)0xFFFE4).mk0l
|
||||||
|
#define MK0L_bit (*(volatile union un_mk0l *)0xFFFE4).BIT
|
||||||
|
#define MK0H (*(volatile union un_mk0h *)0xFFFE5).mk0h
|
||||||
|
#define MK0H_bit (*(volatile union un_mk0h *)0xFFFE5).BIT
|
||||||
|
#define MK1 (*(volatile union un_mk1 *)0xFFFE6).mk1
|
||||||
|
#define MK1_bit (*(volatile union un_mk1 *)0xFFFE6).BIT
|
||||||
|
#define MK1L (*(volatile union un_mk1l *)0xFFFE6).mk1l
|
||||||
|
#define MK1L_bit (*(volatile union un_mk1l *)0xFFFE6).BIT
|
||||||
|
#define MK1H (*(volatile union un_mk1h *)0xFFFE7).mk1h
|
||||||
|
#define MK1H_bit (*(volatile union un_mk1h *)0xFFFE7).BIT
|
||||||
|
#define PR00 (*(volatile union un_pr00 *)0xFFFE8).pr00
|
||||||
|
#define PR00_bit (*(volatile union un_pr00 *)0xFFFE8).BIT
|
||||||
|
#define PR00L (*(volatile union un_pr00l *)0xFFFE8).pr00l
|
||||||
|
#define PR00L_bit (*(volatile union un_pr00l *)0xFFFE8).BIT
|
||||||
|
#define PR00H (*(volatile union un_pr00h *)0xFFFE9).pr00h
|
||||||
|
#define PR00H_bit (*(volatile union un_pr00h *)0xFFFE9).BIT
|
||||||
|
#define PR01 (*(volatile union un_pr01 *)0xFFFEA).pr01
|
||||||
|
#define PR01_bit (*(volatile union un_pr01 *)0xFFFEA).BIT
|
||||||
|
#define PR01L (*(volatile union un_pr01l *)0xFFFEA).pr01l
|
||||||
|
#define PR01L_bit (*(volatile union un_pr01l *)0xFFFEA).BIT
|
||||||
|
#define PR01H (*(volatile union un_pr01h *)0xFFFEB).pr01h
|
||||||
|
#define PR01H_bit (*(volatile union un_pr01h *)0xFFFEB).BIT
|
||||||
|
#define PR10 (*(volatile union un_pr10 *)0xFFFEC).pr10
|
||||||
|
#define PR10_bit (*(volatile union un_pr10 *)0xFFFEC).BIT
|
||||||
|
#define PR10L (*(volatile union un_pr10l *)0xFFFEC).pr10l
|
||||||
|
#define PR10L_bit (*(volatile union un_pr10l *)0xFFFEC).BIT
|
||||||
|
#define PR10H (*(volatile union un_pr10h *)0xFFFED).pr10h
|
||||||
|
#define PR10H_bit (*(volatile union un_pr10h *)0xFFFED).BIT
|
||||||
|
#define PR11 (*(volatile union un_pr11 *)0xFFFEE).pr11
|
||||||
|
#define PR11_bit (*(volatile union un_pr11 *)0xFFFEE).BIT
|
||||||
|
#define PR11L (*(volatile union un_pr11l *)0xFFFEE).pr11l
|
||||||
|
#define PR11L_bit (*(volatile union un_pr11l *)0xFFFEE).BIT
|
||||||
|
#define PR11H (*(volatile union un_pr11h *)0xFFFEF).pr11h
|
||||||
|
#define PR11H_bit (*(volatile union un_pr11h *)0xFFFEF).BIT
|
||||||
|
#define MDAL (*(volatile unsigned short *)0xFFFF0)
|
||||||
|
#define MULA (*(volatile unsigned short *)0xFFFF0)
|
||||||
|
#define MDAH (*(volatile unsigned short *)0xFFFF2)
|
||||||
|
#define MULB (*(volatile unsigned short *)0xFFFF2)
|
||||||
|
#define MDBH (*(volatile unsigned short *)0xFFFF4)
|
||||||
|
#define MULOH (*(volatile unsigned short *)0xFFFF4)
|
||||||
|
#define MDBL (*(volatile unsigned short *)0xFFFF6)
|
||||||
|
#define MULOL (*(volatile unsigned short *)0xFFFF6)
|
||||||
|
#define PMC (*(volatile union un_pmc *)0xFFFFE).pmc
|
||||||
|
#define PMC_bit (*(volatile union un_pmc *)0xFFFFE).BIT
|
||||||
|
|
||||||
|
/*
|
||||||
|
Sfr bits
|
||||||
|
*/
|
||||||
|
#define ADCE ADM0_bit.no0
|
||||||
|
#define ADCS ADM0_bit.no7
|
||||||
|
#define SPD0 IICS0_bit.no0
|
||||||
|
#define STD0 IICS0_bit.no1
|
||||||
|
#define ACKD0 IICS0_bit.no2
|
||||||
|
#define TRC0 IICS0_bit.no3
|
||||||
|
#define COI0 IICS0_bit.no4
|
||||||
|
#define EXC0 IICS0_bit.no5
|
||||||
|
#define ALD0 IICS0_bit.no6
|
||||||
|
#define MSTS0 IICS0_bit.no7
|
||||||
|
#define IICRSV0 IICF0_bit.no0
|
||||||
|
#define STCEN0 IICF0_bit.no1
|
||||||
|
#define IICBSY0 IICF0_bit.no6
|
||||||
|
#define STCF0 IICF0_bit.no7
|
||||||
|
#define FSSTP FSSQ_bit.no6
|
||||||
|
#define SQST FSSQ_bit.no7
|
||||||
|
#define SQEND FSASTH_bit.no6
|
||||||
|
#define ESQEND FSASTH_bit.no7
|
||||||
|
#define RTCE RTCC0_bit.no7
|
||||||
|
#define RWAIT RTCC1_bit.no0
|
||||||
|
#define RWST RTCC1_bit.no1
|
||||||
|
#define RIFG RTCC1_bit.no3
|
||||||
|
#define WAFG RTCC1_bit.no4
|
||||||
|
#define WALIE RTCC1_bit.no6
|
||||||
|
#define WALE RTCC1_bit.no7
|
||||||
|
#define HIOSTOP CSC_bit.no0
|
||||||
|
#define MSTOP CSC_bit.no7
|
||||||
|
#define MCM0 CKC_bit.no4
|
||||||
|
#define MCS CKC_bit.no5
|
||||||
|
#define PCLOE0 CKS0_bit.no7
|
||||||
|
#define PCLOE1 CKS1_bit.no7
|
||||||
|
#define LVIF LVIM_bit.no0
|
||||||
|
#define LVIOMSK LVIM_bit.no1
|
||||||
|
#define LVISEN LVIM_bit.no7
|
||||||
|
#define LVILV LVIS_bit.no0
|
||||||
|
#define LVIMD LVIS_bit.no7
|
||||||
|
#define DWAIT0 DMC0_bit.no4
|
||||||
|
#define DS0 DMC0_bit.no5
|
||||||
|
#define DRS0 DMC0_bit.no6
|
||||||
|
#define STG0 DMC0_bit.no7
|
||||||
|
#define DWAIT1 DMC1_bit.no4
|
||||||
|
#define DS1 DMC1_bit.no5
|
||||||
|
#define DRS1 DMC1_bit.no6
|
||||||
|
#define STG1 DMC1_bit.no7
|
||||||
|
#define DST0 DRC0_bit.no0
|
||||||
|
#define DEN0 DRC0_bit.no7
|
||||||
|
#define DST1 DRC1_bit.no0
|
||||||
|
#define DEN1 DRC1_bit.no7
|
||||||
|
#define PIF8 IF2_bit.no5
|
||||||
|
#define PIF9 IF2_bit.no6
|
||||||
|
#define MDIF IF2H_bit.no5
|
||||||
|
#define FLIF IF2H_bit.no7
|
||||||
|
#define PMK8 MK2_bit.no5
|
||||||
|
#define PMK9 MK2_bit.no6
|
||||||
|
#define MDMK MK2H_bit.no5
|
||||||
|
#define FLMK MK2H_bit.no7
|
||||||
|
#define PPR08 PR02_bit.no5
|
||||||
|
#define PPR09 PR02_bit.no6
|
||||||
|
#define MDPR0 PR02H_bit.no5
|
||||||
|
#define FLPR0 PR02H_bit.no7
|
||||||
|
#define PPR18 PR12_bit.no5
|
||||||
|
#define PPR19 PR12_bit.no6
|
||||||
|
#define MDPR1 PR12H_bit.no5
|
||||||
|
#define FLPR1 PR12H_bit.no7
|
||||||
|
#define WDTIIF IF0_bit.no0
|
||||||
|
#define LVIIF IF0_bit.no1
|
||||||
|
#define PIF0 IF0_bit.no2
|
||||||
|
#define PIF1 IF0_bit.no3
|
||||||
|
#define PIF2 IF0_bit.no4
|
||||||
|
#define PIF3 IF0_bit.no5
|
||||||
|
#define PIF4 IF0_bit.no6
|
||||||
|
#define PIF5 IF0_bit.no7
|
||||||
|
#define DMAIF0 IF0H_bit.no3
|
||||||
|
#define DMAIF1 IF0H_bit.no4
|
||||||
|
#define CSIIF00 IF0H_bit.no5
|
||||||
|
#define IICIF00 IF0H_bit.no5
|
||||||
|
#define STIF0 IF0H_bit.no5
|
||||||
|
#define TMIF00 IF0H_bit.no6
|
||||||
|
#define CSIIF01 IF0H_bit.no7
|
||||||
|
#define IICIF01 IF0H_bit.no7
|
||||||
|
#define SRIF0 IF0H_bit.no7
|
||||||
|
#define SREIF0 IF1_bit.no0
|
||||||
|
#define TMIF01H IF1_bit.no0
|
||||||
|
#define TMIF03H IF1_bit.no3
|
||||||
|
#define IICAIF0 IF1_bit.no4
|
||||||
|
#define TMIF01 IF1_bit.no5
|
||||||
|
#define TMIF02 IF1_bit.no6
|
||||||
|
#define TMIF03 IF1_bit.no7
|
||||||
|
#define ADIF IF1H_bit.no0
|
||||||
|
#define RTCIF IF1H_bit.no1
|
||||||
|
#define ITIF IF1H_bit.no2
|
||||||
|
#define USBIF IF1H_bit.no4
|
||||||
|
#define RSUIF IF1H_bit.no5
|
||||||
|
#define WDTIMK MK0_bit.no0
|
||||||
|
#define LVIMK MK0_bit.no1
|
||||||
|
#define PMK0 MK0_bit.no2
|
||||||
|
#define PMK1 MK0_bit.no3
|
||||||
|
#define PMK2 MK0_bit.no4
|
||||||
|
#define PMK3 MK0_bit.no5
|
||||||
|
#define PMK4 MK0_bit.no6
|
||||||
|
#define PMK5 MK0_bit.no7
|
||||||
|
#define DMAMK0 MK0H_bit.no3
|
||||||
|
#define DMAMK1 MK0H_bit.no4
|
||||||
|
#define CSIMK00 MK0H_bit.no5
|
||||||
|
#define IICMK00 MK0H_bit.no5
|
||||||
|
#define STMK0 MK0H_bit.no5
|
||||||
|
#define TMMK00 MK0H_bit.no6
|
||||||
|
#define CSIMK01 MK0H_bit.no7
|
||||||
|
#define IICMK01 MK0H_bit.no7
|
||||||
|
#define SRMK0 MK0H_bit.no7
|
||||||
|
#define SREMK0 MK1_bit.no0
|
||||||
|
#define TMMK01H MK1_bit.no0
|
||||||
|
#define TMMK03H MK1_bit.no3
|
||||||
|
#define IICAMK0 MK1_bit.no4
|
||||||
|
#define TMMK01 MK1_bit.no5
|
||||||
|
#define TMMK02 MK1_bit.no6
|
||||||
|
#define TMMK03 MK1_bit.no7
|
||||||
|
#define ADMK MK1H_bit.no0
|
||||||
|
#define RTCMK MK1H_bit.no1
|
||||||
|
#define ITMK MK1H_bit.no2
|
||||||
|
#define USBMK MK1H_bit.no4
|
||||||
|
#define RSUMK MK1H_bit.no5
|
||||||
|
#define WDTIPR0 PR00_bit.no0
|
||||||
|
#define LVIPR0 PR00_bit.no1
|
||||||
|
#define PPR00 PR00_bit.no2
|
||||||
|
#define PPR01 PR00_bit.no3
|
||||||
|
#define PPR02 PR00_bit.no4
|
||||||
|
#define PPR03 PR00_bit.no5
|
||||||
|
#define PPR04 PR00_bit.no6
|
||||||
|
#define PPR05 PR00_bit.no7
|
||||||
|
#define DMAPR00 PR00H_bit.no3
|
||||||
|
#define DMAPR01 PR00H_bit.no4
|
||||||
|
#define CSIPR000 PR00H_bit.no5
|
||||||
|
#define IICPR000 PR00H_bit.no5
|
||||||
|
#define STPR00 PR00H_bit.no5
|
||||||
|
#define TMPR000 PR00H_bit.no6
|
||||||
|
#define CSIPR001 PR00H_bit.no7
|
||||||
|
#define IICPR001 PR00H_bit.no7
|
||||||
|
#define SRPR00 PR00H_bit.no7
|
||||||
|
#define SREPR00 PR01_bit.no0
|
||||||
|
#define TMPR001H PR01_bit.no0
|
||||||
|
#define TMPR003H PR01_bit.no3
|
||||||
|
#define IICAPR00 PR01_bit.no4
|
||||||
|
#define TMPR001 PR01_bit.no5
|
||||||
|
#define TMPR002 PR01_bit.no6
|
||||||
|
#define TMPR003 PR01_bit.no7
|
||||||
|
#define ADPR0 PR01H_bit.no0
|
||||||
|
#define RTCPR0 PR01H_bit.no1
|
||||||
|
#define ITPR0 PR01H_bit.no2
|
||||||
|
#define USBPR0 PR01H_bit.no4
|
||||||
|
#define RSUPR0 PR01H_bit.no5
|
||||||
|
#define WDTIPR1 PR10_bit.no0
|
||||||
|
#define LVIPR1 PR10_bit.no1
|
||||||
|
#define PPR10 PR10_bit.no2
|
||||||
|
#define PPR11 PR10_bit.no3
|
||||||
|
#define PPR12 PR10_bit.no4
|
||||||
|
#define PPR13 PR10_bit.no5
|
||||||
|
#define PPR14 PR10_bit.no6
|
||||||
|
#define PPR15 PR10_bit.no7
|
||||||
|
#define DMAPR10 PR10H_bit.no3
|
||||||
|
#define DMAPR11 PR10H_bit.no4
|
||||||
|
#define CSIPR100 PR10H_bit.no5
|
||||||
|
#define IICPR100 PR10H_bit.no5
|
||||||
|
#define STPR10 PR10H_bit.no5
|
||||||
|
#define TMPR100 PR10H_bit.no6
|
||||||
|
#define CSIPR101 PR10H_bit.no7
|
||||||
|
#define IICPR101 PR10H_bit.no7
|
||||||
|
#define SRPR10 PR10H_bit.no7
|
||||||
|
#define SREPR10 PR11_bit.no0
|
||||||
|
#define TMPR101H PR11_bit.no0
|
||||||
|
#define TMPR103H PR11_bit.no3
|
||||||
|
#define IICAPR10 PR11_bit.no4
|
||||||
|
#define TMPR101 PR11_bit.no5
|
||||||
|
#define TMPR102 PR11_bit.no6
|
||||||
|
#define TMPR103 PR11_bit.no7
|
||||||
|
#define ADPR1 PR11H_bit.no0
|
||||||
|
#define RTCPR1 PR11H_bit.no1
|
||||||
|
#define ITPR1 PR11H_bit.no2
|
||||||
|
#define USBPR1 PR11H_bit.no4
|
||||||
|
#define RSUPR1 PR11H_bit.no5
|
||||||
|
#define MAA PMC_bit.no0
|
||||||
|
|
||||||
|
/*
|
||||||
|
Interrupt vector addresses
|
||||||
|
*/
|
||||||
|
#define RST_vect (0x0)
|
||||||
|
#define INTDBG_vect (0x2)
|
||||||
|
#define INTSRO_vect (0x4)
|
||||||
|
#define INTWDTI_vect (0x4)
|
||||||
|
#define INTLVI_vect (0x6)
|
||||||
|
#define INTP0_vect (0x8)
|
||||||
|
#define INTP1_vect (0xA)
|
||||||
|
#define INTP2_vect (0xC)
|
||||||
|
#define INTP3_vect (0xE)
|
||||||
|
#define INTP4_vect (0x10)
|
||||||
|
#define INTP5_vect (0x12)
|
||||||
|
#define INTDMA0_vect (0x1A)
|
||||||
|
#define INTDMA1_vect (0x1C)
|
||||||
|
#define INTCSI00_vect (0x1E)
|
||||||
|
#define INTIIC00_vect (0x1E)
|
||||||
|
#define INTST0_vect (0x1E)
|
||||||
|
#define INTTM00_vect (0x20)
|
||||||
|
#define INTCSI01_vect (0x22)
|
||||||
|
#define INTIIC01_vect (0x22)
|
||||||
|
#define INTSR0_vect (0x22)
|
||||||
|
#define INTSRE0_vect (0x24)
|
||||||
|
#define INTTM01H_vect (0x24)
|
||||||
|
#define INTTM03H_vect (0x2A)
|
||||||
|
#define INTIICA0_vect (0x2C)
|
||||||
|
#define INTTM01_vect (0x2E)
|
||||||
|
#define INTTM02_vect (0x30)
|
||||||
|
#define INTTM03_vect (0x32)
|
||||||
|
#define INTAD_vect (0x34)
|
||||||
|
#define INTRTC_vect (0x36)
|
||||||
|
#define INTIT_vect (0x38)
|
||||||
|
#define INTUSB_vect (0x3C)
|
||||||
|
#define INTRSUM_vect (0x3E)
|
||||||
|
#define INTP8_vect (0x4E)
|
||||||
|
#define INTP9_vect (0x50)
|
||||||
|
#define INTMD_vect (0x5E)
|
||||||
|
#define INTFL_vect (0x62)
|
||||||
|
#define BRK_I_vect (0x7E)
|
||||||
|
#endif
|
524
FreeRTOS/Demo/RL78_E2Studio_GCC/src/iodefine_ext.h
Normal file
524
FreeRTOS/Demo/RL78_E2Studio_GCC/src/iodefine_ext.h
Normal file
|
@ -0,0 +1,524 @@
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PROJECT NAME : RTOSDemo */
|
||||||
|
/* FILE : iodefine_ext.h */
|
||||||
|
/* DESCRIPTION : Definition of Extended SFRs */
|
||||||
|
/* CPU SERIES : RL78 - G1C */
|
||||||
|
/* CPU TYPE : R5F10JBC */
|
||||||
|
/* */
|
||||||
|
/* This file is generated by e2studio. */
|
||||||
|
/* */
|
||||||
|
/***********************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************/
|
||||||
|
/* Header file generated from device file: */
|
||||||
|
/* DR5F10JBC.DVF */
|
||||||
|
/* Copyright(C) 2012 Renesas */
|
||||||
|
/* File Version V1.00 */
|
||||||
|
/* Tool Version 1.9.7121 */
|
||||||
|
/* Date Generated 13/11/2012 */
|
||||||
|
/************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __IOREG_BIT_STRUCTURES
|
||||||
|
#define __IOREG_BIT_STRUCTURES
|
||||||
|
typedef struct {
|
||||||
|
unsigned char no0 :1;
|
||||||
|
unsigned char no1 :1;
|
||||||
|
unsigned char no2 :1;
|
||||||
|
unsigned char no3 :1;
|
||||||
|
unsigned char no4 :1;
|
||||||
|
unsigned char no5 :1;
|
||||||
|
unsigned char no6 :1;
|
||||||
|
unsigned char no7 :1;
|
||||||
|
} __BITS8;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned short no0 :1;
|
||||||
|
unsigned short no1 :1;
|
||||||
|
unsigned short no2 :1;
|
||||||
|
unsigned short no3 :1;
|
||||||
|
unsigned short no4 :1;
|
||||||
|
unsigned short no5 :1;
|
||||||
|
unsigned short no6 :1;
|
||||||
|
unsigned short no7 :1;
|
||||||
|
unsigned short no8 :1;
|
||||||
|
unsigned short no9 :1;
|
||||||
|
unsigned short no10 :1;
|
||||||
|
unsigned short no11 :1;
|
||||||
|
unsigned short no12 :1;
|
||||||
|
unsigned short no13 :1;
|
||||||
|
unsigned short no14 :1;
|
||||||
|
unsigned short no15 :1;
|
||||||
|
} __BITS16;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef IODEFINE_EXT_H
|
||||||
|
#define IODEFINE_EXT_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
IO Registers
|
||||||
|
*/
|
||||||
|
union un_adm2 {
|
||||||
|
unsigned char adm2;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pms {
|
||||||
|
unsigned char pms;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu0 {
|
||||||
|
unsigned char pu0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu1 {
|
||||||
|
unsigned char pu1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu3 {
|
||||||
|
unsigned char pu3;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu4 {
|
||||||
|
unsigned char pu4;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu5 {
|
||||||
|
unsigned char pu5;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu7 {
|
||||||
|
unsigned char pu7;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pu12 {
|
||||||
|
unsigned char pu12;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pim0 {
|
||||||
|
unsigned char pim0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pim3 {
|
||||||
|
unsigned char pim3;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pim5 {
|
||||||
|
unsigned char pim5;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pom0 {
|
||||||
|
unsigned char pom0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pom3 {
|
||||||
|
unsigned char pom3;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pom5 {
|
||||||
|
unsigned char pom5;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pmc0 {
|
||||||
|
unsigned char pmc0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pmc12 {
|
||||||
|
unsigned char pmc12;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_nfen0 {
|
||||||
|
unsigned char nfen0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_nfen1 {
|
||||||
|
unsigned char nfen1;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_isc {
|
||||||
|
unsigned char isc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_dflctl {
|
||||||
|
unsigned char dflctl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_bectl {
|
||||||
|
unsigned char bectl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_fsse {
|
||||||
|
unsigned char fsse;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_pfs {
|
||||||
|
unsigned char pfs;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mduc {
|
||||||
|
unsigned char mduc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_per0 {
|
||||||
|
unsigned char per0;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_rmc {
|
||||||
|
unsigned char rmc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_rpectl {
|
||||||
|
unsigned char rpectl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_se0l {
|
||||||
|
unsigned char se0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_ss0l {
|
||||||
|
unsigned char ss0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_st0l {
|
||||||
|
unsigned char st0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_soe0l {
|
||||||
|
unsigned char soe0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_te0l {
|
||||||
|
unsigned char te0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_ts0l {
|
||||||
|
unsigned char ts0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_tt0l {
|
||||||
|
unsigned char tt0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_toe0l {
|
||||||
|
unsigned char toe0l;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_iicctl00 {
|
||||||
|
unsigned char iicctl00;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_iicctl01 {
|
||||||
|
unsigned char iicctl01;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_dscctl {
|
||||||
|
unsigned char dscctl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_mckc {
|
||||||
|
unsigned char mckc;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
union un_crc0ctl {
|
||||||
|
unsigned char crc0ctl;
|
||||||
|
__BITS8 BIT;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define ADM2 (*(volatile union un_adm2 *)0xF0010).adm2
|
||||||
|
#define ADM2_bit (*(volatile union un_adm2 *)0xF0010).BIT
|
||||||
|
#define ADUL (*(volatile unsigned char *)0xF0011)
|
||||||
|
#define ADLL (*(volatile unsigned char *)0xF0012)
|
||||||
|
#define ADTES (*(volatile unsigned char *)0xF0013)
|
||||||
|
#define PMS (*(volatile union un_pms *)0xF0018).pms
|
||||||
|
#define PMS_bit (*(volatile union un_pms *)0xF0018).BIT
|
||||||
|
#define PIOR (*(volatile unsigned char *)0xF001A)
|
||||||
|
#define PU0 (*(volatile union un_pu0 *)0xF0030).pu0
|
||||||
|
#define PU0_bit (*(volatile union un_pu0 *)0xF0030).BIT
|
||||||
|
#define PU1 (*(volatile union un_pu1 *)0xF0031).pu1
|
||||||
|
#define PU1_bit (*(volatile union un_pu1 *)0xF0031).BIT
|
||||||
|
#define PU3 (*(volatile union un_pu3 *)0xF0033).pu3
|
||||||
|
#define PU3_bit (*(volatile union un_pu3 *)0xF0033).BIT
|
||||||
|
#define PU4 (*(volatile union un_pu4 *)0xF0034).pu4
|
||||||
|
#define PU4_bit (*(volatile union un_pu4 *)0xF0034).BIT
|
||||||
|
#define PU5 (*(volatile union un_pu5 *)0xF0035).pu5
|
||||||
|
#define PU5_bit (*(volatile union un_pu5 *)0xF0035).BIT
|
||||||
|
#define PU7 (*(volatile union un_pu7 *)0xF0037).pu7
|
||||||
|
#define PU7_bit (*(volatile union un_pu7 *)0xF0037).BIT
|
||||||
|
#define PU12 (*(volatile union un_pu12 *)0xF003C).pu12
|
||||||
|
#define PU12_bit (*(volatile union un_pu12 *)0xF003C).BIT
|
||||||
|
#define PIM0 (*(volatile union un_pim0 *)0xF0040).pim0
|
||||||
|
#define PIM0_bit (*(volatile union un_pim0 *)0xF0040).BIT
|
||||||
|
#define PIM3 (*(volatile union un_pim3 *)0xF0043).pim3
|
||||||
|
#define PIM3_bit (*(volatile union un_pim3 *)0xF0043).BIT
|
||||||
|
#define PIM5 (*(volatile union un_pim5 *)0xF0045).pim5
|
||||||
|
#define PIM5_bit (*(volatile union un_pim5 *)0xF0045).BIT
|
||||||
|
#define POM0 (*(volatile union un_pom0 *)0xF0050).pom0
|
||||||
|
#define POM0_bit (*(volatile union un_pom0 *)0xF0050).BIT
|
||||||
|
#define POM3 (*(volatile union un_pom3 *)0xF0053).pom3
|
||||||
|
#define POM3_bit (*(volatile union un_pom3 *)0xF0053).BIT
|
||||||
|
#define POM5 (*(volatile union un_pom5 *)0xF0055).pom5
|
||||||
|
#define POM5_bit (*(volatile union un_pom5 *)0xF0055).BIT
|
||||||
|
#define PMC0 (*(volatile union un_pmc0 *)0xF0060).pmc0
|
||||||
|
#define PMC0_bit (*(volatile union un_pmc0 *)0xF0060).BIT
|
||||||
|
#define PMC12 (*(volatile union un_pmc12 *)0xF006C).pmc12
|
||||||
|
#define PMC12_bit (*(volatile union un_pmc12 *)0xF006C).BIT
|
||||||
|
#define NFEN0 (*(volatile union un_nfen0 *)0xF0070).nfen0
|
||||||
|
#define NFEN0_bit (*(volatile union un_nfen0 *)0xF0070).BIT
|
||||||
|
#define NFEN1 (*(volatile union un_nfen1 *)0xF0071).nfen1
|
||||||
|
#define NFEN1_bit (*(volatile union un_nfen1 *)0xF0071).BIT
|
||||||
|
#define ISC (*(volatile union un_isc *)0xF0073).isc
|
||||||
|
#define ISC_bit (*(volatile union un_isc *)0xF0073).BIT
|
||||||
|
#define TIS0 (*(volatile unsigned char *)0xF0074)
|
||||||
|
#define ADPC (*(volatile unsigned char *)0xF0076)
|
||||||
|
#define IAWCTL (*(volatile unsigned char *)0xF0077)
|
||||||
|
#define PRDSEL (*(volatile unsigned short *)0xF007E)
|
||||||
|
#define TOOLEN (*(volatile unsigned char *)0xF0080)
|
||||||
|
#define BPAL0 (*(volatile unsigned char *)0xF0081)
|
||||||
|
#define BPAH0 (*(volatile unsigned char *)0xF0082)
|
||||||
|
#define BPAS0 (*(volatile unsigned char *)0xF0083)
|
||||||
|
#define BACDVL0 (*(volatile unsigned char *)0xF0084)
|
||||||
|
#define BACDVH0 (*(volatile unsigned char *)0xF0085)
|
||||||
|
#define BACDML0 (*(volatile unsigned char *)0xF0086)
|
||||||
|
#define BACDMH0 (*(volatile unsigned char *)0xF0087)
|
||||||
|
#define MONMOD (*(volatile unsigned char *)0xF0088)
|
||||||
|
#define DFLCTL (*(volatile union un_dflctl *)0xF0090).dflctl
|
||||||
|
#define DFLCTL_bit (*(volatile union un_dflctl *)0xF0090).BIT
|
||||||
|
#define HIOTRM (*(volatile unsigned char *)0xF00A0)
|
||||||
|
#define BECTL (*(volatile union un_bectl *)0xF00A1).bectl
|
||||||
|
#define BECTL_bit (*(volatile union un_bectl *)0xF00A1).BIT
|
||||||
|
#define HOCODIV (*(volatile unsigned char *)0xF00A8)
|
||||||
|
#define TEMPCAL0 (*(volatile unsigned char *)0xF00AC)
|
||||||
|
#define TEMPCAL1 (*(volatile unsigned char *)0xF00AD)
|
||||||
|
#define TEMPCAL2 (*(volatile unsigned char *)0xF00AE)
|
||||||
|
#define TEMPCAL3 (*(volatile unsigned char *)0xF00AF)
|
||||||
|
#define FLSEC (*(volatile unsigned short *)0xF00B0)
|
||||||
|
#define FLFSWS (*(volatile unsigned short *)0xF00B2)
|
||||||
|
#define FLFSWE (*(volatile unsigned short *)0xF00B4)
|
||||||
|
#define FSSET (*(volatile unsigned char *)0xF00B6)
|
||||||
|
#define FSSE (*(volatile union un_fsse *)0xF00B7).fsse
|
||||||
|
#define FSSE_bit (*(volatile union un_fsse *)0xF00B7).BIT
|
||||||
|
#define FLFADL (*(volatile unsigned short *)0xF00B8)
|
||||||
|
#define FLFADH (*(volatile unsigned char *)0xF00BA)
|
||||||
|
#define PFCMD (*(volatile unsigned char *)0xF00C0)
|
||||||
|
#define PFS (*(volatile union un_pfs *)0xF00C1).pfs
|
||||||
|
#define PFS_bit (*(volatile union un_pfs *)0xF00C1).BIT
|
||||||
|
#define FLRL (*(volatile unsigned short *)0xF00C2)
|
||||||
|
#define FLRH (*(volatile unsigned short *)0xF00C4)
|
||||||
|
#define FLWE (*(volatile unsigned char *)0xF00C6)
|
||||||
|
#define FLRE (*(volatile unsigned char *)0xF00C7)
|
||||||
|
#define FLTMS (*(volatile unsigned short *)0xF00C8)
|
||||||
|
#define DFLMC (*(volatile unsigned short *)0xF00CA)
|
||||||
|
#define FLMCL (*(volatile unsigned short *)0xF00CC)
|
||||||
|
#define FLMCH (*(volatile unsigned char *)0xF00CE)
|
||||||
|
#define FSCTL (*(volatile unsigned char *)0xF00CF)
|
||||||
|
#define ICEADR (*(volatile unsigned short *)0xF00D0)
|
||||||
|
#define ICEDAT (*(volatile unsigned short *)0xF00D2)
|
||||||
|
#define MDCL (*(volatile unsigned short *)0xF00E0)
|
||||||
|
#define MDCH (*(volatile unsigned short *)0xF00E2)
|
||||||
|
#define MDUC (*(volatile union un_mduc *)0xF00E8).mduc
|
||||||
|
#define MDUC_bit (*(volatile union un_mduc *)0xF00E8).BIT
|
||||||
|
#define PER0 (*(volatile union un_per0 *)0xF00F0).per0
|
||||||
|
#define PER0_bit (*(volatile union un_per0 *)0xF00F0).BIT
|
||||||
|
#define OSMC (*(volatile unsigned char *)0xF00F3)
|
||||||
|
#define RMC (*(volatile union un_rmc *)0xF00F4).rmc
|
||||||
|
#define RMC_bit (*(volatile union un_rmc *)0xF00F4).BIT
|
||||||
|
#define RPECTL (*(volatile union un_rpectl *)0xF00F5).rpectl
|
||||||
|
#define RPECTL_bit (*(volatile union un_rpectl *)0xF00F5).BIT
|
||||||
|
#define BCDADJ (*(volatile unsigned char *)0xF00FE)
|
||||||
|
#define VECTCTRL (*(volatile unsigned char *)0xF00FF)
|
||||||
|
#define SSR00 (*(volatile unsigned short *)0xF0100)
|
||||||
|
#define SSR00L (*(volatile unsigned char *)0xF0100)
|
||||||
|
#define SSR01 (*(volatile unsigned short *)0xF0102)
|
||||||
|
#define SSR01L (*(volatile unsigned char *)0xF0102)
|
||||||
|
#define SIR00 (*(volatile unsigned short *)0xF0108)
|
||||||
|
#define SIR00L (*(volatile unsigned char *)0xF0108)
|
||||||
|
#define SIR01 (*(volatile unsigned short *)0xF010A)
|
||||||
|
#define SIR01L (*(volatile unsigned char *)0xF010A)
|
||||||
|
#define SMR00 (*(volatile unsigned short *)0xF0110)
|
||||||
|
#define SMR01 (*(volatile unsigned short *)0xF0112)
|
||||||
|
#define SCR00 (*(volatile unsigned short *)0xF0118)
|
||||||
|
#define SCR01 (*(volatile unsigned short *)0xF011A)
|
||||||
|
#define SE0 (*(volatile unsigned short *)0xF0120)
|
||||||
|
#define SE0L (*(volatile union un_se0l *)0xF0120).se0l
|
||||||
|
#define SE0L_bit (*(volatile union un_se0l *)0xF0120).BIT
|
||||||
|
#define SS0 (*(volatile unsigned short *)0xF0122)
|
||||||
|
#define SS0L (*(volatile union un_ss0l *)0xF0122).ss0l
|
||||||
|
#define SS0L_bit (*(volatile union un_ss0l *)0xF0122).BIT
|
||||||
|
#define ST0 (*(volatile unsigned short *)0xF0124)
|
||||||
|
#define ST0L (*(volatile union un_st0l *)0xF0124).st0l
|
||||||
|
#define ST0L_bit (*(volatile union un_st0l *)0xF0124).BIT
|
||||||
|
#define SPS0 (*(volatile unsigned short *)0xF0126)
|
||||||
|
#define SPS0L (*(volatile unsigned char *)0xF0126)
|
||||||
|
#define SO0 (*(volatile unsigned short *)0xF0128)
|
||||||
|
#define SOE0 (*(volatile unsigned short *)0xF012A)
|
||||||
|
#define SOE0L (*(volatile union un_soe0l *)0xF012A).soe0l
|
||||||
|
#define SOE0L_bit (*(volatile union un_soe0l *)0xF012A).BIT
|
||||||
|
#define EDR00 (*(volatile unsigned short *)0xF012C)
|
||||||
|
#define EDR00L (*(volatile unsigned char *)0xF012C)
|
||||||
|
#define EDR01 (*(volatile unsigned short *)0xF012E)
|
||||||
|
#define EDR01L (*(volatile unsigned char *)0xF012E)
|
||||||
|
#define SOL0 (*(volatile unsigned short *)0xF0134)
|
||||||
|
#define SOL0L (*(volatile unsigned char *)0xF0134)
|
||||||
|
#define SSC0 (*(volatile unsigned short *)0xF0138)
|
||||||
|
#define SSC0L (*(volatile unsigned char *)0xF0138)
|
||||||
|
#define TCR00 (*(volatile unsigned short *)0xF0180)
|
||||||
|
#define TCR01 (*(volatile unsigned short *)0xF0182)
|
||||||
|
#define TCR02 (*(volatile unsigned short *)0xF0184)
|
||||||
|
#define TCR03 (*(volatile unsigned short *)0xF0186)
|
||||||
|
#define TMR00 (*(volatile unsigned short *)0xF0190)
|
||||||
|
#define TMR01 (*(volatile unsigned short *)0xF0192)
|
||||||
|
#define TMR02 (*(volatile unsigned short *)0xF0194)
|
||||||
|
#define TMR03 (*(volatile unsigned short *)0xF0196)
|
||||||
|
#define TSR00 (*(volatile unsigned short *)0xF01A0)
|
||||||
|
#define TSR00L (*(volatile unsigned char *)0xF01A0)
|
||||||
|
#define TSR01 (*(volatile unsigned short *)0xF01A2)
|
||||||
|
#define TSR01L (*(volatile unsigned char *)0xF01A2)
|
||||||
|
#define TSR02 (*(volatile unsigned short *)0xF01A4)
|
||||||
|
#define TSR02L (*(volatile unsigned char *)0xF01A4)
|
||||||
|
#define TSR03 (*(volatile unsigned short *)0xF01A6)
|
||||||
|
#define TSR03L (*(volatile unsigned char *)0xF01A6)
|
||||||
|
#define TE0 (*(volatile unsigned short *)0xF01B0)
|
||||||
|
#define TE0L (*(volatile union un_te0l *)0xF01B0).te0l
|
||||||
|
#define TE0L_bit (*(volatile union un_te0l *)0xF01B0).BIT
|
||||||
|
#define TS0 (*(volatile unsigned short *)0xF01B2)
|
||||||
|
#define TS0L (*(volatile union un_ts0l *)0xF01B2).ts0l
|
||||||
|
#define TS0L_bit (*(volatile union un_ts0l *)0xF01B2).BIT
|
||||||
|
#define TT0 (*(volatile unsigned short *)0xF01B4)
|
||||||
|
#define TT0L (*(volatile union un_tt0l *)0xF01B4).tt0l
|
||||||
|
#define TT0L_bit (*(volatile union un_tt0l *)0xF01B4).BIT
|
||||||
|
#define TPS0 (*(volatile unsigned short *)0xF01B6)
|
||||||
|
#define TO0 (*(volatile unsigned short *)0xF01B8)
|
||||||
|
#define TO0L (*(volatile unsigned char *)0xF01B8)
|
||||||
|
#define TOE0 (*(volatile unsigned short *)0xF01BA)
|
||||||
|
#define TOE0L (*(volatile union un_toe0l *)0xF01BA).toe0l
|
||||||
|
#define TOE0L_bit (*(volatile union un_toe0l *)0xF01BA).BIT
|
||||||
|
#define TOL0 (*(volatile unsigned short *)0xF01BC)
|
||||||
|
#define TOL0L (*(volatile unsigned char *)0xF01BC)
|
||||||
|
#define TOM0 (*(volatile unsigned short *)0xF01BE)
|
||||||
|
#define TOM0L (*(volatile unsigned char *)0xF01BE)
|
||||||
|
#define IICCTL00 (*(volatile union un_iicctl00 *)0xF0230).iicctl00
|
||||||
|
#define IICCTL00_bit (*(volatile union un_iicctl00 *)0xF0230).BIT
|
||||||
|
#define IICCTL01 (*(volatile union un_iicctl01 *)0xF0231).iicctl01
|
||||||
|
#define IICCTL01_bit (*(volatile union un_iicctl01 *)0xF0231).BIT
|
||||||
|
#define IICWL0 (*(volatile unsigned char *)0xF0232)
|
||||||
|
#define IICWH0 (*(volatile unsigned char *)0xF0233)
|
||||||
|
#define SVA0 (*(volatile unsigned char *)0xF0234)
|
||||||
|
#define IICSE0 (*(volatile unsigned char *)0xF0235)
|
||||||
|
#define DSCCTL (*(volatile union un_dscctl *)0xF02E5).dscctl
|
||||||
|
#define DSCCTL_bit (*(volatile union un_dscctl *)0xF02E5).BIT
|
||||||
|
#define MCKC (*(volatile union un_mckc *)0xF02E6).mckc
|
||||||
|
#define MCKC_bit (*(volatile union un_mckc *)0xF02E6).BIT
|
||||||
|
#define CRC0CTL (*(volatile union un_crc0ctl *)0xF02F0).crc0ctl
|
||||||
|
#define CRC0CTL_bit (*(volatile union un_crc0ctl *)0xF02F0).BIT
|
||||||
|
#define PGCRCL (*(volatile unsigned short *)0xF02F2)
|
||||||
|
#define CRCD (*(volatile unsigned short *)0xF02FA)
|
||||||
|
#define SYSCFG (*(volatile unsigned short *)0xF0400)
|
||||||
|
#define SYSCFG1 (*(volatile unsigned short *)0xF0402)
|
||||||
|
#define SYSSTS0 (*(volatile unsigned short *)0xF0404)
|
||||||
|
#define SYSSTS1 (*(volatile unsigned short *)0xF0406)
|
||||||
|
#define DVSTCTR0 (*(volatile unsigned short *)0xF0408)
|
||||||
|
#define DVSTCTR1 (*(volatile unsigned short *)0xF040A)
|
||||||
|
#define DMA0PCFG (*(volatile unsigned short *)0xF0410)
|
||||||
|
#define DMA1PCFG (*(volatile unsigned short *)0xF0412)
|
||||||
|
#define CFIFOM (*(volatile unsigned short *)0xF0414)
|
||||||
|
#define CFIFOML (*(volatile unsigned char *)0xF0414)
|
||||||
|
#define D0FIFOM (*(volatile unsigned short *)0xF0418)
|
||||||
|
#define D0FIFOML (*(volatile unsigned char *)0xF0418)
|
||||||
|
#define D1FIFOM (*(volatile unsigned short *)0xF041C)
|
||||||
|
#define D1FIFOML (*(volatile unsigned char *)0xF041C)
|
||||||
|
#define CFIFOSEL (*(volatile unsigned short *)0xF0420)
|
||||||
|
#define CFIFOCTR (*(volatile unsigned short *)0xF0422)
|
||||||
|
#define D0FIFOSEL (*(volatile unsigned short *)0xF0428)
|
||||||
|
#define D0FIFOCTR (*(volatile unsigned short *)0xF042A)
|
||||||
|
#define D1FIFOSEL (*(volatile unsigned short *)0xF042C)
|
||||||
|
#define D1FIFOCTR (*(volatile unsigned short *)0xF042E)
|
||||||
|
#define INTENB0 (*(volatile unsigned short *)0xF0430)
|
||||||
|
#define INTENB1 (*(volatile unsigned short *)0xF0432)
|
||||||
|
#define INTENB2 (*(volatile unsigned short *)0xF0434)
|
||||||
|
#define BRDYENB (*(volatile unsigned short *)0xF0436)
|
||||||
|
#define NRDYENB (*(volatile unsigned short *)0xF0438)
|
||||||
|
#define BEMPENB (*(volatile unsigned short *)0xF043A)
|
||||||
|
#define SOFCFG (*(volatile unsigned short *)0xF043C)
|
||||||
|
#define INTSTS0 (*(volatile unsigned short *)0xF0440)
|
||||||
|
#define INTSTS1 (*(volatile unsigned short *)0xF0442)
|
||||||
|
#define INTSTS2 (*(volatile unsigned short *)0xF0444)
|
||||||
|
#define BRDYSTS (*(volatile unsigned short *)0xF0446)
|
||||||
|
#define NRDYSTS (*(volatile unsigned short *)0xF0448)
|
||||||
|
#define BEMPSTS (*(volatile unsigned short *)0xF044A)
|
||||||
|
#define FRMNUM (*(volatile unsigned short *)0xF044C)
|
||||||
|
#define USBADDR (*(volatile unsigned short *)0xF0450)
|
||||||
|
#define USBREQ (*(volatile unsigned short *)0xF0454)
|
||||||
|
#define USBVAL (*(volatile unsigned short *)0xF0456)
|
||||||
|
#define USBINDX (*(volatile unsigned short *)0xF0458)
|
||||||
|
#define USBLENG (*(volatile unsigned short *)0xF045A)
|
||||||
|
#define DCPCFG (*(volatile unsigned short *)0xF045C)
|
||||||
|
#define DCPMAXP (*(volatile unsigned short *)0xF045E)
|
||||||
|
#define DCPCTR (*(volatile unsigned short *)0xF0460)
|
||||||
|
#define PIPESEL (*(volatile unsigned short *)0xF0464)
|
||||||
|
#define PIPECFG (*(volatile unsigned short *)0xF0468)
|
||||||
|
#define PIPEMAXP (*(volatile unsigned short *)0xF046C)
|
||||||
|
#define PIPEPERI (*(volatile unsigned short *)0xF046E)
|
||||||
|
#define PIPE4CTR (*(volatile unsigned short *)0xF0476)
|
||||||
|
#define PIPE5CTR (*(volatile unsigned short *)0xF0478)
|
||||||
|
#define PIPE6CTR (*(volatile unsigned short *)0xF047A)
|
||||||
|
#define PIPE7CTR (*(volatile unsigned short *)0xF047C)
|
||||||
|
#define PIPE4TRE (*(volatile unsigned short *)0xF049C)
|
||||||
|
#define PIPE4TRN (*(volatile unsigned short *)0xF049E)
|
||||||
|
#define PIPE5TRE (*(volatile unsigned short *)0xF04A0)
|
||||||
|
#define PIPE5TRN (*(volatile unsigned short *)0xF04A2)
|
||||||
|
#define USBBCCTRL0 (*(volatile unsigned short *)0xF04B0)
|
||||||
|
#define USBBCCTRL1 (*(volatile unsigned short *)0xF04B4)
|
||||||
|
#define USBBCOPT0 (*(volatile unsigned short *)0xF04B8)
|
||||||
|
#define USBBCOPT1 (*(volatile unsigned short *)0xF04BC)
|
||||||
|
#define USBMC (*(volatile unsigned short *)0xF04CC)
|
||||||
|
#define DEVADD0 (*(volatile unsigned short *)0xF04D0)
|
||||||
|
#define DEVADD1 (*(volatile unsigned short *)0xF04D2)
|
||||||
|
#define DEVADD2 (*(volatile unsigned short *)0xF04D4)
|
||||||
|
#define DEVADD3 (*(volatile unsigned short *)0xF04D6)
|
||||||
|
#define DEVADD4 (*(volatile unsigned short *)0xF04D8)
|
||||||
|
#define DEVADD5 (*(volatile unsigned short *)0xF04DA)
|
||||||
|
|
||||||
|
/*
|
||||||
|
Sfr bits
|
||||||
|
*/
|
||||||
|
#define ADTYP ADM2_bit.no0
|
||||||
|
#define AWC ADM2_bit.no2
|
||||||
|
#define ADRCK ADM2_bit.no3
|
||||||
|
#define DFLEN DFLCTL_bit.no0
|
||||||
|
#define BRSAM BECTL_bit.no0
|
||||||
|
#define ESQST FSSE_bit.no7
|
||||||
|
#define DIVST MDUC_bit.no0
|
||||||
|
#define MACSF MDUC_bit.no1
|
||||||
|
#define MACOF MDUC_bit.no2
|
||||||
|
#define MDSM MDUC_bit.no3
|
||||||
|
#define MACMODE MDUC_bit.no6
|
||||||
|
#define DIVMODE MDUC_bit.no7
|
||||||
|
#define TAU0EN PER0_bit.no0
|
||||||
|
#define SAU0EN PER0_bit.no2
|
||||||
|
#define IICA0EN PER0_bit.no4
|
||||||
|
#define ADCEN PER0_bit.no5
|
||||||
|
#define RTCEN PER0_bit.no7
|
||||||
|
#define PAENB RMC_bit.no0
|
||||||
|
#define WDVOL RMC_bit.no7
|
||||||
|
#define RPEF RPECTL_bit.no0
|
||||||
|
#define RPERDIS RPECTL_bit.no7
|
||||||
|
#define SPT0 IICCTL00_bit.no0
|
||||||
|
#define STT0 IICCTL00_bit.no1
|
||||||
|
#define ACKE0 IICCTL00_bit.no2
|
||||||
|
#define WTIM0 IICCTL00_bit.no3
|
||||||
|
#define SPIE0 IICCTL00_bit.no4
|
||||||
|
#define WREL0 IICCTL00_bit.no5
|
||||||
|
#define LREL0 IICCTL00_bit.no6
|
||||||
|
#define IICE0 IICCTL00_bit.no7
|
||||||
|
#define PRS0 IICCTL01_bit.no0
|
||||||
|
#define DFC0 IICCTL01_bit.no2
|
||||||
|
#define SMC0 IICCTL01_bit.no3
|
||||||
|
#define DAD0 IICCTL01_bit.no4
|
||||||
|
#define CLD0 IICCTL01_bit.no5
|
||||||
|
#define WUP0 IICCTL01_bit.no7
|
||||||
|
#define CRC0EN CRC0CTL_bit.no7
|
||||||
|
|
||||||
|
/*
|
||||||
|
Interrupt vector addresses
|
||||||
|
*/
|
||||||
|
#endif
|
441
FreeRTOS/Demo/RL78_E2Studio_GCC/src/main.c
Normal file
441
FreeRTOS/Demo/RL78_E2Studio_GCC/src/main.c
Normal file
|
@ -0,0 +1,441 @@
|
||||||
|
/*
|
||||||
|
FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.
|
||||||
|
|
||||||
|
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||||
|
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||||
|
* Complete, revised, and edited pdf reference manuals are also *
|
||||||
|
* available. *
|
||||||
|
* *
|
||||||
|
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||||
|
* ensuring you get running as quickly as possible and with an *
|
||||||
|
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||||
|
* the FreeRTOS project to continue with its mission of providing *
|
||||||
|
* professional grade, cross platform, de facto standard solutions *
|
||||||
|
* for microcontrollers - completely free of charge! *
|
||||||
|
* *
|
||||||
|
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||||
|
* *
|
||||||
|
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
This file is part of the FreeRTOS distribution.
|
||||||
|
|
||||||
|
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License (version 2) as published by the
|
||||||
|
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||||
|
|
||||||
|
>>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
|
||||||
|
distribute a combined work that includes FreeRTOS without being obliged to
|
||||||
|
provide the source code for proprietary components outside of the FreeRTOS
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details. You should have received a copy of the GNU General Public License
|
||||||
|
and the FreeRTOS license exception along with FreeRTOS; if not itcan be
|
||||||
|
viewed here: http://www.freertos.org/a00114.html and also obtained by
|
||||||
|
writing to Real Time Engineers Ltd., contact details for whom are available
|
||||||
|
on the FreeRTOS WEB site.
|
||||||
|
|
||||||
|
1 tab == 4 spaces!
|
||||||
|
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* Having a problem? Start by reading the FAQ "My application does *
|
||||||
|
* not run, what could be wrong?" *
|
||||||
|
* *
|
||||||
|
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||||
|
license and Real Time Engineers Ltd. contact details.
|
||||||
|
|
||||||
|
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||||
|
including FreeRTOS+Trace - an indispensable productivity tool, and our new
|
||||||
|
fully thread aware and reentrant UDP/IP stack.
|
||||||
|
|
||||||
|
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||||
|
Integrity Systems, who sell the code with commercial support,
|
||||||
|
indemnification and middleware, under the OpenRTOS brand.
|
||||||
|
|
||||||
|
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||||
|
engineered and independently SIL3 certified version for use in safety and
|
||||||
|
mission critical applications that require provable dependability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON
|
||||||
|
* THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO
|
||||||
|
* APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT!
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* main() creates the demo application tasks and timers, then starts the
|
||||||
|
* scheduler.
|
||||||
|
*
|
||||||
|
* This demo is configured to run on the RL78/G13 Promotion Board, which is
|
||||||
|
* fitted with a R5F100LEA microcontroller. The R5F100LEA contains a little
|
||||||
|
* under 4K bytes of usable internal RAM. The RAM size restricts the number of
|
||||||
|
* demo tasks that can be created, and the demo creates 13 tasks, 4 queues and
|
||||||
|
* two timers. The RL78 range does however include parts with up to 32K bytes
|
||||||
|
* of RAM (at the time of writing). Using FreeRTOS on such a part will allow an
|
||||||
|
* application to make a more comprehensive use of FreeRTOS tasks, and other
|
||||||
|
* FreeRTOS features.
|
||||||
|
*
|
||||||
|
* In addition to the standard demo tasks, the following tasks, tests and timers
|
||||||
|
* are created within this file:
|
||||||
|
*
|
||||||
|
* "Reg test" tasks - These fill the registers with known values, then check
|
||||||
|
* that each register still contains its expected value. Each task uses a
|
||||||
|
* different set of values. The reg test tasks execute with a very low priority,
|
||||||
|
* so get preempted very frequently. A register containing an unexpected value
|
||||||
|
* is indicative of an error in the context switching mechanism.
|
||||||
|
*
|
||||||
|
* The "Demo" Timer and Callback Function:
|
||||||
|
* The demo timer callback function does nothing more than increment a variable.
|
||||||
|
* The period of the demo timer is set relative to the period of the check timer
|
||||||
|
* (described below). This allows the check timer to know how many times the
|
||||||
|
* demo timer callback function should execute between each execution of the
|
||||||
|
* check timer callback function. The variable incremented in the demo timer
|
||||||
|
* callback function is used to determine how many times the callback function
|
||||||
|
* has executed.
|
||||||
|
*
|
||||||
|
* The "Check" Timer and Callback Function:
|
||||||
|
* The check timer period is initially set to three seconds. The check timer
|
||||||
|
* callback function checks that all the standard demo tasks, the reg test tasks,
|
||||||
|
* and the demo timer are not only still executing, but are executing without
|
||||||
|
* reporting any errors. If the check timer discovers that a task or timer has
|
||||||
|
* stalled, or reported an error, then it changes its own period from the
|
||||||
|
* initial three seconds, to just 200ms. The check timer callback function also
|
||||||
|
* toggles the user LED each time it is called. This provides a visual
|
||||||
|
* indication of the system status: If the LED toggles every three seconds,
|
||||||
|
* then no issues have been discovered. If the LED toggles every 200ms, then an
|
||||||
|
* issue has been discovered with at least one task.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Scheduler include files. */
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
#include "timers.h"
|
||||||
|
|
||||||
|
/* Standard demo includes. */
|
||||||
|
#include "dynamic.h"
|
||||||
|
#include "PollQ.h"
|
||||||
|
#include "blocktim.h"
|
||||||
|
|
||||||
|
/* Hardware includes. */
|
||||||
|
#include "port_iodefine.h"
|
||||||
|
|
||||||
|
/* The period at which the check timer will expire, in ms, provided no errors
|
||||||
|
have been reported by any of the standard demo tasks. ms are converted to the
|
||||||
|
equivalent in ticks using the portTICK_RATE_MS constant. */
|
||||||
|
#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_RATE_MS )
|
||||||
|
|
||||||
|
/* The period at which the check timer will expire, in ms, if an error has been
|
||||||
|
reported in one of the standard demo tasks, the check tasks, or the demo timer.
|
||||||
|
ms are converted to the equivalent in ticks using the portTICK_RATE_MS
|
||||||
|
constant. */
|
||||||
|
#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_RATE_MS )
|
||||||
|
|
||||||
|
/* These two definitions are used to set the period of the demo timer. The demo
|
||||||
|
timer period is always relative to the check timer period, so the check timer
|
||||||
|
can determine if the demo timer has expired the expected number of times between
|
||||||
|
its own executions. */
|
||||||
|
#define mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT ( 100UL )
|
||||||
|
#define mainDEMO_TIMER_PERIOD_MS ( mainCHECK_TIMER_PERIOD_MS / mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT )
|
||||||
|
|
||||||
|
/* The LED toggled by the check timer. */
|
||||||
|
#define mainLED_0 P1_bit.no0
|
||||||
|
|
||||||
|
/* A block time of zero simple means "don't block". */
|
||||||
|
#define mainDONT_BLOCK ( 0U )
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The 'check' timer callback function, as described at the top of this file.
|
||||||
|
*/
|
||||||
|
static void prvCheckTimerCallback( xTimerHandle xTimer );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The 'demo' timer callback function, as described at the top of this file.
|
||||||
|
*/
|
||||||
|
static void prvDemoTimerCallback( xTimerHandle xTimer );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function is called from the C startup routine to setup the processor -
|
||||||
|
* in particular the clock source.
|
||||||
|
*/
|
||||||
|
int __low_level_init(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions that define the RegTest tasks, as described at the top of this file.
|
||||||
|
*/
|
||||||
|
extern void vRegTest1( void *pvParameters );
|
||||||
|
extern void vRegTest2( void *pvParameters );
|
||||||
|
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Variables that are incremented on each cycle of the two reg tests to allow
|
||||||
|
the check timer to know that they are still executing. */
|
||||||
|
unsigned short usRegTest1LoopCounter = 0, usRegTest2LoopCounter;
|
||||||
|
|
||||||
|
/* The check timer. This uses prvCheckTimerCallback() as its callback
|
||||||
|
function. */
|
||||||
|
static xTimerHandle xCheckTimer = NULL;
|
||||||
|
|
||||||
|
/* The demo timer. This uses prvDemoTimerCallback() as its callback function. */
|
||||||
|
static xTimerHandle xDemoTimer = NULL;
|
||||||
|
|
||||||
|
/* This variable is incremented each time the demo timer expires. */
|
||||||
|
static volatile unsigned long ulDemoSoftwareTimerCounter = 0UL;
|
||||||
|
|
||||||
|
/* RL78/G13 Option Byte Definition. Watchdog disabled, LVI enabled, OCD interface
|
||||||
|
enabled. */
|
||||||
|
#if 0
|
||||||
|
__root __far const unsigned char OptionByte[] @ 0x00C0 =
|
||||||
|
{
|
||||||
|
0x00U, 0xFFU, 0xF8U, 0x81U
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Security byte definition */
|
||||||
|
__root __far const unsigned char ucSecurityCode[] @ 0x00C4 =
|
||||||
|
{
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
short main( void )
|
||||||
|
{
|
||||||
|
/* Creates all the tasks and timers, then starts the scheduler. */
|
||||||
|
|
||||||
|
/* First create the 'standard demo' tasks. These are used to demonstrate
|
||||||
|
API functions being used and also to test the kernel port. More information
|
||||||
|
is provided on the FreeRTOS.org WEB site. */
|
||||||
|
vStartDynamicPriorityTasks();
|
||||||
|
vStartPolledQueueTasks( tskIDLE_PRIORITY );
|
||||||
|
vCreateBlockTimeTasks();
|
||||||
|
|
||||||
|
/* Create the RegTest tasks as described at the top of this file. */
|
||||||
|
// xTaskCreate( vRegTest1, "Reg1", configMINIMAL_STACK_SIZE, NULL, 0, NULL );
|
||||||
|
// xTaskCreate( vRegTest2, "Reg2", configMINIMAL_STACK_SIZE, NULL, 0, NULL );
|
||||||
|
|
||||||
|
/* Create the software timer that performs the 'check' functionality,
|
||||||
|
as described at the top of this file. */
|
||||||
|
xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */
|
||||||
|
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
|
||||||
|
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
||||||
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
|
prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Create the software timer that just increments a variable for demo
|
||||||
|
purposes. */
|
||||||
|
xDemoTimer = xTimerCreate( ( const signed char * ) "DemoTimer",/* A text name, purely to help debugging. */
|
||||||
|
( mainDEMO_TIMER_PERIOD_MS ), /* The timer period, in this case it is always calculated relative to the check timer period (see the definition of mainDEMO_TIMER_PERIOD_MS). */
|
||||||
|
pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
|
||||||
|
( void * ) 0, /* The ID is not used, so can be set to anything. */
|
||||||
|
prvDemoTimerCallback /* The callback function that inspects the status of all the other tasks. */
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Start both the check timer and the demo timer. The timers won't actually
|
||||||
|
start until the scheduler is started. */
|
||||||
|
xTimerStart( xCheckTimer, mainDONT_BLOCK );
|
||||||
|
xTimerStart( xDemoTimer, mainDONT_BLOCK );
|
||||||
|
|
||||||
|
/* Finally start the scheduler running. */
|
||||||
|
vTaskStartScheduler();
|
||||||
|
|
||||||
|
/* If this line is reached then vTaskStartScheduler() returned because there
|
||||||
|
was insufficient heap memory remaining for the idle task to be created. */
|
||||||
|
for( ;; );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvDemoTimerCallback( xTimerHandle xTimer )
|
||||||
|
{
|
||||||
|
/* The demo timer has expired. All it does is increment a variable. The
|
||||||
|
period of the demo timer is relative to that of the check timer, so the
|
||||||
|
check timer knows how many times this variable should have been incremented
|
||||||
|
between each execution of the check timer's own callback. */
|
||||||
|
ulDemoSoftwareTimerCounter++;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void prvCheckTimerCallback( xTimerHandle xTimer )
|
||||||
|
{
|
||||||
|
static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS;
|
||||||
|
static unsigned short usLastRegTest1Counter = 0, usLastRegTest2Counter = 0;
|
||||||
|
|
||||||
|
/* Inspect the status of the standard demo tasks. */
|
||||||
|
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
xErrorStatus = pdFAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xArePollingQueuesStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
xErrorStatus = pdFAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
|
||||||
|
{
|
||||||
|
xErrorStatus = pdFAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Indicate an error if either of the reg test loop counters have not
|
||||||
|
incremented since the last time this function was called. */
|
||||||
|
if( usLastRegTest1Counter == usRegTest1LoopCounter )
|
||||||
|
{
|
||||||
|
xErrorStatus = pdFAIL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
usLastRegTest1Counter = usRegTest1LoopCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( usLastRegTest2Counter == usRegTest2LoopCounter )
|
||||||
|
{
|
||||||
|
xErrorStatus = pdFAIL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
usLastRegTest2Counter = usRegTest2LoopCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ensure that the demo software timer has expired
|
||||||
|
mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT times in between
|
||||||
|
each call of this function. A critical section is not required to access
|
||||||
|
ulDemoSoftwareTimerCounter as the variable is only accessed from another
|
||||||
|
software timer callback, and only one software timer callback can be
|
||||||
|
executing at any time. */
|
||||||
|
if( ( ulDemoSoftwareTimerCounter < ( mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT - 1 ) ) ||
|
||||||
|
( ulDemoSoftwareTimerCounter > ( mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT + 1 ) )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
xErrorStatus = pdFAIL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ulDemoSoftwareTimerCounter = 0UL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( xErrorStatus == pdFAIL ) && ( xChangedTimerPeriodAlready == pdFALSE ) )
|
||||||
|
{
|
||||||
|
/* An error has occurred, but the timer's period has not yet been changed,
|
||||||
|
change it now, and remember that it has been changed. Shortening the
|
||||||
|
timer's period means the LED will toggle at a faster rate, giving a
|
||||||
|
visible indication that something has gone wrong. */
|
||||||
|
xChangedTimerPeriodAlready = pdTRUE;
|
||||||
|
|
||||||
|
/* This call to xTimerChangePeriod() uses a zero block time. Functions
|
||||||
|
called from inside of a timer callback function must *never* attempt to
|
||||||
|
block. */
|
||||||
|
xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Toggle the LED. The toggle rate will depend on whether or not an error
|
||||||
|
has been found in any tasks. */
|
||||||
|
mainLED_0 = !mainLED_0;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
int __low_level_init(void)
|
||||||
|
{
|
||||||
|
unsigned portCHAR ucResetFlag = RESF;
|
||||||
|
|
||||||
|
portDISABLE_INTERRUPTS();
|
||||||
|
|
||||||
|
/* Set fMX */
|
||||||
|
CMC = 0x00;
|
||||||
|
MSTOP = 1U;
|
||||||
|
|
||||||
|
/* Set fMAIN */
|
||||||
|
MCM0 = 0U;
|
||||||
|
|
||||||
|
/* Set fSUB */
|
||||||
|
XTSTOP = 1U;
|
||||||
|
OSMC = 0x10;
|
||||||
|
|
||||||
|
/* Set fCLK */
|
||||||
|
CSS = 0U;
|
||||||
|
|
||||||
|
/* Set fIH */
|
||||||
|
HIOSTOP = 0U;
|
||||||
|
|
||||||
|
/* LED port initialization - set port register. */
|
||||||
|
// P7 &= 0x7F;
|
||||||
|
P1 &= 0xFE;
|
||||||
|
|
||||||
|
/* Set port mode register. */
|
||||||
|
// PM7 &= 0x7F;
|
||||||
|
PM1 &= 0xFE;
|
||||||
|
|
||||||
|
/* Switch pin initialization - enable pull-up resistor. */
|
||||||
|
// PU12_bit.no0 = 1;
|
||||||
|
|
||||||
|
return pdTRUE;
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vRegTestError( void )
|
||||||
|
{
|
||||||
|
/* Called by both reg test tasks if an error is found. There is no way out
|
||||||
|
of this function so the loop counter of the calling task will stop
|
||||||
|
incrementing, which will result in the check timer signialling an error. */
|
||||||
|
for( ;; );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vApplicationMallocFailedHook( void )
|
||||||
|
{
|
||||||
|
/* Called if a call to pvPortMalloc() fails because there is insufficient
|
||||||
|
free memory available in the FreeRTOS heap. pvPortMalloc() is called
|
||||||
|
internally by FreeRTOS API functions that create tasks, queues, software
|
||||||
|
timers, and semaphores. The size of the FreeRTOS heap is set by the
|
||||||
|
configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
|
||||||
|
taskDISABLE_INTERRUPTS();
|
||||||
|
for( ;; );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )
|
||||||
|
{
|
||||||
|
( void ) pcTaskName;
|
||||||
|
( void ) pxTask;
|
||||||
|
|
||||||
|
/* Run time stack overflow checking is performed if
|
||||||
|
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
||||||
|
function is called if a stack overflow is detected. */
|
||||||
|
taskDISABLE_INTERRUPTS();
|
||||||
|
for( ;; );
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vApplicationIdleHook( void )
|
||||||
|
{
|
||||||
|
volatile size_t xFreeHeapSpace;
|
||||||
|
|
||||||
|
/* This is just a trivial example of an idle hook. It is called on each
|
||||||
|
cycle of the idle task. It must *NOT* attempt to block. In this case the
|
||||||
|
idle task just queries the amount of FreeRTOS heap that remains. See the
|
||||||
|
memory management section on the http://www.FreeRTOS.org web site for memory
|
||||||
|
management options. If there is a lot of heap memory free then the
|
||||||
|
configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h can be reduced to free up
|
||||||
|
RAM. */
|
||||||
|
xFreeHeapSpace = xPortGetFreeHeapSize();
|
||||||
|
}
|
||||||
|
|
121
FreeRTOS/Demo/RL78_E2Studio_GCC/src/reset_program.asm
Normal file
121
FreeRTOS/Demo/RL78_E2Studio_GCC/src/reset_program.asm
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PROJECT NAME : RTOSDemo */
|
||||||
|
/* FILE : reset_program.asm */
|
||||||
|
/* DESCRIPTION : Reset Program */
|
||||||
|
/* CPU SERIES : RL78 - G1C */
|
||||||
|
/* CPU TYPE : R5F10JBC */
|
||||||
|
/* */
|
||||||
|
/* This file is generated by e2studio. */
|
||||||
|
/* */
|
||||||
|
/***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*reset_program.asm*/
|
||||||
|
|
||||||
|
.list
|
||||||
|
|
||||||
|
.global _PowerON_Reset /*! global Start routine */
|
||||||
|
.short _PowerON_Reset
|
||||||
|
|
||||||
|
#ifdef CPPAPP
|
||||||
|
___dso_handle:
|
||||||
|
.global ___dso_handle
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
.extern _HardwareSetup /*! external Sub-routine to initialise Hardware*/
|
||||||
|
.extern _data
|
||||||
|
.extern _mdata
|
||||||
|
.extern _ebss
|
||||||
|
.extern _bss
|
||||||
|
|
||||||
|
.extern _edata
|
||||||
|
.extern _main
|
||||||
|
.extern _stack
|
||||||
|
.extern _exit
|
||||||
|
|
||||||
|
/* ;; HL = start of list
|
||||||
|
;; DE = end of list
|
||||||
|
;; BC = step direction (+2 or -2)
|
||||||
|
*/
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
/* call to _PowerON_Reset */
|
||||||
|
_PowerON_Reset:
|
||||||
|
/* initialise user stack pointer */
|
||||||
|
movw sp,#_stack /* Set stack pointer */
|
||||||
|
|
||||||
|
|
||||||
|
/* load data section from ROM to RAM */
|
||||||
|
;; block move to initialize .data
|
||||||
|
|
||||||
|
;; we're copying from 00:[_romdatastart] to 0F:[_datastart]
|
||||||
|
;; and our data is not in the mirrored area.
|
||||||
|
mov es, #0
|
||||||
|
sel rb0 /* ;;bank 0 */
|
||||||
|
movw de, #_mdata /* src ROM address of data section in de */
|
||||||
|
movw hl, #_data /* dest start RAM address of data section in hl */
|
||||||
|
|
||||||
|
sel rb1 /* bank 1 */
|
||||||
|
movw hl, #_data /* dest start RAM address of data section in hl */
|
||||||
|
movw ax, #_edata /* ;; size of romdata section in ax */
|
||||||
|
subw ax,hl /* store data size */
|
||||||
|
shrw ax,1
|
||||||
|
1:
|
||||||
|
cmpw ax, #0 /* check if end of data */
|
||||||
|
bz $1f
|
||||||
|
decw ax
|
||||||
|
sel rb0 /* bank 0 */
|
||||||
|
movw ax, es:[de]
|
||||||
|
movw [hl], ax
|
||||||
|
incw de
|
||||||
|
incw de
|
||||||
|
incw hl
|
||||||
|
incw hl
|
||||||
|
sel rb1 /* bank 1 - compare and decrement*/
|
||||||
|
br $1b
|
||||||
|
1:
|
||||||
|
|
||||||
|
|
||||||
|
/* bss initialisation : zero out bss */
|
||||||
|
sel rb0 /* bank 0 */
|
||||||
|
movw hl, #_bss /* store the start address of bss in hl */
|
||||||
|
movw ax, #0 /* load AX reg with zero */
|
||||||
|
sel rb1 /* bank 1 */
|
||||||
|
movw ax, #_ebss /* store the end address (size of) bss section in ax */
|
||||||
|
subw ax,hl ;; store data size
|
||||||
|
shrw ax,1
|
||||||
|
1:
|
||||||
|
cmpw ax, #0
|
||||||
|
bz $1f
|
||||||
|
decw ax
|
||||||
|
sel rb0 /* bank 0 */
|
||||||
|
movw [hl], ax
|
||||||
|
incw hl
|
||||||
|
incw hl
|
||||||
|
sel rb1
|
||||||
|
br $1b
|
||||||
|
1:
|
||||||
|
sel rb0 /* bank 0 */
|
||||||
|
|
||||||
|
/* call the hardware initialiser */
|
||||||
|
call !!_HardwareSetup
|
||||||
|
nop
|
||||||
|
|
||||||
|
/* start user program */
|
||||||
|
|
||||||
|
movw ax, #0
|
||||||
|
push ax /* envp */
|
||||||
|
push ax /* argv */
|
||||||
|
push ax /* argc */
|
||||||
|
call !!_main
|
||||||
|
|
||||||
|
|
||||||
|
/* call to exit*/
|
||||||
|
_exit:
|
||||||
|
br $_exit
|
||||||
|
|
||||||
|
.end
|
24
FreeRTOS/Demo/RL78_E2Studio_GCC/src/typedefine.h
Normal file
24
FreeRTOS/Demo/RL78_E2Studio_GCC/src/typedefine.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PROJECT NAME : RTOSDemo */
|
||||||
|
/* FILE : typedefine.h */
|
||||||
|
/* DESCRIPTION : Aliases of Integer Type */
|
||||||
|
/* CPU SERIES : RL78 - G1C */
|
||||||
|
/* CPU TYPE : R5F10JBC */
|
||||||
|
/* */
|
||||||
|
/* This file is generated by e2studio. */
|
||||||
|
/* */
|
||||||
|
/***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef signed char _SBYTE;
|
||||||
|
typedef unsigned char _UBYTE;
|
||||||
|
typedef signed short _SWORD;
|
||||||
|
typedef unsigned short _UWORD;
|
||||||
|
typedef signed int _SINT;
|
||||||
|
typedef unsigned int _UINT;
|
||||||
|
typedef signed long _SDWORD;
|
||||||
|
typedef unsigned long _UDWORD;
|
||||||
|
typedef signed long long _SQWORD;
|
||||||
|
typedef unsigned long long _UQWORD;
|
158
FreeRTOS/Demo/RL78_E2Studio_GCC/src/vector_table.c
Normal file
158
FreeRTOS/Demo/RL78_E2Studio_GCC/src/vector_table.c
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PROJECT NAME : RTOSDemo */
|
||||||
|
/* FILE : vector_table.c */
|
||||||
|
/* DESCRIPTION : Vector Table */
|
||||||
|
/* CPU SERIES : RL78 - G1C */
|
||||||
|
/* CPU TYPE : R5F10JBC */
|
||||||
|
/* */
|
||||||
|
/* This file is generated by e2studio. */
|
||||||
|
/* */
|
||||||
|
/***********************************************************************/
|
||||||
|
|
||||||
|
#include "interrupt_handlers.h"
|
||||||
|
|
||||||
|
extern void PowerON_Reset (void);
|
||||||
|
|
||||||
|
const unsigned char Option_Bytes[] __attribute__ ((section (".option_bytes"))) = {
|
||||||
|
0xef, 0xff, 0xe8, 0x85
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned char Security_Id[] __attribute__ ((section (".security_id"))) = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
#define VEC __attribute__ ((section (".vec")))
|
||||||
|
const void *HardwareVectors[] VEC = {
|
||||||
|
// Address 0x0
|
||||||
|
PowerON_Reset,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define VECT_SECT __attribute__ ((section (".vects")))
|
||||||
|
const void *Vectors[] VECT_SECT = {
|
||||||
|
//INT_SRO/INT_WDTI (0x4)
|
||||||
|
INT_WDTI,
|
||||||
|
//INT_LVI (0x6)
|
||||||
|
INT_LVI,
|
||||||
|
//INT_P0 (0x8)
|
||||||
|
INT_P0,
|
||||||
|
//INT_P1 (0xA)
|
||||||
|
INT_P1,
|
||||||
|
//INT_P2 (0xC)
|
||||||
|
INT_P2,
|
||||||
|
//INT_P3 (0xE)
|
||||||
|
INT_P3,
|
||||||
|
//INT_P4 (0x10)
|
||||||
|
INT_P4,
|
||||||
|
//INT_P5 (0x12)
|
||||||
|
INT_P5,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
//INT_DMA0 (0x1A)
|
||||||
|
INT_DMA0,
|
||||||
|
//INT_DMA1 (0x1C)
|
||||||
|
INT_DMA1,
|
||||||
|
//INT_CSI00/INT_IIC00/INT_ST0 (0x1E)
|
||||||
|
INT_ST0,
|
||||||
|
//INT_TM00 (0x20)
|
||||||
|
INT_TM00,
|
||||||
|
//INT_CSI01/INT_IIC01/INT_SR0 (0x22)
|
||||||
|
INT_SR0,
|
||||||
|
//INT_SRE0/INT_TM01H (0x24)
|
||||||
|
INT_TM01H,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
//INT_TM03H (0x2A)
|
||||||
|
INT_TM03H,
|
||||||
|
//INT_IICA0 (0x2C)
|
||||||
|
INT_IICA0,
|
||||||
|
//INT_TM01 (0x2E)
|
||||||
|
INT_TM01,
|
||||||
|
//INT_TM02 (0x30)
|
||||||
|
INT_TM02,
|
||||||
|
//INT_TM03 (0x32)
|
||||||
|
INT_TM03,
|
||||||
|
//INT_AD (0x34)
|
||||||
|
INT_AD,
|
||||||
|
//INT_RTC (0x36)
|
||||||
|
INT_RTC,
|
||||||
|
//INT_IT (0x38)
|
||||||
|
INT_IT,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
//INT_USB (0x3C)
|
||||||
|
INT_USB,
|
||||||
|
//INT_RSUM (0x3E)
|
||||||
|
INT_RSUM,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
//INT_P8 (0x4E)
|
||||||
|
INT_P8,
|
||||||
|
//INT_P9 (0x50)
|
||||||
|
INT_P9,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
//INT_MD (0x5E)
|
||||||
|
INT_MD,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
//INT_FL (0x62)
|
||||||
|
INT_FL,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
// Padding
|
||||||
|
(void*)0xFFFF,
|
||||||
|
//INT_BRK_I (0x7E)
|
||||||
|
INT_BRK_I,
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue