Moved remotely

git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@113 9fe90eed-be63-e94b-8204-d34ff4c2ff93
This commit is contained in:
Matthias
2009-01-12 08:38:14 +00:00
parent 4e45654a5f
commit 6cc948eef8
204 changed files with 0 additions and 0 deletions
@@ -0,0 +1,547 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject>
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939">
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="a" artifactName="MmcFilesystem" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" description="" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939" name="Debug" parent="org.eclipse.cdt.build.core.prefbase.cfg" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cygwin.base.633642026" name="Cygwin GCC" superClass="cdt.managedbuild.toolchain.gnu.cygwin.base" unusedChildren="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin.base;cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.Cygwin_PE" id="cdt.managedbuild.target.gnu.platform.cygwin.base.2110914823" name="Debug Platform" osList="win32" superClass="cdt.managedbuild.target.gnu.platform.cygwin.base"/>
<builder buildPath="${workspace_loc:/Drivers/Debug}" id="cdt.managedbuild.target.gnu.builder.cygwin.base.607554776" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.cygwin.base"/>
<tool command="arm-elf-ar" id="cdt.managedbuild.tool.gnu.archiver.cygwin.base.357143976" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.cygwin.base">
<option id="gnu.both.lib.option.flags.1185130714" name="Archiver flags" superClass="gnu.both.lib.option.flags" value="-r" valueType="string"/>
</tool>
<tool command="arm-elf-gcc" id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base">
<option id="gnu.c.compiler.option.include.paths.1137340833" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/FreeRTOS/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/Drivers}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/inc}&quot;"/>
</option>
<option id="gnu.c.compiler.option.misc.other.1949135949" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -fshort-enums -mthumb-interwork" valueType="string"/>
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1085516223" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
<listOptionValue builtIn="false" value="ROWLEY_LPC23xx"/>
<listOptionValue builtIn="false" value="LPC23xx"/>
<listOptionValue builtIn="false" value="LPC2378_PORTB"/>
<listOptionValue builtIn="false" value="PACK_STRUCT_END=__attribute\(\(packed\)\)"/>
<listOptionValue builtIn="false" value="ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\)"/>
</option>
<option id="gnu.c.compiler.option.optimization.level.1752774671" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" value="gnu.c.optimization.level.more" valueType="enumerated"/>
<option id="gnu.c.compiler.option.misc.verbose.462009253" name="Verbose (-v)" superClass="gnu.c.compiler.option.misc.verbose" value="false" valueType="boolean"/>
<option id="gnu.c.compiler.option.misc.ansi.2137510527" name="Support ANSI programs (-ansi)" superClass="gnu.c.compiler.option.misc.ansi" value="false" valueType="boolean"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.604520423" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool command="arm-elf-as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.cygwin.base.406320894" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.cygwin.base">
<option id="gnu.both.asm.option.flags.1225377542" name="Assembler flags" superClass="gnu.both.asm.option.flags" value="-mcpu=arm7tdmi " valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1377488642" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.cygwin.base.1772915699" name="Cygwin C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.cygwin.base"/>
</toolChain>
</folderInfo>
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.1726487795" name="uart2ISR.c" rcbsApplicability="disable" resourcePath="uart2ISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.807212826">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.807212826" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
<option id="gnu.c.compiler.option.misc.other.1483219050" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.538962034" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1247135253" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1636187940" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.2037878102" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.542584516" name="ssp0ISR.h" rcbsApplicability="disable" resourcePath="ssp0ISR.h" toolsToInvoke="">
<tool announcement="Invoking: Resource Custom Build Step" command="" customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1012553571" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.220483950" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1469071974" name="Resource Custom Build Step Output Type" outputNames=""/>
</tool>
</fileInfo>
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.1910095641" name="uartISR.c" rcbsApplicability="disable" resourcePath="uartISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.1416994682">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.1416994682" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
<option id="gnu.c.compiler.option.misc.other.1446657461" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.140142352" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1456382687" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.477895768" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1335295582" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.71673656" name="uart3ISR.c" rcbsApplicability="disable" resourcePath="uart3ISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.362131041">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.362131041" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
<option id="gnu.c.compiler.option.misc.other.225622065" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.401063069" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.413027139" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1803766596" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1065873980" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.291818688" name="armVIC.h" rcbsApplicability="disable" resourcePath="armVIC.h" toolsToInvoke=""/>
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.1708887602" name="InternalFlash.c" rcbsApplicability="disable" resourcePath="InternalFlash.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.932504930">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.932504930" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
<option id="gnu.c.compiler.option.misc.other.558003532" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork -Wa,-adhlns=InternalFlash.lst" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1690946070" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool announcement="Invoking: Resource Custom Build Step" command="" customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.961589329" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1906296082" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1575197997" name="Resource Custom Build Step Output Type" outputNames=""/>
</tool>
</fileInfo>
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.498448602" name="ssp1ISR.c" rcbsApplicability="disable" resourcePath="ssp1ISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.2078712431">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.2078712431" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
<option id="gnu.c.compiler.option.misc.other.1436529494" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.2052416051" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1278877933" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.2116630855" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1780833023" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.1994651202" name="ssp0ISR.c" rcbsApplicability="disable" resourcePath="ssp0ISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.913112132">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.913112132" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
<option id="gnu.c.compiler.option.misc.other.494774626" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1950626595" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1012067148" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1191788519" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.904965216" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.295586484" name="dioISR.c" rcbsApplicability="disable" resourcePath="dioISR.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.1556128745">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.1556128745" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
<option id="gnu.c.compiler.option.misc.other.525661100" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.1249324241" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1640417589" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1006727924" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1533768805" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<fileInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.22360852" name="armVIC.c" rcbsApplicability="disable" resourcePath="armVIC.c" toolsToInvoke="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.591611026">
<tool id="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668.591611026" name="Cygwin C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668">
<option id="gnu.c.compiler.option.misc.other.828490660" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -fomit-frame-pointer -mcpu=arm7tdmi -mthumb-interwork" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.823549379" superClass="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"/>
</tool>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.1351627299" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.1687122584" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency" paths=""/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.113518925" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<sourceEntries>
<entry excluding="spi0.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings>
<externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/Drivers"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/Drivers/Debug"/>
</externalSetting>
</externalSettings>
<extensions>
<extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
<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"/>
</extensions>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<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="-f ${project_name}_scd.mk" command="make" 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="-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.GCCWinManagedMakePerProjectProfileCPP">
<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.GCCWinManagedMakePerProjectProfileC">
<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>
<scannerConfigBuildInfo instanceId="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939;preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.604520423">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
<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="-f ${project_name}_scd.mk" command="make" 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="-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.GCCWinManagedMakePerProjectProfileCPP">
<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.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="arm-elf-gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
<cconfiguration id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1129081297">
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="" artifactName="Drivers" buildProperties="" description="" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1129081297" name="Release" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1129081297." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1880939016" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.eclipse.cdt.build.core.prefbase.toolchain.1880939016.902038749" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.251371665" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.3457715" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1309685191" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1220779287" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1638995662" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1684595952" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.275834681" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1651791339" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="spi0.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1129081297" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.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="org.eclipse.cdt.core.externalSettings"/>
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
<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="-f ${project_name}_scd.mk" command="make" 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="-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.GCCWinManagedMakePerProjectProfileCPP">
<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.GCCWinManagedMakePerProjectProfileC">
<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>
<scannerConfigBuildInfo instanceId="preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939;preference.org.eclipse.cdt.managedbuilder.core.configurationDataProvider.1098510086.1154456939.;cdt.managedbuild.tool.gnu.c.compiler.cygwin.base.835204668;cdt.managedbuild.tool.gnu.c.compiler.input.cygwin.604520423">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
<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="-f ${project_name}_scd.mk" command="make" 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="-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.GCCWinManagedMakePerProjectProfileCPP">
<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.GCCWinManagedMakePerProjectProfileC">
<buildOutputProvider>
<openAction enabled="true" filePath=""/>
<parser enabled="true"/>
</buildOutputProvider>
<scannerInfoProvider id="specsFile">
<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="arm-elf-gcc" useDefault="true"/>
<parser enabled="true"/>
</scannerInfoProvider>
</profile>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="Drivers.null.1361814750" name="Drivers"/>
</storageModule>
</cproject>
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MmcFilesystem</name>
<comment></comment>
<projects>
<project>MmcFilesystem</project>
<project>inc</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/Drivers/Debug}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</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.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,192 @@
/* ---------------------------------------------------------------------------
* diskio.c (C)ChaN, 2007
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* This is a stub disk I/O module that acts as front end of the existing
* disk I/O modules and attach it to FatFs module with common interface.
*
* ---------------------------------------------------------------------------
* Version(s): 0.2, Aug 11, 2008, MMi
* Edited to fit into LAN_2636 Project
* Change disk_write and disk_read functions to work with MMC
* disable multible drive support
*
* 0.1, 2007 ChanN
* Creation
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
#include "LPC23xx.h"
#include "types.h"
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "fat_diskio.h"
#include "rtc.h"
#include "mmc.h"
#include "mmc_transfer.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
#define ATA 0
#define MMC 1
#define USB 2
#define PAGESIZE 512 /* Pagesize of Card in Byte */
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
DSTATUS disk_initialize(UINT8 drive)
{
DSTATUS stat = 0;
/* Multidevice support disabled, always return "Operation suceeded" */
switch (drive)
{
case ATA:
return (stat);
case MMC:
return (stat);
case USB:
return (stat);
default:
return (stat);
}
return STA_NOINIT;
}
DSTATUS disk_status(UINT8 drive)
{
DSTATUS stat = 0;
/* Multidevice support disabled, always return "Operation suceeded" */
switch (drive)
{
case ATA:
return (stat);
case MMC:
return (stat);
case USB:
return (stat);
default:
return (stat);
}
return STA_NOINIT;
}
DRESULT disk_ioctl(UINT8 drive, UINT8 ctrl, void *buffer)
{
DRESULT res = 0;
/* Multidevice support disabled, always return "Operation suceeded" */
switch (drive)
{
case ATA:
return (res);
case MMC:
return (res);
case USB:
return (res);
default:
return (res);
}
return RES_PARERR;
}
DRESULT disk_read(UINT8 drive, pUINT8 buffer, UINT32 sector, UINT8 count)
{
UINT32 readResult = 1;
MmcState_t cardResult; /* returned from the card reading */
/* Read MMC/SD card on the desired sector for desired length
* The multiplications are necessary because the File Systems counts in
* sectors whereas the original MMC/SD driver requires the adress offset
*/
cardResult = CardRead(buffer, (sector * PAGESIZE), (count * PAGESIZE));
/* Switch corresponding to the read result */
switch (cardResult)
{
case MmcOk:
/* Enter here, the reading worked without problems */
readResult = 0;
break;
default:
/* enter here, there were some problems while reading */
readResult = 1;
break;
}
return (readResult);
}
#if _READONLY == 0 /* defined in diskio.h */
DRESULT disk_write(UINT8 drive, pUINT8 buffer, UINT32 sector, UINT8 count)
{
UINT32 writeResult = 1;
MmcState_t cardResult;
/* Read MMC/SD card on the desired sector for desired length
* The multiplications are necessary because the File Systems counts in
* sectors whereas the original MMC/SD driver requires the adress offset
*/
cardResult = CardWrite(buffer, (sector * PAGESIZE), (count * PAGESIZE));
/* Switch corresponding to the read result */
switch (cardResult)
{
case MmcOk:
/* Enter here, the writing worked without problems */
writeResult = 0;
break;
default:
/* enter here, there were some problems while writing */
writeResult = 1;
break;
}
return (writeResult);
}
#endif /* _READONLY */
@@ -0,0 +1,172 @@
/* ---------------------------------------------------------------------------
* diskio.h (C)ChaN, 2007
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description: Low level disk interface modlue include file R0.06
* ---------------------------------------------------------------------------
* Version(s): 0.2, Aug 11, 2008, MMi
* Edited to fit into LAN_2636 Project
* Change disk_write and disk_read functions to work with MMC
*
* 0.1, 2007 ChanN
* Creation
* ---------------------------------------------------------------------------
*/
#ifndef DISKIO_H_
#define DISKIO_H_
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
#include "LPC23xx.h"
#include "types.h"
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
#define _READONLY 0 /* 1: Read-only mode */
#define _USE_IOCTL 1
/* Disk Status Bits (DSTATUS) */
#define STA_NOINIT 0x01 /* Drive not initialized */
#define STA_NODISK 0x02 /* No medium in the drive */
#define STA_PROTECT 0x04 /* Write protected */
/* Generic command */
#define CTRL_SYNC 0 /* Mandatory for read/write */
#define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */
#define GET_SECTOR_SIZE 2
#define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */
#define CTRL_POWER 4
#define CTRL_LOCK 5
#define CTRL_EJECT 6
/* MMC/SDC command */
#define MMC_GET_TYPE 10
#define MMC_GET_CSD 11
#define MMC_GET_CID 12
#define MMC_GET_OCR 13
#define MMC_GET_SDSTAT 14
/* ATA/CF command */
#define ATA_GET_REV 20
#define ATA_GET_MODEL 21
#define ATA_GET_SN 22
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* Status of Disk Functions */
typedef UINT8 DSTATUS;
/* Results of Disk Functions */
typedef enum
{
RES_OK = 0, /* 0: Successful */
RES_ERROR, /* 1: R/W Error */
RES_WRPRT, /* 2: Write Protected */
RES_NOTRDY, /* 3: Not Ready */
RES_PARERR /* 4: Invalid Parameter */
} DRESULT;
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function: disk_initialize
*
* Function to call initialisations for different devices. This function is
* needed by the filesystem but is deactivated because for this project, no
* multible devices are used. Function always returns "Operation suceeded"
*
* Parameters: UINT8 drive - Device number
*
* Return : DSTATUS - Initialisation status of desired device
* ---------------------------------------------------------------------------
*/
DSTATUS disk_initialize(UINT8 drive);
/* ---------------------------------------------------------------------------
* Function: disk_status
*
* Function to call status calls for different devices. This function is
* needed by the filesystem but is deactivated because for this project, no
* multible devices are used. Function always returns "Operation suceeded"
*
* Parameters: UINT8 drive - Device number
*
* Return : DSTATUS - Status of desired device
* ---------------------------------------------------------------------------
*/
DSTATUS disk_status(UINT8 drive);
/* ---------------------------------------------------------------------------
* Function: disk_ioctrl
*
* Function to call controllings for different devices. This function is
* needed by the filesystem but is deactivated because for this project, no
* multible devices are used. Function always returns "Operation suceeded"
*
* Parameters: UINT8 drive - Device number
* UINT8 ctrl - A certain command
* void *buff - A function pointer
*
* Return : DRESULT - Initialisation status of desired device
* ---------------------------------------------------------------------------
*/
DRESULT disk_ioctl(UINT8 drive, UINT8 ctrl, void *buff);
/* ---------------------------------------------------------------------------
* Function: disk_read
*
* Function to read from the memory card.
*
* Parameters: UINT8 drive - Device number
* pUINT8 buffer - Pointer to position to storage read data
* UINT32 sector - Sector an that reading should be started
* UINT8 count - Number of following sectors to read
*
* Return : DSTATUS - Initialisation status of desired device
* ---------------------------------------------------------------------------
*/
DRESULT disk_read(UINT8 drive, pUINT8 buffer, UINT32 sector, UINT8 count);
/* ---------------------------------------------------------------------------
* Function: disk_write
*
* Function to write to the memory card.
*
* Parameters: UINT8 drive - Device number
* pUINT8 buffer - Pointer to position where data is stored
* UINT32 sector - Sector an that writing should be started
* UINT8 count - Number of following sectors to write on
*
* Return : DSTATUS - Initialisation status of desired device
* ---------------------------------------------------------------------------
*/
#if _READONLY == 0
DRESULT disk_write(UINT8 drive, pUINT8 buffer, UINT32 sector, UINT8 count);
#endif
#endif /*FAT_TIME_H_*/
@@ -0,0 +1,989 @@
/* ---------------------------------------------------------------------------
* FAT_intern.c (C)ChaN, 2008
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description: FatFs - FAT file system module R0.06
*
* The FatFs module is an experimenal project to implement FAT file system to
* cheap microcontrollers. This is a free software and is opened for education,
* research and development under license policy of following trems.
*
* Copyright (C) 2008, ChaN, all right reserved.
*
* The FatFs module is a free software and there is no warranty.
* You can use, modify and/or redistribute it for personal, non-profit or
* commercial use without restriction under your responsibility.
* Redistributions of source code must retain the above copyright notice.
* ---------------------------------------------------------------------------
* Last Change: 0.2, Aug 11, 2008, MMi
* Edited to fit into LAN_2636 Project
*
*----------------------------------------------------------------------------
* Feb 26,'06 R0.00 Prototype.
*
* Apr 29,'06 R0.01 First stable version.
*
* Jun 01,'06 R0.02 Added FAT12 support.
* Removed unbuffered mode.
* Fixed a problem on small (<32M) patition.
* Jun 10,'06 R0.02a Added a configuration option (_FS_MINIMUM).
*
* Sep 22,'06 R0.03 Added f_rename().
* Changed option _FS_MINIMUM to _FS_MINIMIZE.
* Dec 11,'06 R0.03a Improved cluster scan algolithm to write files fast.
* Fixed f_mkdir() creates incorrect directory on FAT32.
*
* Feb 04,'07 R0.04 Supported multiple drive system.
* Changed some interfaces for multiple drive system.
* Changed f_mountdrv() to f_mount().
* Added f_mkfs().
* Apr 01,'07 R0.04a Supported multiple partitions on a plysical drive.
* Added a capability of extending file size to f_lseek().
* Added minimization level 3.
* Fixed an endian sensitive code in f_mkfs().
* May 05,'07 R0.04b Added a configuration option _USE_NTFLAG.
* Added FSInfo support.
* Fixed DBCS name can result FR_INVALID_NAME.
* Fixed short seek (<= csize) collapses the file object.
*
* Aug 25,'07 R0.05 Changed arguments of f_read(), f_write() and f_mkfs().
* Fixed f_mkfs() on FAT32 creates incorrect FSInfo.
* Fixed f_mkdir() on FAT32 creates incorrect directory.
* Feb 03,'08 R0.05a Added f_truncate() and f_utime().
* Fixed off by one error at FAT sub-type determination.
* Fixed btr in f_read() can be mistruncated.
* Fixed cached sector is not flushed when create and close
* without write.
*
* Apr 01,'08 R0.06 Added fputc(), fputs(), fprintf() and fgets().
* Improved performance of f_lseek() on moving to the same
* or following cluster.
*---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
/* Compiler includes */
#include <string.h>
#include "LPC23xx.h"
#include "types.h"
/* FreeRTOS includes */
#include "FreeRTOS.h"
#include "task.h"
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "fat_intern.h" /* FatFs declarations */
#include "fat_public.h"
#include "fat_diskio.h" /* Include file for user provided disk functions */
#include "fat_time.h" /* Get time from RTC */
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
FATFS *FatFs[_DRIVES] = {0,0}; /* Pointer to file system objects */
/* (logical drives) */
UINT16 fsid; /* File system mount ID */
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
BOOLEAN move_window (FATFS *fs, UINT32 sector)
{
UINT32 wsect;
wsect = fs->winsect;
if (wsect != sector)
{
/* Changed current window */
#if !_FS_READONLY /* If write-access granted */
UINT8 n;
if (fs->winflag)
{
/* Write back dirty window if needed */
if (disk_write(fs->drive, fs->win, wsect, 1) != RES_OK)
return FALSE;
fs->winflag = 0;
if (wsect < (fs->fatbase + fs->sects_fat))
{
/* In FAT area */
for (n = fs->n_fats; n >= 2; n--)
{
/* Refrect the change to FAT copy */
wsect += fs->sects_fat;
disk_write(fs->drive, fs->win, wsect, 1);
}
}
}
#endif
if (sector)
{
if (disk_read(fs->drive, fs->win, sector, 1) != RES_OK)
{
return FALSE;
}
fs->winsect = sector;
}
}
return TRUE;
}
#if !_FS_READONLY
FRESULT sync (FATFS *fs)
{
fs->winflag = 1;
if (!move_window(fs, 0))
return FR_RW_ERROR;
#if _USE_FSINFO
/* Update FSInfo sector if needed */
if (fs->fs_type == FS_FAT32 && fs->fsi_flag)
{
fs->winsect = 0;
memset(fs->win, 0, 512);
ST_WORD(&fs->win[BS_55AA], 0xAA55);
ST_DWORD(&fs->win[FSI_LeadSig], 0x41615252);
ST_DWORD(&fs->win[FSI_StrucSig], 0x61417272);
ST_DWORD(&fs->win[FSI_Free_Count], fs->free_clust);
ST_DWORD(&fs->win[FSI_Nxt_Free], fs->last_clust);
disk_write(fs->drive, fs->win, fs->fsi_sector, 1);
fs->fsi_flag = 0;
}
#endif
/* Make sure that no pending write process in the physical drive */
if (disk_ioctl(fs->drive, CTRL_SYNC, NULL) != RES_OK)
return FR_RW_ERROR;
return FR_OK;
}
#endif
UINT32 get_cluster (FATFS *fs, UINT32 clust)
{
UINT16 wc, bc;
UINT32 fatsect;
if (clust >= 2 && clust < fs->max_clust)
{
/* Is it a valid cluster number? */
fatsect = fs->fatbase;
switch (fs->fs_type)
{
case FS_FAT12:
bc = (UINT16)clust * 3 / 2;
if (!move_window(fs, fatsect + (bc / SS(fs))))
break;
wc = fs->win[bc & (SS(fs) - 1)];
bc++;
if (!move_window(fs, fatsect + (bc / SS(fs))))
break;
wc |= (UINT16)fs->win[bc & (SS(fs) - 1)] << 8;
return (clust & 1) ? (wc >> 4) : (wc & 0xFFF);
case FS_FAT16:
if (!move_window(fs, fatsect + (clust / (SS(fs) / 2))))
break;
return LD_WORD(&fs->win[((UINT16)clust * 2) & (SS(fs) - 1)]);
case FS_FAT32:
if (!move_window(fs, fatsect + (clust / (SS(fs) / 4))))
break;
return LD_DWORD(&fs->win[((UINT16)clust * 4) & (SS(fs) - 1)]) & 0x0FFFFFFF;
}
}
return 1; /* Out of cluster range, or an error occured */
}
#if !_FS_READONLY
BOOLEAN put_cluster(FATFS *fs, UINT32 clust, UINT32 val)
{
UINT32 fatsect;
UINT16 bc;
UINT8 *p;
fatsect = fs->fatbase;
switch (fs->fs_type)
{
case FS_FAT12:
bc = (UINT16)clust * 3 / 2;
if (!move_window(fs, fatsect + (bc / SS(fs))))
{
return FALSE;
}
p = &fs->win[bc & (SS(fs) - 1)];
*p = (clust & 1) ? ((*p & 0x0F) | ((UINT8)val << 4)) : (UINT8)val;
bc++;
fs->winflag = 1;
if (!move_window(fs, fatsect + (bc / SS(fs))))
{
return FALSE;
}
p = &fs->win[bc & (SS(fs) - 1)];
*p = (clust & 1) ? (UINT8)(val >> 4) : ((*p & 0xF0) | ((UINT8)(val
>> 8) & 0x0F));
break;
case FS_FAT16:
if (!move_window(fs, fatsect + (clust / (SS(fs) / 2))))
{
return FALSE;
}
ST_WORD(&fs->win[((UINT16)clust * 2) & (SS(fs) - 1)], (UINT16)val);
break;
case FS_FAT32:
if (!move_window(fs, fatsect + (clust / (SS(fs) / 4))))
{
return FALSE;
}
ST_DWORD(&fs->win[((UINT16)clust * 4) & (SS(fs) - 1)], val);
break;
default:
return FALSE;
}
fs->winflag = 1;
return TRUE;
}
#endif /* !_FS_READONLY */
#if !_FS_READONLY
BOOLEAN remove_chain (FATFS *fs, UINT32 clust)
{
UINT32 nxt;
while (clust >= 2 && clust < fs->max_clust)
{
nxt = get_cluster(fs, clust);
if (nxt == 1)
{
return FALSE;
}
if (!put_cluster(fs, clust, 0))
{
return FALSE;
}
if (fs->free_clust != 0xFFFFFFFF)
{
fs->free_clust++;
#if _USE_FSINFO
fs->fsi_flag = 1;
#endif
}
clust = nxt;
}
return TRUE;
}
#endif
#if !_FS_READONLY
UINT32 create_chain (FATFS *fs, UINT32 clust)
{
UINT32 cstat;
UINT32 ncl;
UINT32 scl;
UINT32 mcl = fs->max_clust;
if (clust == 0)
{
/* Create new chain */
scl = fs->last_clust; /* Get suggested start point */
if (scl == 0 || scl >= mcl)
scl = 1;
}
else
{
/* Stretch existing chain */
cstat = get_cluster(fs, clust); /* Check the cluster status */
if (cstat < 2)
{
return 1; /* It is an invalid cluster */
}
if (cstat < mcl)
{
return cstat; /* Is already followed by cluster */
}
scl = clust;
}
ncl = scl; /* Start cluster */
for (;;)
{
ncl++; /* Next cluster */
if (ncl >= mcl)
{
/* Wrap around */
ncl = 2;
if (ncl > scl)
return 0; /* No free custer */
}
cstat = get_cluster(fs, ncl); /* Get the cluster status */
if (cstat == 0)
{
break; /* Found a free cluster */
}
if (cstat == 1)
{
return 1; /* Any error occured */
}
if (ncl == scl)
{
return 0; /* No free custer */
}
}
if (!put_cluster(fs, ncl, 0x0FFFFFFF))
{
return 1; /* Mark the new cluster "in use" */
}
if (clust != 0 && !put_cluster(fs, clust, ncl))
{
return 1; /* Link it to previous one if needed*/
}
fs->last_clust = ncl; /* Update fsinfo */
if (fs->free_clust != 0xFFFFFFFF)
{
fs->free_clust--;
#if _USE_FSINFO
fs->fsi_flag = 1;
#endif
}
return ncl; /* Return new cluster number */
}
#endif /* !_FS_READONLY */
UINT32 clust2sect(FATFS *fs, UINT32 clust)
{
clust -= 2;
if (clust >= (fs->max_clust - 2))
{
return 0; /* Invalid cluster number */
}
return (clust * fs->csize + fs->database);
}
BOOLEAN next_dir_entry(DIR *dj)
{
UINT32 clust;
UINT16 idx;
idx = dj->index + 1;
if ((idx & ((SS(dj->fs) - 1) / 32)) == 0)
{
/* Table sector changed? */
dj->sect++; /* Next sector */
if (dj->clust == 0)
{
/* In static table */
if (idx >= dj->fs->n_rootdir)
{
return FALSE; /* Reached to end of table */
}
}
else
{
/* In dynamic table */
if (((idx / (SS(dj->fs) / 32)) & (dj->fs->csize - 1)) == 0)
{
/* Cluster changed? */
clust = get_cluster(dj->fs, dj->clust); /* Get next cluster */
if (clust < 2 || clust >= dj->fs->max_clust)
{
/* Reached to end of table */
return FALSE;
}
dj->clust = clust; /* Initialize for new cluster */
dj->sect = clust2sect(dj->fs, clust);
}
}
}
dj->index = idx; /* Lower bits of dj->index indicates*/
/* offset in dj->sect */
return TRUE;
}
#if _FS_MINIMIZE <= 1
void get_fileinfo (FILINFO *finfo, const UINT8 *dir)
{
UINT8 n;
UINT8 c;
UINT8 a;
char *p;
p = &finfo->fname[0];
a = _USE_NTFLAG ? dir[DIR_NTres] : 0; /* NT flag */
for (n = 0; n < 8; n++)
{
/* Convert file name (body) */
c = dir[n];
if (c == ' ')
{
break;
}
if (c == 0x05)
{
c = 0xE5;
}
if (a & 0x08 && c >= 'A' && c <= 'Z')
{
c += 0x20;
}
*p++ = c;
}
if (dir[8] != ' ')
{
/* Convert file name (extension) */
*p++ = '.';
for (n = 8; n < 11; n++)
{
c = dir[n];
if (c == ' ')
{
break;
}
if (a & 0x10 && c >= 'A' && c <= 'Z')
{
c += 0x20;
}
*p++ = c;
}
}
*p = '\0';
finfo->fattrib = dir[DIR_Attr]; /* Attribute */
finfo->fsize = LD_DWORD(&dir[DIR_FileSize]); /* Size */
finfo->fdate = LD_WORD(&dir[DIR_WrtDate]); /* Date */
finfo->ftime = LD_WORD(&dir[DIR_WrtTime]); /* Time */
}
#endif /* _FS_MINIMIZE <= 1 */
char make_dirfile(const char **path, char *dirname)
{
UINT8 n;
UINT8 t;
UINT8 c;
UINT8 a;
UINT8 b;
memset(dirname, ' ', 8+3); /* Fill buffer with spaces */
a = 0;
b = 0x18; /* NT flag */
n = 0;
t = 8;
for (;;)
{
c = *(*path)++;
if (c == '\0' || c == '/')
{
/* Reached to end of str or directory separator */
if (n == 0)
{
break;
}
dirname[11] = _USE_NTFLAG ? (a & b) : 0;
return c;
}
if (c <= ' ' || c == 0x7F)
{
break; /* Reject invisible chars */
}
if (c == '.')
{
if (!(a & 1) && n >= 1 && n <= 8)
{
/* Enter extension part */
n = 8;
t = 11;
continue;
}
break;
}
if (_USE_SJIS && ((c >= 0x81 && c <= 0x9F) || /* Accept S-JIS code */
(c >= 0xE0 && c <= 0xFC)))
{
if (n == 0 && c == 0xE5) /* Change heading \xE5 to \x05 */
{
c = 0x05;
}
a ^= 0x01;
goto md_l2; /* LABEL SEE END OF FUNCTION */
}
if (c == '"')
{
break; /* Reject " */
}
if (c <= ')')
{
goto md_l1; /* LABEL SEE END OF FUNCTION */
}
/* Accept ! # $ % & ' ( ) */
if (c <= ',')
{
break; /* Reject * + , */
}
if (c <= '9')
{
goto md_l1;
}
/* Accept - 0-9 */
if (c <= '?')
{
break; /* Reject : ; < = > ? */
}
if (!(a & 1))
{
/* These checks are not applied to S-JIS 2nd byte */
if (c == '|')
{
break; /* Reject | */
}
if (c >= '[' && c <= ']')
{
break; /* Reject [ \ ] */
}
if (_USE_NTFLAG && c >= 'A' && c <= 'Z')
{
(t == 8) ? (b &= 0xF7) : (b &= 0xEF);
}
if (c >= 'a' && c <= 'z')
{
/* Convert to upper case */
c -= 0x20;
if (_USE_NTFLAG)
{
(t == 8) ? (a |= 0x08) : (a |= 0x10);
}
}
}
/* GOTO LABELS */
md_l1: a &= 0xFE;
md_l2: if (n >= t)
{
break;
}
dirname[n++] = c;
}
return 1;
}
FRESULT trace_path (DIR *dj, char *fn, const char *path, UINT8 **dir)
{
UINT32 clust;
char ds;
UINT8 *dptr = NULL;
FATFS *fs = dj->fs;
/* Initialize directory object */
clust = fs->dirbase;
if (fs->fs_type == FS_FAT32)
{
dj->clust = dj->sclust = clust;
dj->sect = clust2sect(fs, clust);
}
else
{
dj->clust = dj->sclust = 0;
dj->sect = clust;
}
dj->index = 0;
if (*path == '\0')
{
/* Null path means the root directory */
*dir = NULL;
return FR_OK;
}
for (;;)
{
ds = make_dirfile(&path, fn); /* Get a paragraph into fn[] */
if (ds == 1)
{
return FR_INVALID_NAME;
}
for (;;)
{
if (!move_window(fs, dj->sect))
{
return FR_RW_ERROR;
}
/* Pointer to the directory entry */
dptr = &fs->win[(dj->index & ((SS(fs) - 1) / 32)) * 32];
if (dptr[DIR_Name] == 0) /* Has it reached to end of dir? */
{
return !ds ? FR_NO_FILE : FR_NO_PATH;
}
if (dptr[DIR_Name] != 0xE5 /* Matched? */
&& !(dptr[DIR_Attr] & AR_VOL)
&& !memcmp(&dptr[DIR_Name], fn, 8+3))
{
break;
}
if (!next_dir_entry(dj)) /* Next directory pointer */
{
return !ds ? FR_NO_FILE : FR_NO_PATH;
}
}
if (!ds)
{
*dir = dptr;
return FR_OK;
} /* Matched with end of path */
if (!(dptr[DIR_Attr] & AR_DIR))
{
return FR_NO_PATH; /* Cannot trace because it is a file*/
}
/* Get cluster# of the directory */
clust = ((UINT32)LD_WORD(&dptr[DIR_FstClusHI]) << 16)
| LD_WORD(&dptr[DIR_FstClusLO]);
/* Restart scanning at the new directory */
dj->clust = dj->sclust = clust;
dj->sect = clust2sect(fs, clust);
dj->index = 2;
}
}
#if !_FS_READONLY
FRESULT reserve_direntry (DIR *dj, UINT8 **dir)
{
UINT32 clust;
UINT32 sector;
UINT8 c;
UINT8 n;
UINT8 *dptr;
FATFS *fs = dj->fs;
/* Re-initialize directory object */
clust = dj->sclust;
if (clust != 0)
{
/* Dyanmic directory table */
dj->clust = clust;
dj->sect = clust2sect(fs, clust);
}
else
{
/* Static directory table */
dj->sect = fs->dirbase;
}
dj->index = 0;
do
{
if (!move_window(fs, dj->sect))
{
return FR_RW_ERROR;
}
/* Pointer to the directory entry */
dptr = &fs->win[(dj->index & ((SS(dj->fs) - 1) / 32)) * 32];
c = dptr[DIR_Name];
if (c == 0 || c == 0xE5)
{
/* Found an empty entry */
*dir = dptr;
return FR_OK;
}
} while (next_dir_entry(dj)); /* Next directory pointer */
/* Reached to end of the directory table */
/* Abort when it is a static table or could not stretch dynamic table */
if (clust == 0 || !(clust = create_chain(fs, dj->clust)))
{
return FR_DENIED;
}
if (clust == 1 || !move_window(fs, 0))
{
return FR_RW_ERROR;
}
/* Cleanup the expanded table */
fs->winsect = sector = clust2sect(fs, clust);
memset(fs->win, 0, SS(fs));
for (n = fs->csize; n; n--)
{
if (disk_write(fs->drive, fs->win, sector, 1) != RES_OK)
{
return FR_RW_ERROR;
}
sector++;
}
fs->winflag = 1;
*dir = fs->win;
return FR_OK;
}
#endif
UINT8 check_fs (FATFS *fs, UINT32 sect)
{
/* Load boot record */
if (disk_read(fs->drive, fs->win, sect, 1) != RES_OK)
{
return 2;
}
/* Check record signature (always placed at offset 510 even if the sector
* size is >512)
*/
if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55)
{
return 2;
}
/* Check FAT signature */
if (!memcmp(&fs->win[BS_FilSysType], "FAT", 3))
{
return 0;
}
if (!memcmp(&fs->win[BS_FilSysType32], "FAT32", 5)
&& !(fs->win[BPB_ExtFlags] & 0x80))
{
return 0;
}
return 1;
}
FRESULT auto_mount (const char **path, FATFS **rfs, UINT8 chk_wp)
{
UINT32 bootsect;
UINT32 fatsize;
UINT32 totalsect;
UINT32 maxclust;
UINT8 drv;
UINT8 fmt;
UINT8 *tbl;
DSTATUS stat;
const char *p = *path;
FATFS *fs;
/* Get drive number from the path name */
while (*p == ' ')
{
p++; /* Strip leading spaces */
}
drv = p[0] - '0'; /* Is there a drive number? */
if (drv <= 9 && p[1] == ':')
{
p += 2; /* Found drive number, get&strip it */
}
else
{
drv = 0; /* No drive number is given, use */
/* drive number 0 as default */
}
if (*p == '/')
{
p++; /* Strip heading slash */
}
*path = p; /* Return pointer to the path name */
/* Check if the drive number is valid or not */
if (drv >= _DRIVES)
{
return FR_INVALID_DRIVE; /* Is the drive number valid? */
}
*rfs = fs = FatFs[drv]; /* Returen pointer to the */
/* corresponding file system object */
if (!fs)
{
return FR_NOT_ENABLED; /* Is file system object registered?*/
}
if (fs->fs_type)
{
/* If the logical drive has been mounted */
stat = disk_status(fs->drive);
if (!(stat & STA_NOINIT))
{
/* and physical drive is kept initialized (has not been changed)*/
#if !_FS_READONLY
/* Check write protection if needed */
if (chk_wp && (stat & STA_PROTECT))
{
return FR_WRITE_PROTECTED;
}
#endif
return FR_OK; /* The file system object is valid */
}
}
/* The logical drive must be re-mounted.
* Following code attempts to mount the logical drive
*/
memset(fs, 0, sizeof(FATFS)); /* Clean-up the file system object */
fs->drive = LD2PD(drv); /* Bind logical and physical drive */
stat = disk_initialize(fs->drive); /* Initialize low level I/O layer */
if (stat & STA_NOINIT) /* Check if the drive is ready */
{
return FR_NOT_READY;
}
#if S_MAX_SIZ > 512 /* Get disk sector size if needed */
if (disk_ioctl(drv,GET_SECTOR_SIZE,&SS(fs)) != RES_OK || SS(fs)> S_MAX_SIZ)
{
return FR_NO_FILESYSTEM;
}
#endif
#if !_FS_READONLY
if (chk_wp && (stat & STA_PROTECT)) /* Check write protection if needed */
{
return FR_WRITE_PROTECTED;
}
#endif
/* Search FAT partition on the drive */
fmt = check_fs(fs, bootsect = 0); /* Check sector 0 as an SFD format */
if (fmt == 1)
{
/* Not an FAT boot record, it may be patitioned */
/* Check a partition listed in top of the partition table */
tbl = &fs->win[MBR_Table + LD2PT(drv) * 16]; /* Partition table */
if (tbl[4])
{
/* Is the partition existing? */
bootsect = LD_DWORD(&tbl[8]); /* Partition offset in LBA */
fmt = check_fs(fs, bootsect); /* Check the partition */
}
}
/* No valid FAT patition is found */
if (fmt || LD_WORD(&fs->win[BPB_BytsPerSec]) != SS(fs))
{
return FR_NO_FILESYSTEM;
}
/* Initialize the file system object */
fatsize = LD_WORD(&fs->win[BPB_FATSz16]); /* Number of sectors per FAT */
if (!fatsize)
{
fatsize = LD_DWORD(&fs->win[BPB_FATSz32]);
}
fs->sects_fat = fatsize;
/* Number of FAT copies */
fs->n_fats = fs->win[BPB_NumFATs];
/* (Number of sectors in FAT area) */
fatsize *= fs->n_fats;
/* FAT start sector (lba) */
fs->fatbase = bootsect + LD_WORD(&fs->win[BPB_RsvdSecCnt]);
/* Number of sectors per cluster */
fs->csize = fs->win[BPB_SecPerClus];
/* Nmuber of root directory entries */
fs->n_rootdir = LD_WORD(&fs->win[BPB_RootEntCnt]);
/* Number of sectors on the file system */
totalsect = LD_WORD(&fs->win[BPB_TotSec16]);
if (!totalsect)
{
totalsect = LD_DWORD(&fs->win[BPB_TotSec32]);
}
/* max_clust = Last cluster# + 1 */
fs->max_clust = maxclust = (totalsect - LD_WORD(&fs->win[BPB_RsvdSecCnt])
- fatsize - fs->n_rootdir / (SS(fs)/32) ) / fs->csize + 2;
fmt = FS_FAT12; /* Determine the FAT sub type */
if (maxclust >= 0xFF7)
{
fmt = FS_FAT16;
}
if (maxclust >= 0xFFF7)
{
fmt = FS_FAT32;
}
if (fmt == FS_FAT32)
{
/* Root directory start cluster */
fs->dirbase = LD_DWORD(&fs->win[BPB_RootClus]);
}
else
{
/* Root directory start sector (lba) */
fs->dirbase = fs->fatbase + fatsize;
}
/* Data start sector (lba) */
fs->database = fs->fatbase + fatsize + fs->n_rootdir / (SS(fs)/32);
#if !_FS_READONLY
/* Initialize allocation information */
fs->free_clust = 0xFFFFFFFF;
#if _USE_FSINFO
/* Get fsinfo if needed */
if (fmt == FS_FAT32)
{
fs->fsi_sector = bootsect + LD_WORD(&fs->win[BPB_FSInfo]);
if (disk_read(fs->drive, fs->win, fs->fsi_sector, 1) == RES_OK &&
LD_WORD(&fs->win[BS_55AA]) == 0xAA55 &&
LD_DWORD(&fs->win[FSI_LeadSig]) == 0x41615252 &&
LD_DWORD(&fs->win[FSI_StrucSig]) == 0x61417272)
{
fs->last_clust = LD_DWORD(&fs->win[FSI_Nxt_Free]);
fs->free_clust = LD_DWORD(&fs->win[FSI_Free_Count]);
}
}
#endif
#endif
fs->fs_type = fmt; /* FAT syb-type */
fs->id = ++fsid; /* File system mount ID */
return FR_OK;
}
FRESULT validate (const FATFS *fs, UINT16 id)
{
if (!fs || !fs->fs_type || fs->id != id)
{
return FR_INVALID_OBJECT;
}
if (disk_status(fs->drive) & STA_NOINIT)
{
return FR_NOT_READY;
}
return FR_OK;
}
@@ -0,0 +1,396 @@
/* ---------------------------------------------------------------------------
* FAT_intern.h (C)ChaN, 2008
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description: FatFs - FAT file system module include file R0.06
*
* FatFs module is an experimenal project to implement FAT file system to
* cheap microcontrollers. This is a free software and is opened for education,
* research and development under license policy of following trems.
*
* Copyright (C) 2008, ChaN, all right reserved.
*
* The FatFs module is a free software and there is no warranty.
* You can use, modify and/or redistribute it for personal, non-profit or
* commercial use without any restriction under your responsibility.
* Redistributions of source code must retain the above copyright notice.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Version(s): 0.2, Aug 11, 2008, MMi
* Edited to fit into LAN_2636 Project
*
* 0.1, 2008 ChanN
* Creation
* ---------------------------------------------------------------------------
*/
#ifndef FAT_INTERN_H_
#define FAT_INTERN_H_
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
#include "LPC23xx.h"
#include "types.h"
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* The _MCU_ENDIAN defines which access method is used to the FAT structure.
* 1: Enable word access.
* 2: Disable word access and use byte-by-byte access instead.
*/
#define _MCU_ENDIAN 2
/* Setting _FS_READONLY to 1 defines read only configuration. This removes
* writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
* f_truncate and useless f_getfree.
*/
#define _FS_READONLY 0
/* _FS_MINIMIZE option defines minimization level to remove some functions.
* 0: Full function.
* 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
* are removed.
* 2: f_opendir and f_readdir are removed in addition to level 1.
* 3: f_lseek is removed in addition to level 2. */
#define _FS_MINIMIZE 0
/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
#define _USE_STRFUNC 0
/* When _USE_MKFS is set to 1 and _FS_READONLY is set to 0, f_mkfs function is
* enabled.
*/
#define _USE_MKFS 0
/* Number of logical drives to use. This affects the size of internal table.*/
#define _DRIVES 2
/* When _MULTI_PARTITION is set to 0, each logical drive is bound to same
* physical drive number and can mount only 1st primaly partition. When it is
* set to 1, each logical drive can mount a partition listed in Drives[].
*/
#define _MULTI_PARTITION 0
/* To enable FSInfo support on FAT32 volume, set _USE_FSINFO to 1. */
#define _USE_FSINFO 0
/* When _USE_SJIS is set to 1, Shift-JIS code transparency is enabled,
* otherwise only US-ASCII(7bit) code can be accepted as file/directory name.
*/
#define _USE_SJIS 1
/* When _USE_NTFLAG is set to 1, upper/lower case of the file name is enabled.
* Note that the files are always accessed in case insensitive.
*/
#define _USE_NTFLAG 1
/* Definitions corresponds to multiple sector size */
#define S_MAX_SIZ 512U /* Do not change */
#if S_MAX_SIZ > 512U
#define SS(fs) ((fs)->s_size)
#else
#define SS(fs) 512U
#endif
/* Definitions corresponds to multi partition */
#if _MULTI_PARTITION != 0 /* Multiple partition cfg */
#define LD2PD(drv) (Drives[drv].pd) /* Get physical drive number */
#define LD2PT(drv) (Drives[drv].pt) /* Get partition number */
#else /* Single partition cfg */
#define LD2PD(drv) (drv) /* Physical drive number is equal */
/* to logical drive number */
#define LD2PT(drv) 0 /* Always mounts the 1st partition */
#endif
/* String functions enabled */
#if _USE_STRFUNC
#define feof(fp) ((fp)->fptr == (fp)->fsize)
#define EOF -1
int fputc (int, FIL*); /* Put a character to the file */
int fputs (const char*, FIL*); /* Put a string to the file */
int fprintf (FIL*, const char*, ...); /* Put a formatted string to file */
char* fgets (char*, int, FIL*); /* Get a string from the file */
#endif
/* File access control and file status flags */
#define FA_OPEN_EXISTING 0x00 /* Open file. Fails if not exist */
#define FA_READ 0x01 /* Allow reading access */
#if _FS_READONLY == 0 /* En-/disable writing functions */
#define FA_WRITE 0x02 /* Allow writing access */
#define FA_CREATE_NEW 0x04 /* Create file. Fails if exists */
#define FA_CREATE_ALWAYS 0x08 /* Create file, overwrites if exists*/
#define FA_OPEN_ALWAYS 0x10 /* Open file, create if not exists */
#define FA__WRITTEN 0x20 /* "FileChanged" Flag (internal use)*/
#define FA__DIRTY 0x40
#endif
#define FA__ERROR 0x80 /* ERROR Flag */
/* FAT sub types */
#define FS_FAT12 1
#define FS_FAT16 2
#define FS_FAT32 3
/* File attribute bits for directory entry */
#define AR_RDO 0x01 /* Read only */
#define AR_HID 0x02 /* Hidden */
#define AR_SYS 0x04 /* System */
#define AR_VOL 0x08 /* Volume label */
#define AR_LFN 0x0F /* LFN entry */
#define AR_DIR 0x10 /* Directory */
#define AR_ARC 0x20 /* Archive */
/* Offset of FAT structure members */
#define BS_jmpBoot 0 /* Jump Statement */
#define BS_OEMName 3 /* OEM Name */
#define BPB_BytsPerSec 11 /* Bytes per Sector */
#define BPB_SecPerClus 13 /* Sectors per Cluster */
#define BPB_RsvdSecCnt 14 /* Number of reserved Sectors */
#define BPB_NumFATs 16 /* Number of FATs */
#define BPB_RootEntCnt 17 /* Number of Root entries */
#define BPB_TotSec16 19 /* Number of total Sectors (FAT16) */
#define BPB_Media 21 /* Media Descriptor (unnecessary) */
#define BPB_FATSz16 22 /* Number of Sectors per FAT */
#define BPB_SecPerTrk 24 /* Sectors per Track */
#define BPB_NumHeads 26 /* Number of writing-heads */
#define BPB_HiddSec 28 /* Number of hidden Sectors */
#define BPB_TotSec32 32 /* Number of total Sectors (FAT32) */
#define BS_55AA 510 /* MBR ending structure "55AA" */
/* Offset of additional FAT12/FAT16 Descriptors */
#define BS_DrvNum 36 /* Physical BIOS Drive number */
#define BS_BootSig 38 /* Extended Boot Signature */
#define BS_VolID 39 /* Volume ID */
#define BS_VolLab 43 /* Volume Label (not necessary) */
#define BS_FilSysType 54 /* Filesystem Type */
/* Offset of additional FAT32 Descriptors */
#define BPB_FATSz32 36 /* Number of Sectors per FAT */
#define BPB_ExtFlags 40 /* Extended FAT Flags */
#define BPB_FSVer 42 /* FAT32 Version (usually:0x0000) */
#define BPB_RootClus 44 /* Rootcluster number */
#define BPB_FSInfo 48 /* FS Information Sector (usually 1)*/
#define BPB_BkBootSec 50 /* Sectornumber of Bootsector copy */
#define BS_DrvNum32 64 /* Physical BIOS Drive number */
#define BS_BootSig32 66 /* Extended Boot Signature */
#define BS_VolID32 67 /* Volume ID */
#define BS_VolLab32 71 /* Volume Label (unused) */
#define BS_FilSysType32 82 /* FAT Version (always FAT32) */
/* Offset of additional File System Information */
#define FSI_LeadSig 0
#define FSI_StrucSig 484
#define FSI_Free_Count 488
#define FSI_Nxt_Free 492
#define MBR_Table 446
/* Offset of directory or file information in RootDirectory entries */
#define DIR_Name 0 /* Entry name (8B Name 3B Extension)*/
#define DIR_Attr 11 /* Attributes */
#define DIR_NTres 12 /* Used by NT */
#define DIR_CrtTime 14 /* Creation Time */
#define DIR_CrtDate 16 /* Creation Date */
#define DIR_FstClusHI 20 /* First Cluster (High Bytes) */
#define DIR_WrtTime 22 /* Last written Time */
#define DIR_WrtDate 24 /* Last written Date */
#define DIR_FstClusLO 26 /* First Cluster (Low Bytes) */
#define DIR_FileSize 28 /* File Size */
/* Multi-byte word access macros */
#if _MCU_ENDIAN == 1 /* Use word access */
#define LD_WORD(ptr) (UINT16)(*(UINT16*)(UINT8*)(ptr))
#define LD_DWORD(ptr) (UINT32)(*(UINT32*)(UINT8*)(ptr))
#define ST_WORD(ptr,val) *(UINT16*)(UINT8*)(ptr)=(UINT16)(val)
#define ST_DWORD(ptr,val) *(UINT32*)(UINT8*)(ptr)=(UINT32)(val)
#elif _MCU_ENDIAN == 2 /* Use byte-by-byte access */
#define LD_WORD(ptr) (UINT16)(((UINT16)*(volatile UINT8*)((ptr)+1)<<8)|(UINT16)*(volatile UINT8*)(ptr))
#define LD_DWORD(ptr) (UINT32)(((UINT32)*(volatile UINT8*)((ptr)+3)<<24)|((UINT32)*(volatile UINT8*)((ptr)+2)<<16)|((UINT16)*(volatile UINT8*)((ptr)+1)<<8)|*(volatile UINT8*)(ptr))
#define ST_WORD(ptr,val) *(volatile UINT8*)(ptr)=(UINT8)(val); *(volatile UINT8*)((ptr)+1)=(UINT8)((UINT16)(val)>>8)
#define ST_DWORD(ptr,val) *(volatile UINT8*)(ptr)=(UINT8)(val); *(volatile UINT8*)((ptr)+1)=(UINT8)((UINT16)(val)>>8); *(volatile UINT8*)((ptr)+2)=(UINT8)((UINT32)(val)>>16); *(volatile UINT8*)((ptr)+3)=(UINT8)((UINT32)(val)>>24)
#else
#error Do not forget to set _MCU_ENDIAN properly!
#endif
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* File system object structure */
typedef struct _FATFS
{
UINT16 id; /* File system mount ID */
UINT16 n_rootdir; /* Number of root directory entries */
UINT32 winsect; /* Current sector in the win[] */
UINT32 sects_fat; /* Sectors per FAT */
UINT32 max_clust; /* Maximum number of cluster + 1 */
UINT32 fatbase; /* FAT start sector */
UINT32 dirbase; /* RootDir start sector */
/* (cluster number for FAT32) */
UINT32 database; /* Data start sector */
#if !_FS_READONLY
UINT32 last_clust; /* Last allocated cluster */
UINT32 free_clust; /* Number of free clusters */
#if _USE_FSINFO
UINT32 fsi_sector; /* Fsinfo sector */
UINT8 fsi_flag; /* fsinfo dirty flag */
/* (1:must be written back) */
UINT8 pad2;
#endif
#endif
UINT8 fs_type; /* FAT sub type */
UINT8 csize; /* Number of sectors per cluster */
#if S_MAX_SIZ > 512U
UINT16 s_size; /* Sector size */
#endif
UINT8 n_fats; /* Number of FAT copies */
UINT8 drive; /* Physical drive number */
UINT8 winflag; /* win[] dirty flag */
/* (1:must be written back) */
UINT8 pad1;
UINT8 win[S_MAX_SIZ]; /* Disk access window for FAT */
} FATFS;
/* Directory object structure */
typedef struct _DIR
{
UINT16 id; /* Owner file system mount ID */
UINT16 index; /* Current index */
FATFS* fs; /* Pointer to file system object */
UINT32 sclust; /* Start cluster */
UINT32 clust; /* Current cluster */
UINT32 sect; /* Current sector */
} DIR;
/* File object structure */
typedef struct _FIL
{
UINT16 id; /* Owner file system mount ID */
UINT8 flag; /* File status flags */
UINT8 csect; /* Sector address in the cluster */
FATFS* fs; /* Pointer to file system object */
UINT32 fptr; /* File Read/Write pointer */
UINT32 fsize; /* File size */
UINT32 org_clust; /* File start cluster */
UINT32 curr_clust; /* Current cluster */
UINT32 curr_sect; /* Current sector */
#if _FS_READONLY == 0
UINT32 dir_sect; /* Sector containing directory entry*/
pUINT8 dir_ptr; /* Pointer to dir entry in window */
#endif
UINT8 buffer[S_MAX_SIZ]; /* File Read/Write buffer */
} FIL;
/* File status structure */
typedef struct _FILINFO
{
UINT32 fsize; /* Size */
UINT16 fdate; /* Date */
UINT16 ftime; /* Time */
UINT8 fattrib; /* Attribute */
char fname[8+1+3+1]; /* Name (8.3 format) */
} FILINFO;
/* File function return code (FRESULT) */
typedef enum
{
FR_OK = 0, /* 0 - Operation Suceeded */
FR_NOT_READY, /* 1 - Device not ready */
FR_NO_FILE, /* 2 - No file available */
FR_NO_PATH, /* 3 - No path available */
FR_INVALID_NAME, /* 4 - Invalid file or dir name */
FR_INVALID_DRIVE, /* 5 - Invalid drive number */
FR_DENIED, /* 6 - Access denied */
FR_EXIST, /* 7 - File or dir already exists */
FR_RW_ERROR, /* 8 - Read or Write Error */
FR_WRITE_PROTECTED, /* 9 - Device is write-protected */
FR_NOT_ENABLED, /* 10 - Device/function not enabled */
FR_NO_FILESYSTEM, /* 11 - No filesystem available */
FR_INVALID_OBJECT, /* 12 - Invalid object reference */
FR_MKFS_ABORTED /* 13 - MKFS function aborted */
} FRESULT;
/* Definitions corresponds to multi partition */
#if _MULTI_PARTITION != 0 /* Multiple partition cfg */
typedef struct _PARTITION
{
UINT8 pd; /* Physical drive # (0-255) */
UINT8 pt; /* Partition # (0-3) */
} PARTITION;
extern
const PARTITION Drives[]; /* Logical drive number to physical */
#endif
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
BOOLEAN move_window (FATFS *fs, UINT32 sector);
#if !_FS_READONLY
FRESULT sync (FATFS *fs);
#endif
UINT32 get_cluster (FATFS *fs, UINT32 clust);
#if !_FS_READONLY
BOOLEAN put_cluster(FATFS *fs, UINT32 clust, UINT32 val);
#endif
#if !_FS_READONLY
BOOLEAN remove_chain (FATFS *fs, UINT32 clust);
#endif
#if !_FS_READONLY
UINT32 create_chain (FATFS *fs, UINT32 clust);
#endif
UINT32 clust2sect(FATFS *fs, UINT32 clust);
BOOLEAN next_dir_entry(DIR *dj);
#if _FS_MINIMIZE <= 1
void get_fileinfo (FILINFO *finfo, const UINT8 *dir);
#endif
char make_dirfile(const char **path, char *dirname);
FRESULT trace_path (DIR *dj, char *fn, const char *path, UINT8 **dir);
#if !_FS_READONLY
FRESULT reserve_direntry (DIR *dj, UINT8 **dir);
#endif
UINT8 check_fs (FATFS *fs, UINT32 sect);
FRESULT auto_mount (const char **path, FATFS **rfs, UINT8 chk_wp);
FRESULT validate (const FATFS *fs, UINT16 id);
#endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,345 @@
/* ---------------------------------------------------------------------------
* FAT_intern.h (C)ChaN, 2008
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description: FatFs - FAT file system module include file R0.06
*
* FatFs module is an experimenal project to implement FAT file system to
* cheap microcontrollers. This is a free software and is opened for education,
* research and development under license policy of following trems.
*
* Copyright (C) 2008, ChaN, all right reserved.
*
* The FatFs module is a free software and there is no warranty.
* You can use, modify and/or redistribute it for personal, non-profit or
* commercial use without any restriction under your responsibility.
* Redistributions of source code must retain the above copyright notice.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Version(s): 0.2, Aug 11, 2008, MMi
* Edited to fit into LAN_2636 Project
*
* 0.1, 2008 ChanN
* Creation
* ---------------------------------------------------------------------------
*/
#ifndef FAT_PUBLIC_H_
#define FAT_PUBLIC_H_
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
#include "LPC23xx.h"
#include "types.h"
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "fat_intern.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
void FAT_StatusOut (FRESULT result);
/* ---------------------------------------------------------------------------
* Function: f_mount
*
* Function mounts or unmounts a logical drive
*
* Parameters: UINT8 drive - Device number that should be (un)mounted
* FATFS *fs - Pointer to a clean file system structure
*
* Return : FRESULT - Result if mounting was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_mount (UINT8 drive, FATFS *fs);
/* ---------------------------------------------------------------------------
* Function: f_open
*
* Function opens or creates a file, depending on the rights given by the
* Attributes in mode. The Filename must contain the whole physical path, so
* include every subfolder. If using multible drives, the drivenumber is also
* necessary. Skipping the drivenumber forces the System to use 0 as drive
* number. So in single drive mode, drive number should be 0.
*
* Parameters: FIL *fp - Pointer to a clean file structure
* const char *path - Name of the File ("drive:subdir/file.ext")
*
* Return : FRESULT - Result if opening was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_open (FIL *fp, const char *path, UINT8 mode);
/* ---------------------------------------------------------------------------
* Function: f_read
*
* Function to read from a file. File needs to be opened before with f_open.
* The file structure of this is then given tp f_read. Data is read to *buff.
*
* Parameters: FIL *fp - Pointer to opened file structure
* void *buff - Array to read to
* UINT32 btr - indicates how much bytes should be read
* UINT32 *br - returns, how much uch bytes are already read
*
* Return : FRESULT - Result if reading was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_read (FIL *fp, void *buff, UINT32 btr, UINT32 *br);
/* ---------------------------------------------------------------------------
* Function: f_write
*
* Function to write to a file. File needs to be opened before with f_open.
* The file structure of this is then given tp f_write. Data is written from
* *buff.
*
* Parameters: FIL *fp - Pointer to opened file structure
* void *buff - Array to write from
* UINT32 btr - indicates how much bytes should be written
* UINT32 *br - returns, how much uch bytes are already written
*
* Return : FRESULT - Result if writing was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_write (FIL *fp, const void *buff, UINT32 btw, UINT32 *bw);
/* ---------------------------------------------------------------------------
* Function: f_sync
*
* Function to flush cached data of a written file
*
* Parameters: FIL *fp - Pointer to opened file structure
*
* Return : FRESULT - Result if syncing was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_sync(FIL *fp);
/* ---------------------------------------------------------------------------
* Function: f_close
*
* Function to close a opened file. The file is then not accessible anymore.
*
* Parameters: FIL *fp - Pointer to opened file structure
*
* Return : FRESULT - Result if closing was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_close(FIL *fp);
/* ---------------------------------------------------------------------------
* Function: f_lseek
*
* Function to move the file pointer. When creating a file, the pointer is at
* offset 0x00. After writing or reading, the pointer is moved by the number
* of bytes that have been read.
*
* Parameters: FIL *fp - Pointer to opened file structure
*
* Return : FRESULT - Result if seeking was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_lseek (FIL *fp, UINT32 ofs);
/* ---------------------------------------------------------------------------
* Function: f_opendir
*
* Function to open an already existing directory. Fails, if directory is not
* available or accessible.
*
* Parameters: DIR *dj - Pointer to clean directory structure
* const char *path - Directory name ("dir/subdir/subsubdir")
*
* Return : FRESULT - Result if opening was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_opendir (DIR *dj, const char *path);
/* ---------------------------------------------------------------------------
* Function: f_readdir
*
* Function to read a directory Item
*
* Parameters: DIR *dj - Pointer to directory structure
* FILINFO *finfo - Pointer to a clean file info structure
*
* Return : FRESULT - Result if reading was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_readdir (DIR *dj, FILINFO *finfo);
/* ---------------------------------------------------------------------------
* Function: f_stat
*
* Function to get a file status
*
* Parameters: const char* path - Name of the path
* FILINFO *finfo - Pointer to a clean file info structure
*
* Return : FRESULT - Result if reading was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_stat(const char* path, FILINFO* finfo);
/* ---------------------------------------------------------------------------
* Function: f_truncate
*
* Function to truncate/abort
*
* Parameters: FIL *fp - Pointer to a opened file object structure
*
*
* Return : FRESULT - Result if aborting was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_truncate(FIL *fp);
/* ---------------------------------------------------------------------------
* Function: f_getfree
*
* Function to get free clusters on the drive
*
* Parameters: const char* drive - Number of drive
* UINT32 *nclust - Pointer to store number of free clusters
* FATFS **fats - Pointer to Pointer to file system
*
*
* Return : FRESULT - Result if getting was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_getfree (const char *drv, UINT32 *nclust, FATFS **fatfs);
/* ---------------------------------------------------------------------------
* Function: f_unlink
*
* Function to delete an existing file or directory.
* NOTE: Directories must be empty before deleting!
*
* Parameters: const char* path - Name of file/directory
*
* Return : FRESULT - Result if deleting was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_unlink(const char* path);
/* ---------------------------------------------------------------------------
* Function: f_mkdir
*
* Function to create directories.
* Syntax: "dir/subdir/subsubdir"
*
* Parameters: const char* path - Name/Path of directory
*
* Return : FRESULT - Result if creating was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_mkdir(const char* path);
/* ---------------------------------------------------------------------------
* Function: f_chmod
*
* Function to change attributes of files and directories.
* Usage example:
* To set read-only flag, clear archive flag and retain others:
* f_chmod("file.txt", AR_RDO, (AR_RDO | AR_ARC));
*
* Parameters: const char* path - Name of file/directory
* UINT8 value - The Attribute Bits to SET
* UINT8 mask - All Attribute Bits to CHANGE
*
* Return : FRESULT - Result if changing was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_chmod (const char *path, UINT8 value, UINT8 mask);
/* ---------------------------------------------------------------------------
* Function: f_utime
*
* Function to change timestamp of file or directory
*
* Parameters: const char* path - Name of file/directory
* const FILINFO *finfo - file info structure with new timestamp
*
* Return : FRESULT - Result if changing was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_utime (const char *path, const FILINFO *finfo);
/* ---------------------------------------------------------------------------
* Function: f_rename
*
* Function to rename and move a file or directory.
* Usage: To move a file, simply give the complete physical path in path_new
*
* NOTE: The original author mentioned that movies directories to other
* directories seems to collapse the FAT, but all tests with this were
* positive without any problems. If FAT collapses after moving directories,
* refer to here!
*
* Parameters: const char* path_old - Old Name of file/directory
* const char* path_new - New Name of file/directory
*
* Return : FRESULT - Result if moving/renaming was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_rename (const char *path_old, const char *path_new);
/* ---------------------------------------------------------------------------
* Function: f_mkfs
*
* Function to make/create a file system
*
* NOTE: Is usually unused!
*
* Parameters: UINT8 drv - Drive number
* UINT8 partition - Partition number
* UINT16 allocsize - Allocating unit size in bytes
*
* Return : FRESULT - Result if moving/renaming was successful or not
* ---------------------------------------------------------------------------
*/
FRESULT f_mkfs (UINT8 drv, UINT8 partition, UINT16 allocsize);
#endif /*FAT_PUBLIC_H_*/
@@ -0,0 +1,244 @@
/* ---------------------------------------------------------------------------
* dosfs_test.c (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jul 29, 2008, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
/* Compiler includes */
#include <string.h>
#include <stdlib.h>
#include "LPC23xx.h"
#include "types.h"
/* FreeRTOS includes */
#include "FreeRTOS.h"
#include "task.h"
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "fat_test.h"
#include "fat_intern.h"
#include "fat_public.h"
#include "fat_diskio.h"
#include "mmc.h"
#include "SerOut.h"
#include "serial.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
UINT8 ff_Write[0x200]; /* used with MMC Write Function */
UINT8 ff_Read[0x200];
UINT8 test_Write[0x200];
UINT8 test_Read1[0x200];
UINT8 test_Read2[0x200];
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
void ffTestStart (void)
{
UINT32 loopcnt;
MmcState_t CardStatus;
/* Clear Terminal Screen with VT100 Command */
serWrite(SerOutPort, sizeof("\x1B[2J"), "\x1B[2J"); /*WARNING don't care*/
MmcInitMedia(); /* Init Card and give Status */
/* Test that write and Read work */
CardStatus = disk_write (0, (pUINT8)ff_Write, 3, 1);
CardStatus = disk_read (0, (pUINT8)ff_Read, 3, 1);
for (loopcnt = 0; loopcnt < 0x200; loopcnt++)
{
if (ff_Write[loopcnt] != ff_Read[loopcnt])
{
debugPrint ("\n\rCompare ERROR");
break;
}
ff_Write[loopcnt] = 0;
ff_Read[loopcnt] = 0;
}
vTaskDelay(1000);
/* ---------------------------------------------------------------------------
* BEGINN FAT TEST SEQUENCE
* ---------------------------------------------------------------------------
*/
/* Mount SD-Card as virtual drive 0 */
FATFS volume_object;
debugPrint ("\n\r-----");
debugPrint ("\n\rMount Volume as Drive 0");
FAT_StatusOut (f_mount (0, &volume_object));
vTaskDelay (100);
/* FILE ACCESS TESTS
* Open a File. If file does not exist, create it
* Close File
* Delete File
*/
FIL file_1; /* create a blank File structure */
debugPrint ("\n\r-----");
debugPrint ("\n\rOpen, Close and Delete a File");
FAT_StatusOut (f_open (&file_1, "test.fil", (FA_CREATE_ALWAYS)));
FAT_StatusOut (f_close (&file_1));
FAT_StatusOut (f_unlink ("test.fil"));
vTaskDelay (100);
/* DIRECTORY ACCESS TESTS
* Create a subdirectory
* Open a File in the subdirectory. If file does not exist, create it
* Sync File
* Leave file opened
*/
debugPrint ("\n\r-----");
debugPrint ("\n\rCreate subdirs, create file in subdir, sync file, delete subdir");
FAT_StatusOut (f_mkdir ("subdir"));
FAT_StatusOut (f_mkdir ("deleteme"));
FAT_StatusOut (f_open (&file_1, "subdir/test.dat", (FA_READ | FA_WRITE | FA_CREATE_ALWAYS)));
FAT_StatusOut (f_sync (&file_1));
FAT_StatusOut (f_unlink ("deleteme"));
vTaskDelay (100);
/* FILE READ/WRITE TESTS
* Read MBR from Disc into an Array
* Open a file. If file does not exist, create it with read and write access
* Write MBR from Array in opened/created file
* Write MBR in already opened file from above (test.dat)
* Sync both files
* Set File Pointer for both files to offset 0x00
* Read both files and compare content with original MBR
* Close both files
*
* Shown with this is that the file system is capable of multifile access
* by usage of the fil information structure.
*/
UINT32 bytes_written;
UINT32 bytes_read;
FIL file_2; /* create a blank File structure */
debugPrint ("\n\r-----");
debugPrint ("\n\rOpen, write and read to files");
disk_read (0, (pUINT8)test_Write, 0, 1);
FAT_StatusOut (f_open (&file_2, "write.txt", (FA_WRITE | FA_READ | FA_CREATE_ALWAYS)));
FAT_StatusOut (f_write (&file_2, &test_Write, 0x200, &bytes_written));
FAT_StatusOut (f_write (&file_1, &test_Write, 0x200, &bytes_written));
FAT_StatusOut (f_sync (&file_2));
FAT_StatusOut (f_sync (&file_1));
FAT_StatusOut (f_lseek (&file_2, 0x00));
FAT_StatusOut (f_lseek (&file_1, 0x00));
FAT_StatusOut (f_read (&file_2, &test_Read1, 0x200, &bytes_read));
FAT_StatusOut (f_read (&file_1, &test_Read2, 0x200, &bytes_read));
for (loopcnt = 0; loopcnt < 0x200; loopcnt++)
{
if ((test_Write[loopcnt] != test_Read1[loopcnt])
|| (test_Write[loopcnt] != test_Read2[loopcnt]))
{
/* Strings are not equal */
debugPrint ("\n\rCompare Error");
break;
}
}
FAT_StatusOut (f_close (&file_2));
FAT_StatusOut (f_close (&file_1));
vTaskDelay (100);
/* RENAMING FILE AND DIRECTORY
* Create two files and two Directories
* Rename a File
* Rename a Directory
* Move a File
* Move a Directory
* Combine moving with renaming
* Close both files
*/
debugPrint ("\n\r-----");
debugPrint ("\n\rCreate, Rename and Move each a file and a directory");
FAT_StatusOut (f_open (&file_1, "rename1.old", (FA_CREATE_ALWAYS)));
FAT_StatusOut (f_open (&file_2, "rename2.old", (FA_CREATE_ALWAYS)));
FAT_StatusOut (f_mkdir ("renameme"));
FAT_StatusOut (f_mkdir ("movehere"));
FAT_StatusOut (f_rename ("rename1.old", "renamed1.new"));
FAT_StatusOut (f_rename ("renameme", "renamed"));
FAT_StatusOut (f_rename ("renamed1.new", "movehere/renamed1.new"));
FAT_StatusOut (f_rename ("renamed", "movehere/renamed"));
FAT_StatusOut (f_rename ("rename2.old", "movehere/renamed2.new"));
FAT_StatusOut (f_close (&file_1));
FAT_StatusOut (f_close (&file_2));
vTaskDelay (100);
/* CHANGING FILES
* Open a file. If not available, create it
* change Attributes (SET HIDDEN, set READ ONLY, clear ARCHIVE)
*/
debugPrint ("\n\r-----");
debugPrint ("\n\rChange Attributes");
FAT_StatusOut (f_open (&file_1, "attr.dat", (FA_READ | FA_WRITE | FA_CREATE_ALWAYS)));
FAT_StatusOut (f_chmod ("attr.dat", (AR_HID | AR_RDO), (AR_HID | AR_RDO | AR_ARC)));
FAT_StatusOut (f_close (&file_1));
vTaskDelay (100);
/* DO A SPEED TEST
* Fill write array with signs
* Open "speed.txt. If file does not exist, create it with write access
* Write Buffer x-Times to the speed.txt
*/
UINT8 character = 48;
debugPrint ("\n\r-----");
debugPrint ("\n\rSpeed Test");
for (loopcnt = 0; loopcnt < 0x200; loopcnt++)
{
ff_Write[loopcnt] = character;
}
FAT_StatusOut (f_open (&file_1, "speed.txt", (FA_WRITE | FA_OPEN_ALWAYS)));
for (loopcnt = 0; loopcnt < 20000; loopcnt++)
{
f_write (&file_1, &ff_Write, 0x200, &bytes_written);
}
FAT_StatusOut (f_close (&file_1));
debugPrint ("\n\rREADY!!!");
}
@@ -0,0 +1,56 @@
/* ---------------------------------------------------------------------------
* dosfs_test.h (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jul 29, 2008, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef DOSFS_TEST_H_
#define DOSFS_TEST_H_
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
#include "LPC23xx.h"
#include "types.h"
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "FAT_intern.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
void ffTestStart (void);
#endif /*DOSFS_TEST_H_*/
@@ -0,0 +1,79 @@
/* ---------------------------------------------------------------------------
* fat_time.c (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Aug 11, 2008, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* System include files
* ---------------------------------------------------------------------------
*/
#include "LPC23xx.h"
#include "types.h"
/* ---------------------------------------------------------------------------
* Application include files
* ---------------------------------------------------------------------------
*/
#include "rtc.h"
/* ---------------------------------------------------------------------------
* Local constant and macro definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Global variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local variable definitions
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Local function definitions
* ---------------------------------------------------------------------------
*/
UINT32 get_fattime (void)
{
UINT32 complete_time;
UINT16 time;
UINT16 date;
t_rtc rtcReadValue;
rtcRead (&rtcReadValue);
/* Read and calculate time stamps from RTC for the FAT time stamps */
time =((rtcReadValue.hour << 11) /* Add hours (5 Bits) */
|(rtcReadValue.min << 5) /* Add minutes (6 Bits) */
|(rtcReadValue.sec / 2) /* Add seconds (5 Bits) (* 2) */
); /* Seconds with resolution of 2 */
/* Read and calculate date stamps from RTC for the FAT date stamps */
date =(((rtcReadValue.year - 1980) << 9) /* Add year (7 Bits) */
|(rtcReadValue.mon << 5) /* Add month (4 Bits) */
|(rtcReadValue.day) /* Add day (5 Bits) */
); /* Year since in 1980 */
/* Calculate a 32 Bit value used by the FAT system */
complete_time = ((date << 16) | time);
return (complete_time);
}
@@ -0,0 +1,64 @@
/* ---------------------------------------------------------------------------
* fat_time.h (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Aug 11, 2008, MMi
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef FAT_TIME_H_
#define FAT_TIME_H_
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
#include "LPC23xx.h"
#include "types.h"
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function: get_fattime
*
* Function to read time from RTC and format values into needed 32 Bit value
*
* Parameters: void
*
* Return : UINT32 - Time value
* ---------------------------------------------------------------------------
*/
UINT32 get_fattime (void);
#endif /*FAT_TIME_H_*/