mirror of
https://github.com/dougg3/mac-rom-simm-programmer.git
synced 2026-01-22 18:16:04 +00:00
Fix line endings
A whole bunch of files in this project had DOS line endings. This is due to how I started working on it on a Windows machine with little Git experience. Now it's inconsistent so I'm fixing it.
This commit is contained in:
582
.cproject
582
.cproject
@@ -1,291 +1,291 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="de.innot.avreclipse.configuration.app.debug.1674332705">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.configuration.app.debug.1674332705" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" description="" id="de.innot.avreclipse.configuration.app.debug.1674332705" name="Debug" parent="de.innot.avreclipse.configuration.app.debug">
|
||||
<folderInfo id="de.innot.avreclipse.configuration.app.debug.1674332705." name="/" resourcePath="">
|
||||
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.debug.1454585760" name="AVR-GCC Toolchain" superClass="de.innot.avreclipse.toolchain.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.debug.511484921" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.debug.102499711" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.debug.1447923913" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug.839780790" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug.1298864252" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug"/>
|
||||
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.debug.319856793" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.debug"/>
|
||||
<builder buildPath="${workspace_loc:/SIMMProgrammer/Debug}" id="de.innot.avreclipse.target.builder.winavr.app.debug.531166446" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.debug.1341917862" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.assembler.option.debug.level.990051736" name="Generate Debugging Info" superClass="de.innot.avreclipse.assembler.option.debug.level"/>
|
||||
<inputType id="de.innot.avreclipse.tool.assembler.input.207805478" superClass="de.innot.avreclipse.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.debug.1123922496" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.compiler.option.debug.level.1719005254" name="Generate Debugging Info" superClass="de.innot.avreclipse.compiler.option.debug.level"/>
|
||||
<option id="de.innot.avreclipse.compiler.option.optimize.1096379855" name="Optimization Level" superClass="de.innot.avreclipse.compiler.option.optimize"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="de.innot.avreclipse.compiler.option.def.212979603" name="Define Syms (-D)" superClass="de.innot.avreclipse.compiler.option.def" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="USB_DEVICE_ONLY"/>
|
||||
<listOptionValue builtIn="false" value="F_USB=16000000"/>
|
||||
<listOptionValue builtIn="false" value="DEVICE_STATE_AS_GPIOR=0"/>
|
||||
<listOptionValue builtIn="false" value="ORDERED_EP_CONFIG"/>
|
||||
<listOptionValue builtIn="false" value="FIXED_CONTROL_ENDPOINT_SIZE=8"/>
|
||||
<listOptionValue builtIn="false" value="FIXED_NUM_CONFIGURATIONS=1"/>
|
||||
<listOptionValue builtIn="false" value="USE_FLASH_DESCRIPTORS"/>
|
||||
<listOptionValue builtIn="false" value="USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)""/>
|
||||
</option>
|
||||
<option id="de.innot.avreclipse.compiler.option.otherflags.1513967861" name="Other flags" superClass="de.innot.avreclipse.compiler.option.otherflags" value="-ffunction-sections -fdata-sections" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="de.innot.avreclipse.compiler.option.incpath.173462079" superClass="de.innot.avreclipse.compiler.option.incpath" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/SIMMProgrammer/hal/at90usb646}""/>
|
||||
</option>
|
||||
<inputType id="de.innot.avreclipse.compiler.winavr.input.1367172122" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cppcompiler.app.debug.24092953" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.debug">
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.917276956" name="Generate Debugging Info" superClass="de.innot.avreclipse.cppcompiler.option.debug.level"/>
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.optimize.1022518531" name="Optimization Level" superClass="de.innot.avreclipse.cppcompiler.option.optimize"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.linker.winavr.app.debug.806884166" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.linker.option.otherlinkargs.1714687929" name="Other Arguments" superClass="de.innot.avreclipse.linker.option.otherlinkargs" value="-Wl,--gc-sections" valueType="string"/>
|
||||
<inputType id="de.innot.avreclipse.tool.linker.input.1020880987" name="OBJ Files" superClass="de.innot.avreclipse.tool.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cpplinker.app.debug.198227335" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.1956389786" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.debug.1166552106" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug.1427404113" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.debug.2030541034" name="AVR Create EEPROM image" superClass="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.size.winavr.app.debug.335508392" name="Print Size" superClass="de.innot.avreclipse.tool.size.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.avrdude.app.debug.403293383" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.debug"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="tests"/>
|
||||
<entry excluding="tests" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="de.innot.avreclipse.configuration.app.release.1163010375">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.configuration.app.release.1163010375" 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.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" description="" id="de.innot.avreclipse.configuration.app.release.1163010375" name="Release" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="de.innot.avreclipse.configuration.app.release" postannouncebuildStep="Generate BIN file for firmware flashing" postbuildStep="avr-objcopy -R .eeprom -O binary ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin">
|
||||
<folderInfo id="de.innot.avreclipse.configuration.app.release.1163010375." name="/" resourcePath="">
|
||||
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.release.405615296" name="AVR-GCC Toolchain" superClass="de.innot.avreclipse.toolchain.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release.1550189649" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.release.804255150" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.release.498398371" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.release.544896205" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release.1698397894" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release"/>
|
||||
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.release.203303297" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.release"/>
|
||||
<builder buildPath="${workspace_loc:/SIMMProgrammer/Release}" id="de.innot.avreclipse.target.builder.winavr.app.release.596686773" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.release.1168333362" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.assembler.option.debug.level.334865401" name="Generate Debugging Info" superClass="de.innot.avreclipse.assembler.option.debug.level" value="de.innot.avreclipse.assembler.option.debug.level.none" valueType="enumerated"/>
|
||||
<inputType id="de.innot.avreclipse.tool.assembler.input.1202935293" superClass="de.innot.avreclipse.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.release.883804772" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.compiler.option.debug.level.369847490" name="Generate Debugging Info" superClass="de.innot.avreclipse.compiler.option.debug.level" value="de.innot.avreclipse.compiler.option.debug.level.none" valueType="enumerated"/>
|
||||
<option id="de.innot.avreclipse.compiler.option.optimize.471434010" name="Optimization Level" superClass="de.innot.avreclipse.compiler.option.optimize" value="de.innot.avreclipse.compiler.optimize.size" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="de.innot.avreclipse.compiler.option.def.1514251723" name="Define Syms (-D)" superClass="de.innot.avreclipse.compiler.option.def" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="USB_DEVICE_ONLY"/>
|
||||
<listOptionValue builtIn="false" value="F_USB=16000000"/>
|
||||
<listOptionValue builtIn="false" value="DEVICE_STATE_AS_GPIOR=0"/>
|
||||
<listOptionValue builtIn="false" value="ORDERED_EP_CONFIG"/>
|
||||
<listOptionValue builtIn="false" value="FIXED_CONTROL_ENDPOINT_SIZE=8"/>
|
||||
<listOptionValue builtIn="false" value="FIXED_NUM_CONFIGURATIONS=1"/>
|
||||
<listOptionValue builtIn="false" value="USE_FLASH_DESCRIPTORS"/>
|
||||
<listOptionValue builtIn="false" value="USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)""/>
|
||||
</option>
|
||||
<option id="de.innot.avreclipse.compiler.option.otherflags.1566165436" name="Other flags" superClass="de.innot.avreclipse.compiler.option.otherflags" value="-ffunction-sections -fdata-sections" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="de.innot.avreclipse.compiler.option.incpath.2119807530" superClass="de.innot.avreclipse.compiler.option.incpath" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/SIMMProgrammer/hal/at90usb646}""/>
|
||||
</option>
|
||||
<inputType id="de.innot.avreclipse.compiler.winavr.input.2084198580" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cppcompiler.app.release.912002244" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.release">
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.420222929" name="Generate Debugging Info" superClass="de.innot.avreclipse.cppcompiler.option.debug.level" value="de.innot.avreclipse.cppcompiler.option.debug.level.none" valueType="enumerated"/>
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.optimize.1657124646" name="Optimization Level" superClass="de.innot.avreclipse.cppcompiler.option.optimize" value="de.innot.avreclipse.cppcompiler.optimize.size" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.linker.winavr.app.release.381852607" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.linker.option.otherlinkargs.270243458" name="Other Arguments" superClass="de.innot.avreclipse.linker.option.otherlinkargs" value="-Wl,--gc-sections" valueType="string"/>
|
||||
<inputType id="de.innot.avreclipse.tool.linker.input.567763029" name="OBJ Files" superClass="de.innot.avreclipse.tool.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cpplinker.app.release.929102657" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.534869254" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.release.1162163813" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.release.1254097849" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.release.1435818473" name="AVR Create EEPROM image" superClass="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.size.winavr.app.release.1166766118" name="Print Size" superClass="de.innot.avreclipse.tool.size.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.avrdude.app.release.1179659974" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.release"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="tests"/>
|
||||
<entry excluding="tests" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="SIMMProgrammer.de.innot.avreclipse.project.winavr.elf_2.1.0.1374953899" name="AVR Cross Target Application" projectType="de.innot.avreclipse.project.winavr.elf_2.1.0"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<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.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>
|
||||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.1163010375;de.innot.avreclipse.configuration.app.release.1163010375.;de.innot.avreclipse.tool.compiler.winavr.app.release.883804772;de.innot.avreclipse.compiler.winavr.input.2084198580">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/>
|
||||
<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.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>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.debug.1674332705;de.innot.avreclipse.configuration.app.debug.1674332705.;de.innot.avreclipse.tool.compiler.winavr.app.debug.1123922496;de.innot.avreclipse.compiler.winavr.input.1367172122">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/>
|
||||
<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.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>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cproject>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="de.innot.avreclipse.configuration.app.debug.1674332705">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.configuration.app.debug.1674332705" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" description="" id="de.innot.avreclipse.configuration.app.debug.1674332705" name="Debug" parent="de.innot.avreclipse.configuration.app.debug">
|
||||
<folderInfo id="de.innot.avreclipse.configuration.app.debug.1674332705." name="/" resourcePath="">
|
||||
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.debug.1454585760" name="AVR-GCC Toolchain" superClass="de.innot.avreclipse.toolchain.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.debug.511484921" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.debug.102499711" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.debug.1447923913" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug.839780790" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.debug"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug.1298864252" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.debug"/>
|
||||
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.debug.319856793" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.debug"/>
|
||||
<builder buildPath="${workspace_loc:/SIMMProgrammer/Debug}" id="de.innot.avreclipse.target.builder.winavr.app.debug.531166446" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.debug.1341917862" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.assembler.option.debug.level.990051736" name="Generate Debugging Info" superClass="de.innot.avreclipse.assembler.option.debug.level"/>
|
||||
<inputType id="de.innot.avreclipse.tool.assembler.input.207805478" superClass="de.innot.avreclipse.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.debug.1123922496" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.compiler.option.debug.level.1719005254" name="Generate Debugging Info" superClass="de.innot.avreclipse.compiler.option.debug.level"/>
|
||||
<option id="de.innot.avreclipse.compiler.option.optimize.1096379855" name="Optimization Level" superClass="de.innot.avreclipse.compiler.option.optimize"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="de.innot.avreclipse.compiler.option.def.212979603" name="Define Syms (-D)" superClass="de.innot.avreclipse.compiler.option.def" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="USB_DEVICE_ONLY"/>
|
||||
<listOptionValue builtIn="false" value="F_USB=16000000"/>
|
||||
<listOptionValue builtIn="false" value="DEVICE_STATE_AS_GPIOR=0"/>
|
||||
<listOptionValue builtIn="false" value="ORDERED_EP_CONFIG"/>
|
||||
<listOptionValue builtIn="false" value="FIXED_CONTROL_ENDPOINT_SIZE=8"/>
|
||||
<listOptionValue builtIn="false" value="FIXED_NUM_CONFIGURATIONS=1"/>
|
||||
<listOptionValue builtIn="false" value="USE_FLASH_DESCRIPTORS"/>
|
||||
<listOptionValue builtIn="false" value="USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)""/>
|
||||
</option>
|
||||
<option id="de.innot.avreclipse.compiler.option.otherflags.1513967861" name="Other flags" superClass="de.innot.avreclipse.compiler.option.otherflags" value="-ffunction-sections -fdata-sections" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="de.innot.avreclipse.compiler.option.incpath.173462079" superClass="de.innot.avreclipse.compiler.option.incpath" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/SIMMProgrammer/hal/at90usb646}""/>
|
||||
</option>
|
||||
<inputType id="de.innot.avreclipse.compiler.winavr.input.1367172122" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cppcompiler.app.debug.24092953" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.debug">
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.917276956" name="Generate Debugging Info" superClass="de.innot.avreclipse.cppcompiler.option.debug.level"/>
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.optimize.1022518531" name="Optimization Level" superClass="de.innot.avreclipse.cppcompiler.option.optimize"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.linker.winavr.app.debug.806884166" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.debug">
|
||||
<option id="de.innot.avreclipse.linker.option.otherlinkargs.1714687929" name="Other Arguments" superClass="de.innot.avreclipse.linker.option.otherlinkargs" value="-Wl,--gc-sections" valueType="string"/>
|
||||
<inputType id="de.innot.avreclipse.tool.linker.input.1020880987" name="OBJ Files" superClass="de.innot.avreclipse.tool.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cpplinker.app.debug.198227335" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.1956389786" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.debug.1166552106" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug.1427404113" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.debug.2030541034" name="AVR Create EEPROM image" superClass="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.size.winavr.app.debug.335508392" name="Print Size" superClass="de.innot.avreclipse.tool.size.winavr.app.debug"/>
|
||||
<tool id="de.innot.avreclipse.tool.avrdude.app.debug.403293383" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.debug"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="tests"/>
|
||||
<entry excluding="tests" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="de.innot.avreclipse.configuration.app.release.1163010375">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.configuration.app.release.1163010375" 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.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="de.innot.avreclipse.buildArtefactType.app" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=de.innot.avreclipse.buildArtefactType.app,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" description="" id="de.innot.avreclipse.configuration.app.release.1163010375" name="Release" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=" parent="de.innot.avreclipse.configuration.app.release" postannouncebuildStep="Generate BIN file for firmware flashing" postbuildStep="avr-objcopy -R .eeprom -O binary ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin">
|
||||
<folderInfo id="de.innot.avreclipse.configuration.app.release.1163010375." name="/" resourcePath="">
|
||||
<toolChain id="de.innot.avreclipse.toolchain.winavr.app.release.405615296" name="AVR-GCC Toolchain" superClass="de.innot.avreclipse.toolchain.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release.1550189649" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.release.804255150" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.release.498398371" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.app.release.544896205" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size.app.release"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release.1698397894" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude.app.release"/>
|
||||
<targetPlatform id="de.innot.avreclipse.targetplatform.winavr.app.release.203303297" name="AVR Cross-Target" superClass="de.innot.avreclipse.targetplatform.winavr.app.release"/>
|
||||
<builder buildPath="${workspace_loc:/SIMMProgrammer/Release}" id="de.innot.avreclipse.target.builder.winavr.app.release.596686773" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.assembler.winavr.app.release.1168333362" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.assembler.option.debug.level.334865401" name="Generate Debugging Info" superClass="de.innot.avreclipse.assembler.option.debug.level" value="de.innot.avreclipse.assembler.option.debug.level.none" valueType="enumerated"/>
|
||||
<inputType id="de.innot.avreclipse.tool.assembler.input.1202935293" superClass="de.innot.avreclipse.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.compiler.winavr.app.release.883804772" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.compiler.option.debug.level.369847490" name="Generate Debugging Info" superClass="de.innot.avreclipse.compiler.option.debug.level" value="de.innot.avreclipse.compiler.option.debug.level.none" valueType="enumerated"/>
|
||||
<option id="de.innot.avreclipse.compiler.option.optimize.471434010" name="Optimization Level" superClass="de.innot.avreclipse.compiler.option.optimize" value="de.innot.avreclipse.compiler.optimize.size" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="de.innot.avreclipse.compiler.option.def.1514251723" name="Define Syms (-D)" superClass="de.innot.avreclipse.compiler.option.def" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="USB_DEVICE_ONLY"/>
|
||||
<listOptionValue builtIn="false" value="F_USB=16000000"/>
|
||||
<listOptionValue builtIn="false" value="DEVICE_STATE_AS_GPIOR=0"/>
|
||||
<listOptionValue builtIn="false" value="ORDERED_EP_CONFIG"/>
|
||||
<listOptionValue builtIn="false" value="FIXED_CONTROL_ENDPOINT_SIZE=8"/>
|
||||
<listOptionValue builtIn="false" value="FIXED_NUM_CONFIGURATIONS=1"/>
|
||||
<listOptionValue builtIn="false" value="USE_FLASH_DESCRIPTORS"/>
|
||||
<listOptionValue builtIn="false" value="USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)""/>
|
||||
</option>
|
||||
<option id="de.innot.avreclipse.compiler.option.otherflags.1566165436" name="Other flags" superClass="de.innot.avreclipse.compiler.option.otherflags" value="-ffunction-sections -fdata-sections" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="de.innot.avreclipse.compiler.option.incpath.2119807530" superClass="de.innot.avreclipse.compiler.option.incpath" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/SIMMProgrammer/hal/at90usb646}""/>
|
||||
</option>
|
||||
<inputType id="de.innot.avreclipse.compiler.winavr.input.2084198580" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cppcompiler.app.release.912002244" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.app.release">
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.debug.level.420222929" name="Generate Debugging Info" superClass="de.innot.avreclipse.cppcompiler.option.debug.level" value="de.innot.avreclipse.cppcompiler.option.debug.level.none" valueType="enumerated"/>
|
||||
<option id="de.innot.avreclipse.cppcompiler.option.optimize.1657124646" name="Optimization Level" superClass="de.innot.avreclipse.cppcompiler.option.optimize" value="de.innot.avreclipse.cppcompiler.optimize.size" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.linker.winavr.app.release.381852607" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.app.release">
|
||||
<option id="de.innot.avreclipse.linker.option.otherlinkargs.270243458" name="Other Arguments" superClass="de.innot.avreclipse.linker.option.otherlinkargs" value="-Wl,--gc-sections" valueType="string"/>
|
||||
<inputType id="de.innot.avreclipse.tool.linker.input.567763029" name="OBJ Files" superClass="de.innot.avreclipse.tool.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cpplinker.app.release.929102657" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.534869254" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.objdump.winavr.app.release.1162163813" name="AVR Create Extended Listing" superClass="de.innot.avreclipse.tool.objdump.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.flash.winavr.app.release.1254097849" name="AVR Create Flash image" superClass="de.innot.avreclipse.tool.objcopy.flash.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.release.1435818473" name="AVR Create EEPROM image" superClass="de.innot.avreclipse.tool.objcopy.eeprom.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.size.winavr.app.release.1166766118" name="Print Size" superClass="de.innot.avreclipse.tool.size.winavr.app.release"/>
|
||||
<tool id="de.innot.avreclipse.tool.avrdude.app.release.1179659974" name="AVRDude" superClass="de.innot.avreclipse.tool.avrdude.app.release"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="tests"/>
|
||||
<entry excluding="tests" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="SIMMProgrammer.de.innot.avreclipse.project.winavr.elf_2.1.0.1374953899" name="AVR Cross Target Application" projectType="de.innot.avreclipse.project.winavr.elf_2.1.0"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<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.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>
|
||||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.release.1163010375;de.innot.avreclipse.configuration.app.release.1163010375.;de.innot.avreclipse.tool.compiler.winavr.app.release.883804772;de.innot.avreclipse.compiler.winavr.input.2084198580">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/>
|
||||
<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.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>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.configuration.app.debug.1674332705;de.innot.avreclipse.configuration.app.debug.1674332705.;de.innot.avreclipse.tool.compiler.winavr.app.debug.1123922496;de.innot.avreclipse.compiler.winavr.input.1367172122">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/>
|
||||
<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.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>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cproject>
|
||||
|
||||
166
.project
166
.project
@@ -1,83 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>SIMMProgrammer</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||
<value>${workspace_loc:/SIMMProgrammer/Release}</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>de.innot.avreclipse.core.avrnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>SIMMProgrammer</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>?name?</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.append_environment</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||
<value></value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||
<value>make</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
||||
<value>${workspace_loc:/SIMMProgrammer/Release}</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||
<value>clean</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.contents</key>
|
||||
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||
<value>false</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
|
||||
<value>all</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.stopOnError</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
<dictionary>
|
||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||
<value>true</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>de.innot.avreclipse.core.avrnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
#Sat Mar 03 13:46:14 PST 2012
|
||||
avrtarget/ClockFrequency=16000000
|
||||
avrtarget/ExtRAMSize=0
|
||||
avrtarget/ExtendedRAM=false
|
||||
avrtarget/MCUType=at90usb646
|
||||
avrtarget/UseEEPROM=false
|
||||
avrtarget/UseExtendedRAMforHeap=true
|
||||
avrtarget/avrdude/BitBangDelay=
|
||||
avrtarget/avrdude/Bitclock=
|
||||
avrtarget/avrdude/EEPROMFile=
|
||||
avrtarget/avrdude/EEPROMFromConfig=true
|
||||
avrtarget/avrdude/FlashFile=
|
||||
avrtarget/avrdude/FlashFromConfig=true
|
||||
avrtarget/avrdude/Fuses/ByteValues=223\:208\:248
|
||||
avrtarget/avrdude/Fuses/FileName=
|
||||
avrtarget/avrdude/Fuses/MCUid=at90usb646
|
||||
avrtarget/avrdude/Fuses/UseFile=false
|
||||
avrtarget/avrdude/Fuses/Write=true
|
||||
avrtarget/avrdude/Locks/ByteValues=-1
|
||||
avrtarget/avrdude/Locks/FileName=
|
||||
avrtarget/avrdude/Locks/MCUid=at90usb646
|
||||
avrtarget/avrdude/Locks/UseFile=false
|
||||
avrtarget/avrdude/Locks/Write=false
|
||||
avrtarget/avrdude/NoChipErase=false
|
||||
avrtarget/avrdude/NoSigCheck=false
|
||||
avrtarget/avrdude/NoVerify=false
|
||||
avrtarget/avrdude/NoWrite=false
|
||||
avrtarget/avrdude/OtherOptions=
|
||||
avrtarget/avrdude/ProgrammerID=programmerconfig.1
|
||||
avrtarget/avrdude/UseCounter=false
|
||||
avrtarget/avrdude/WriteEEPROM=false
|
||||
avrtarget/avrdude/WriteFlash=true
|
||||
avrtarget/perConfig=false
|
||||
eclipse.preferences.version=1
|
||||
#Sat Mar 03 13:46:14 PST 2012
|
||||
avrtarget/ClockFrequency=16000000
|
||||
avrtarget/ExtRAMSize=0
|
||||
avrtarget/ExtendedRAM=false
|
||||
avrtarget/MCUType=at90usb646
|
||||
avrtarget/UseEEPROM=false
|
||||
avrtarget/UseExtendedRAMforHeap=true
|
||||
avrtarget/avrdude/BitBangDelay=
|
||||
avrtarget/avrdude/Bitclock=
|
||||
avrtarget/avrdude/EEPROMFile=
|
||||
avrtarget/avrdude/EEPROMFromConfig=true
|
||||
avrtarget/avrdude/FlashFile=
|
||||
avrtarget/avrdude/FlashFromConfig=true
|
||||
avrtarget/avrdude/Fuses/ByteValues=223\:208\:248
|
||||
avrtarget/avrdude/Fuses/FileName=
|
||||
avrtarget/avrdude/Fuses/MCUid=at90usb646
|
||||
avrtarget/avrdude/Fuses/UseFile=false
|
||||
avrtarget/avrdude/Fuses/Write=true
|
||||
avrtarget/avrdude/Locks/ByteValues=-1
|
||||
avrtarget/avrdude/Locks/FileName=
|
||||
avrtarget/avrdude/Locks/MCUid=at90usb646
|
||||
avrtarget/avrdude/Locks/UseFile=false
|
||||
avrtarget/avrdude/Locks/Write=false
|
||||
avrtarget/avrdude/NoChipErase=false
|
||||
avrtarget/avrdude/NoSigCheck=false
|
||||
avrtarget/avrdude/NoVerify=false
|
||||
avrtarget/avrdude/NoWrite=false
|
||||
avrtarget/avrdude/OtherOptions=
|
||||
avrtarget/avrdude/ProgrammerID=programmerconfig.1
|
||||
avrtarget/avrdude/UseCounter=false
|
||||
avrtarget/avrdude/WriteEEPROM=false
|
||||
avrtarget/avrdude/WriteFlash=true
|
||||
avrtarget/perConfig=false
|
||||
eclipse.preferences.version=1
|
||||
|
||||
678
LICENSE.txt
678
LICENSE.txt
@@ -1,339 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
||||
78
chip_id.h
78
chip_id.h
@@ -1,39 +1,39 @@
|
||||
/*
|
||||
* chip_id.h
|
||||
*
|
||||
* Created on: Dec 10, 2011
|
||||
* Author: Doug
|
||||
*
|
||||
* Copyright (C) 2011-2020 Doug Brown
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CHIP_ID_H_
|
||||
#define CHIP_ID_H_
|
||||
|
||||
#define SST_GREENLIANT 0xBF
|
||||
#define GLS29EE010 0x07
|
||||
#define GLS29SF020 0x24
|
||||
#define GLS29SF040 0x13
|
||||
#define SST39SF010A 0xB5
|
||||
#define SST39SF020A 0xB6
|
||||
#define SST39SF040 0xB7
|
||||
|
||||
#define AMD 0x01
|
||||
#define AM29F040B 0xA4
|
||||
|
||||
#endif /* CHIP_ID_H_ */
|
||||
/*
|
||||
* chip_id.h
|
||||
*
|
||||
* Created on: Dec 10, 2011
|
||||
* Author: Doug
|
||||
*
|
||||
* Copyright (C) 2011-2020 Doug Brown
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CHIP_ID_H_
|
||||
#define CHIP_ID_H_
|
||||
|
||||
#define SST_GREENLIANT 0xBF
|
||||
#define GLS29EE010 0x07
|
||||
#define GLS29SF020 0x24
|
||||
#define GLS29SF040 0x13
|
||||
#define SST39SF010A 0xB5
|
||||
#define SST39SF020A 0xB6
|
||||
#define SST39SF040 0xB7
|
||||
|
||||
#define AMD 0x01
|
||||
#define AM29F040B 0xA4
|
||||
|
||||
#endif /* CHIP_ID_H_ */
|
||||
|
||||
@@ -1,212 +1,212 @@
|
||||
/*
|
||||
* mcp23s17.c
|
||||
*
|
||||
* Created on: Nov 25, 2011
|
||||
* Author: Doug
|
||||
*
|
||||
* Copyright (C) 2011-2020 Doug Brown
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mcp23s17.h"
|
||||
#include "hardware.h"
|
||||
|
||||
/// Maximum SPI clock rate = 10 MHz
|
||||
#define MCP23S17_MAX_CLOCK 10000000UL
|
||||
|
||||
static void MCP23S17_WriteBothRegs(MCP23S17 *mcp, uint8_t addrA, uint16_t value);
|
||||
static uint16_t MCP23S17_ReadBothRegs(MCP23S17 *mcp, uint8_t addrA);
|
||||
|
||||
/** Initializes an MCP23S17 object
|
||||
*
|
||||
* @param mcp The MCP23S17 object to initialize
|
||||
* @param resetPin The GPIO pin hooked to the reset input
|
||||
*/
|
||||
void MCP23S17_Init(MCP23S17 *mcp, GPIOPin resetPin)
|
||||
{
|
||||
SPI_InitDevice(&mcp->spi, MCP23S17_MAX_CLOCK, SPI_MODE_0);
|
||||
|
||||
// Do a reset pulse if we need to. No need to save the reset pin
|
||||
// after that.
|
||||
if (!GPIO_IsNull(resetPin))
|
||||
{
|
||||
GPIO_SetDirection(resetPin, true);
|
||||
GPIO_SetOff(resetPin);
|
||||
DelayUS(1);
|
||||
GPIO_SetOn(resetPin);
|
||||
DelayUS(1);
|
||||
}
|
||||
}
|
||||
|
||||
/** Begins a set of transactions with the MCP23S17.
|
||||
*
|
||||
* @param mcp The MCP23S17 to talk with
|
||||
*
|
||||
* You have to call this before using any of the MCP23S17 functions other than
|
||||
* init. This takes control of the SPI bus. If the MCP23S17 is the only device
|
||||
* on the bus, you can just call this once in the program. Otherwise, you should
|
||||
* release it as soon as you're done so other SPI devices can use the bus instead.
|
||||
*/
|
||||
void MCP23S17_Begin(MCP23S17 *mcp)
|
||||
{
|
||||
SPI_RequestBus(&mcp->spi);
|
||||
}
|
||||
|
||||
/** Ends a set of transactions with the MCP23S17.
|
||||
*
|
||||
* @param mcp The MCP23S17 to release
|
||||
*
|
||||
* You should call this when you're done talking to the MCP23S17 to free up the
|
||||
* SPI bus for other devices.
|
||||
*/
|
||||
void MCP23S17_End(MCP23S17 *mcp)
|
||||
{
|
||||
SPI_ReleaseBus(&mcp->spi);
|
||||
}
|
||||
|
||||
/** Sets the data direction register in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @param ddr Bitmask representing direction of the 16 GPIO pins (1 = output, 0 = input)
|
||||
*/
|
||||
void MCP23S17_SetDDR(MCP23S17 *mcp, uint16_t ddr)
|
||||
{
|
||||
// The MCP23S17's DDR is backwards from most other chips. I like dealing
|
||||
// with it so it behaves like other MCUs, so I invert any DDR values in this
|
||||
// driver. In other words, when you set or get the DDR through this driver,
|
||||
// the 1s and 0s are backwards from what the MCP23S17's datasheet says, but
|
||||
// they are consistent with most MCUs. I value the consistency more.
|
||||
MCP23S17_WriteBothRegs(mcp, MCP23S17_IODIRA, ~ddr);
|
||||
}
|
||||
|
||||
/** Reads the data direction register in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @return Bitmask representing direction of the 16 GPIO pins (1 = output, 0 = input)
|
||||
*/
|
||||
uint16_t MCP23S17_DDR(MCP23S17 *mcp)
|
||||
{
|
||||
// As I mentioned above, DDR bits are inverted from what the MCP23S17's
|
||||
// datasheet says, but consistent with most MCUs
|
||||
return ~MCP23S17_ReadBothRegs(mcp, MCP23S17_IODIRA);
|
||||
}
|
||||
|
||||
/** Sets the output values in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @param data Bitmask representing output state of the 16 GPIO pins (1 = high, 0 = low)
|
||||
*/
|
||||
void MCP23S17_SetOutputs(MCP23S17 *mcp, uint16_t data)
|
||||
{
|
||||
MCP23S17_WriteBothRegs(mcp, MCP23S17_GPIOA, data);
|
||||
}
|
||||
|
||||
/** Gets the current output values in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @return Bitmask representing output state of the 16 GPIO pins (1 = high, 0 = low)
|
||||
*/
|
||||
uint16_t MCP23S17_Outputs(MCP23S17 *mcp)
|
||||
{
|
||||
return MCP23S17_ReadBothRegs(mcp, MCP23S17_OLATA);
|
||||
}
|
||||
|
||||
/** Reads the current input values in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @return Bitmask representing input state of the 16 GPIO pins (1 = high, 0 = low)
|
||||
*/
|
||||
uint16_t MCP23S17_ReadInputs(MCP23S17 *mcp)
|
||||
{
|
||||
return MCP23S17_ReadBothRegs(mcp, MCP23S17_GPIOA);
|
||||
}
|
||||
|
||||
/** Enables/disables pullups in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @param pullups Bitmask representing which input pins should have pullups enabled.
|
||||
*/
|
||||
void MCP23S17_SetPullups(MCP23S17 *mcp, uint16_t pullups)
|
||||
{
|
||||
MCP23S17_WriteBothRegs(mcp, MCP23S17_GPPUA, pullups);
|
||||
}
|
||||
|
||||
/** Reads the current pullup state in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* return Bitmask representing which input pins have pullups enabled.
|
||||
*/
|
||||
uint16_t MCP23S17_Pullups(MCP23S17 *mcp)
|
||||
{
|
||||
return MCP23S17_ReadBothRegs(mcp, MCP23S17_GPPUA);
|
||||
}
|
||||
|
||||
/** Helper function that writes two consecutive registers in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @param addrA The address of the first ("A") register
|
||||
* @param value The value to write to the A and B registers. High byte = A, low byte = B
|
||||
*/
|
||||
static void MCP23S17_WriteBothRegs(MCP23S17 *mcp, uint8_t addrA, uint16_t value)
|
||||
{
|
||||
// addrA should contain the address of the "A" register.
|
||||
// the chip should also be in "same bank" mode.
|
||||
SPI_Assert(&mcp->spi);
|
||||
|
||||
// Start off the communication by telling the MCP23S17 that we are writing to a register
|
||||
SPI_RWByte(&mcp->spi, MCP23S17_CONTROL_WRITE(0));
|
||||
|
||||
// Tell it the first register we're writing to (the "A" register)
|
||||
SPI_RWByte(&mcp->spi, addrA);
|
||||
|
||||
// Write the first byte of the register
|
||||
SPI_RWByte(&mcp->spi, (uint8_t)((value >> 8) & 0xFF));
|
||||
|
||||
// It should auto-increment to the "B" register, now write that
|
||||
SPI_RWByte(&mcp->spi, (uint8_t)(value & 0xFF));
|
||||
|
||||
SPI_Deassert(&mcp->spi);
|
||||
}
|
||||
|
||||
/** Helper function that reads two consecutive registers in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @param addrA The address of the first ("A") register
|
||||
* @return The value read back from the A and B registers. High byte = A, low byte = B
|
||||
*/
|
||||
static uint16_t MCP23S17_ReadBothRegs(MCP23S17 *mcp, uint8_t addrA)
|
||||
{
|
||||
uint16_t returnVal;
|
||||
|
||||
SPI_Assert(&mcp->spi);
|
||||
|
||||
// Start off the communication by telling the MCP23S17 that we are reading from a register
|
||||
SPI_RWByte(&mcp->spi, MCP23S17_CONTROL_READ(0));
|
||||
|
||||
// Tell it which register we're reading from (the "A" register)
|
||||
SPI_RWByte(&mcp->spi, addrA);
|
||||
|
||||
// Read the first byte of the register
|
||||
returnVal = (((uint16_t)SPI_RWByte(&mcp->spi, 0)) << 8);
|
||||
|
||||
// It should auto-increment to the "B" register, now read that
|
||||
returnVal |= SPI_RWByte(&mcp->spi, 0);
|
||||
|
||||
SPI_Deassert(&mcp->spi);
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
/*
|
||||
* mcp23s17.c
|
||||
*
|
||||
* Created on: Nov 25, 2011
|
||||
* Author: Doug
|
||||
*
|
||||
* Copyright (C) 2011-2020 Doug Brown
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "mcp23s17.h"
|
||||
#include "hardware.h"
|
||||
|
||||
/// Maximum SPI clock rate = 10 MHz
|
||||
#define MCP23S17_MAX_CLOCK 10000000UL
|
||||
|
||||
static void MCP23S17_WriteBothRegs(MCP23S17 *mcp, uint8_t addrA, uint16_t value);
|
||||
static uint16_t MCP23S17_ReadBothRegs(MCP23S17 *mcp, uint8_t addrA);
|
||||
|
||||
/** Initializes an MCP23S17 object
|
||||
*
|
||||
* @param mcp The MCP23S17 object to initialize
|
||||
* @param resetPin The GPIO pin hooked to the reset input
|
||||
*/
|
||||
void MCP23S17_Init(MCP23S17 *mcp, GPIOPin resetPin)
|
||||
{
|
||||
SPI_InitDevice(&mcp->spi, MCP23S17_MAX_CLOCK, SPI_MODE_0);
|
||||
|
||||
// Do a reset pulse if we need to. No need to save the reset pin
|
||||
// after that.
|
||||
if (!GPIO_IsNull(resetPin))
|
||||
{
|
||||
GPIO_SetDirection(resetPin, true);
|
||||
GPIO_SetOff(resetPin);
|
||||
DelayUS(1);
|
||||
GPIO_SetOn(resetPin);
|
||||
DelayUS(1);
|
||||
}
|
||||
}
|
||||
|
||||
/** Begins a set of transactions with the MCP23S17.
|
||||
*
|
||||
* @param mcp The MCP23S17 to talk with
|
||||
*
|
||||
* You have to call this before using any of the MCP23S17 functions other than
|
||||
* init. This takes control of the SPI bus. If the MCP23S17 is the only device
|
||||
* on the bus, you can just call this once in the program. Otherwise, you should
|
||||
* release it as soon as you're done so other SPI devices can use the bus instead.
|
||||
*/
|
||||
void MCP23S17_Begin(MCP23S17 *mcp)
|
||||
{
|
||||
SPI_RequestBus(&mcp->spi);
|
||||
}
|
||||
|
||||
/** Ends a set of transactions with the MCP23S17.
|
||||
*
|
||||
* @param mcp The MCP23S17 to release
|
||||
*
|
||||
* You should call this when you're done talking to the MCP23S17 to free up the
|
||||
* SPI bus for other devices.
|
||||
*/
|
||||
void MCP23S17_End(MCP23S17 *mcp)
|
||||
{
|
||||
SPI_ReleaseBus(&mcp->spi);
|
||||
}
|
||||
|
||||
/** Sets the data direction register in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @param ddr Bitmask representing direction of the 16 GPIO pins (1 = output, 0 = input)
|
||||
*/
|
||||
void MCP23S17_SetDDR(MCP23S17 *mcp, uint16_t ddr)
|
||||
{
|
||||
// The MCP23S17's DDR is backwards from most other chips. I like dealing
|
||||
// with it so it behaves like other MCUs, so I invert any DDR values in this
|
||||
// driver. In other words, when you set or get the DDR through this driver,
|
||||
// the 1s and 0s are backwards from what the MCP23S17's datasheet says, but
|
||||
// they are consistent with most MCUs. I value the consistency more.
|
||||
MCP23S17_WriteBothRegs(mcp, MCP23S17_IODIRA, ~ddr);
|
||||
}
|
||||
|
||||
/** Reads the data direction register in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @return Bitmask representing direction of the 16 GPIO pins (1 = output, 0 = input)
|
||||
*/
|
||||
uint16_t MCP23S17_DDR(MCP23S17 *mcp)
|
||||
{
|
||||
// As I mentioned above, DDR bits are inverted from what the MCP23S17's
|
||||
// datasheet says, but consistent with most MCUs
|
||||
return ~MCP23S17_ReadBothRegs(mcp, MCP23S17_IODIRA);
|
||||
}
|
||||
|
||||
/** Sets the output values in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @param data Bitmask representing output state of the 16 GPIO pins (1 = high, 0 = low)
|
||||
*/
|
||||
void MCP23S17_SetOutputs(MCP23S17 *mcp, uint16_t data)
|
||||
{
|
||||
MCP23S17_WriteBothRegs(mcp, MCP23S17_GPIOA, data);
|
||||
}
|
||||
|
||||
/** Gets the current output values in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @return Bitmask representing output state of the 16 GPIO pins (1 = high, 0 = low)
|
||||
*/
|
||||
uint16_t MCP23S17_Outputs(MCP23S17 *mcp)
|
||||
{
|
||||
return MCP23S17_ReadBothRegs(mcp, MCP23S17_OLATA);
|
||||
}
|
||||
|
||||
/** Reads the current input values in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @return Bitmask representing input state of the 16 GPIO pins (1 = high, 0 = low)
|
||||
*/
|
||||
uint16_t MCP23S17_ReadInputs(MCP23S17 *mcp)
|
||||
{
|
||||
return MCP23S17_ReadBothRegs(mcp, MCP23S17_GPIOA);
|
||||
}
|
||||
|
||||
/** Enables/disables pullups in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @param pullups Bitmask representing which input pins should have pullups enabled.
|
||||
*/
|
||||
void MCP23S17_SetPullups(MCP23S17 *mcp, uint16_t pullups)
|
||||
{
|
||||
MCP23S17_WriteBothRegs(mcp, MCP23S17_GPPUA, pullups);
|
||||
}
|
||||
|
||||
/** Reads the current pullup state in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* return Bitmask representing which input pins have pullups enabled.
|
||||
*/
|
||||
uint16_t MCP23S17_Pullups(MCP23S17 *mcp)
|
||||
{
|
||||
return MCP23S17_ReadBothRegs(mcp, MCP23S17_GPPUA);
|
||||
}
|
||||
|
||||
/** Helper function that writes two consecutive registers in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @param addrA The address of the first ("A") register
|
||||
* @param value The value to write to the A and B registers. High byte = A, low byte = B
|
||||
*/
|
||||
static void MCP23S17_WriteBothRegs(MCP23S17 *mcp, uint8_t addrA, uint16_t value)
|
||||
{
|
||||
// addrA should contain the address of the "A" register.
|
||||
// the chip should also be in "same bank" mode.
|
||||
SPI_Assert(&mcp->spi);
|
||||
|
||||
// Start off the communication by telling the MCP23S17 that we are writing to a register
|
||||
SPI_RWByte(&mcp->spi, MCP23S17_CONTROL_WRITE(0));
|
||||
|
||||
// Tell it the first register we're writing to (the "A" register)
|
||||
SPI_RWByte(&mcp->spi, addrA);
|
||||
|
||||
// Write the first byte of the register
|
||||
SPI_RWByte(&mcp->spi, (uint8_t)((value >> 8) & 0xFF));
|
||||
|
||||
// It should auto-increment to the "B" register, now write that
|
||||
SPI_RWByte(&mcp->spi, (uint8_t)(value & 0xFF));
|
||||
|
||||
SPI_Deassert(&mcp->spi);
|
||||
}
|
||||
|
||||
/** Helper function that reads two consecutive registers in the MCP23S17
|
||||
*
|
||||
* @param mcp The MCP23S17
|
||||
* @param addrA The address of the first ("A") register
|
||||
* @return The value read back from the A and B registers. High byte = A, low byte = B
|
||||
*/
|
||||
static uint16_t MCP23S17_ReadBothRegs(MCP23S17 *mcp, uint8_t addrA)
|
||||
{
|
||||
uint16_t returnVal;
|
||||
|
||||
SPI_Assert(&mcp->spi);
|
||||
|
||||
// Start off the communication by telling the MCP23S17 that we are reading from a register
|
||||
SPI_RWByte(&mcp->spi, MCP23S17_CONTROL_READ(0));
|
||||
|
||||
// Tell it which register we're reading from (the "A" register)
|
||||
SPI_RWByte(&mcp->spi, addrA);
|
||||
|
||||
// Read the first byte of the register
|
||||
returnVal = (((uint16_t)SPI_RWByte(&mcp->spi, 0)) << 8);
|
||||
|
||||
// It should auto-increment to the "B" register, now read that
|
||||
returnVal |= SPI_RWByte(&mcp->spi, 0);
|
||||
|
||||
SPI_Deassert(&mcp->spi);
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
@@ -1,76 +1,76 @@
|
||||
/*
|
||||
* mcp23s17.h
|
||||
*
|
||||
* Created on: Nov 25, 2011
|
||||
* Author: Doug
|
||||
*
|
||||
* Copyright (C) 2011-2020 Doug Brown
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DRIVERS_MCP23S17_H_
|
||||
#define DRIVERS_MCP23S17_H_
|
||||
|
||||
#include "../hal/spi.h"
|
||||
|
||||
/// A few register defines. Ordinarily I wouldn't put these in the header file
|
||||
/// because users of this module shouldn't care...but I have had to do some
|
||||
/// optimizations with the AVR to bypass the hardware abstraction layer.
|
||||
#define MCP23S17_CONTROL_WRITE(address) (0x40 | (address << 1))
|
||||
#define MCP23S17_CONTROL_READ(address) (0x40 | (address << 1) | 1)
|
||||
#define MCP23S17_IODIRA 0x00
|
||||
#define MCP23S17_IODIRB 0x01
|
||||
#define MCP23S17_IPOLA 0x02
|
||||
#define MCP23S17_IPOLB 0x03
|
||||
#define MCP23S17_GPINTENA 0x04
|
||||
#define MCP23S17_GPINTENB 0x05
|
||||
#define MCP23S17_DEFVALA 0x06
|
||||
#define MCP23S17_DEFVALB 0x07
|
||||
#define MCP23S17_INTCONA 0x08
|
||||
#define MCP23S17_INTCONB 0x09
|
||||
#define MCP23S17_IOCON 0x0A
|
||||
#define MCP23S17_IOCON_AGAIN 0x0B
|
||||
#define MCP23S17_GPPUA 0x0C
|
||||
#define MCP23S17_GPPUB 0x0D
|
||||
#define MCP23S17_INTFA 0x0E
|
||||
#define MCP23S17_INTFB 0x0F
|
||||
#define MCP23S17_INTCAPA 0x10
|
||||
#define MCP23S17_INTCAPB 0x11
|
||||
#define MCP23S17_GPIOA 0x12
|
||||
#define MCP23S17_GPIOB 0x13
|
||||
#define MCP23S17_OLATA 0x14
|
||||
#define MCP23S17_OLATB 0x15
|
||||
|
||||
/// Struct representing a single MCP23S17 device
|
||||
typedef struct MCP23S17
|
||||
{
|
||||
/// The SPI device representing this MCP23S17
|
||||
SPIDevice spi;
|
||||
} MCP23S17;
|
||||
|
||||
void MCP23S17_Init(MCP23S17 *mcp, GPIOPin resetPin);
|
||||
void MCP23S17_Begin(MCP23S17 *mcp);
|
||||
void MCP23S17_End(MCP23S17 *mcp);
|
||||
void MCP23S17_SetDDR(MCP23S17 *mcp, uint16_t ddr);
|
||||
uint16_t MCP23S17_DDR(MCP23S17 *mcp);
|
||||
void MCP23S17_SetOutputs(MCP23S17 *mcp, uint16_t data);
|
||||
uint16_t MCP23S17_Outputs(MCP23S17 *mcp);
|
||||
uint16_t MCP23S17_ReadInputs(MCP23S17 *mcp);
|
||||
void MCP23S17_SetPullups(MCP23S17 *mcp, uint16_t pullups);
|
||||
uint16_t MCP23S17_Pullups(MCP23S17 *mcp);
|
||||
|
||||
#endif /* DRIVERS_MCP23S17_H_ */
|
||||
/*
|
||||
* mcp23s17.h
|
||||
*
|
||||
* Created on: Nov 25, 2011
|
||||
* Author: Doug
|
||||
*
|
||||
* Copyright (C) 2011-2020 Doug Brown
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DRIVERS_MCP23S17_H_
|
||||
#define DRIVERS_MCP23S17_H_
|
||||
|
||||
#include "../hal/spi.h"
|
||||
|
||||
/// A few register defines. Ordinarily I wouldn't put these in the header file
|
||||
/// because users of this module shouldn't care...but I have had to do some
|
||||
/// optimizations with the AVR to bypass the hardware abstraction layer.
|
||||
#define MCP23S17_CONTROL_WRITE(address) (0x40 | (address << 1))
|
||||
#define MCP23S17_CONTROL_READ(address) (0x40 | (address << 1) | 1)
|
||||
#define MCP23S17_IODIRA 0x00
|
||||
#define MCP23S17_IODIRB 0x01
|
||||
#define MCP23S17_IPOLA 0x02
|
||||
#define MCP23S17_IPOLB 0x03
|
||||
#define MCP23S17_GPINTENA 0x04
|
||||
#define MCP23S17_GPINTENB 0x05
|
||||
#define MCP23S17_DEFVALA 0x06
|
||||
#define MCP23S17_DEFVALB 0x07
|
||||
#define MCP23S17_INTCONA 0x08
|
||||
#define MCP23S17_INTCONB 0x09
|
||||
#define MCP23S17_IOCON 0x0A
|
||||
#define MCP23S17_IOCON_AGAIN 0x0B
|
||||
#define MCP23S17_GPPUA 0x0C
|
||||
#define MCP23S17_GPPUB 0x0D
|
||||
#define MCP23S17_INTFA 0x0E
|
||||
#define MCP23S17_INTFB 0x0F
|
||||
#define MCP23S17_INTCAPA 0x10
|
||||
#define MCP23S17_INTCAPB 0x11
|
||||
#define MCP23S17_GPIOA 0x12
|
||||
#define MCP23S17_GPIOB 0x13
|
||||
#define MCP23S17_OLATA 0x14
|
||||
#define MCP23S17_OLATB 0x15
|
||||
|
||||
/// Struct representing a single MCP23S17 device
|
||||
typedef struct MCP23S17
|
||||
{
|
||||
/// The SPI device representing this MCP23S17
|
||||
SPIDevice spi;
|
||||
} MCP23S17;
|
||||
|
||||
void MCP23S17_Init(MCP23S17 *mcp, GPIOPin resetPin);
|
||||
void MCP23S17_Begin(MCP23S17 *mcp);
|
||||
void MCP23S17_End(MCP23S17 *mcp);
|
||||
void MCP23S17_SetDDR(MCP23S17 *mcp, uint16_t ddr);
|
||||
uint16_t MCP23S17_DDR(MCP23S17 *mcp);
|
||||
void MCP23S17_SetOutputs(MCP23S17 *mcp, uint16_t data);
|
||||
uint16_t MCP23S17_Outputs(MCP23S17 *mcp);
|
||||
uint16_t MCP23S17_ReadInputs(MCP23S17 *mcp);
|
||||
void MCP23S17_SetPullups(MCP23S17 *mcp, uint16_t pullups);
|
||||
uint16_t MCP23S17_Pullups(MCP23S17 *mcp);
|
||||
|
||||
#endif /* DRIVERS_MCP23S17_H_ */
|
||||
|
||||
@@ -1,429 +1,429 @@
|
||||
/*
|
||||
* parallel_flash.c
|
||||
*
|
||||
* Created on: Nov 25, 2011
|
||||
* Author: Doug
|
||||
*
|
||||
* Copyright (C) 2011-2020 Doug Brown
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "parallel_flash.h"
|
||||
#include "../util.h"
|
||||
|
||||
/// Erasable sector size in SST39SF040
|
||||
#define SECTOR_SIZE_SST39SF040 (4*1024UL)
|
||||
/// Erasable sector size in M29F160FB5AN6E2, 8-bit mode
|
||||
#define SECTOR_SIZE_M29F160FB5AN6E2_8 (64*1024UL)
|
||||
|
||||
static uint32_t ParallelFlash_MaskForChips(uint8_t chips);
|
||||
static ALWAYS_INLINE void ParallelFlash_WaitForCompletion(void);
|
||||
static ALWAYS_INLINE uint32_t ParallelFlash_UnlockAddress1(void);
|
||||
|
||||
/// The type/arrangement of parallel flash chips we are talking to
|
||||
static ParallelFlashChipType curChipType = ParallelFlash_SST39SF040_x4;
|
||||
|
||||
/** Sets the type/arrangement of parallel flash chips we are talking to
|
||||
*
|
||||
* @param type The type/arrangement of flash chips
|
||||
*/
|
||||
void ParallelFlash_SetChipType(ParallelFlashChipType type)
|
||||
{
|
||||
curChipType = type;
|
||||
}
|
||||
|
||||
/** Gets the type/arrangement of parallel flash chips we are talking to
|
||||
*
|
||||
* @return The current type/arrangement of flash chips
|
||||
*/
|
||||
ParallelFlashChipType ParallelFlash_ChipType(void)
|
||||
{
|
||||
return curChipType;
|
||||
}
|
||||
|
||||
/** Reads data from the flash chip
|
||||
*
|
||||
* @param startAddress The address for reading
|
||||
* @param buf The buffer to read to
|
||||
* @param len The number of bytes to read
|
||||
*/
|
||||
void ParallelFlash_Read(uint32_t startAddress, uint32_t *buf, uint16_t len)
|
||||
{
|
||||
// Just forward this request directly onto the parallel bus. Nothing
|
||||
// special is required for reading a chunk of data.
|
||||
ParallelBus_Read(startAddress, buf, len);
|
||||
}
|
||||
|
||||
/** Unlocks the flash chips using the special write sequence
|
||||
*
|
||||
* @param chipsMask The mask of which chips to unlock
|
||||
*/
|
||||
void ParallelFlash_UnlockChips(uint8_t chipsMask)
|
||||
{
|
||||
// Use a mask so we don't unlock chips we don't want to talk with
|
||||
uint32_t mask = ParallelFlash_MaskForChips(chipsMask);
|
||||
uint32_t unlockAddress = ParallelFlash_UnlockAddress1();
|
||||
|
||||
// First part of unlock sequence:
|
||||
// Write 0x55555555 to the address bus and 0xAA to the data bus
|
||||
// (Some datasheets may only say 0x555 or 0x5555, but they ignore
|
||||
// the upper bits, so writing the alternating pattern to all address lines
|
||||
// should make it compatible with larger chips).
|
||||
ParallelBus_WriteCycle(unlockAddress, 0xAAAAAAAAUL & mask);
|
||||
|
||||
// Second part of unlock sequence is the same thing, but reversed.
|
||||
ParallelBus_WriteCycle(~unlockAddress, 0x55555555UL & mask);
|
||||
}
|
||||
|
||||
/** Reads the ID of the chips
|
||||
*
|
||||
* @param Pointer to variable for storing ID info about each chip
|
||||
*/
|
||||
void ParallelFlash_IdentifyChips(ParallelFlashChipID *chips)
|
||||
{
|
||||
// Start by writing the unlock sequence to ALL chips
|
||||
ParallelFlash_UnlockChips(ALL_CHIPS);
|
||||
|
||||
// Write 0x90 to the first unlock address for the identify command...
|
||||
ParallelBus_WriteCycle(ParallelFlash_UnlockAddress1(), 0x90909090UL);
|
||||
|
||||
// Now we can read the vendor and product ID from addresses 0 and 1
|
||||
// (or 1 and 2 if we're using the M29F160FB5AN6E2 in 8-bit mode).
|
||||
// Note: The Micron datasheet says it requires 12V to be applied to A9
|
||||
// in order for the identification command to work properly, but in
|
||||
// practice the identification process works fine without it.
|
||||
uint32_t vendorAddress = curChipType != ParallelFlash_M29F160FB5AN6E2_x4 ?
|
||||
0 : 1;
|
||||
uint32_t manufacturers = ParallelBus_ReadCycle(vendorAddress);
|
||||
uint32_t devices = ParallelBus_ReadCycle(vendorAddress + 1);
|
||||
for (int8_t i = 0; i < PARALLEL_FLASH_NUM_CHIPS; i++)
|
||||
{
|
||||
uint8_t manufacturer = (uint8_t)(manufacturers >> (8 * i));
|
||||
uint8_t device = (uint8_t)(devices >> (8 * i));
|
||||
chips[PARALLEL_FLASH_NUM_CHIPS - i - 1].manufacturer = manufacturer;
|
||||
chips[PARALLEL_FLASH_NUM_CHIPS - i - 1].device = device;
|
||||
}
|
||||
|
||||
// Exit software ID mode
|
||||
ParallelBus_WriteCycle(0, 0xF0F0F0F0UL);
|
||||
}
|
||||
|
||||
/** Erases the specified chips
|
||||
*
|
||||
* @param chipsMask The mask of which chips to erase
|
||||
*/
|
||||
void ParallelFlash_EraseChips(uint8_t chipsMask)
|
||||
{
|
||||
uint32_t unlockAddress = ParallelFlash_UnlockAddress1();
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0x80808080UL);
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0x10101010UL);
|
||||
ParallelFlash_WaitForCompletion();
|
||||
}
|
||||
|
||||
/** Erases only the range of sectors specified in the specified chips
|
||||
*
|
||||
* @param address The start address to erase (must be aligned to a sector boundary)
|
||||
* @param length The number of bytes to erase (must be aligned to a sector boundary)
|
||||
* @param chipsMask The mask of which chips to erase
|
||||
* @return True on success, false on failure
|
||||
*/
|
||||
bool ParallelFlash_EraseSectors(uint32_t address, uint32_t length, uint8_t chipsMask)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
// Figure out our sector size
|
||||
uint32_t sectorSize;
|
||||
switch (curChipType)
|
||||
{
|
||||
case ParallelFlash_SST39SF040_x4:
|
||||
default:
|
||||
sectorSize = SECTOR_SIZE_SST39SF040;
|
||||
break;
|
||||
case ParallelFlash_M29F160FB5AN6E2_x4:
|
||||
sectorSize = SECTOR_SIZE_M29F160FB5AN6E2_8;
|
||||
break;
|
||||
}
|
||||
|
||||
// Make sure the area requested to be erased is on good boundaries
|
||||
if ((address % sectorSize) ||
|
||||
(length % sectorSize))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// We're good to go. Let's do it. The process varies based on the chip type
|
||||
if (curChipType == ParallelFlash_SST39SF040_x4)
|
||||
{
|
||||
// This chip sucks because you have to erase each sector with its own
|
||||
// complete erase unlock command, which can take a while. At least
|
||||
// individual erase operations are much faster on this chip...
|
||||
while (length)
|
||||
{
|
||||
// Start the erase command
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(ParallelFlash_UnlockAddress1(), 0x80808080UL);
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
|
||||
// Now provide a sector address, but only one. Then the whole
|
||||
// unlock sequence has to be done again after this sector is done.
|
||||
ParallelBus_WriteCycle(address, 0x30303030UL);
|
||||
|
||||
address += sectorSize;
|
||||
length -= sectorSize;
|
||||
|
||||
// Wait for completion of this individual erase operation before
|
||||
// we can start a new erase operation.
|
||||
ParallelFlash_WaitForCompletion();
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
else if (curChipType == ParallelFlash_M29F160FB5AN6E2_x4)
|
||||
{
|
||||
// This chip is nicer because it can take all the sector addresses at
|
||||
// once and then do the final erase operation in one fell swoop.
|
||||
// Start the erase command
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(ParallelFlash_UnlockAddress1(), 0x80808080UL);
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
|
||||
// Now provide as many sector addresses as needed to erase.
|
||||
// The first address is a bit of a special case because the boot sector
|
||||
// actually has finer granularity for sector sizes.
|
||||
if (address == 0)
|
||||
{
|
||||
ParallelBus_WriteCycle(0x00000000UL, 0x30303030UL);
|
||||
ParallelBus_WriteCycle(0x00004000UL, 0x30303030UL);
|
||||
ParallelBus_WriteCycle(0x00006000UL, 0x30303030UL);
|
||||
ParallelBus_WriteCycle(0x00008000UL, 0x30303030UL);
|
||||
address += sectorSize;
|
||||
length -= sectorSize;
|
||||
}
|
||||
|
||||
// The remaining sectors can use a more generic algorithm
|
||||
while (length)
|
||||
{
|
||||
ParallelBus_WriteCycle(address, 0x30303030UL);
|
||||
address += sectorSize;
|
||||
length -= sectorSize;
|
||||
}
|
||||
|
||||
// Wait for completion of the entire erase operation
|
||||
ParallelFlash_WaitForCompletion();
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/** Writes a buffer of data to all 4 chips simultaneously
|
||||
*
|
||||
* @param startAddress The starting address to write in flash
|
||||
* @param buf The buffer to write
|
||||
* @param len The length of data to write
|
||||
*
|
||||
* The API may look silly to have broken into different functions like this, but
|
||||
* it's a performance optimization. It means we don't have to check during every
|
||||
* byte write to see the chip unlock mask. It saves a bunch of time.
|
||||
*/
|
||||
void ParallelFlash_WriteAllChips(uint32_t startAddress, uint32_t const *buf, uint16_t len)
|
||||
{
|
||||
uint32_t unlockAddress = ParallelFlash_UnlockAddress1();
|
||||
|
||||
// Normal write process used by most parallel flashes
|
||||
if (curChipType != ParallelFlash_M29F160FB5AN6E2_x4)
|
||||
{
|
||||
while (len--)
|
||||
{
|
||||
// Write this byte.
|
||||
// Unlock...and don't use the unlock function because this one
|
||||
// is more efficient knowing the mask is 0xFFFFFFFF
|
||||
ParallelBus_WriteCycle(unlockAddress, 0xAAAAAAAAUL);
|
||||
ParallelBus_WriteCycle(~unlockAddress, 0x55555555UL);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0xA0A0A0A0UL);
|
||||
ParallelBus_WriteCycle(startAddress, *buf);
|
||||
ParallelFlash_WaitForCompletion();
|
||||
|
||||
startAddress++;
|
||||
buf++;
|
||||
}
|
||||
}
|
||||
// Optimized write process available on the M29F160FB5AN6E2, requires
|
||||
// fewer write cycles per byte if you know you're writing multiple bytes.
|
||||
else
|
||||
{
|
||||
// Do an unlock bypass command so that we can write bytes faster.
|
||||
// Writes will only require 2 write cycles instead of 4
|
||||
ParallelBus_WriteCycle(unlockAddress, 0xAAAAAAAAUL);
|
||||
ParallelBus_WriteCycle(~unlockAddress, 0x55555555UL);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0x20202020UL);
|
||||
|
||||
while (len--)
|
||||
{
|
||||
// Write this byte.
|
||||
ParallelBus_WriteCycle(0, 0xA0A0A0A0UL);
|
||||
ParallelBus_WriteCycle(startAddress, *buf);
|
||||
ParallelFlash_WaitForCompletion();
|
||||
|
||||
startAddress++;
|
||||
buf++;
|
||||
}
|
||||
|
||||
// When we're all done, do "unlock bypass reset" to exit from
|
||||
// programming mode
|
||||
ParallelBus_WriteCycle(0, 0x90909090UL);
|
||||
ParallelBus_WriteCycle(0, 0x00000000UL);
|
||||
}
|
||||
}
|
||||
|
||||
/** Writes a buffer of data to the specified chips simultaneously
|
||||
*
|
||||
* @param startAddress The starting address to write in flash
|
||||
* @param buf The buffer to write
|
||||
* @param len The length of data to write
|
||||
* @param chipsMask The mask of which chips to write
|
||||
*/
|
||||
void ParallelFlash_WriteSomeChips(uint32_t startAddress, uint32_t const *buf, uint16_t len, uint8_t chipsMask)
|
||||
{
|
||||
uint32_t unlockAddress = ParallelFlash_UnlockAddress1();
|
||||
|
||||
// Normal write process used by most parallel flashes
|
||||
if (curChipType != ParallelFlash_M29F160FB5AN6E2_x4)
|
||||
{
|
||||
while (len--)
|
||||
{
|
||||
// Write this byte.
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0xA0A0A0A0UL);
|
||||
ParallelBus_WriteCycle(startAddress, *buf);
|
||||
ParallelFlash_WaitForCompletion();
|
||||
|
||||
startAddress++;
|
||||
buf++;
|
||||
}
|
||||
}
|
||||
// Optimized write process available on the M29F160FB5AN6E2, requires
|
||||
// fewer write cycles per byte if you know you're writing multiple bytes.
|
||||
else
|
||||
{
|
||||
// Do an unlock bypass command so that we can write bytes faster.
|
||||
// Writes will only require 2 write cycles instead of 4
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0x20202020UL);
|
||||
|
||||
while (len--)
|
||||
{
|
||||
// Write this byte.
|
||||
ParallelBus_WriteCycle(0, 0xA0A0A0A0UL);
|
||||
ParallelBus_WriteCycle(startAddress, *buf);
|
||||
ParallelFlash_WaitForCompletion();
|
||||
|
||||
startAddress++;
|
||||
buf++;
|
||||
}
|
||||
|
||||
// When we're all done, do "unlock bypass reset" to exit from
|
||||
// programming mode
|
||||
ParallelBus_WriteCycle(0, 0x90909090UL);
|
||||
ParallelBus_WriteCycle(0, 0x00000000UL);
|
||||
}
|
||||
}
|
||||
|
||||
/** Calculates a 32-bit mask to use with the unlock process when unlocking chips
|
||||
*
|
||||
* @param chipsMask The mask of which chips to write
|
||||
* @return A 32-bit mask that can be used on the data bus to filter out the unlock sequence
|
||||
*
|
||||
* For clarity, chipsMask has 1 bit per chip. The return value has 1 byte per
|
||||
* chip. The return value masks the unlock sequence so we only supply a valid
|
||||
* unlock sequence to the chips that we want to unlock.
|
||||
*/
|
||||
static uint32_t ParallelFlash_MaskForChips(uint8_t chips)
|
||||
{
|
||||
// Calculates a mask so we can filter out chips we don't care about.
|
||||
|
||||
// Optimization because we typically don't mask the chips
|
||||
if (chips == 0x0F)
|
||||
{
|
||||
return 0xFFFFFFFFUL;
|
||||
}
|
||||
|
||||
// This probably looks dumb not doing this as a loop...but AVR GCC is
|
||||
// terrible. This approach results in more optimal generated instructions.
|
||||
uint32_t mask = 0;
|
||||
if (chips & (1 << 0))
|
||||
{
|
||||
mask |= 0x000000FFUL;
|
||||
}
|
||||
if (chips & (1 << 1))
|
||||
{
|
||||
mask |= 0x0000FF00UL;
|
||||
}
|
||||
if (chips & (1 << 2))
|
||||
{
|
||||
mask |= 0x00FF0000UL;
|
||||
}
|
||||
if (chips & (1 << 3))
|
||||
{
|
||||
mask |= 0xFF000000UL;
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
/** Waits for an erase or write operation on the flash chip to complete.
|
||||
*
|
||||
* We know we're done when the value we read from the chip stops changing. There
|
||||
* is a "toggle" status bit that will stop toggling when the op is complete.
|
||||
*/
|
||||
static ALWAYS_INLINE void ParallelFlash_WaitForCompletion(void)
|
||||
{
|
||||
uint32_t readback = ParallelBus_ReadCycle(0);
|
||||
uint32_t next = ParallelBus_ReadCycle(0);
|
||||
while (next != readback)
|
||||
{
|
||||
readback = next;
|
||||
next = ParallelBus_ReadCycle(0);
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets the first unlock address to use when unlocking writes on this chip
|
||||
*
|
||||
* @return The first unlock address.
|
||||
*
|
||||
* Note: The second unlock address is the bitwise NOT of this address.
|
||||
*/
|
||||
static ALWAYS_INLINE uint32_t ParallelFlash_UnlockAddress1(void)
|
||||
{
|
||||
// Most chips use alternating bits, with A0 being a 1 bit
|
||||
if (curChipType != ParallelFlash_M29F160FB5AN6E2_x4)
|
||||
{
|
||||
return 0x55555555UL;
|
||||
}
|
||||
// The M29F160FB5AN6E2 is weird because it's an 8-/16-bit chip. In 8-bit
|
||||
// mode it has an "A-1" pin that we treat as A0, then the chip's A0 pin is
|
||||
// really our A1, and so on. The unlock sequence still starts on the chip's
|
||||
// physical pin A0, so effectively the unlock address is inverted.
|
||||
else
|
||||
{
|
||||
return 0xAAAAAAAAUL;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* parallel_flash.c
|
||||
*
|
||||
* Created on: Nov 25, 2011
|
||||
* Author: Doug
|
||||
*
|
||||
* Copyright (C) 2011-2020 Doug Brown
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "parallel_flash.h"
|
||||
#include "../util.h"
|
||||
|
||||
/// Erasable sector size in SST39SF040
|
||||
#define SECTOR_SIZE_SST39SF040 (4*1024UL)
|
||||
/// Erasable sector size in M29F160FB5AN6E2, 8-bit mode
|
||||
#define SECTOR_SIZE_M29F160FB5AN6E2_8 (64*1024UL)
|
||||
|
||||
static uint32_t ParallelFlash_MaskForChips(uint8_t chips);
|
||||
static ALWAYS_INLINE void ParallelFlash_WaitForCompletion(void);
|
||||
static ALWAYS_INLINE uint32_t ParallelFlash_UnlockAddress1(void);
|
||||
|
||||
/// The type/arrangement of parallel flash chips we are talking to
|
||||
static ParallelFlashChipType curChipType = ParallelFlash_SST39SF040_x4;
|
||||
|
||||
/** Sets the type/arrangement of parallel flash chips we are talking to
|
||||
*
|
||||
* @param type The type/arrangement of flash chips
|
||||
*/
|
||||
void ParallelFlash_SetChipType(ParallelFlashChipType type)
|
||||
{
|
||||
curChipType = type;
|
||||
}
|
||||
|
||||
/** Gets the type/arrangement of parallel flash chips we are talking to
|
||||
*
|
||||
* @return The current type/arrangement of flash chips
|
||||
*/
|
||||
ParallelFlashChipType ParallelFlash_ChipType(void)
|
||||
{
|
||||
return curChipType;
|
||||
}
|
||||
|
||||
/** Reads data from the flash chip
|
||||
*
|
||||
* @param startAddress The address for reading
|
||||
* @param buf The buffer to read to
|
||||
* @param len The number of bytes to read
|
||||
*/
|
||||
void ParallelFlash_Read(uint32_t startAddress, uint32_t *buf, uint16_t len)
|
||||
{
|
||||
// Just forward this request directly onto the parallel bus. Nothing
|
||||
// special is required for reading a chunk of data.
|
||||
ParallelBus_Read(startAddress, buf, len);
|
||||
}
|
||||
|
||||
/** Unlocks the flash chips using the special write sequence
|
||||
*
|
||||
* @param chipsMask The mask of which chips to unlock
|
||||
*/
|
||||
void ParallelFlash_UnlockChips(uint8_t chipsMask)
|
||||
{
|
||||
// Use a mask so we don't unlock chips we don't want to talk with
|
||||
uint32_t mask = ParallelFlash_MaskForChips(chipsMask);
|
||||
uint32_t unlockAddress = ParallelFlash_UnlockAddress1();
|
||||
|
||||
// First part of unlock sequence:
|
||||
// Write 0x55555555 to the address bus and 0xAA to the data bus
|
||||
// (Some datasheets may only say 0x555 or 0x5555, but they ignore
|
||||
// the upper bits, so writing the alternating pattern to all address lines
|
||||
// should make it compatible with larger chips).
|
||||
ParallelBus_WriteCycle(unlockAddress, 0xAAAAAAAAUL & mask);
|
||||
|
||||
// Second part of unlock sequence is the same thing, but reversed.
|
||||
ParallelBus_WriteCycle(~unlockAddress, 0x55555555UL & mask);
|
||||
}
|
||||
|
||||
/** Reads the ID of the chips
|
||||
*
|
||||
* @param Pointer to variable for storing ID info about each chip
|
||||
*/
|
||||
void ParallelFlash_IdentifyChips(ParallelFlashChipID *chips)
|
||||
{
|
||||
// Start by writing the unlock sequence to ALL chips
|
||||
ParallelFlash_UnlockChips(ALL_CHIPS);
|
||||
|
||||
// Write 0x90 to the first unlock address for the identify command...
|
||||
ParallelBus_WriteCycle(ParallelFlash_UnlockAddress1(), 0x90909090UL);
|
||||
|
||||
// Now we can read the vendor and product ID from addresses 0 and 1
|
||||
// (or 1 and 2 if we're using the M29F160FB5AN6E2 in 8-bit mode).
|
||||
// Note: The Micron datasheet says it requires 12V to be applied to A9
|
||||
// in order for the identification command to work properly, but in
|
||||
// practice the identification process works fine without it.
|
||||
uint32_t vendorAddress = curChipType != ParallelFlash_M29F160FB5AN6E2_x4 ?
|
||||
0 : 1;
|
||||
uint32_t manufacturers = ParallelBus_ReadCycle(vendorAddress);
|
||||
uint32_t devices = ParallelBus_ReadCycle(vendorAddress + 1);
|
||||
for (int8_t i = 0; i < PARALLEL_FLASH_NUM_CHIPS; i++)
|
||||
{
|
||||
uint8_t manufacturer = (uint8_t)(manufacturers >> (8 * i));
|
||||
uint8_t device = (uint8_t)(devices >> (8 * i));
|
||||
chips[PARALLEL_FLASH_NUM_CHIPS - i - 1].manufacturer = manufacturer;
|
||||
chips[PARALLEL_FLASH_NUM_CHIPS - i - 1].device = device;
|
||||
}
|
||||
|
||||
// Exit software ID mode
|
||||
ParallelBus_WriteCycle(0, 0xF0F0F0F0UL);
|
||||
}
|
||||
|
||||
/** Erases the specified chips
|
||||
*
|
||||
* @param chipsMask The mask of which chips to erase
|
||||
*/
|
||||
void ParallelFlash_EraseChips(uint8_t chipsMask)
|
||||
{
|
||||
uint32_t unlockAddress = ParallelFlash_UnlockAddress1();
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0x80808080UL);
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0x10101010UL);
|
||||
ParallelFlash_WaitForCompletion();
|
||||
}
|
||||
|
||||
/** Erases only the range of sectors specified in the specified chips
|
||||
*
|
||||
* @param address The start address to erase (must be aligned to a sector boundary)
|
||||
* @param length The number of bytes to erase (must be aligned to a sector boundary)
|
||||
* @param chipsMask The mask of which chips to erase
|
||||
* @return True on success, false on failure
|
||||
*/
|
||||
bool ParallelFlash_EraseSectors(uint32_t address, uint32_t length, uint8_t chipsMask)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
// Figure out our sector size
|
||||
uint32_t sectorSize;
|
||||
switch (curChipType)
|
||||
{
|
||||
case ParallelFlash_SST39SF040_x4:
|
||||
default:
|
||||
sectorSize = SECTOR_SIZE_SST39SF040;
|
||||
break;
|
||||
case ParallelFlash_M29F160FB5AN6E2_x4:
|
||||
sectorSize = SECTOR_SIZE_M29F160FB5AN6E2_8;
|
||||
break;
|
||||
}
|
||||
|
||||
// Make sure the area requested to be erased is on good boundaries
|
||||
if ((address % sectorSize) ||
|
||||
(length % sectorSize))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// We're good to go. Let's do it. The process varies based on the chip type
|
||||
if (curChipType == ParallelFlash_SST39SF040_x4)
|
||||
{
|
||||
// This chip sucks because you have to erase each sector with its own
|
||||
// complete erase unlock command, which can take a while. At least
|
||||
// individual erase operations are much faster on this chip...
|
||||
while (length)
|
||||
{
|
||||
// Start the erase command
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(ParallelFlash_UnlockAddress1(), 0x80808080UL);
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
|
||||
// Now provide a sector address, but only one. Then the whole
|
||||
// unlock sequence has to be done again after this sector is done.
|
||||
ParallelBus_WriteCycle(address, 0x30303030UL);
|
||||
|
||||
address += sectorSize;
|
||||
length -= sectorSize;
|
||||
|
||||
// Wait for completion of this individual erase operation before
|
||||
// we can start a new erase operation.
|
||||
ParallelFlash_WaitForCompletion();
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
else if (curChipType == ParallelFlash_M29F160FB5AN6E2_x4)
|
||||
{
|
||||
// This chip is nicer because it can take all the sector addresses at
|
||||
// once and then do the final erase operation in one fell swoop.
|
||||
// Start the erase command
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(ParallelFlash_UnlockAddress1(), 0x80808080UL);
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
|
||||
// Now provide as many sector addresses as needed to erase.
|
||||
// The first address is a bit of a special case because the boot sector
|
||||
// actually has finer granularity for sector sizes.
|
||||
if (address == 0)
|
||||
{
|
||||
ParallelBus_WriteCycle(0x00000000UL, 0x30303030UL);
|
||||
ParallelBus_WriteCycle(0x00004000UL, 0x30303030UL);
|
||||
ParallelBus_WriteCycle(0x00006000UL, 0x30303030UL);
|
||||
ParallelBus_WriteCycle(0x00008000UL, 0x30303030UL);
|
||||
address += sectorSize;
|
||||
length -= sectorSize;
|
||||
}
|
||||
|
||||
// The remaining sectors can use a more generic algorithm
|
||||
while (length)
|
||||
{
|
||||
ParallelBus_WriteCycle(address, 0x30303030UL);
|
||||
address += sectorSize;
|
||||
length -= sectorSize;
|
||||
}
|
||||
|
||||
// Wait for completion of the entire erase operation
|
||||
ParallelFlash_WaitForCompletion();
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/** Writes a buffer of data to all 4 chips simultaneously
|
||||
*
|
||||
* @param startAddress The starting address to write in flash
|
||||
* @param buf The buffer to write
|
||||
* @param len The length of data to write
|
||||
*
|
||||
* The API may look silly to have broken into different functions like this, but
|
||||
* it's a performance optimization. It means we don't have to check during every
|
||||
* byte write to see the chip unlock mask. It saves a bunch of time.
|
||||
*/
|
||||
void ParallelFlash_WriteAllChips(uint32_t startAddress, uint32_t const *buf, uint16_t len)
|
||||
{
|
||||
uint32_t unlockAddress = ParallelFlash_UnlockAddress1();
|
||||
|
||||
// Normal write process used by most parallel flashes
|
||||
if (curChipType != ParallelFlash_M29F160FB5AN6E2_x4)
|
||||
{
|
||||
while (len--)
|
||||
{
|
||||
// Write this byte.
|
||||
// Unlock...and don't use the unlock function because this one
|
||||
// is more efficient knowing the mask is 0xFFFFFFFF
|
||||
ParallelBus_WriteCycle(unlockAddress, 0xAAAAAAAAUL);
|
||||
ParallelBus_WriteCycle(~unlockAddress, 0x55555555UL);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0xA0A0A0A0UL);
|
||||
ParallelBus_WriteCycle(startAddress, *buf);
|
||||
ParallelFlash_WaitForCompletion();
|
||||
|
||||
startAddress++;
|
||||
buf++;
|
||||
}
|
||||
}
|
||||
// Optimized write process available on the M29F160FB5AN6E2, requires
|
||||
// fewer write cycles per byte if you know you're writing multiple bytes.
|
||||
else
|
||||
{
|
||||
// Do an unlock bypass command so that we can write bytes faster.
|
||||
// Writes will only require 2 write cycles instead of 4
|
||||
ParallelBus_WriteCycle(unlockAddress, 0xAAAAAAAAUL);
|
||||
ParallelBus_WriteCycle(~unlockAddress, 0x55555555UL);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0x20202020UL);
|
||||
|
||||
while (len--)
|
||||
{
|
||||
// Write this byte.
|
||||
ParallelBus_WriteCycle(0, 0xA0A0A0A0UL);
|
||||
ParallelBus_WriteCycle(startAddress, *buf);
|
||||
ParallelFlash_WaitForCompletion();
|
||||
|
||||
startAddress++;
|
||||
buf++;
|
||||
}
|
||||
|
||||
// When we're all done, do "unlock bypass reset" to exit from
|
||||
// programming mode
|
||||
ParallelBus_WriteCycle(0, 0x90909090UL);
|
||||
ParallelBus_WriteCycle(0, 0x00000000UL);
|
||||
}
|
||||
}
|
||||
|
||||
/** Writes a buffer of data to the specified chips simultaneously
|
||||
*
|
||||
* @param startAddress The starting address to write in flash
|
||||
* @param buf The buffer to write
|
||||
* @param len The length of data to write
|
||||
* @param chipsMask The mask of which chips to write
|
||||
*/
|
||||
void ParallelFlash_WriteSomeChips(uint32_t startAddress, uint32_t const *buf, uint16_t len, uint8_t chipsMask)
|
||||
{
|
||||
uint32_t unlockAddress = ParallelFlash_UnlockAddress1();
|
||||
|
||||
// Normal write process used by most parallel flashes
|
||||
if (curChipType != ParallelFlash_M29F160FB5AN6E2_x4)
|
||||
{
|
||||
while (len--)
|
||||
{
|
||||
// Write this byte.
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0xA0A0A0A0UL);
|
||||
ParallelBus_WriteCycle(startAddress, *buf);
|
||||
ParallelFlash_WaitForCompletion();
|
||||
|
||||
startAddress++;
|
||||
buf++;
|
||||
}
|
||||
}
|
||||
// Optimized write process available on the M29F160FB5AN6E2, requires
|
||||
// fewer write cycles per byte if you know you're writing multiple bytes.
|
||||
else
|
||||
{
|
||||
// Do an unlock bypass command so that we can write bytes faster.
|
||||
// Writes will only require 2 write cycles instead of 4
|
||||
ParallelFlash_UnlockChips(chipsMask);
|
||||
ParallelBus_WriteCycle(unlockAddress, 0x20202020UL);
|
||||
|
||||
while (len--)
|
||||
{
|
||||
// Write this byte.
|
||||
ParallelBus_WriteCycle(0, 0xA0A0A0A0UL);
|
||||
ParallelBus_WriteCycle(startAddress, *buf);
|
||||
ParallelFlash_WaitForCompletion();
|
||||
|
||||
startAddress++;
|
||||
buf++;
|
||||
}
|
||||
|
||||
// When we're all done, do "unlock bypass reset" to exit from
|
||||
// programming mode
|
||||
ParallelBus_WriteCycle(0, 0x90909090UL);
|
||||
ParallelBus_WriteCycle(0, 0x00000000UL);
|
||||
}
|
||||
}
|
||||
|
||||
/** Calculates a 32-bit mask to use with the unlock process when unlocking chips
|
||||
*
|
||||
* @param chipsMask The mask of which chips to write
|
||||
* @return A 32-bit mask that can be used on the data bus to filter out the unlock sequence
|
||||
*
|
||||
* For clarity, chipsMask has 1 bit per chip. The return value has 1 byte per
|
||||
* chip. The return value masks the unlock sequence so we only supply a valid
|
||||
* unlock sequence to the chips that we want to unlock.
|
||||
*/
|
||||
static uint32_t ParallelFlash_MaskForChips(uint8_t chips)
|
||||
{
|
||||
// Calculates a mask so we can filter out chips we don't care about.
|
||||
|
||||
// Optimization because we typically don't mask the chips
|
||||
if (chips == 0x0F)
|
||||
{
|
||||
return 0xFFFFFFFFUL;
|
||||
}
|
||||
|
||||
// This probably looks dumb not doing this as a loop...but AVR GCC is
|
||||
// terrible. This approach results in more optimal generated instructions.
|
||||
uint32_t mask = 0;
|
||||
if (chips & (1 << 0))
|
||||
{
|
||||
mask |= 0x000000FFUL;
|
||||
}
|
||||
if (chips & (1 << 1))
|
||||
{
|
||||
mask |= 0x0000FF00UL;
|
||||
}
|
||||
if (chips & (1 << 2))
|
||||
{
|
||||
mask |= 0x00FF0000UL;
|
||||
}
|
||||
if (chips & (1 << 3))
|
||||
{
|
||||
mask |= 0xFF000000UL;
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
/** Waits for an erase or write operation on the flash chip to complete.
|
||||
*
|
||||
* We know we're done when the value we read from the chip stops changing. There
|
||||
* is a "toggle" status bit that will stop toggling when the op is complete.
|
||||
*/
|
||||
static ALWAYS_INLINE void ParallelFlash_WaitForCompletion(void)
|
||||
{
|
||||
uint32_t readback = ParallelBus_ReadCycle(0);
|
||||
uint32_t next = ParallelBus_ReadCycle(0);
|
||||
while (next != readback)
|
||||
{
|
||||
readback = next;
|
||||
next = ParallelBus_ReadCycle(0);
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets the first unlock address to use when unlocking writes on this chip
|
||||
*
|
||||
* @return The first unlock address.
|
||||
*
|
||||
* Note: The second unlock address is the bitwise NOT of this address.
|
||||
*/
|
||||
static ALWAYS_INLINE uint32_t ParallelFlash_UnlockAddress1(void)
|
||||
{
|
||||
// Most chips use alternating bits, with A0 being a 1 bit
|
||||
if (curChipType != ParallelFlash_M29F160FB5AN6E2_x4)
|
||||
{
|
||||
return 0x55555555UL;
|
||||
}
|
||||
// The M29F160FB5AN6E2 is weird because it's an 8-/16-bit chip. In 8-bit
|
||||
// mode it has an "A-1" pin that we treat as A0, then the chip's A0 pin is
|
||||
// really our A1, and so on. The unlock sequence still starts on the chip's
|
||||
// physical pin A0, so effectively the unlock address is inverted.
|
||||
else
|
||||
{
|
||||
return 0xAAAAAAAAUL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,83 +1,83 @@
|
||||
/*
|
||||
* parallel_flash.h
|
||||
*
|
||||
* Created on: Nov 25, 2011
|
||||
* Author: Doug
|
||||
*
|
||||
* Copyright (C) 2011-2020 Doug Brown
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DRIVERS_PARALLEL_FLASH_H_
|
||||
#define DRIVERS_PARALLEL_FLASH_H_
|
||||
|
||||
#include "../hal/parallel_bus.h"
|
||||
|
||||
/// The number of chips we are simultaneously addressing
|
||||
#define PARALLEL_FLASH_NUM_CHIPS 4
|
||||
|
||||
/// Masks for functions that want a chip mask...
|
||||
#define IC1 (1 << 3)
|
||||
#define IC2 (1 << 2)
|
||||
#define IC3 (1 << 1)
|
||||
#define IC4 (1 << 0)
|
||||
#define ALL_CHIPS (IC1 | IC2 | IC3 | IC4)
|
||||
|
||||
/// Holds info about the chip (retrieved with JEDEC standards)
|
||||
typedef struct ParallelFlashChipID
|
||||
{
|
||||
/// The manufacturer ID
|
||||
uint8_t manufacturer;
|
||||
/// The device ID
|
||||
uint8_t device;
|
||||
} ParallelFlashChipID;
|
||||
|
||||
/// Type/layout of chips currently being addressed
|
||||
typedef enum ParallelFlashChipType
|
||||
{
|
||||
/// Four SST39SF040 chips, 512 KB each, for a total of 2 MB
|
||||
ParallelFlash_SST39SF040_x4,
|
||||
/// Four M29F160FB5AN6E2 chips, 2 MB each, in 8-bit mode, for a total of 8 MB
|
||||
ParallelFlash_M29F160FB5AN6E2_x4,
|
||||
} ParallelFlashChipType;
|
||||
|
||||
// Tells which type of flash chip we are communicating with
|
||||
void ParallelFlash_SetChipType(ParallelFlashChipType type);
|
||||
ParallelFlashChipType ParallelFlash_ChipType(void);
|
||||
|
||||
// Reads a set of data from all 4 chips simultaneously
|
||||
void ParallelFlash_Read(uint32_t startAddress, uint32_t *buf, uint16_t len);
|
||||
|
||||
// Does an unlock sequence on the chips requested
|
||||
void ParallelFlash_UnlockChips(uint8_t chipsMask);
|
||||
|
||||
// Identifies all four chips
|
||||
void ParallelFlash_IdentifyChips(ParallelFlashChipID *chips);
|
||||
|
||||
// Erases the chips/sectors requested
|
||||
void ParallelFlash_EraseChips(uint8_t chipsMask);
|
||||
bool ParallelFlash_EraseSectors(uint32_t address, uint32_t length, uint8_t chipsMask);
|
||||
|
||||
// Writes a buffer to all 4 chips simultaneously (each uint32_t contains an 8-bit portion for each chip).
|
||||
// Optimized variant of this function if we know we're writing to all 4 chips simultaneously.
|
||||
// Allows us to bypass a lot of operations involving "chipsMask".
|
||||
void ParallelFlash_WriteAllChips(uint32_t startAddress, uint32_t const *buf, uint16_t len);
|
||||
|
||||
// Writes a buffer to a mask of requested chips (each uint32_t contains an 8-bit portion for each chip).
|
||||
void ParallelFlash_WriteSomeChips(uint32_t startAddress, uint32_t const *buf, uint16_t len, uint8_t chipsMask);
|
||||
|
||||
#endif /* DRIVERS_PARALLEL_FLASH_H_ */
|
||||
/*
|
||||
* parallel_flash.h
|
||||
*
|
||||
* Created on: Nov 25, 2011
|
||||
* Author: Doug
|
||||
*
|
||||
* Copyright (C) 2011-2020 Doug Brown
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DRIVERS_PARALLEL_FLASH_H_
|
||||
#define DRIVERS_PARALLEL_FLASH_H_
|
||||
|
||||
#include "../hal/parallel_bus.h"
|
||||
|
||||
/// The number of chips we are simultaneously addressing
|
||||
#define PARALLEL_FLASH_NUM_CHIPS 4
|
||||
|
||||
/// Masks for functions that want a chip mask...
|
||||
#define IC1 (1 << 3)
|
||||
#define IC2 (1 << 2)
|
||||
#define IC3 (1 << 1)
|
||||
#define IC4 (1 << 0)
|
||||
#define ALL_CHIPS (IC1 | IC2 | IC3 | IC4)
|
||||
|
||||
/// Holds info about the chip (retrieved with JEDEC standards)
|
||||
typedef struct ParallelFlashChipID
|
||||
{
|
||||
/// The manufacturer ID
|
||||
uint8_t manufacturer;
|
||||
/// The device ID
|
||||
uint8_t device;
|
||||
} ParallelFlashChipID;
|
||||
|
||||
/// Type/layout of chips currently being addressed
|
||||
typedef enum ParallelFlashChipType
|
||||
{
|
||||
/// Four SST39SF040 chips, 512 KB each, for a total of 2 MB
|
||||
ParallelFlash_SST39SF040_x4,
|
||||
/// Four M29F160FB5AN6E2 chips, 2 MB each, in 8-bit mode, for a total of 8 MB
|
||||
ParallelFlash_M29F160FB5AN6E2_x4,
|
||||
} ParallelFlashChipType;
|
||||
|
||||
// Tells which type of flash chip we are communicating with
|
||||
void ParallelFlash_SetChipType(ParallelFlashChipType type);
|
||||
ParallelFlashChipType ParallelFlash_ChipType(void);
|
||||
|
||||
// Reads a set of data from all 4 chips simultaneously
|
||||
void ParallelFlash_Read(uint32_t startAddress, uint32_t *buf, uint16_t len);
|
||||
|
||||
// Does an unlock sequence on the chips requested
|
||||
void ParallelFlash_UnlockChips(uint8_t chipsMask);
|
||||
|
||||
// Identifies all four chips
|
||||
void ParallelFlash_IdentifyChips(ParallelFlashChipID *chips);
|
||||
|
||||
// Erases the chips/sectors requested
|
||||
void ParallelFlash_EraseChips(uint8_t chipsMask);
|
||||
bool ParallelFlash_EraseSectors(uint32_t address, uint32_t length, uint8_t chipsMask);
|
||||
|
||||
// Writes a buffer to all 4 chips simultaneously (each uint32_t contains an 8-bit portion for each chip).
|
||||
// Optimized variant of this function if we know we're writing to all 4 chips simultaneously.
|
||||
// Allows us to bypass a lot of operations involving "chipsMask".
|
||||
void ParallelFlash_WriteAllChips(uint32_t startAddress, uint32_t const *buf, uint16_t len);
|
||||
|
||||
// Writes a buffer to a mask of requested chips (each uint32_t contains an 8-bit portion for each chip).
|
||||
void ParallelFlash_WriteSomeChips(uint32_t startAddress, uint32_t const *buf, uint16_t len, uint8_t chipsMask);
|
||||
|
||||
#endif /* DRIVERS_PARALLEL_FLASH_H_ */
|
||||
|
||||
@@ -1,271 +1,271 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2011.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
*
|
||||
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
|
||||
* computer-readable structures which the host requests upon device enumeration, to determine
|
||||
* the device's capabilities and functions.
|
||||
*/
|
||||
|
||||
#include "Descriptors.h"
|
||||
|
||||
/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
|
||||
* the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
|
||||
* This allows the host to track a device across insertions on different ports, allowing them to retain allocated
|
||||
* resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
|
||||
* so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
|
||||
* from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
|
||||
* port location).
|
||||
*/
|
||||
#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
|
||||
#warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
|
||||
#endif
|
||||
|
||||
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
|
||||
* device characteristics, including the supported USB version, control endpoint size and the
|
||||
* number of device configurations. The descriptor is read out by the USB host when the enumeration
|
||||
* process begins.
|
||||
*/
|
||||
const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.Class = CDC_CSCP_CDCClass,
|
||||
.SubClass = CDC_CSCP_NoSpecificSubclass,
|
||||
.Protocol = CDC_CSCP_NoSpecificProtocol,
|
||||
|
||||
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
|
||||
|
||||
.VendorID = 0x16D0,
|
||||
.ProductID = 0x06AA,
|
||||
.ReleaseNumber = VERSION_BCD(00.01),
|
||||
|
||||
.ManufacturerStrIndex = 0x01,
|
||||
.ProductStrIndex = 0x02,
|
||||
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
|
||||
|
||||
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
|
||||
};
|
||||
|
||||
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
|
||||
* of the device in one of its supported configurations, including information about any device interfaces
|
||||
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
|
||||
* a configuration so that the host may correctly communicate with the USB device.
|
||||
*/
|
||||
const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
||||
{
|
||||
.Config =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
|
||||
|
||||
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
|
||||
.TotalInterfaces = 2,
|
||||
|
||||
.ConfigurationNumber = 1,
|
||||
.ConfigurationStrIndex = NO_DESCRIPTOR,
|
||||
|
||||
.ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
|
||||
|
||||
.MaxPowerConsumption = USB_CONFIG_POWER_MA(500)
|
||||
},
|
||||
|
||||
.CDC_CCI_Interface =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 1,
|
||||
|
||||
.Class = CDC_CSCP_CDCClass,
|
||||
.SubClass = CDC_CSCP_ACMSubclass,
|
||||
.Protocol = CDC_CSCP_ATCommandProtocol,
|
||||
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
|
||||
.CDC_Functional_Header =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
|
||||
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
|
||||
|
||||
.CDCSpecification = VERSION_BCD(01.10),
|
||||
},
|
||||
|
||||
.CDC_Functional_ACM =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
|
||||
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
|
||||
|
||||
.Capabilities = 0x06,
|
||||
},
|
||||
|
||||
.CDC_Functional_Union =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
|
||||
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
|
||||
|
||||
.MasterInterfaceNumber = 0,
|
||||
.SlaveInterfaceNumber = 1,
|
||||
},
|
||||
|
||||
.CDC_NotificationEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
|
||||
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
|
||||
.PollingIntervalMS = 0xFF
|
||||
},
|
||||
|
||||
.CDC_DCI_Interface =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 1,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 2,
|
||||
|
||||
.Class = CDC_CSCP_CDCDataClass,
|
||||
.SubClass = CDC_CSCP_NoDataSubclass,
|
||||
.Protocol = CDC_CSCP_NoDataProtocol,
|
||||
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
|
||||
.CDC_DataOutEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = CDC_TXRX_EPSIZE,
|
||||
.PollingIntervalMS = 0x01
|
||||
},
|
||||
|
||||
.CDC_DataInEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = CDC_TXRX_EPSIZE,
|
||||
.PollingIntervalMS = 0x01
|
||||
}
|
||||
};
|
||||
|
||||
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
|
||||
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
|
||||
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
|
||||
*/
|
||||
const USB_Descriptor_String_t PROGMEM LanguageString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = {LANGUAGE_ID_ENG}
|
||||
};
|
||||
|
||||
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
|
||||
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
|
||||
* Descriptor.
|
||||
*/
|
||||
const USB_Descriptor_String_t PROGMEM ManufacturerString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(10), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"Doug Brown"
|
||||
};
|
||||
|
||||
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
|
||||
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
|
||||
* Descriptor.
|
||||
*/
|
||||
const USB_Descriptor_String_t PROGMEM ProductString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(23), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"Mac ROM SIMM Programmer"
|
||||
};
|
||||
|
||||
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
|
||||
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
||||
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
|
||||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const void ** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
||||
const void *Address = NULL;
|
||||
uint16_t Size = NO_DESCRIPTOR;
|
||||
|
||||
switch (DescriptorType)
|
||||
{
|
||||
case DTYPE_Device:
|
||||
Address = &DeviceDescriptor;
|
||||
Size = sizeof(USB_Descriptor_Device_t);
|
||||
break;
|
||||
case DTYPE_Configuration:
|
||||
Address = &ConfigurationDescriptor;
|
||||
Size = sizeof(USB_Descriptor_Configuration_t);
|
||||
break;
|
||||
case DTYPE_String:
|
||||
switch (DescriptorNumber)
|
||||
{
|
||||
case 0x00:
|
||||
Address = &LanguageString;
|
||||
Size = pgm_read_byte(&LanguageString.Header.Size);
|
||||
break;
|
||||
case 0x01:
|
||||
Address = &ManufacturerString;
|
||||
Size = pgm_read_byte(&ManufacturerString.Header.Size);
|
||||
break;
|
||||
case 0x02:
|
||||
Address = &ProductString;
|
||||
Size = pgm_read_byte(&ProductString.Header.Size);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
*DescriptorAddress = Address;
|
||||
return Size;
|
||||
}
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2011.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
*
|
||||
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
|
||||
* computer-readable structures which the host requests upon device enumeration, to determine
|
||||
* the device's capabilities and functions.
|
||||
*/
|
||||
|
||||
#include "Descriptors.h"
|
||||
|
||||
/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
|
||||
* the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
|
||||
* This allows the host to track a device across insertions on different ports, allowing them to retain allocated
|
||||
* resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
|
||||
* so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
|
||||
* from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
|
||||
* port location).
|
||||
*/
|
||||
#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
|
||||
#warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
|
||||
#endif
|
||||
|
||||
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
|
||||
* device characteristics, including the supported USB version, control endpoint size and the
|
||||
* number of device configurations. The descriptor is read out by the USB host when the enumeration
|
||||
* process begins.
|
||||
*/
|
||||
const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
|
||||
|
||||
.USBSpecification = VERSION_BCD(01.10),
|
||||
.Class = CDC_CSCP_CDCClass,
|
||||
.SubClass = CDC_CSCP_NoSpecificSubclass,
|
||||
.Protocol = CDC_CSCP_NoSpecificProtocol,
|
||||
|
||||
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
|
||||
|
||||
.VendorID = 0x16D0,
|
||||
.ProductID = 0x06AA,
|
||||
.ReleaseNumber = VERSION_BCD(00.01),
|
||||
|
||||
.ManufacturerStrIndex = 0x01,
|
||||
.ProductStrIndex = 0x02,
|
||||
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
|
||||
|
||||
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
|
||||
};
|
||||
|
||||
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
|
||||
* of the device in one of its supported configurations, including information about any device interfaces
|
||||
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
|
||||
* a configuration so that the host may correctly communicate with the USB device.
|
||||
*/
|
||||
const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
|
||||
{
|
||||
.Config =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
|
||||
|
||||
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
|
||||
.TotalInterfaces = 2,
|
||||
|
||||
.ConfigurationNumber = 1,
|
||||
.ConfigurationStrIndex = NO_DESCRIPTOR,
|
||||
|
||||
.ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED),
|
||||
|
||||
.MaxPowerConsumption = USB_CONFIG_POWER_MA(500)
|
||||
},
|
||||
|
||||
.CDC_CCI_Interface =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 0,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 1,
|
||||
|
||||
.Class = CDC_CSCP_CDCClass,
|
||||
.SubClass = CDC_CSCP_ACMSubclass,
|
||||
.Protocol = CDC_CSCP_ATCommandProtocol,
|
||||
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
|
||||
.CDC_Functional_Header =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
|
||||
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
|
||||
|
||||
.CDCSpecification = VERSION_BCD(01.10),
|
||||
},
|
||||
|
||||
.CDC_Functional_ACM =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
|
||||
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
|
||||
|
||||
.Capabilities = 0x06,
|
||||
},
|
||||
|
||||
.CDC_Functional_Union =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
|
||||
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
|
||||
|
||||
.MasterInterfaceNumber = 0,
|
||||
.SlaveInterfaceNumber = 1,
|
||||
},
|
||||
|
||||
.CDC_NotificationEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_NOTIFICATION_EPNUM),
|
||||
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
|
||||
.PollingIntervalMS = 0xFF
|
||||
},
|
||||
|
||||
.CDC_DCI_Interface =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
|
||||
|
||||
.InterfaceNumber = 1,
|
||||
.AlternateSetting = 0,
|
||||
|
||||
.TotalEndpoints = 2,
|
||||
|
||||
.Class = CDC_CSCP_CDCDataClass,
|
||||
.SubClass = CDC_CSCP_NoDataSubclass,
|
||||
.Protocol = CDC_CSCP_NoDataProtocol,
|
||||
|
||||
.InterfaceStrIndex = NO_DESCRIPTOR
|
||||
},
|
||||
|
||||
.CDC_DataOutEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DIR_OUT | CDC_RX_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = CDC_TXRX_EPSIZE,
|
||||
.PollingIntervalMS = 0x01
|
||||
},
|
||||
|
||||
.CDC_DataInEndpoint =
|
||||
{
|
||||
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
|
||||
|
||||
.EndpointAddress = (ENDPOINT_DIR_IN | CDC_TX_EPNUM),
|
||||
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
|
||||
.EndpointSize = CDC_TXRX_EPSIZE,
|
||||
.PollingIntervalMS = 0x01
|
||||
}
|
||||
};
|
||||
|
||||
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
|
||||
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
|
||||
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
|
||||
*/
|
||||
const USB_Descriptor_String_t PROGMEM LanguageString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = {LANGUAGE_ID_ENG}
|
||||
};
|
||||
|
||||
/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable
|
||||
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
|
||||
* Descriptor.
|
||||
*/
|
||||
const USB_Descriptor_String_t PROGMEM ManufacturerString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(10), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"Doug Brown"
|
||||
};
|
||||
|
||||
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
|
||||
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
|
||||
* Descriptor.
|
||||
*/
|
||||
const USB_Descriptor_String_t PROGMEM ProductString =
|
||||
{
|
||||
.Header = {.Size = USB_STRING_LEN(23), .Type = DTYPE_String},
|
||||
|
||||
.UnicodeString = L"Mac ROM SIMM Programmer"
|
||||
};
|
||||
|
||||
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
|
||||
* documentation) by the application code so that the address and size of a requested descriptor can be given
|
||||
* to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function
|
||||
* is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the
|
||||
* USB host.
|
||||
*/
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const void ** const DescriptorAddress)
|
||||
{
|
||||
const uint8_t DescriptorType = (wValue >> 8);
|
||||
const uint8_t DescriptorNumber = (wValue & 0xFF);
|
||||
|
||||
const void *Address = NULL;
|
||||
uint16_t Size = NO_DESCRIPTOR;
|
||||
|
||||
switch (DescriptorType)
|
||||
{
|
||||
case DTYPE_Device:
|
||||
Address = &DeviceDescriptor;
|
||||
Size = sizeof(USB_Descriptor_Device_t);
|
||||
break;
|
||||
case DTYPE_Configuration:
|
||||
Address = &ConfigurationDescriptor;
|
||||
Size = sizeof(USB_Descriptor_Configuration_t);
|
||||
break;
|
||||
case DTYPE_String:
|
||||
switch (DescriptorNumber)
|
||||
{
|
||||
case 0x00:
|
||||
Address = &LanguageString;
|
||||
Size = pgm_read_byte(&LanguageString.Header.Size);
|
||||
break;
|
||||
case 0x01:
|
||||
Address = &ManufacturerString;
|
||||
Size = pgm_read_byte(&ManufacturerString.Header.Size);
|
||||
break;
|
||||
case 0x02:
|
||||
Address = &ProductString;
|
||||
Size = pgm_read_byte(&ProductString.Header.Size);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
*DescriptorAddress = Address;
|
||||
return Size;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,89 +1,89 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2011.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
*
|
||||
* Header file for Descriptors.c.
|
||||
*/
|
||||
|
||||
#ifndef _DESCRIPTORS_H_
|
||||
#define _DESCRIPTORS_H_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#include "LUFA/Drivers/USB/USB.h"
|
||||
|
||||
/* Macros: */
|
||||
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
|
||||
#define CDC_NOTIFICATION_EPNUM 2
|
||||
|
||||
/** Endpoint number of the CDC device-to-host data IN endpoint. */
|
||||
#define CDC_TX_EPNUM 3
|
||||
|
||||
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
|
||||
#define CDC_RX_EPNUM 4
|
||||
|
||||
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
|
||||
#define CDC_NOTIFICATION_EPSIZE 8
|
||||
|
||||
/** Size in bytes of the CDC data IN and OUT endpoints. */
|
||||
#define CDC_TXRX_EPSIZE 64
|
||||
|
||||
/* Type Defines: */
|
||||
/** Type define for the device configuration descriptor structure. This must be defined in the
|
||||
* application code, as the configuration descriptor contains several sub-descriptors which
|
||||
* vary between devices, and which describe the device's usage to the host.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
// CDC Command Interface
|
||||
USB_Descriptor_Interface_t CDC_CCI_Interface;
|
||||
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
|
||||
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
|
||||
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
|
||||
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
|
||||
|
||||
// CDC Data Interface
|
||||
USB_Descriptor_Interface_t CDC_DCI_Interface;
|
||||
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
|
||||
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2011.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
*
|
||||
* Header file for Descriptors.c.
|
||||
*/
|
||||
|
||||
#ifndef _DESCRIPTORS_H_
|
||||
#define _DESCRIPTORS_H_
|
||||
|
||||
/* Includes: */
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#include "LUFA/Drivers/USB/USB.h"
|
||||
|
||||
/* Macros: */
|
||||
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
|
||||
#define CDC_NOTIFICATION_EPNUM 2
|
||||
|
||||
/** Endpoint number of the CDC device-to-host data IN endpoint. */
|
||||
#define CDC_TX_EPNUM 3
|
||||
|
||||
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
|
||||
#define CDC_RX_EPNUM 4
|
||||
|
||||
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
|
||||
#define CDC_NOTIFICATION_EPSIZE 8
|
||||
|
||||
/** Size in bytes of the CDC data IN and OUT endpoints. */
|
||||
#define CDC_TXRX_EPSIZE 64
|
||||
|
||||
/* Type Defines: */
|
||||
/** Type define for the device configuration descriptor structure. This must be defined in the
|
||||
* application code, as the configuration descriptor contains several sub-descriptors which
|
||||
* vary between devices, and which describe the device's usage to the host.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
USB_Descriptor_Configuration_Header_t Config;
|
||||
|
||||
// CDC Command Interface
|
||||
USB_Descriptor_Interface_t CDC_CCI_Interface;
|
||||
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
|
||||
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
|
||||
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
|
||||
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
|
||||
|
||||
// CDC Data Interface
|
||||
USB_Descriptor_Interface_t CDC_DCI_Interface;
|
||||
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
|
||||
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
|
||||
} USB_Descriptor_Configuration_t;
|
||||
|
||||
/* Function Prototypes: */
|
||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
|
||||
const uint8_t wIndex,
|
||||
const void** const DescriptorAddress)
|
||||
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,88 +1,88 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a stub driver header file, for implementing custom board
|
||||
layout hardware with compatible LUFA board specific drivers. If
|
||||
the library is configured to use the BOARD_USER board mode, this
|
||||
driver file should be completed and copied into the "/Board/" folder
|
||||
inside the application's folder.
|
||||
|
||||
This stub is for the board-specific component of the LUFA Buttons driver,
|
||||
for the control of physical board-mounted GPIO pushbuttons.
|
||||
*/
|
||||
|
||||
#ifndef __BUTTONS_USER_H__
|
||||
#define __BUTTONS_USER_H__
|
||||
|
||||
/* Includes: */
|
||||
// TODO: Add any required includes here
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_BUTTONS_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Button mask for the first button on the board. */
|
||||
#define BUTTONS_BUTTON1 // TODO: Add mask for first board button here
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void Buttons_Init(void)
|
||||
{
|
||||
// TODO: Initialize the appropriate port pins as an inputs here, with pull-ups
|
||||
}
|
||||
|
||||
static inline void Buttons_Disable(void)
|
||||
{
|
||||
// TODO: Clear the appropriate port pins as high impedance inputs here
|
||||
}
|
||||
|
||||
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Buttons_GetStatus(void)
|
||||
{
|
||||
// TODO: Return current button status here, debounced if required
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a stub driver header file, for implementing custom board
|
||||
layout hardware with compatible LUFA board specific drivers. If
|
||||
the library is configured to use the BOARD_USER board mode, this
|
||||
driver file should be completed and copied into the "/Board/" folder
|
||||
inside the application's folder.
|
||||
|
||||
This stub is for the board-specific component of the LUFA Buttons driver,
|
||||
for the control of physical board-mounted GPIO pushbuttons.
|
||||
*/
|
||||
|
||||
#ifndef __BUTTONS_USER_H__
|
||||
#define __BUTTONS_USER_H__
|
||||
|
||||
/* Includes: */
|
||||
// TODO: Add any required includes here
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_BUTTONS_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Button mask for the first button on the board. */
|
||||
#define BUTTONS_BUTTON1 // TODO: Add mask for first board button here
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void Buttons_Init(void)
|
||||
{
|
||||
// TODO: Initialize the appropriate port pins as an inputs here, with pull-ups
|
||||
}
|
||||
|
||||
static inline void Buttons_Disable(void)
|
||||
{
|
||||
// TODO: Clear the appropriate port pins as high impedance inputs here
|
||||
}
|
||||
|
||||
static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Buttons_GetStatus(void)
|
||||
{
|
||||
// TODO: Return current button status here, debounced if required
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,218 +1,218 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a stub driver header file, for implementing custom board
|
||||
layout hardware with compatible LUFA board specific drivers. If
|
||||
the library is configured to use the BOARD_USER board mode, this
|
||||
driver file should be completed and copied into the "/Board/" folder
|
||||
inside the application's folder.
|
||||
|
||||
This stub is for the board-specific component of the LUFA Dataflash
|
||||
driver.
|
||||
*/
|
||||
|
||||
#ifndef __DATAFLASH_USER_H__
|
||||
#define __DATAFLASH_USER_H__
|
||||
|
||||
/* Includes: */
|
||||
// TODO: Add any required includes here
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_DATAFLASH_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead.
|
||||
#endif
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Macros: */
|
||||
#define DATAFLASH_CHIPCS_MASK // TODO: Replace this with a mask of all the /CS pins of all Dataflashes
|
||||
#define DATAFLASH_CHIPCS_DDR // TODO: Replace with the DDR register name for the board's Dataflash ICs
|
||||
#define DATAFLASH_CHIPCS_PORT // TODO: Replace with the PORT register name for the board's Dataflash ICs
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Constant indicating the total number of dataflash ICs mounted on the selected board. */
|
||||
#define DATAFLASH_TOTALCHIPS 1 // TODO: Replace with the number of Dataflashes on the board, max 2
|
||||
|
||||
/** Mask for no dataflash chip selected. */
|
||||
#define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK
|
||||
|
||||
/** Mask for the first dataflash chip selected. */
|
||||
#define DATAFLASH_CHIP1 // TODO: Replace with mask to hold /CS of first Dataflash low, and all others high
|
||||
|
||||
/** Mask for the second dataflash chip selected. */
|
||||
#define DATAFLASH_CHIP2 // TODO: Replace with mask to hold /CS of second Dataflash low, and all others high
|
||||
|
||||
/** Internal main memory page size for the board's dataflash ICs. */
|
||||
#define DATAFLASH_PAGE_SIZE // TODO: Replace with the page size for the Dataflash ICs
|
||||
|
||||
/** Total number of pages inside each of the board's dataflash ICs. */
|
||||
#define DATAFLASH_PAGES // TODO: Replace with the total number of pages inside one of the Dataflash ICs
|
||||
|
||||
/* Inline Functions: */
|
||||
/** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC.
|
||||
* The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used.
|
||||
*/
|
||||
static inline void Dataflash_Init(void)
|
||||
{
|
||||
DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK;
|
||||
DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK;
|
||||
}
|
||||
|
||||
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
|
||||
*
|
||||
* \param[in] Byte Byte of data to send to the dataflash
|
||||
*
|
||||
* \return Last response byte from the dataflash
|
||||
*/
|
||||
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash.
|
||||
*
|
||||
* \param[in] Byte Byte of data to send to the dataflash
|
||||
*/
|
||||
static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline void Dataflash_SendByte(const uint8_t Byte)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash.
|
||||
*
|
||||
* \return Last response byte from the dataflash
|
||||
*/
|
||||
static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Dataflash_ReceiveByte(void)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/** Determines the currently selected dataflash chip.
|
||||
*
|
||||
* \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected
|
||||
* or a DATAFLASH_CHIPn mask (where n is the chip number).
|
||||
*/
|
||||
static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Dataflash_GetSelectedChip(void)
|
||||
{
|
||||
return (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK);
|
||||
}
|
||||
|
||||
/** Selects the given dataflash chip.
|
||||
*
|
||||
* \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is
|
||||
* the chip number).
|
||||
*/
|
||||
static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE;
|
||||
static inline void Dataflash_SelectChip(const uint8_t ChipMask)
|
||||
{
|
||||
DATAFLASH_CHIPCS_PORT = ((DATAFLASH_CHIPCS_PORT & ~DATAFLASH_CHIPCS_MASK) | ChipMask);
|
||||
}
|
||||
|
||||
/** Deselects the current dataflash chip, so that no dataflash is selected. */
|
||||
static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void Dataflash_DeselectChip(void)
|
||||
{
|
||||
Dataflash_SelectChip(DATAFLASH_NO_CHIP);
|
||||
}
|
||||
|
||||
/** Selects a dataflash IC from the given page number, which should range from 0 to
|
||||
* ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one
|
||||
* dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside
|
||||
* the total number of pages contained in the boards dataflash ICs, all dataflash ICs
|
||||
* are deselected.
|
||||
*
|
||||
* \param[in] PageAddress Address of the page to manipulate, ranging from
|
||||
* 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1).
|
||||
*/
|
||||
static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress)
|
||||
{
|
||||
Dataflash_DeselectChip();
|
||||
|
||||
if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS))
|
||||
return;
|
||||
|
||||
#if (DATAFLASH_TOTALCHIPS == 2)
|
||||
if (PageAddress & 0x01)
|
||||
Dataflash_SelectChip(DATAFLASH_CHIP2);
|
||||
else
|
||||
Dataflash_SelectChip(DATAFLASH_CHIP1);
|
||||
#else
|
||||
Dataflash_SelectChip(DATAFLASH_CHIP1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive
|
||||
* a new command.
|
||||
*/
|
||||
static inline void Dataflash_ToggleSelectedChipCS(void)
|
||||
{
|
||||
uint8_t SelectedChipMask = Dataflash_GetSelectedChip();
|
||||
|
||||
Dataflash_DeselectChip();
|
||||
Dataflash_SelectChip(SelectedChipMask);
|
||||
}
|
||||
|
||||
/** Spin-loops while the currently selected dataflash is busy executing a command, such as a main
|
||||
* memory page program or main memory to buffer transfer.
|
||||
*/
|
||||
static inline void Dataflash_WaitWhileBusy(void)
|
||||
{
|
||||
Dataflash_ToggleSelectedChipCS();
|
||||
Dataflash_SendByte(DF_CMD_GETSTATUS);
|
||||
while (!(Dataflash_ReceiveByte() & DF_STATUS_READY));
|
||||
Dataflash_ToggleSelectedChipCS();
|
||||
}
|
||||
|
||||
/** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with
|
||||
* dataflash commands which require a complete 24-bit address.
|
||||
*
|
||||
* \param[in] PageAddress Page address within the selected dataflash IC
|
||||
* \param[in] BufferByte Address within the dataflash's buffer
|
||||
*/
|
||||
static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, const uint16_t BufferByte)
|
||||
{
|
||||
#if (DATAFLASH_TOTALCHIPS == 2)
|
||||
PageAddress >>= 1;
|
||||
#endif
|
||||
|
||||
Dataflash_SendByte(PageAddress >> 5);
|
||||
Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
|
||||
Dataflash_SendByte(BufferByte);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a stub driver header file, for implementing custom board
|
||||
layout hardware with compatible LUFA board specific drivers. If
|
||||
the library is configured to use the BOARD_USER board mode, this
|
||||
driver file should be completed and copied into the "/Board/" folder
|
||||
inside the application's folder.
|
||||
|
||||
This stub is for the board-specific component of the LUFA Dataflash
|
||||
driver.
|
||||
*/
|
||||
|
||||
#ifndef __DATAFLASH_USER_H__
|
||||
#define __DATAFLASH_USER_H__
|
||||
|
||||
/* Includes: */
|
||||
// TODO: Add any required includes here
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_DATAFLASH_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead.
|
||||
#endif
|
||||
|
||||
/* Private Interface - For use in library only: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
/* Macros: */
|
||||
#define DATAFLASH_CHIPCS_MASK // TODO: Replace this with a mask of all the /CS pins of all Dataflashes
|
||||
#define DATAFLASH_CHIPCS_DDR // TODO: Replace with the DDR register name for the board's Dataflash ICs
|
||||
#define DATAFLASH_CHIPCS_PORT // TODO: Replace with the PORT register name for the board's Dataflash ICs
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Constant indicating the total number of dataflash ICs mounted on the selected board. */
|
||||
#define DATAFLASH_TOTALCHIPS 1 // TODO: Replace with the number of Dataflashes on the board, max 2
|
||||
|
||||
/** Mask for no dataflash chip selected. */
|
||||
#define DATAFLASH_NO_CHIP DATAFLASH_CHIPCS_MASK
|
||||
|
||||
/** Mask for the first dataflash chip selected. */
|
||||
#define DATAFLASH_CHIP1 // TODO: Replace with mask to hold /CS of first Dataflash low, and all others high
|
||||
|
||||
/** Mask for the second dataflash chip selected. */
|
||||
#define DATAFLASH_CHIP2 // TODO: Replace with mask to hold /CS of second Dataflash low, and all others high
|
||||
|
||||
/** Internal main memory page size for the board's dataflash ICs. */
|
||||
#define DATAFLASH_PAGE_SIZE // TODO: Replace with the page size for the Dataflash ICs
|
||||
|
||||
/** Total number of pages inside each of the board's dataflash ICs. */
|
||||
#define DATAFLASH_PAGES // TODO: Replace with the total number of pages inside one of the Dataflash ICs
|
||||
|
||||
/* Inline Functions: */
|
||||
/** Initializes the dataflash driver so that commands and data may be sent to an attached dataflash IC.
|
||||
* The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used.
|
||||
*/
|
||||
static inline void Dataflash_Init(void)
|
||||
{
|
||||
DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK;
|
||||
DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK;
|
||||
}
|
||||
|
||||
/** Sends a byte to the currently selected dataflash IC, and returns a byte from the dataflash.
|
||||
*
|
||||
* \param[in] Byte Byte of data to send to the dataflash
|
||||
*
|
||||
* \return Last response byte from the dataflash
|
||||
*/
|
||||
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash.
|
||||
*
|
||||
* \param[in] Byte Byte of data to send to the dataflash
|
||||
*/
|
||||
static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
|
||||
static inline void Dataflash_SendByte(const uint8_t Byte)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash.
|
||||
*
|
||||
* \return Last response byte from the dataflash
|
||||
*/
|
||||
static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Dataflash_ReceiveByte(void)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/** Determines the currently selected dataflash chip.
|
||||
*
|
||||
* \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected
|
||||
* or a DATAFLASH_CHIPn mask (where n is the chip number).
|
||||
*/
|
||||
static inline uint8_t Dataflash_GetSelectedChip(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Dataflash_GetSelectedChip(void)
|
||||
{
|
||||
return (DATAFLASH_CHIPCS_PORT & DATAFLASH_CHIPCS_MASK);
|
||||
}
|
||||
|
||||
/** Selects the given dataflash chip.
|
||||
*
|
||||
* \param[in] ChipMask Mask of the Dataflash IC to select, in the form of DATAFLASH_CHIPn mask (where n is
|
||||
* the chip number).
|
||||
*/
|
||||
static inline void Dataflash_SelectChip(const uint8_t ChipMask) ATTR_ALWAYS_INLINE;
|
||||
static inline void Dataflash_SelectChip(const uint8_t ChipMask)
|
||||
{
|
||||
DATAFLASH_CHIPCS_PORT = ((DATAFLASH_CHIPCS_PORT & ~DATAFLASH_CHIPCS_MASK) | ChipMask);
|
||||
}
|
||||
|
||||
/** Deselects the current dataflash chip, so that no dataflash is selected. */
|
||||
static inline void Dataflash_DeselectChip(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void Dataflash_DeselectChip(void)
|
||||
{
|
||||
Dataflash_SelectChip(DATAFLASH_NO_CHIP);
|
||||
}
|
||||
|
||||
/** Selects a dataflash IC from the given page number, which should range from 0 to
|
||||
* ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one
|
||||
* dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside
|
||||
* the total number of pages contained in the boards dataflash ICs, all dataflash ICs
|
||||
* are deselected.
|
||||
*
|
||||
* \param[in] PageAddress Address of the page to manipulate, ranging from
|
||||
* 0 to ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1).
|
||||
*/
|
||||
static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress)
|
||||
{
|
||||
Dataflash_DeselectChip();
|
||||
|
||||
if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS))
|
||||
return;
|
||||
|
||||
#if (DATAFLASH_TOTALCHIPS == 2)
|
||||
if (PageAddress & 0x01)
|
||||
Dataflash_SelectChip(DATAFLASH_CHIP2);
|
||||
else
|
||||
Dataflash_SelectChip(DATAFLASH_CHIP1);
|
||||
#else
|
||||
Dataflash_SelectChip(DATAFLASH_CHIP1);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive
|
||||
* a new command.
|
||||
*/
|
||||
static inline void Dataflash_ToggleSelectedChipCS(void)
|
||||
{
|
||||
uint8_t SelectedChipMask = Dataflash_GetSelectedChip();
|
||||
|
||||
Dataflash_DeselectChip();
|
||||
Dataflash_SelectChip(SelectedChipMask);
|
||||
}
|
||||
|
||||
/** Spin-loops while the currently selected dataflash is busy executing a command, such as a main
|
||||
* memory page program or main memory to buffer transfer.
|
||||
*/
|
||||
static inline void Dataflash_WaitWhileBusy(void)
|
||||
{
|
||||
Dataflash_ToggleSelectedChipCS();
|
||||
Dataflash_SendByte(DF_CMD_GETSTATUS);
|
||||
while (!(Dataflash_ReceiveByte() & DF_STATUS_READY));
|
||||
Dataflash_ToggleSelectedChipCS();
|
||||
}
|
||||
|
||||
/** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with
|
||||
* dataflash commands which require a complete 24-bit address.
|
||||
*
|
||||
* \param[in] PageAddress Page address within the selected dataflash IC
|
||||
* \param[in] BufferByte Address within the dataflash's buffer
|
||||
*/
|
||||
static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, const uint16_t BufferByte)
|
||||
{
|
||||
#if (DATAFLASH_TOTALCHIPS == 2)
|
||||
PageAddress >>= 1;
|
||||
#endif
|
||||
|
||||
Dataflash_SendByte(PageAddress >> 5);
|
||||
Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
|
||||
Dataflash_SendByte(BufferByte);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,100 +1,100 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a stub driver header file, for implementing custom board
|
||||
layout hardware with compatible LUFA board specific drivers. If
|
||||
the library is configured to use the BOARD_USER board mode, this
|
||||
driver file should be completed and copied into the "/Board/" folder
|
||||
inside the application's folder.
|
||||
|
||||
This stub is for the board-specific component of the LUFA Joystick
|
||||
driver, for a digital four-way (plus button) joystick.
|
||||
*/
|
||||
|
||||
#ifndef __JOYSTICK_USER_H__
|
||||
#define __JOYSTICK_USER_H__
|
||||
|
||||
/* Includes: */
|
||||
// TODO: Add any required includes here
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_JOYSTICK_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Mask for the joystick being pushed in the left direction. */
|
||||
#define JOY_LEFT // TODO: Add mask to indicate joystick left position here
|
||||
|
||||
/** Mask for the joystick being pushed in the right direction. */
|
||||
#define JOY_RIGHT // TODO: Add mask to indicate joystick right position here
|
||||
|
||||
/** Mask for the joystick being pushed in the upward direction. */
|
||||
#define JOY_UP // TODO: Add mask to indicate joystick up position here
|
||||
|
||||
/** Mask for the joystick being pushed in the downward direction. */
|
||||
#define JOY_DOWN // TODO: Add mask to indicate joystick down position here
|
||||
|
||||
/** Mask for the joystick being pushed inward. */
|
||||
#define JOY_PRESS // TODO: Add mask to indicate joystick pressed position here
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void Joystick_Init(void)
|
||||
{
|
||||
// TODO: Initialize joystick port pins as inputs with pull-ups
|
||||
}
|
||||
|
||||
static inline void Joystick_Disable(void)
|
||||
{
|
||||
// TODO: Clear the joystick pins as high impedance inputs here
|
||||
}
|
||||
|
||||
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Joystick_GetStatus(void)
|
||||
{
|
||||
// TODO: Return current joystick position data which can be obtained by masking against the JOY_* macros
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a stub driver header file, for implementing custom board
|
||||
layout hardware with compatible LUFA board specific drivers. If
|
||||
the library is configured to use the BOARD_USER board mode, this
|
||||
driver file should be completed and copied into the "/Board/" folder
|
||||
inside the application's folder.
|
||||
|
||||
This stub is for the board-specific component of the LUFA Joystick
|
||||
driver, for a digital four-way (plus button) joystick.
|
||||
*/
|
||||
|
||||
#ifndef __JOYSTICK_USER_H__
|
||||
#define __JOYSTICK_USER_H__
|
||||
|
||||
/* Includes: */
|
||||
// TODO: Add any required includes here
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_JOYSTICK_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Mask for the joystick being pushed in the left direction. */
|
||||
#define JOY_LEFT // TODO: Add mask to indicate joystick left position here
|
||||
|
||||
/** Mask for the joystick being pushed in the right direction. */
|
||||
#define JOY_RIGHT // TODO: Add mask to indicate joystick right position here
|
||||
|
||||
/** Mask for the joystick being pushed in the upward direction. */
|
||||
#define JOY_UP // TODO: Add mask to indicate joystick up position here
|
||||
|
||||
/** Mask for the joystick being pushed in the downward direction. */
|
||||
#define JOY_DOWN // TODO: Add mask to indicate joystick down position here
|
||||
|
||||
/** Mask for the joystick being pushed inward. */
|
||||
#define JOY_PRESS // TODO: Add mask to indicate joystick pressed position here
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void Joystick_Init(void)
|
||||
{
|
||||
// TODO: Initialize joystick port pins as inputs with pull-ups
|
||||
}
|
||||
|
||||
static inline void Joystick_Disable(void)
|
||||
{
|
||||
// TODO: Clear the joystick pins as high impedance inputs here
|
||||
}
|
||||
|
||||
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t Joystick_GetStatus(void)
|
||||
{
|
||||
// TODO: Return current joystick position data which can be obtained by masking against the JOY_* macros
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,128 +1,128 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a stub driver header file, for implementing custom board
|
||||
layout hardware with compatible LUFA board specific drivers. If
|
||||
the library is configured to use the BOARD_USER board mode, this
|
||||
driver file should be completed and copied into the "/Board/" folder
|
||||
inside the application's folder.
|
||||
|
||||
This stub is for the board-specific component of the LUFA LEDs driver,
|
||||
for the LEDs (up to four) mounted on most development boards.
|
||||
*/
|
||||
|
||||
#ifndef __LEDS_USER_H__
|
||||
#define __LEDS_USER_H__
|
||||
|
||||
/* Includes: */
|
||||
// TODO: Add any required includes here
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_LEDS_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** LED mask for the first LED on the board. */
|
||||
#define LEDS_LED1 // TODO: Add mask for first board LED here
|
||||
|
||||
/** LED mask for the second LED on the board. */
|
||||
#define LEDS_LED2 // TODO: Add mask for second board LED here
|
||||
|
||||
/** LED mask for the third LED on the board. */
|
||||
#define LEDS_LED3 // TODO: Add mask for third board LED here
|
||||
|
||||
/** LED mask for the fourth LED on the board. */
|
||||
#define LEDS_LED4 // TODO: Add mask for fourth board LED here
|
||||
|
||||
/** LED mask for all the LEDs on the board. */
|
||||
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4)
|
||||
|
||||
/** LED mask for none of the board LEDs. */
|
||||
#define LEDS_NO_LEDS 0
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void LEDs_Init(void)
|
||||
{
|
||||
// TODO: Add code to initialize LED port pins as outputs here
|
||||
}
|
||||
|
||||
static inline void LEDs_Disable(void)
|
||||
{
|
||||
// TODO: Clear the LED port pins as high impedance inputs here
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
// TODO: Add code to turn on LEDs given in the LEDMask mask here, leave others as-is
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
// TODO: Add code to turn off LEDs given in the LEDMask mask here, leave others as-is
|
||||
}
|
||||
|
||||
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
// TODO: Add code to turn on only LEDs given in the LEDMask mask here, all others off
|
||||
}
|
||||
|
||||
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
|
||||
{
|
||||
// TODO: Add code to set the Leds in the given LEDMask to the status given in ActiveMask here
|
||||
}
|
||||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
// TODO: Add code to toggle the Leds in the given LEDMask, ignoring all others
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t LEDs_GetLEDs(void)
|
||||
{
|
||||
// TODO: Add code to return the current LEDs status' here which can be masked against LED_LED* macros
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a stub driver header file, for implementing custom board
|
||||
layout hardware with compatible LUFA board specific drivers. If
|
||||
the library is configured to use the BOARD_USER board mode, this
|
||||
driver file should be completed and copied into the "/Board/" folder
|
||||
inside the application's folder.
|
||||
|
||||
This stub is for the board-specific component of the LUFA LEDs driver,
|
||||
for the LEDs (up to four) mounted on most development boards.
|
||||
*/
|
||||
|
||||
#ifndef __LEDS_USER_H__
|
||||
#define __LEDS_USER_H__
|
||||
|
||||
/* Includes: */
|
||||
// TODO: Add any required includes here
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_LEDS_H)
|
||||
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** LED mask for the first LED on the board. */
|
||||
#define LEDS_LED1 // TODO: Add mask for first board LED here
|
||||
|
||||
/** LED mask for the second LED on the board. */
|
||||
#define LEDS_LED2 // TODO: Add mask for second board LED here
|
||||
|
||||
/** LED mask for the third LED on the board. */
|
||||
#define LEDS_LED3 // TODO: Add mask for third board LED here
|
||||
|
||||
/** LED mask for the fourth LED on the board. */
|
||||
#define LEDS_LED4 // TODO: Add mask for fourth board LED here
|
||||
|
||||
/** LED mask for all the LEDs on the board. */
|
||||
#define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4)
|
||||
|
||||
/** LED mask for none of the board LEDs. */
|
||||
#define LEDS_NO_LEDS 0
|
||||
|
||||
/* Inline Functions: */
|
||||
#if !defined(__DOXYGEN__)
|
||||
static inline void LEDs_Init(void)
|
||||
{
|
||||
// TODO: Add code to initialize LED port pins as outputs here
|
||||
}
|
||||
|
||||
static inline void LEDs_Disable(void)
|
||||
{
|
||||
// TODO: Clear the LED port pins as high impedance inputs here
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
// TODO: Add code to turn on LEDs given in the LEDMask mask here, leave others as-is
|
||||
}
|
||||
|
||||
static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
// TODO: Add code to turn off LEDs given in the LEDMask mask here, leave others as-is
|
||||
}
|
||||
|
||||
static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
// TODO: Add code to turn on only LEDs given in the LEDMask mask here, all others off
|
||||
}
|
||||
|
||||
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
|
||||
{
|
||||
// TODO: Add code to set the Leds in the given LEDMask to the status given in ActiveMask here
|
||||
}
|
||||
|
||||
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
|
||||
{
|
||||
// TODO: Add code to toggle the Leds in the given LEDMask, ignoring all others
|
||||
}
|
||||
|
||||
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint8_t LEDs_GetLEDs(void)
|
||||
{
|
||||
// TODO: Add code to return the current LEDs status' here which can be masked against LED_LED* macros
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,160 +1,160 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a header file which can be used to configure LUFA's
|
||||
compile time options, as an alternative to the compile time
|
||||
constants supplied through a makefile. To use this configuration
|
||||
header, copy this into your project's root directory and supply
|
||||
the \c USE_LUFA_CONFIG_HEADER token to the compiler so that it is
|
||||
defined in all compiled source files.
|
||||
|
||||
For information on what each token does, refer to the LUFA
|
||||
manual section "Summary of Compile Tokens".
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_CONFIG_H__
|
||||
#define __LUFA_CONFIG_H__
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
|
||||
/* Non-USB Related Configuration Tokens: */
|
||||
// #define DISABLE_TERMINAL_CODES
|
||||
|
||||
/* USB Class Driver Related Tokens: */
|
||||
// #define HID_HOST_BOOT_PROTOCOL_ONLY
|
||||
// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_MAX_COLLECTIONS {Insert Value Here}
|
||||
// #define HID_MAX_REPORTITEMS {Insert Value Here}
|
||||
// #define HID_MAX_REPORT_IDS {Insert Value Here}
|
||||
// #define NO_CLASS_DRIVER_AUTOFLUSH
|
||||
|
||||
/* General USB Driver Related Tokens: */
|
||||
// #define ORDERED_EP_CONFIG
|
||||
// #define USE_STATIC_OPTIONS {Insert Value Here}
|
||||
// #define USB_DEVICE_ONLY
|
||||
// #define USB_HOST_ONLY
|
||||
// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
|
||||
// #define NO_LIMITED_CONTROLLER_CONNECT
|
||||
// #define NO_SOF_EVENTS
|
||||
|
||||
/* USB Device Mode Driver Related Tokens: */
|
||||
// #define USE_RAM_DESCRIPTORS
|
||||
// #define USE_FLASH_DESCRIPTORS
|
||||
// #define USE_EEPROM_DESCRIPTORS
|
||||
// #define NO_INTERNAL_SERIAL
|
||||
// #define FIXED_CONTROL_ENDPOINT_SIZE {Insert Value Here}
|
||||
// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
|
||||
// #define FIXED_NUM_CONFIGURATION {Insert Value Here}
|
||||
// #define CONTROL_ONLY_DEVICE
|
||||
// #define INTERRUPT_CONTROL_ENDPOINT
|
||||
// #define NO_DEVICE_REMOTE_WAKEUP
|
||||
// #define NO_DEVICE_SELF_POWER
|
||||
|
||||
/* USB Host Mode Driver Related Tokens: */
|
||||
// #define HOST_STATE_AS_GPIOR {Insert Value Here}
|
||||
// #define USB_HOST_TIMEOUT_MS {Insert Value Here}
|
||||
// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here}
|
||||
// #define NO_AUTO_VBUS_MANAGEMENT
|
||||
// #define INVERTED_VBUS_ENABLE_LINE
|
||||
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
|
||||
/* Non-USB Related Configuration Tokens: */
|
||||
// #define DISABLE_TERMINAL_CODES
|
||||
|
||||
/* USB Class Driver Related Tokens: */
|
||||
// #define HID_HOST_BOOT_PROTOCOL_ONLY
|
||||
// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_MAX_COLLECTIONS {Insert Value Here}
|
||||
// #define HID_MAX_REPORTITEMS {Insert Value Here}
|
||||
// #define HID_MAX_REPORT_IDS {Insert Value Here}
|
||||
// #define NO_CLASS_DRIVER_AUTOFLUSH
|
||||
|
||||
/* General USB Driver Related Tokens: */
|
||||
// #define USE_STATIC_OPTIONS {Insert Value Here}
|
||||
// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
|
||||
// #define NO_LIMITED_CONTROLLER_CONNECT
|
||||
// #define NO_SOF_EVENTS
|
||||
|
||||
/* USB Device Mode Driver Related Tokens: */
|
||||
// #define USE_RAM_DESCRIPTORS
|
||||
// #define USE_FLASH_DESCRIPTORS
|
||||
// #define USE_EEPROM_DESCRIPTORS
|
||||
// #define NO_INTERNAL_SERIAL
|
||||
// #define FIXED_CONTROL_ENDPOINT_SIZE {Insert Value Here}
|
||||
// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
|
||||
// #define FIXED_NUM_CONFIGURATION {Insert Value Here}
|
||||
// #define CONTROL_ONLY_DEVICE
|
||||
// #define NO_DEVICE_REMOTE_WAKEUP
|
||||
// #define NO_DEVICE_SELF_POWER
|
||||
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
|
||||
/* Non-USB Related Configuration Tokens: */
|
||||
// #define DISABLE_TERMINAL_CODES
|
||||
|
||||
/* USB Class Driver Related Tokens: */
|
||||
// #define HID_HOST_BOOT_PROTOCOL_ONLY
|
||||
// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_MAX_COLLECTIONS {Insert Value Here}
|
||||
// #define HID_MAX_REPORTITEMS {Insert Value Here}
|
||||
// #define HID_MAX_REPORT_IDS {Insert Value Here}
|
||||
// #define NO_CLASS_DRIVER_AUTOFLUSH
|
||||
|
||||
/* General USB Driver Related Tokens: */
|
||||
// #define ORDERED_EP_CONFIG
|
||||
// #define USE_STATIC_OPTIONS {Insert Value Here}
|
||||
// #define USB_DEVICE_ONLY
|
||||
// #define USB_HOST_ONLY
|
||||
// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
|
||||
// #define NO_SOF_EVENTS
|
||||
|
||||
/* USB Device Mode Driver Related Tokens: */
|
||||
// #define NO_INTERNAL_SERIAL
|
||||
// #define FIXED_CONTROL_ENDPOINT_SIZE {Insert Value Here}
|
||||
// #define FIXED_NUM_CONFIGURATION {Insert Value Here}
|
||||
// #define CONTROL_ONLY_DEVICE
|
||||
// #define INTERRUPT_CONTROL_ENDPOINT
|
||||
// #define NO_DEVICE_REMOTE_WAKEUP
|
||||
// #define NO_DEVICE_SELF_POWER
|
||||
|
||||
/* USB Host Mode Driver Related Tokens: */
|
||||
// #define USB_HOST_TIMEOUT_MS {Insert Value Here}
|
||||
// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here}
|
||||
// #define NO_AUTO_VBUS_MANAGEMENT
|
||||
// #define INVERTED_VBUS_ENABLE_LINE
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/*
|
||||
This is a header file which can be used to configure LUFA's
|
||||
compile time options, as an alternative to the compile time
|
||||
constants supplied through a makefile. To use this configuration
|
||||
header, copy this into your project's root directory and supply
|
||||
the \c USE_LUFA_CONFIG_HEADER token to the compiler so that it is
|
||||
defined in all compiled source files.
|
||||
|
||||
For information on what each token does, refer to the LUFA
|
||||
manual section "Summary of Compile Tokens".
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_CONFIG_H__
|
||||
#define __LUFA_CONFIG_H__
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
|
||||
/* Non-USB Related Configuration Tokens: */
|
||||
// #define DISABLE_TERMINAL_CODES
|
||||
|
||||
/* USB Class Driver Related Tokens: */
|
||||
// #define HID_HOST_BOOT_PROTOCOL_ONLY
|
||||
// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_MAX_COLLECTIONS {Insert Value Here}
|
||||
// #define HID_MAX_REPORTITEMS {Insert Value Here}
|
||||
// #define HID_MAX_REPORT_IDS {Insert Value Here}
|
||||
// #define NO_CLASS_DRIVER_AUTOFLUSH
|
||||
|
||||
/* General USB Driver Related Tokens: */
|
||||
// #define ORDERED_EP_CONFIG
|
||||
// #define USE_STATIC_OPTIONS {Insert Value Here}
|
||||
// #define USB_DEVICE_ONLY
|
||||
// #define USB_HOST_ONLY
|
||||
// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
|
||||
// #define NO_LIMITED_CONTROLLER_CONNECT
|
||||
// #define NO_SOF_EVENTS
|
||||
|
||||
/* USB Device Mode Driver Related Tokens: */
|
||||
// #define USE_RAM_DESCRIPTORS
|
||||
// #define USE_FLASH_DESCRIPTORS
|
||||
// #define USE_EEPROM_DESCRIPTORS
|
||||
// #define NO_INTERNAL_SERIAL
|
||||
// #define FIXED_CONTROL_ENDPOINT_SIZE {Insert Value Here}
|
||||
// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
|
||||
// #define FIXED_NUM_CONFIGURATION {Insert Value Here}
|
||||
// #define CONTROL_ONLY_DEVICE
|
||||
// #define INTERRUPT_CONTROL_ENDPOINT
|
||||
// #define NO_DEVICE_REMOTE_WAKEUP
|
||||
// #define NO_DEVICE_SELF_POWER
|
||||
|
||||
/* USB Host Mode Driver Related Tokens: */
|
||||
// #define HOST_STATE_AS_GPIOR {Insert Value Here}
|
||||
// #define USB_HOST_TIMEOUT_MS {Insert Value Here}
|
||||
// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here}
|
||||
// #define NO_AUTO_VBUS_MANAGEMENT
|
||||
// #define INVERTED_VBUS_ENABLE_LINE
|
||||
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
|
||||
/* Non-USB Related Configuration Tokens: */
|
||||
// #define DISABLE_TERMINAL_CODES
|
||||
|
||||
/* USB Class Driver Related Tokens: */
|
||||
// #define HID_HOST_BOOT_PROTOCOL_ONLY
|
||||
// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_MAX_COLLECTIONS {Insert Value Here}
|
||||
// #define HID_MAX_REPORTITEMS {Insert Value Here}
|
||||
// #define HID_MAX_REPORT_IDS {Insert Value Here}
|
||||
// #define NO_CLASS_DRIVER_AUTOFLUSH
|
||||
|
||||
/* General USB Driver Related Tokens: */
|
||||
// #define USE_STATIC_OPTIONS {Insert Value Here}
|
||||
// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
|
||||
// #define NO_LIMITED_CONTROLLER_CONNECT
|
||||
// #define NO_SOF_EVENTS
|
||||
|
||||
/* USB Device Mode Driver Related Tokens: */
|
||||
// #define USE_RAM_DESCRIPTORS
|
||||
// #define USE_FLASH_DESCRIPTORS
|
||||
// #define USE_EEPROM_DESCRIPTORS
|
||||
// #define NO_INTERNAL_SERIAL
|
||||
// #define FIXED_CONTROL_ENDPOINT_SIZE {Insert Value Here}
|
||||
// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
|
||||
// #define FIXED_NUM_CONFIGURATION {Insert Value Here}
|
||||
// #define CONTROL_ONLY_DEVICE
|
||||
// #define NO_DEVICE_REMOTE_WAKEUP
|
||||
// #define NO_DEVICE_SELF_POWER
|
||||
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
|
||||
/* Non-USB Related Configuration Tokens: */
|
||||
// #define DISABLE_TERMINAL_CODES
|
||||
|
||||
/* USB Class Driver Related Tokens: */
|
||||
// #define HID_HOST_BOOT_PROTOCOL_ONLY
|
||||
// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
|
||||
// #define HID_MAX_COLLECTIONS {Insert Value Here}
|
||||
// #define HID_MAX_REPORTITEMS {Insert Value Here}
|
||||
// #define HID_MAX_REPORT_IDS {Insert Value Here}
|
||||
// #define NO_CLASS_DRIVER_AUTOFLUSH
|
||||
|
||||
/* General USB Driver Related Tokens: */
|
||||
// #define ORDERED_EP_CONFIG
|
||||
// #define USE_STATIC_OPTIONS {Insert Value Here}
|
||||
// #define USB_DEVICE_ONLY
|
||||
// #define USB_HOST_ONLY
|
||||
// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
|
||||
// #define NO_SOF_EVENTS
|
||||
|
||||
/* USB Device Mode Driver Related Tokens: */
|
||||
// #define NO_INTERNAL_SERIAL
|
||||
// #define FIXED_CONTROL_ENDPOINT_SIZE {Insert Value Here}
|
||||
// #define FIXED_NUM_CONFIGURATION {Insert Value Here}
|
||||
// #define CONTROL_ONLY_DEVICE
|
||||
// #define INTERRUPT_CONTROL_ENDPOINT
|
||||
// #define NO_DEVICE_REMOTE_WAKEUP
|
||||
// #define NO_DEVICE_SELF_POWER
|
||||
|
||||
/* USB Host Mode Driver Related Tokens: */
|
||||
// #define USB_HOST_TIMEOUT_MS {Insert Value Here}
|
||||
// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here}
|
||||
// #define NO_AUTO_VBUS_MANAGEMENT
|
||||
// #define INVERTED_VBUS_ENABLE_LINE
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,486 +1,486 @@
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#----------------------------------------------------------------------------
|
||||
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
|
||||
# >> Modified for use with the LUFA project. <<
|
||||
#
|
||||
# Released to the Public Domain
|
||||
#
|
||||
# Additional material for this makefile was written by:
|
||||
# Peter Fleury
|
||||
# Tim Henigan
|
||||
# Colin O'Flynn
|
||||
# Reiner Patommel
|
||||
# Markus Pfaff
|
||||
# Sander Pool
|
||||
# Frederik Rouleau
|
||||
# Carlos Lamas
|
||||
# Dean Camera
|
||||
# Opendous Inc.
|
||||
# Denver Gingerich
|
||||
#
|
||||
#----------------------------------------------------------------------------
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make dfu = Download the hex file to the device, using dfu-programmer (must
|
||||
# have dfu-programmer installed).
|
||||
#
|
||||
# make flip = Download the hex file to the device, using Atmel FLIP (must
|
||||
# have Atmel FLIP installed).
|
||||
#
|
||||
# make doxygen = Generate DoxyGen documentation for the project (must have
|
||||
# DoxyGen installed)
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only.
|
||||
#
|
||||
# make filename.i = Create a preprocessed source file for use in submitting
|
||||
# bug reports to the GCC project.
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
# MCU name
|
||||
MCU = ### INSERT NAME OF MICROCONTROLLER MODEL HERE ###
|
||||
|
||||
|
||||
# Targeted chip architecture (see library "Architectures" documentation)
|
||||
ARCH = UC3
|
||||
|
||||
|
||||
# Target board (see library "Board Types" documentation, NONE for projects not requiring
|
||||
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
|
||||
# "Board" inside the application directory.
|
||||
BOARD = ### INSERT NAME OF BOARD HERE, OR NONE IF NO BOARD DRIVERS USED ###
|
||||
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This should be the frequency the system core runs at, after the system clock
|
||||
# has been set up correctly and started.
|
||||
F_CPU = ### INSERT PRESCALED SYSTEM CLOCK SPEED HERE, IN HZ ###
|
||||
|
||||
|
||||
# USB controller master clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency of the USB controller's clock generator in Hz.
|
||||
#
|
||||
# For the UC3 chips, this should be equal to 48MHz or 96MHz.
|
||||
F_USB = ### INSERT CLOCK TO USB MODULE HERE, IN HZ ###
|
||||
|
||||
|
||||
# Output format. (can be srec, ihex, binary)
|
||||
FORMAT = ihex
|
||||
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = ### INSERT NAME OF MAIN FILENAME HERE, WITHOUT EXTENSION ###
|
||||
|
||||
|
||||
# Object files directory
|
||||
# To put object files in current directory, use a dot (.), do NOT make
|
||||
# this an empty or blank macro!
|
||||
OBJDIR = .
|
||||
|
||||
|
||||
# Path to the LUFA library
|
||||
LUFA_PATH = ### INSERT PATH TO LUFA LIBRARY RELATIVE TO PROJECT DIRECTORY HERE ###
|
||||
|
||||
|
||||
# LUFA library compile-time options and predefined tokens (add '-D' before each token)
|
||||
LUFA_OPTS = ### INSERT LUFA COMPILE TIME TOKENS HERE ###
|
||||
|
||||
|
||||
# Create the LUFA source path variables by including the LUFA root makefile
|
||||
include $(LUFA_PATH)/LUFA/makefile
|
||||
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.)
|
||||
SRC = $(TARGET).c \
|
||||
$(LUFA_SRC_USB) \
|
||||
$(LUFA_SRC_USBCLASS)
|
||||
### INSERT ADDITIONAL PROJECT SOURCE FILENAMES OR LUFA MODULE NAMES HERE ###
|
||||
|
||||
|
||||
# List C++ source files here. (C dependencies are automatically generated.)
|
||||
CPPSRC =
|
||||
|
||||
|
||||
# List Assembler source files here.
|
||||
# Make them always end in a capital .S. Files ending in a lowercase .s
|
||||
# will not be considered source files but generated files (assembler
|
||||
# output from the compiler), and will be deleted upon "make clean"!
|
||||
# Even though the DOS/Win* filesystem matches both .s and .S the same,
|
||||
# it will preserve the spelling of the filenames, and gcc itself does
|
||||
# care about how the name is spelled on its command-line.
|
||||
ASRC =
|
||||
|
||||
|
||||
# Optimization level, can be [0, 1, 2, 3, s].
|
||||
# 0 = turn off optimization. s = optimize for size.
|
||||
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||
OPT = s
|
||||
|
||||
|
||||
# List any extra directories to look for include files here.
|
||||
# Each directory must be seperated by a space.
|
||||
# Use forward slashes for directory separators.
|
||||
# For a directory that has spaces, enclose it in quotes.
|
||||
EXTRAINCDIRS = $(LUFA_PATH)/
|
||||
|
||||
|
||||
# Compiler flag to set the C Standard level.
|
||||
# c89 = "ANSI" C
|
||||
# gnu89 = c89 plus GCC extensions
|
||||
# c99 = ISO C99 standard (not yet fully implemented)
|
||||
# gnu99 = c99 plus GCC extensions
|
||||
CSTANDARD = -std=gnu99
|
||||
|
||||
|
||||
# Place -D or -U options here for C sources
|
||||
CDEFS = -DF_CPU=$(F_CPU)UL
|
||||
CDEFS += -DF_USB=$(F_USB)UL
|
||||
CDEFS += -DBOARD=BOARD_$(BOARD)
|
||||
CDEFS += -DARCH=ARCH_$(ARCH)
|
||||
CDEFS += $(LUFA_OPTS)
|
||||
|
||||
|
||||
# Place -D or -U options here for ASM sources
|
||||
ADEFS = -DF_CPU=$(F_CPU)
|
||||
ADEFS += -DF_USB=$(F_USB)UL
|
||||
ADEFS += -DBOARD=BOARD_$(BOARD)
|
||||
ADEFS += -DARCH=ARCH_$(ARCH)
|
||||
ADEFS += $(LUFA_OPTS)
|
||||
|
||||
# Place -D or -U options here for C++ sources
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL
|
||||
CPPDEFS += -DF_USB=$(F_USB)UL
|
||||
CPPDEFS += -DBOARD=BOARD_$(BOARD)
|
||||
CPPDEFS += -DARCH=ARCH_$(ARCH)
|
||||
CPPDEFS += $(LUFA_OPTS)
|
||||
|
||||
|
||||
# Debugging level.
|
||||
DEBUG = 3
|
||||
|
||||
|
||||
#---------------- Compiler Options C ----------------
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual and avr-libc documentation
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -adhlns...: create assembler listing
|
||||
CFLAGS = -g$(DEBUG)
|
||||
CFLAGS += $(CDEFS)
|
||||
CFLAGS += -O$(OPT)
|
||||
CFLAGS += -funsigned-char
|
||||
CFLAGS += -funsigned-bitfields
|
||||
CFLAGS += -ffunction-sections
|
||||
CFLAGS += -fno-strict-aliasing
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wstrict-prototypes
|
||||
CFLAGS += -masm-addr-pseudos
|
||||
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
CFLAGS += $(CSTANDARD)
|
||||
|
||||
|
||||
#---------------- Compiler Options C++ ----------------
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual and avr-libc documentation
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -adhlns...: create assembler listing
|
||||
CPPFLAGS = -g$(DEBUG)
|
||||
CPPFLAGS += $(CPPDEFS)
|
||||
CPPFLAGS += -O$(OPT)
|
||||
CPPFLAGS += -funsigned-char
|
||||
CPPFLAGS += -funsigned-bitfields
|
||||
CPPFLAGS += -ffunction-sections
|
||||
CPPFLAGS += -fno-strict-aliasing
|
||||
CPPFLAGS += -fno-exceptions
|
||||
CPPFLAGS += -masm-addr-pseudos
|
||||
CPPFLAGS += -Wall
|
||||
CPPFLAGS += -Wundef
|
||||
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
|
||||
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
#CPPFLAGS += $(CSTANDARD)
|
||||
|
||||
|
||||
#---------------- Assembler Options ----------------
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -adhlns: create listing
|
||||
# -gstabs: have the assembler create line number information; note that
|
||||
# for use in COFF files, additional information about filenames
|
||||
# and function names needs to be present in the assembler source
|
||||
# files -- see avr-libc docs [FIXME: not yet described there]
|
||||
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
|
||||
# dump that will be displayed for a given single line of source input.
|
||||
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
|
||||
|
||||
|
||||
#---------------- Linker Options ----------------
|
||||
# -Wl,...: tell GCC to pass this to linker.
|
||||
# -Map: create map file
|
||||
# --cref: add cross reference to map file
|
||||
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
||||
LDFLAGS += -Wl,--gc-sections --rodata-writable
|
||||
LDFLAGS += -Wl,--direct-data
|
||||
#LDFLAGS += -T linker_script.x
|
||||
|
||||
|
||||
#============================================================================
|
||||
|
||||
|
||||
# Define programs and commands.
|
||||
SHELL = sh
|
||||
CC = avr32-gcc
|
||||
OBJCOPY = avr32-objcopy
|
||||
OBJDUMP = avr32-objdump
|
||||
SIZE = avr32-size
|
||||
AR = avr32-ar rcs
|
||||
NM = avr32-nm
|
||||
REMOVE = rm -f
|
||||
REMOVEDIR = rm -rf
|
||||
COPY = cp
|
||||
WINSHELL = cmd
|
||||
|
||||
|
||||
# Define Messages
|
||||
# English
|
||||
MSG_ERRORS_NONE = Errors: none
|
||||
MSG_BEGIN = -------- begin --------
|
||||
MSG_END = -------- end --------
|
||||
MSG_SIZE_BEFORE = Size before:
|
||||
MSG_SIZE_AFTER = Size after:
|
||||
MSG_COFF = Converting to AVR COFF:
|
||||
MSG_FLASH = Creating load file for Flash:
|
||||
MSG_EEPROM = Creating load file for EEPROM:
|
||||
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||
MSG_LINKING = Linking:
|
||||
MSG_COMPILING = Compiling C:
|
||||
MSG_COMPILING_CPP = Compiling C++:
|
||||
MSG_ASSEMBLING = Assembling:
|
||||
MSG_CLEANING = Cleaning project:
|
||||
MSG_CREATING_LIBRARY = Creating library:
|
||||
|
||||
|
||||
|
||||
|
||||
# Define all object files.
|
||||
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||
|
||||
# Define all listing files.
|
||||
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||
|
||||
|
||||
# Compiler flags to generate dependency files.
|
||||
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
|
||||
|
||||
|
||||
# Combine all necessary flags and optional flags.
|
||||
# Add target processor to flags.
|
||||
ALL_CFLAGS = -mpart=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||
ALL_CPPFLAGS = -mpart=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
|
||||
ALL_ASFLAGS = -mpart=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Default target.
|
||||
all: begin gccversion sizebefore build sizeafter end
|
||||
|
||||
# Change the build target to build a HEX file or a library.
|
||||
build: elf hex lss sym
|
||||
#build: lib
|
||||
|
||||
|
||||
elf: $(TARGET).elf
|
||||
hex: $(TARGET).hex
|
||||
lss: $(TARGET).lss
|
||||
sym: $(TARGET).sym
|
||||
LIBNAME=lib$(TARGET).a
|
||||
lib: $(LIBNAME)
|
||||
|
||||
|
||||
|
||||
# Eye candy.
|
||||
# AVR Studio 3.x does not check make's exit code but relies on
|
||||
# the following magic strings to be generated by the compile job.
|
||||
begin:
|
||||
@echo
|
||||
@echo $(MSG_BEGIN)
|
||||
|
||||
end:
|
||||
@echo $(MSG_END)
|
||||
@echo
|
||||
|
||||
|
||||
# Display size of file.
|
||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
|
||||
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
|
||||
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
|
||||
|
||||
|
||||
sizebefore:
|
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
|
||||
2>/dev/null; echo; fi
|
||||
|
||||
sizeafter:
|
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
|
||||
2>/dev/null; echo; fi
|
||||
|
||||
|
||||
|
||||
# Display compiler version information.
|
||||
gccversion :
|
||||
@$(CC) --version
|
||||
|
||||
|
||||
# Program the device.
|
||||
flip: $(TARGET).hex
|
||||
batchisp -hardware usb -device $(MCU) -operation erase f
|
||||
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
|
||||
batchisp -hardware usb -device $(MCU) -operation start reset 0
|
||||
|
||||
dfu: $(TARGET).hex
|
||||
dfu-programmer $(MCU) erase
|
||||
dfu-programmer $(MCU) flash $(TARGET).hex
|
||||
dfu-programmer $(MCU) reset
|
||||
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file.
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EXTENDED_LISTING) $@
|
||||
$(OBJDUMP) -h -S -z $< > $@
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
%.sym: %.elf
|
||||
@echo
|
||||
@echo $(MSG_SYMBOL_TABLE) $@
|
||||
$(NM) -n $< > $@
|
||||
|
||||
|
||||
|
||||
# Create library from object files.
|
||||
.SECONDARY : $(TARGET).a
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.a: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_CREATING_LIBRARY) $@
|
||||
$(AR) $@ $(OBJ)
|
||||
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
.SECONDARY : $(TARGET).elf
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.elf: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_LINKING) $@
|
||||
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
|
||||
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
$(OBJDIR)/%.o : %.c
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $<
|
||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compile: create object files from C++ source files.
|
||||
$(OBJDIR)/%.o : %.cpp
|
||||
@echo
|
||||
@echo $(MSG_COMPILING_CPP) $<
|
||||
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compile: create assembler files from C source files.
|
||||
%.s : %.c
|
||||
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compile: create assembler files from C++ source files.
|
||||
%.s : %.cpp
|
||||
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
$(OBJDIR)/%.o : %.S
|
||||
@echo
|
||||
@echo $(MSG_ASSEMBLING) $<
|
||||
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Create preprocessed source for use in sending a bug report.
|
||||
%.i : %.c
|
||||
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Target: clean project.
|
||||
clean: begin clean_list end
|
||||
|
||||
clean_list :
|
||||
@echo
|
||||
@echo $(MSG_CLEANING)
|
||||
$(REMOVE) $(TARGET).hex
|
||||
$(REMOVE) $(TARGET).cof
|
||||
$(REMOVE) $(TARGET).elf
|
||||
$(REMOVE) $(TARGET).map
|
||||
$(REMOVE) $(TARGET).sym
|
||||
$(REMOVE) $(TARGET).lss
|
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||
$(REMOVE) $(SRC:.c=.s)
|
||||
$(REMOVE) $(SRC:.c=.d)
|
||||
$(REMOVE) $(SRC:.c=.i)
|
||||
$(REMOVEDIR) .dep
|
||||
|
||||
doxygen:
|
||||
@echo Generating Project Documentation \($(TARGET)\)...
|
||||
@doxygen Doxygen.conf
|
||||
@echo Documentation Generation Complete.
|
||||
|
||||
clean_doxygen:
|
||||
rm -rf Documentation
|
||||
|
||||
checksource:
|
||||
@for f in $(SRC) $(CPPSRC) $(ASRC); do \
|
||||
if [ -f $$f ]; then \
|
||||
echo "Found Source File: $$f" ; \
|
||||
else \
|
||||
echo "Source File Not Found: $$f" ; \
|
||||
fi; done
|
||||
|
||||
|
||||
# Create object files directory
|
||||
$(shell mkdir $(OBJDIR) 2>/dev/null)
|
||||
|
||||
|
||||
# Include the dependency files.
|
||||
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
||||
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
||||
build elf hex lss sym doxygen clean clean_list clean_doxygen \
|
||||
dfu flip checksource
|
||||
|
||||
# Hey Emacs, this is a -*- makefile -*-
|
||||
#----------------------------------------------------------------------------
|
||||
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al.
|
||||
# >> Modified for use with the LUFA project. <<
|
||||
#
|
||||
# Released to the Public Domain
|
||||
#
|
||||
# Additional material for this makefile was written by:
|
||||
# Peter Fleury
|
||||
# Tim Henigan
|
||||
# Colin O'Flynn
|
||||
# Reiner Patommel
|
||||
# Markus Pfaff
|
||||
# Sander Pool
|
||||
# Frederik Rouleau
|
||||
# Carlos Lamas
|
||||
# Dean Camera
|
||||
# Opendous Inc.
|
||||
# Denver Gingerich
|
||||
#
|
||||
#----------------------------------------------------------------------------
|
||||
# On command line:
|
||||
#
|
||||
# make all = Make software.
|
||||
#
|
||||
# make clean = Clean out built project files.
|
||||
#
|
||||
# make dfu = Download the hex file to the device, using dfu-programmer (must
|
||||
# have dfu-programmer installed).
|
||||
#
|
||||
# make flip = Download the hex file to the device, using Atmel FLIP (must
|
||||
# have Atmel FLIP installed).
|
||||
#
|
||||
# make doxygen = Generate DoxyGen documentation for the project (must have
|
||||
# DoxyGen installed)
|
||||
#
|
||||
# make filename.s = Just compile filename.c into the assembler code only.
|
||||
#
|
||||
# make filename.i = Create a preprocessed source file for use in submitting
|
||||
# bug reports to the GCC project.
|
||||
#
|
||||
# To rebuild project do "make clean" then "make all".
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
||||
# MCU name
|
||||
MCU = ### INSERT NAME OF MICROCONTROLLER MODEL HERE ###
|
||||
|
||||
|
||||
# Targeted chip architecture (see library "Architectures" documentation)
|
||||
ARCH = UC3
|
||||
|
||||
|
||||
# Target board (see library "Board Types" documentation, NONE for projects not requiring
|
||||
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
|
||||
# "Board" inside the application directory.
|
||||
BOARD = ### INSERT NAME OF BOARD HERE, OR NONE IF NO BOARD DRIVERS USED ###
|
||||
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This should be the frequency the system core runs at, after the system clock
|
||||
# has been set up correctly and started.
|
||||
F_CPU = ### INSERT PRESCALED SYSTEM CLOCK SPEED HERE, IN HZ ###
|
||||
|
||||
|
||||
# USB controller master clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency of the USB controller's clock generator in Hz.
|
||||
#
|
||||
# For the UC3 chips, this should be equal to 48MHz or 96MHz.
|
||||
F_USB = ### INSERT CLOCK TO USB MODULE HERE, IN HZ ###
|
||||
|
||||
|
||||
# Output format. (can be srec, ihex, binary)
|
||||
FORMAT = ihex
|
||||
|
||||
|
||||
# Target file name (without extension).
|
||||
TARGET = ### INSERT NAME OF MAIN FILENAME HERE, WITHOUT EXTENSION ###
|
||||
|
||||
|
||||
# Object files directory
|
||||
# To put object files in current directory, use a dot (.), do NOT make
|
||||
# this an empty or blank macro!
|
||||
OBJDIR = .
|
||||
|
||||
|
||||
# Path to the LUFA library
|
||||
LUFA_PATH = ### INSERT PATH TO LUFA LIBRARY RELATIVE TO PROJECT DIRECTORY HERE ###
|
||||
|
||||
|
||||
# LUFA library compile-time options and predefined tokens (add '-D' before each token)
|
||||
LUFA_OPTS = ### INSERT LUFA COMPILE TIME TOKENS HERE ###
|
||||
|
||||
|
||||
# Create the LUFA source path variables by including the LUFA root makefile
|
||||
include $(LUFA_PATH)/LUFA/makefile
|
||||
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.)
|
||||
SRC = $(TARGET).c \
|
||||
$(LUFA_SRC_USB) \
|
||||
$(LUFA_SRC_USBCLASS)
|
||||
### INSERT ADDITIONAL PROJECT SOURCE FILENAMES OR LUFA MODULE NAMES HERE ###
|
||||
|
||||
|
||||
# List C++ source files here. (C dependencies are automatically generated.)
|
||||
CPPSRC =
|
||||
|
||||
|
||||
# List Assembler source files here.
|
||||
# Make them always end in a capital .S. Files ending in a lowercase .s
|
||||
# will not be considered source files but generated files (assembler
|
||||
# output from the compiler), and will be deleted upon "make clean"!
|
||||
# Even though the DOS/Win* filesystem matches both .s and .S the same,
|
||||
# it will preserve the spelling of the filenames, and gcc itself does
|
||||
# care about how the name is spelled on its command-line.
|
||||
ASRC =
|
||||
|
||||
|
||||
# Optimization level, can be [0, 1, 2, 3, s].
|
||||
# 0 = turn off optimization. s = optimize for size.
|
||||
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||
OPT = s
|
||||
|
||||
|
||||
# List any extra directories to look for include files here.
|
||||
# Each directory must be seperated by a space.
|
||||
# Use forward slashes for directory separators.
|
||||
# For a directory that has spaces, enclose it in quotes.
|
||||
EXTRAINCDIRS = $(LUFA_PATH)/
|
||||
|
||||
|
||||
# Compiler flag to set the C Standard level.
|
||||
# c89 = "ANSI" C
|
||||
# gnu89 = c89 plus GCC extensions
|
||||
# c99 = ISO C99 standard (not yet fully implemented)
|
||||
# gnu99 = c99 plus GCC extensions
|
||||
CSTANDARD = -std=gnu99
|
||||
|
||||
|
||||
# Place -D or -U options here for C sources
|
||||
CDEFS = -DF_CPU=$(F_CPU)UL
|
||||
CDEFS += -DF_USB=$(F_USB)UL
|
||||
CDEFS += -DBOARD=BOARD_$(BOARD)
|
||||
CDEFS += -DARCH=ARCH_$(ARCH)
|
||||
CDEFS += $(LUFA_OPTS)
|
||||
|
||||
|
||||
# Place -D or -U options here for ASM sources
|
||||
ADEFS = -DF_CPU=$(F_CPU)
|
||||
ADEFS += -DF_USB=$(F_USB)UL
|
||||
ADEFS += -DBOARD=BOARD_$(BOARD)
|
||||
ADEFS += -DARCH=ARCH_$(ARCH)
|
||||
ADEFS += $(LUFA_OPTS)
|
||||
|
||||
# Place -D or -U options here for C++ sources
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL
|
||||
CPPDEFS += -DF_USB=$(F_USB)UL
|
||||
CPPDEFS += -DBOARD=BOARD_$(BOARD)
|
||||
CPPDEFS += -DARCH=ARCH_$(ARCH)
|
||||
CPPDEFS += $(LUFA_OPTS)
|
||||
|
||||
|
||||
# Debugging level.
|
||||
DEBUG = 3
|
||||
|
||||
|
||||
#---------------- Compiler Options C ----------------
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual and avr-libc documentation
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -adhlns...: create assembler listing
|
||||
CFLAGS = -g$(DEBUG)
|
||||
CFLAGS += $(CDEFS)
|
||||
CFLAGS += -O$(OPT)
|
||||
CFLAGS += -funsigned-char
|
||||
CFLAGS += -funsigned-bitfields
|
||||
CFLAGS += -ffunction-sections
|
||||
CFLAGS += -fno-strict-aliasing
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Wstrict-prototypes
|
||||
CFLAGS += -masm-addr-pseudos
|
||||
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
CFLAGS += $(CSTANDARD)
|
||||
|
||||
|
||||
#---------------- Compiler Options C++ ----------------
|
||||
# -g*: generate debugging information
|
||||
# -O*: optimization level
|
||||
# -f...: tuning, see GCC manual and avr-libc documentation
|
||||
# -Wall...: warning level
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -adhlns...: create assembler listing
|
||||
CPPFLAGS = -g$(DEBUG)
|
||||
CPPFLAGS += $(CPPDEFS)
|
||||
CPPFLAGS += -O$(OPT)
|
||||
CPPFLAGS += -funsigned-char
|
||||
CPPFLAGS += -funsigned-bitfields
|
||||
CPPFLAGS += -ffunction-sections
|
||||
CPPFLAGS += -fno-strict-aliasing
|
||||
CPPFLAGS += -fno-exceptions
|
||||
CPPFLAGS += -masm-addr-pseudos
|
||||
CPPFLAGS += -Wall
|
||||
CPPFLAGS += -Wundef
|
||||
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
|
||||
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
#CPPFLAGS += $(CSTANDARD)
|
||||
|
||||
|
||||
#---------------- Assembler Options ----------------
|
||||
# -Wa,...: tell GCC to pass this to the assembler.
|
||||
# -adhlns: create listing
|
||||
# -gstabs: have the assembler create line number information; note that
|
||||
# for use in COFF files, additional information about filenames
|
||||
# and function names needs to be present in the assembler source
|
||||
# files -- see avr-libc docs [FIXME: not yet described there]
|
||||
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
|
||||
# dump that will be displayed for a given single line of source input.
|
||||
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
|
||||
|
||||
|
||||
#---------------- Linker Options ----------------
|
||||
# -Wl,...: tell GCC to pass this to linker.
|
||||
# -Map: create map file
|
||||
# --cref: add cross reference to map file
|
||||
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
||||
LDFLAGS += -Wl,--gc-sections --rodata-writable
|
||||
LDFLAGS += -Wl,--direct-data
|
||||
#LDFLAGS += -T linker_script.x
|
||||
|
||||
|
||||
#============================================================================
|
||||
|
||||
|
||||
# Define programs and commands.
|
||||
SHELL = sh
|
||||
CC = avr32-gcc
|
||||
OBJCOPY = avr32-objcopy
|
||||
OBJDUMP = avr32-objdump
|
||||
SIZE = avr32-size
|
||||
AR = avr32-ar rcs
|
||||
NM = avr32-nm
|
||||
REMOVE = rm -f
|
||||
REMOVEDIR = rm -rf
|
||||
COPY = cp
|
||||
WINSHELL = cmd
|
||||
|
||||
|
||||
# Define Messages
|
||||
# English
|
||||
MSG_ERRORS_NONE = Errors: none
|
||||
MSG_BEGIN = -------- begin --------
|
||||
MSG_END = -------- end --------
|
||||
MSG_SIZE_BEFORE = Size before:
|
||||
MSG_SIZE_AFTER = Size after:
|
||||
MSG_COFF = Converting to AVR COFF:
|
||||
MSG_FLASH = Creating load file for Flash:
|
||||
MSG_EEPROM = Creating load file for EEPROM:
|
||||
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
||||
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
||||
MSG_LINKING = Linking:
|
||||
MSG_COMPILING = Compiling C:
|
||||
MSG_COMPILING_CPP = Compiling C++:
|
||||
MSG_ASSEMBLING = Assembling:
|
||||
MSG_CLEANING = Cleaning project:
|
||||
MSG_CREATING_LIBRARY = Creating library:
|
||||
|
||||
|
||||
|
||||
|
||||
# Define all object files.
|
||||
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||
|
||||
# Define all listing files.
|
||||
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||
|
||||
|
||||
# Compiler flags to generate dependency files.
|
||||
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
|
||||
|
||||
|
||||
# Combine all necessary flags and optional flags.
|
||||
# Add target processor to flags.
|
||||
ALL_CFLAGS = -mpart=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
|
||||
ALL_CPPFLAGS = -mpart=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS)
|
||||
ALL_ASFLAGS = -mpart=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Default target.
|
||||
all: begin gccversion sizebefore build sizeafter end
|
||||
|
||||
# Change the build target to build a HEX file or a library.
|
||||
build: elf hex lss sym
|
||||
#build: lib
|
||||
|
||||
|
||||
elf: $(TARGET).elf
|
||||
hex: $(TARGET).hex
|
||||
lss: $(TARGET).lss
|
||||
sym: $(TARGET).sym
|
||||
LIBNAME=lib$(TARGET).a
|
||||
lib: $(LIBNAME)
|
||||
|
||||
|
||||
|
||||
# Eye candy.
|
||||
# AVR Studio 3.x does not check make's exit code but relies on
|
||||
# the following magic strings to be generated by the compile job.
|
||||
begin:
|
||||
@echo
|
||||
@echo $(MSG_BEGIN)
|
||||
|
||||
end:
|
||||
@echo $(MSG_END)
|
||||
@echo
|
||||
|
||||
|
||||
# Display size of file.
|
||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
|
||||
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf
|
||||
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )
|
||||
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )
|
||||
|
||||
|
||||
sizebefore:
|
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
|
||||
2>/dev/null; echo; fi
|
||||
|
||||
sizeafter:
|
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
|
||||
2>/dev/null; echo; fi
|
||||
|
||||
|
||||
|
||||
# Display compiler version information.
|
||||
gccversion :
|
||||
@$(CC) --version
|
||||
|
||||
|
||||
# Program the device.
|
||||
flip: $(TARGET).hex
|
||||
batchisp -hardware usb -device $(MCU) -operation erase f
|
||||
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program
|
||||
batchisp -hardware usb -device $(MCU) -operation start reset 0
|
||||
|
||||
dfu: $(TARGET).hex
|
||||
dfu-programmer $(MCU) erase
|
||||
dfu-programmer $(MCU) flash $(TARGET).hex
|
||||
dfu-programmer $(MCU) reset
|
||||
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file.
|
||||
%.hex: %.elf
|
||||
@echo
|
||||
@echo $(MSG_FLASH) $@
|
||||
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
%.lss: %.elf
|
||||
@echo
|
||||
@echo $(MSG_EXTENDED_LISTING) $@
|
||||
$(OBJDUMP) -h -S -z $< > $@
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
%.sym: %.elf
|
||||
@echo
|
||||
@echo $(MSG_SYMBOL_TABLE) $@
|
||||
$(NM) -n $< > $@
|
||||
|
||||
|
||||
|
||||
# Create library from object files.
|
||||
.SECONDARY : $(TARGET).a
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.a: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_CREATING_LIBRARY) $@
|
||||
$(AR) $@ $(OBJ)
|
||||
|
||||
|
||||
# Link: create ELF output file from object files.
|
||||
.SECONDARY : $(TARGET).elf
|
||||
.PRECIOUS : $(OBJ)
|
||||
%.elf: $(OBJ)
|
||||
@echo
|
||||
@echo $(MSG_LINKING) $@
|
||||
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
|
||||
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
$(OBJDIR)/%.o : %.c
|
||||
@echo
|
||||
@echo $(MSG_COMPILING) $<
|
||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compile: create object files from C++ source files.
|
||||
$(OBJDIR)/%.o : %.cpp
|
||||
@echo
|
||||
@echo $(MSG_COMPILING_CPP) $<
|
||||
$(CC) -c $(ALL_CPPFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compile: create assembler files from C source files.
|
||||
%.s : %.c
|
||||
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compile: create assembler files from C++ source files.
|
||||
%.s : %.cpp
|
||||
$(CC) -S $(ALL_CPPFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
$(OBJDIR)/%.o : %.S
|
||||
@echo
|
||||
@echo $(MSG_ASSEMBLING) $<
|
||||
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Create preprocessed source for use in sending a bug report.
|
||||
%.i : %.c
|
||||
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Target: clean project.
|
||||
clean: begin clean_list end
|
||||
|
||||
clean_list :
|
||||
@echo
|
||||
@echo $(MSG_CLEANING)
|
||||
$(REMOVE) $(TARGET).hex
|
||||
$(REMOVE) $(TARGET).cof
|
||||
$(REMOVE) $(TARGET).elf
|
||||
$(REMOVE) $(TARGET).map
|
||||
$(REMOVE) $(TARGET).sym
|
||||
$(REMOVE) $(TARGET).lss
|
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
|
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
|
||||
$(REMOVE) $(SRC:.c=.s)
|
||||
$(REMOVE) $(SRC:.c=.d)
|
||||
$(REMOVE) $(SRC:.c=.i)
|
||||
$(REMOVEDIR) .dep
|
||||
|
||||
doxygen:
|
||||
@echo Generating Project Documentation \($(TARGET)\)...
|
||||
@doxygen Doxygen.conf
|
||||
@echo Documentation Generation Complete.
|
||||
|
||||
clean_doxygen:
|
||||
rm -rf Documentation
|
||||
|
||||
checksource:
|
||||
@for f in $(SRC) $(CPPSRC) $(ASRC); do \
|
||||
if [ -f $$f ]; then \
|
||||
echo "Found Source File: $$f" ; \
|
||||
else \
|
||||
echo "Source File Not Found: $$f" ; \
|
||||
fi; done
|
||||
|
||||
|
||||
# Create object files directory
|
||||
$(shell mkdir $(OBJDIR) 2>/dev/null)
|
||||
|
||||
|
||||
# Include the dependency files.
|
||||
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
|
||||
|
||||
|
||||
# Listing of phony targets.
|
||||
.PHONY : all begin finish end sizebefore sizeafter gccversion \
|
||||
build elf hex lss sym doxygen clean clean_list clean_doxygen \
|
||||
dfu flip checksource
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,148 +1,148 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Architecture specific definitions relating to specific processor architectures.
|
||||
*
|
||||
* \copydetails Group_ArchitectureSpecific
|
||||
*
|
||||
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_ArchitectureSpecific Architecture Specific Definitions
|
||||
* \brief Architecture specific definitions relating to specific processor architectures.
|
||||
*
|
||||
* Architecture specific macros, functions and other definitions, which relate to specific architectures. This
|
||||
* definitions may or may not be available in some form on other architectures, and thus should be protected by
|
||||
* preprocessor checks in portable code to prevent compile errors.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_ARCHSPEC_H__
|
||||
#define __LUFA_ARCHSPEC_H__
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
#if (ARCH == ARCH_AVR8) || defined(__DOXYGEN__)
|
||||
/** Disables the AVR's JTAG bus in software, until a system reset. This will override the current JTAG
|
||||
* status as set by the JTAGEN fuse, disabling JTAG debugging and reverting the JTAG pins back to GPIO
|
||||
* mode.
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*/
|
||||
#define JTAG_DISABLE() MACROS{ \
|
||||
__asm__ __volatile__ ( \
|
||||
"in __tmp_reg__,__SREG__" "\n\t" \
|
||||
"cli" "\n\t" \
|
||||
"out %1, %0" "\n\t" \
|
||||
"out __SREG__, __tmp_reg__" "\n\t" \
|
||||
"out %1, %0" "\n\t" \
|
||||
: \
|
||||
: "r" (1 << JTD), \
|
||||
"M" (_SFR_IO_ADDR(MCUCR)) \
|
||||
: "r0"); \
|
||||
}MACROE
|
||||
|
||||
/** Defines a volatile \c NOP statement which cannot be optimized out by the compiler, and thus can always
|
||||
* be set as a breakpoint in the resulting code. Useful for debugging purposes, where the optimizer
|
||||
* removes/reorders code to the point where break points cannot reliably be set.
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*/
|
||||
#define JTAG_DEBUG_POINT() __asm__ __volatile__ ("nop" ::)
|
||||
|
||||
/** Defines an explicit JTAG break point in the resulting binary via the assembly \c BREAK statement. When
|
||||
* a JTAG is used, this causes the program execution to halt when reached until manually resumed.
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*/
|
||||
#define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("break" ::)
|
||||
|
||||
/** Macro for testing condition "x" and breaking via \ref JTAG_DEBUG_BREAK() if the condition is false.
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*
|
||||
* \param[in] Condition Condition that will be evaluated.
|
||||
*/
|
||||
#define JTAG_ASSERT(Condition) MACROS{ if (!(Condition)) { JTAG_DEBUG_BREAK(); } }MACROE
|
||||
|
||||
/** Macro for testing condition \c "x" and writing debug data to the stdout stream if \c false. The stdout stream
|
||||
* must be pre-initialized before this macro is run and linked to an output device, such as the microcontroller's
|
||||
* USART peripheral.
|
||||
*
|
||||
* The output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion {Condition} failed."
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*
|
||||
* \param[in] Condition Condition that will be evaluated,
|
||||
*/
|
||||
#define STDOUT_ASSERT(Condition) MACROS{ if (!(x)) { printf_P(PSTR("%s: Function \"%s\", Line %d: " \
|
||||
"Assertion \"%s\" failed.\r\n"), \
|
||||
__FILE__, __func__, __LINE__, #Condition); } }MACROE
|
||||
|
||||
#if !defined(pgm_read_ptr) || defined(__DOXYGEN__)
|
||||
/** Reads a pointer out of PROGMEM space on the AVR8 architecture. This is currently a wrapper for the
|
||||
* avr-libc \c pgm_read_ptr() macro with a \c void* cast, so that its value can be assigned directly
|
||||
* to a pointer variable or used in pointer arithmetic without further casting in C. In a future
|
||||
* avr-libc distribution this will be part of the standard API and will be implemented in a more formal
|
||||
* manner.
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*
|
||||
* \param[in] Address Address of the pointer to read.
|
||||
*
|
||||
* \return Pointer retrieved from PROGMEM space.
|
||||
*/
|
||||
#define pgm_read_ptr(Address) (void*)pgm_read_word(Address)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Architecture specific definitions relating to specific processor architectures.
|
||||
*
|
||||
* \copydetails Group_ArchitectureSpecific
|
||||
*
|
||||
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_ArchitectureSpecific Architecture Specific Definitions
|
||||
* \brief Architecture specific definitions relating to specific processor architectures.
|
||||
*
|
||||
* Architecture specific macros, functions and other definitions, which relate to specific architectures. This
|
||||
* definitions may or may not be available in some form on other architectures, and thus should be protected by
|
||||
* preprocessor checks in portable code to prevent compile errors.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_ARCHSPEC_H__
|
||||
#define __LUFA_ARCHSPEC_H__
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
#if (ARCH == ARCH_AVR8) || defined(__DOXYGEN__)
|
||||
/** Disables the AVR's JTAG bus in software, until a system reset. This will override the current JTAG
|
||||
* status as set by the JTAGEN fuse, disabling JTAG debugging and reverting the JTAG pins back to GPIO
|
||||
* mode.
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*/
|
||||
#define JTAG_DISABLE() MACROS{ \
|
||||
__asm__ __volatile__ ( \
|
||||
"in __tmp_reg__,__SREG__" "\n\t" \
|
||||
"cli" "\n\t" \
|
||||
"out %1, %0" "\n\t" \
|
||||
"out __SREG__, __tmp_reg__" "\n\t" \
|
||||
"out %1, %0" "\n\t" \
|
||||
: \
|
||||
: "r" (1 << JTD), \
|
||||
"M" (_SFR_IO_ADDR(MCUCR)) \
|
||||
: "r0"); \
|
||||
}MACROE
|
||||
|
||||
/** Defines a volatile \c NOP statement which cannot be optimized out by the compiler, and thus can always
|
||||
* be set as a breakpoint in the resulting code. Useful for debugging purposes, where the optimizer
|
||||
* removes/reorders code to the point where break points cannot reliably be set.
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*/
|
||||
#define JTAG_DEBUG_POINT() __asm__ __volatile__ ("nop" ::)
|
||||
|
||||
/** Defines an explicit JTAG break point in the resulting binary via the assembly \c BREAK statement. When
|
||||
* a JTAG is used, this causes the program execution to halt when reached until manually resumed.
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*/
|
||||
#define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("break" ::)
|
||||
|
||||
/** Macro for testing condition "x" and breaking via \ref JTAG_DEBUG_BREAK() if the condition is false.
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*
|
||||
* \param[in] Condition Condition that will be evaluated.
|
||||
*/
|
||||
#define JTAG_ASSERT(Condition) MACROS{ if (!(Condition)) { JTAG_DEBUG_BREAK(); } }MACROE
|
||||
|
||||
/** Macro for testing condition \c "x" and writing debug data to the stdout stream if \c false. The stdout stream
|
||||
* must be pre-initialized before this macro is run and linked to an output device, such as the microcontroller's
|
||||
* USART peripheral.
|
||||
*
|
||||
* The output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion {Condition} failed."
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*
|
||||
* \param[in] Condition Condition that will be evaluated,
|
||||
*/
|
||||
#define STDOUT_ASSERT(Condition) MACROS{ if (!(x)) { printf_P(PSTR("%s: Function \"%s\", Line %d: " \
|
||||
"Assertion \"%s\" failed.\r\n"), \
|
||||
__FILE__, __func__, __LINE__, #Condition); } }MACROE
|
||||
|
||||
#if !defined(pgm_read_ptr) || defined(__DOXYGEN__)
|
||||
/** Reads a pointer out of PROGMEM space on the AVR8 architecture. This is currently a wrapper for the
|
||||
* avr-libc \c pgm_read_ptr() macro with a \c void* cast, so that its value can be assigned directly
|
||||
* to a pointer variable or used in pointer arithmetic without further casting in C. In a future
|
||||
* avr-libc distribution this will be part of the standard API and will be implemented in a more formal
|
||||
* manner.
|
||||
*
|
||||
* \note This macro is not available for all architectures.
|
||||
*
|
||||
* \param[in] Address Address of the pointer to read.
|
||||
*
|
||||
* \return Pointer retrieved from PROGMEM space.
|
||||
*/
|
||||
#define pgm_read_ptr(Address) (void*)pgm_read_word(Address)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -1,84 +1,84 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Supported library architecture defines.
|
||||
*
|
||||
* \copydetails Group_Architectures
|
||||
*
|
||||
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_Architectures Hardware Architectures
|
||||
* \brief Supported library architecture defines.
|
||||
*
|
||||
* Architecture macros for selecting the desired target microcontroller architecture. One of these values should be
|
||||
* defined as the value of \c ARCH in the user project makefile via the \c -D compiler switch to GCC, to select the
|
||||
* target architecture.
|
||||
*
|
||||
* The selected architecture should remain consistent with the makefile \c ARCH value, which is used to select the
|
||||
* underlying driver source files for each architecture.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_ARCHITECTURES_H__
|
||||
#define __LUFA_ARCHITECTURES_H__
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Selects the Atmel 8-bit AVR (AT90USB* and ATMEGA*U* chips) architecture. */
|
||||
#define ARCH_AVR8 0
|
||||
|
||||
/** Selects the Atmel 32-bit UC3 AVR (AT32UC3* chips) architecture. */
|
||||
#define ARCH_UC3 1
|
||||
|
||||
/** Selects the Atmel XMEGA AVR (ATXMEGA*U chips) architecture. */
|
||||
#define ARCH_XMEGA 2
|
||||
|
||||
#if !defined(__DOXYGEN__)
|
||||
#define ARCH_ ARCH_AVR8
|
||||
|
||||
#if !defined(ARCH)
|
||||
#define ARCH ARCH_AVR8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Supported library architecture defines.
|
||||
*
|
||||
* \copydetails Group_Architectures
|
||||
*
|
||||
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_Architectures Hardware Architectures
|
||||
* \brief Supported library architecture defines.
|
||||
*
|
||||
* Architecture macros for selecting the desired target microcontroller architecture. One of these values should be
|
||||
* defined as the value of \c ARCH in the user project makefile via the \c -D compiler switch to GCC, to select the
|
||||
* target architecture.
|
||||
*
|
||||
* The selected architecture should remain consistent with the makefile \c ARCH value, which is used to select the
|
||||
* underlying driver source files for each architecture.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_ARCHITECTURES_H__
|
||||
#define __LUFA_ARCHITECTURES_H__
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Selects the Atmel 8-bit AVR (AT90USB* and ATMEGA*U* chips) architecture. */
|
||||
#define ARCH_AVR8 0
|
||||
|
||||
/** Selects the Atmel 32-bit UC3 AVR (AT32UC3* chips) architecture. */
|
||||
#define ARCH_UC3 1
|
||||
|
||||
/** Selects the Atmel XMEGA AVR (ATXMEGA*U chips) architecture. */
|
||||
#define ARCH_XMEGA 2
|
||||
|
||||
#if !defined(__DOXYGEN__)
|
||||
#define ARCH_ ARCH_AVR8
|
||||
|
||||
#if !defined(ARCH)
|
||||
#define ARCH ARCH_AVR8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -1,150 +1,150 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Special function/variable attribute macros.
|
||||
*
|
||||
* \copydetails Group_FuncVarAttributes
|
||||
*
|
||||
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_FuncVarAttributes Function/Variable Attributes
|
||||
* \brief Special function/variable attribute macros.
|
||||
*
|
||||
* This module contains macros for applying specific attributes to functions and variables to control various
|
||||
* optimizer and code generation features of the compiler. Attributes may be placed in the function prototype
|
||||
* or variable declaration in any order, and multiple attributes can be specified for a single item via a space
|
||||
* separated list.
|
||||
*
|
||||
* On incompatible versions of GCC or on other compilers, these macros evaluate to nothing unless they are
|
||||
* critical to the code's function and thus must throw a compile error when used.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_FUNCATTR_H__
|
||||
#define __LUFA_FUNCATTR_H__
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
#if (__GNUC__ >= 3) || defined(__DOXYGEN__)
|
||||
/** Indicates to the compiler that the function can not ever return, so that any stack restoring or
|
||||
* return code may be omitted by the compiler in the resulting binary.
|
||||
*/
|
||||
#define ATTR_NO_RETURN __attribute__ ((noreturn))
|
||||
|
||||
/** Indicates that the function returns a value which should not be ignored by the user code. When
|
||||
* applied, any ignored return value from calling the function will produce a compiler warning.
|
||||
*/
|
||||
#define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
|
||||
|
||||
/** Indicates that the specified parameters of the function are pointers which should never be \c NULL.
|
||||
* When applied as a 1-based comma separated list the compiler will emit a warning if the specified
|
||||
* parameters are known at compiler time to be \c NULL at the point of calling the function.
|
||||
*/
|
||||
#define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__)))
|
||||
|
||||
/** Removes any preamble or postamble from the function. When used, the function will not have any
|
||||
* register or stack saving code. This should be used with caution, and when used the programmer
|
||||
* is responsible for maintaining stack and register integrity.
|
||||
*/
|
||||
#define ATTR_NAKED __attribute__ ((naked))
|
||||
|
||||
/** Prevents the compiler from considering a specified function for in-lining. When applied, the given
|
||||
* function will not be in-lined under any circumstances.
|
||||
*/
|
||||
#define ATTR_NO_INLINE __attribute__ ((noinline))
|
||||
|
||||
/** Forces the compiler to inline the specified function. When applied, the given function will be
|
||||
* in-lined under all circumstances.
|
||||
*/
|
||||
#define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
|
||||
|
||||
/** Indicates that the specified function is pure, in that it has no side-effects other than global
|
||||
* or parameter variable access.
|
||||
*/
|
||||
#define ATTR_PURE __attribute__ ((pure))
|
||||
|
||||
/** Indicates that the specified function is constant, in that it has no side effects other than
|
||||
* parameter access.
|
||||
*/
|
||||
#define ATTR_CONST __attribute__ ((const))
|
||||
|
||||
/** Marks a given function as deprecated, which produces a warning if the function is called. */
|
||||
#define ATTR_DEPRECATED __attribute__ ((deprecated))
|
||||
|
||||
/** Marks a function as a weak reference, which can be overridden by other functions with an
|
||||
* identical name (in which case the weak reference is discarded at link time).
|
||||
*/
|
||||
#define ATTR_WEAK __attribute__ ((weak))
|
||||
#endif
|
||||
|
||||
/** Forces the compiler to not automatically zero the given global variable on startup, so that the
|
||||
* current RAM contents is retained. Under most conditions this value will be random due to the
|
||||
* behaviour of volatile memory once power is removed, but may be used in some specific circumstances,
|
||||
* like the passing of values back after a system watchdog reset.
|
||||
*/
|
||||
#define ATTR_NO_INIT __attribute__ ((section (".noinit")))
|
||||
|
||||
/** Places the function in one of the initialization sections, which execute before the main function
|
||||
* of the application. Refer to the avr-libc manual for more information on the initialization sections.
|
||||
*
|
||||
* \param[in] SectionIndex Initialization section number where the function should be placed.
|
||||
*/
|
||||
#define ATTR_INIT_SECTION(SectionIndex) __attribute__ ((used, naked, section (".init" #SectionIndex )))
|
||||
|
||||
/** Marks a function as an alias for another function.
|
||||
*
|
||||
* \param[in] Func Name of the function which the given function name should alias.
|
||||
*/
|
||||
#define ATTR_ALIAS(Func) __attribute__ ((alias( #Func )))
|
||||
|
||||
/** Marks a variable or struct element for packing into the smallest space available, omitting any
|
||||
* alignment bytes usually added between fields to optimize field accesses.
|
||||
*/
|
||||
#define ATTR_PACKED __attribute__ ((packed))
|
||||
|
||||
/** Indicates the minimum alignment in bytes for a variable or struct element.
|
||||
*
|
||||
* \param[in] Bytes Minimum number of bytes the item should be aligned to.
|
||||
*/
|
||||
#define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Special function/variable attribute macros.
|
||||
*
|
||||
* \copydetails Group_FuncVarAttributes
|
||||
*
|
||||
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_FuncVarAttributes Function/Variable Attributes
|
||||
* \brief Special function/variable attribute macros.
|
||||
*
|
||||
* This module contains macros for applying specific attributes to functions and variables to control various
|
||||
* optimizer and code generation features of the compiler. Attributes may be placed in the function prototype
|
||||
* or variable declaration in any order, and multiple attributes can be specified for a single item via a space
|
||||
* separated list.
|
||||
*
|
||||
* On incompatible versions of GCC or on other compilers, these macros evaluate to nothing unless they are
|
||||
* critical to the code's function and thus must throw a compile error when used.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_FUNCATTR_H__
|
||||
#define __LUFA_FUNCATTR_H__
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
#if (__GNUC__ >= 3) || defined(__DOXYGEN__)
|
||||
/** Indicates to the compiler that the function can not ever return, so that any stack restoring or
|
||||
* return code may be omitted by the compiler in the resulting binary.
|
||||
*/
|
||||
#define ATTR_NO_RETURN __attribute__ ((noreturn))
|
||||
|
||||
/** Indicates that the function returns a value which should not be ignored by the user code. When
|
||||
* applied, any ignored return value from calling the function will produce a compiler warning.
|
||||
*/
|
||||
#define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
|
||||
|
||||
/** Indicates that the specified parameters of the function are pointers which should never be \c NULL.
|
||||
* When applied as a 1-based comma separated list the compiler will emit a warning if the specified
|
||||
* parameters are known at compiler time to be \c NULL at the point of calling the function.
|
||||
*/
|
||||
#define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__)))
|
||||
|
||||
/** Removes any preamble or postamble from the function. When used, the function will not have any
|
||||
* register or stack saving code. This should be used with caution, and when used the programmer
|
||||
* is responsible for maintaining stack and register integrity.
|
||||
*/
|
||||
#define ATTR_NAKED __attribute__ ((naked))
|
||||
|
||||
/** Prevents the compiler from considering a specified function for in-lining. When applied, the given
|
||||
* function will not be in-lined under any circumstances.
|
||||
*/
|
||||
#define ATTR_NO_INLINE __attribute__ ((noinline))
|
||||
|
||||
/** Forces the compiler to inline the specified function. When applied, the given function will be
|
||||
* in-lined under all circumstances.
|
||||
*/
|
||||
#define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
|
||||
|
||||
/** Indicates that the specified function is pure, in that it has no side-effects other than global
|
||||
* or parameter variable access.
|
||||
*/
|
||||
#define ATTR_PURE __attribute__ ((pure))
|
||||
|
||||
/** Indicates that the specified function is constant, in that it has no side effects other than
|
||||
* parameter access.
|
||||
*/
|
||||
#define ATTR_CONST __attribute__ ((const))
|
||||
|
||||
/** Marks a given function as deprecated, which produces a warning if the function is called. */
|
||||
#define ATTR_DEPRECATED __attribute__ ((deprecated))
|
||||
|
||||
/** Marks a function as a weak reference, which can be overridden by other functions with an
|
||||
* identical name (in which case the weak reference is discarded at link time).
|
||||
*/
|
||||
#define ATTR_WEAK __attribute__ ((weak))
|
||||
#endif
|
||||
|
||||
/** Forces the compiler to not automatically zero the given global variable on startup, so that the
|
||||
* current RAM contents is retained. Under most conditions this value will be random due to the
|
||||
* behaviour of volatile memory once power is removed, but may be used in some specific circumstances,
|
||||
* like the passing of values back after a system watchdog reset.
|
||||
*/
|
||||
#define ATTR_NO_INIT __attribute__ ((section (".noinit")))
|
||||
|
||||
/** Places the function in one of the initialization sections, which execute before the main function
|
||||
* of the application. Refer to the avr-libc manual for more information on the initialization sections.
|
||||
*
|
||||
* \param[in] SectionIndex Initialization section number where the function should be placed.
|
||||
*/
|
||||
#define ATTR_INIT_SECTION(SectionIndex) __attribute__ ((used, naked, section (".init" #SectionIndex )))
|
||||
|
||||
/** Marks a function as an alias for another function.
|
||||
*
|
||||
* \param[in] Func Name of the function which the given function name should alias.
|
||||
*/
|
||||
#define ATTR_ALIAS(Func) __attribute__ ((alias( #Func )))
|
||||
|
||||
/** Marks a variable or struct element for packing into the smallest space available, omitting any
|
||||
* alignment bytes usually added between fields to optimize field accesses.
|
||||
*/
|
||||
#define ATTR_PACKED __attribute__ ((packed))
|
||||
|
||||
/** Indicates the minimum alignment in bytes for a variable or struct element.
|
||||
*
|
||||
* \param[in] Bytes Minimum number of bytes the item should be aligned to.
|
||||
*/
|
||||
#define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -1,212 +1,212 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Supported pre-made board hardware defines.
|
||||
*
|
||||
* \copydetails Group_BoardTypes
|
||||
*
|
||||
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_BoardTypes Board Types
|
||||
* \brief Supported pre-made board hardware defines.
|
||||
*
|
||||
* Board macros for indicating the chosen physical board hardware to the library. These macros should be used when
|
||||
* defining the \c BOARD token to the chosen hardware via the \c -D switch in the project makefile. If a custom
|
||||
* board is used, the \ref BOARD_NONE or \ref BOARD_USER values should be selected.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_BOARDTYPES_H__
|
||||
#define __LUFA_BOARDTYPES_H__
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Selects the user-defined board drivers, which should be placed in the user project's folder
|
||||
* under a directory named \c /Board/. Each board driver should be named identically to the LUFA
|
||||
* master board driver (i.e., driver in the \c LUFA/Drivers/Board directory) so that the library
|
||||
* can correctly identify it.
|
||||
*/
|
||||
#define BOARD_USER 0
|
||||
|
||||
/** Disables board drivers when operation will not be adversely affected (e.g. LEDs) - use of board drivers
|
||||
* such as the Joystick driver, where the removal would adversely affect the code's operation is still disallowed. */
|
||||
#define BOARD_NONE 1
|
||||
|
||||
/** Selects the USBKEY specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */
|
||||
#define BOARD_USBKEY 2
|
||||
|
||||
/** Selects the STK525 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */
|
||||
#define BOARD_STK525 3
|
||||
|
||||
/** Selects the STK526 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */
|
||||
#define BOARD_STK526 4
|
||||
|
||||
/** Selects the RZUSBSTICK specific board drivers, including the driver for the boards LEDs. */
|
||||
#define BOARD_RZUSBSTICK 5
|
||||
|
||||
/** Selects the ATAVRUSBRF01 specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_ATAVRUSBRF01 6
|
||||
|
||||
/** Selects the BUMBLEB specific board drivers, using the officially recommended peripheral layout. */
|
||||
#define BOARD_BUMBLEB 7
|
||||
|
||||
/** Selects the XPLAIN (Revision 2 or newer) specific board drivers, including LED and Dataflash drivers. */
|
||||
#define BOARD_XPLAIN 8
|
||||
|
||||
/** Selects the XPLAIN (Revision 1) specific board drivers, including LED and Dataflash drivers. */
|
||||
#define BOARD_XPLAIN_REV1 9
|
||||
|
||||
/** Selects the EVK527 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */
|
||||
#define BOARD_EVK527 10
|
||||
|
||||
/** Selects the Teensy version 1.x specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_TEENSY 11
|
||||
|
||||
/** Selects the USBTINY MKII specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_USBTINYMKII 12
|
||||
|
||||
/** Selects the Benito specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_BENITO 13
|
||||
|
||||
/** Selects the JM-DB-U2 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_JMDBU2 14
|
||||
|
||||
/** Selects the Olimex AVR-USB-162 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_OLIMEX162 15
|
||||
|
||||
/** Selects the UDIP specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_UDIP 16
|
||||
|
||||
/** Selects the BUI specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_BUI 17
|
||||
|
||||
/** Selects the Arduino Uno specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_UNO 18
|
||||
|
||||
/** Selects the Busware CUL V3 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_CULV3 19
|
||||
|
||||
/** Selects the Blackcat USB JTAG specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_BLACKCAT 20
|
||||
|
||||
/** Selects the Maximus specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_MAXIMUS 21
|
||||
|
||||
/** Selects the Minimus specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_MINIMUS 22
|
||||
|
||||
/** Selects the Adafruit U4 specific board drivers, including the Button driver. */
|
||||
#define BOARD_ADAFRUITU4 23
|
||||
|
||||
/** Selects the Microsin AVR-USB162 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_MICROSIN162 24
|
||||
|
||||
/** Selects the Kernel Concepts USBFOO specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_USBFOO 25
|
||||
|
||||
/** Selects the Sparkfun ATMEGA8U2 specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_SPARKFUN8U2 26
|
||||
|
||||
/** Selects the Atmel EVK1101 specific board drivers, including the Button, Joystick and LED drivers. */
|
||||
#define BOARD_EVK1101 27
|
||||
|
||||
/** Selects the Busware TUL specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_TUL 28
|
||||
|
||||
/** Selects the Atmel EVK1100 specific board drivers, including the Button, Joystick and LED drivers. */
|
||||
#define BOARD_EVK1100 29
|
||||
|
||||
/** Selects the Atmel EVK1104 specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_EVK1104 30
|
||||
|
||||
/** Selects the Atmel XMEGA A3BU Xplained specific board drivers, including Dataflash, Button and LED drivers. */
|
||||
#define BOARD_A3BU_XPLAINED 31
|
||||
|
||||
/** Selects the Teensy version 2.x specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_TEENSY2 32
|
||||
|
||||
/** Selects the USB2AX version 1 and 2 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_USB2AX 33
|
||||
|
||||
/** Selects the USB2AX version 3 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_USB2AX_V3 34
|
||||
|
||||
/** Selects the Micropendous 32U2 specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_MICROPENDOUS_32U2 35
|
||||
|
||||
/** Selects the Micropendous A specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_A 36
|
||||
|
||||
/** Selects the Micropendous 1 specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_1 37
|
||||
|
||||
/** Selects the Micropendous 2 specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_2 38
|
||||
|
||||
/** Selects the Micropendous 3 specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_3 39
|
||||
|
||||
/** Selects the Micropendous 4 specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_4 40
|
||||
|
||||
/** Selects the Micropendous DIP specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_DIP 41
|
||||
|
||||
/** Selects the Micropendous (Arduino-like) revision 1 specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_MICROPENDOUS_REV1 42
|
||||
|
||||
/** Selects the Micropendous (Arduino-like) revision 2 specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_MICROPENDOUS_REV2 43
|
||||
|
||||
/** Selects the XMEGA B1 Xplained specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_B1_XPLAINED 44
|
||||
|
||||
#if !defined(__DOXYGEN__)
|
||||
#define BOARD_ BOARD_NONE
|
||||
|
||||
#if !defined(BOARD)
|
||||
#define BOARD BOARD_NONE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Supported pre-made board hardware defines.
|
||||
*
|
||||
* \copydetails Group_BoardTypes
|
||||
*
|
||||
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_BoardTypes Board Types
|
||||
* \brief Supported pre-made board hardware defines.
|
||||
*
|
||||
* Board macros for indicating the chosen physical board hardware to the library. These macros should be used when
|
||||
* defining the \c BOARD token to the chosen hardware via the \c -D switch in the project makefile. If a custom
|
||||
* board is used, the \ref BOARD_NONE or \ref BOARD_USER values should be selected.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_BOARDTYPES_H__
|
||||
#define __LUFA_BOARDTYPES_H__
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Selects the user-defined board drivers, which should be placed in the user project's folder
|
||||
* under a directory named \c /Board/. Each board driver should be named identically to the LUFA
|
||||
* master board driver (i.e., driver in the \c LUFA/Drivers/Board directory) so that the library
|
||||
* can correctly identify it.
|
||||
*/
|
||||
#define BOARD_USER 0
|
||||
|
||||
/** Disables board drivers when operation will not be adversely affected (e.g. LEDs) - use of board drivers
|
||||
* such as the Joystick driver, where the removal would adversely affect the code's operation is still disallowed. */
|
||||
#define BOARD_NONE 1
|
||||
|
||||
/** Selects the USBKEY specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */
|
||||
#define BOARD_USBKEY 2
|
||||
|
||||
/** Selects the STK525 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */
|
||||
#define BOARD_STK525 3
|
||||
|
||||
/** Selects the STK526 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */
|
||||
#define BOARD_STK526 4
|
||||
|
||||
/** Selects the RZUSBSTICK specific board drivers, including the driver for the boards LEDs. */
|
||||
#define BOARD_RZUSBSTICK 5
|
||||
|
||||
/** Selects the ATAVRUSBRF01 specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_ATAVRUSBRF01 6
|
||||
|
||||
/** Selects the BUMBLEB specific board drivers, using the officially recommended peripheral layout. */
|
||||
#define BOARD_BUMBLEB 7
|
||||
|
||||
/** Selects the XPLAIN (Revision 2 or newer) specific board drivers, including LED and Dataflash drivers. */
|
||||
#define BOARD_XPLAIN 8
|
||||
|
||||
/** Selects the XPLAIN (Revision 1) specific board drivers, including LED and Dataflash drivers. */
|
||||
#define BOARD_XPLAIN_REV1 9
|
||||
|
||||
/** Selects the EVK527 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */
|
||||
#define BOARD_EVK527 10
|
||||
|
||||
/** Selects the Teensy version 1.x specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_TEENSY 11
|
||||
|
||||
/** Selects the USBTINY MKII specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_USBTINYMKII 12
|
||||
|
||||
/** Selects the Benito specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_BENITO 13
|
||||
|
||||
/** Selects the JM-DB-U2 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_JMDBU2 14
|
||||
|
||||
/** Selects the Olimex AVR-USB-162 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_OLIMEX162 15
|
||||
|
||||
/** Selects the UDIP specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_UDIP 16
|
||||
|
||||
/** Selects the BUI specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_BUI 17
|
||||
|
||||
/** Selects the Arduino Uno specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_UNO 18
|
||||
|
||||
/** Selects the Busware CUL V3 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_CULV3 19
|
||||
|
||||
/** Selects the Blackcat USB JTAG specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_BLACKCAT 20
|
||||
|
||||
/** Selects the Maximus specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_MAXIMUS 21
|
||||
|
||||
/** Selects the Minimus specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_MINIMUS 22
|
||||
|
||||
/** Selects the Adafruit U4 specific board drivers, including the Button driver. */
|
||||
#define BOARD_ADAFRUITU4 23
|
||||
|
||||
/** Selects the Microsin AVR-USB162 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_MICROSIN162 24
|
||||
|
||||
/** Selects the Kernel Concepts USBFOO specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_USBFOO 25
|
||||
|
||||
/** Selects the Sparkfun ATMEGA8U2 specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_SPARKFUN8U2 26
|
||||
|
||||
/** Selects the Atmel EVK1101 specific board drivers, including the Button, Joystick and LED drivers. */
|
||||
#define BOARD_EVK1101 27
|
||||
|
||||
/** Selects the Busware TUL specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_TUL 28
|
||||
|
||||
/** Selects the Atmel EVK1100 specific board drivers, including the Button, Joystick and LED drivers. */
|
||||
#define BOARD_EVK1100 29
|
||||
|
||||
/** Selects the Atmel EVK1104 specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_EVK1104 30
|
||||
|
||||
/** Selects the Atmel XMEGA A3BU Xplained specific board drivers, including Dataflash, Button and LED drivers. */
|
||||
#define BOARD_A3BU_XPLAINED 31
|
||||
|
||||
/** Selects the Teensy version 2.x specific board drivers, including the driver for the board LEDs. */
|
||||
#define BOARD_TEENSY2 32
|
||||
|
||||
/** Selects the USB2AX version 1 and 2 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_USB2AX 33
|
||||
|
||||
/** Selects the USB2AX version 3 specific board drivers, including the Button and LEDs drivers. */
|
||||
#define BOARD_USB2AX_V3 34
|
||||
|
||||
/** Selects the Micropendous 32U2 specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_MICROPENDOUS_32U2 35
|
||||
|
||||
/** Selects the Micropendous A specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_A 36
|
||||
|
||||
/** Selects the Micropendous 1 specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_1 37
|
||||
|
||||
/** Selects the Micropendous 2 specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_2 38
|
||||
|
||||
/** Selects the Micropendous 3 specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_3 39
|
||||
|
||||
/** Selects the Micropendous 4 specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_4 40
|
||||
|
||||
/** Selects the Micropendous DIP specific board drivers, including the Button. */
|
||||
#define BOARD_MICROPENDOUS_DIP 41
|
||||
|
||||
/** Selects the Micropendous (Arduino-like) revision 1 specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_MICROPENDOUS_REV1 42
|
||||
|
||||
/** Selects the Micropendous (Arduino-like) revision 2 specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_MICROPENDOUS_REV2 43
|
||||
|
||||
/** Selects the XMEGA B1 Xplained specific board drivers, including the Button and LED drivers. */
|
||||
#define BOARD_B1_XPLAINED 44
|
||||
|
||||
#if !defined(__DOXYGEN__)
|
||||
#define BOARD_ BOARD_NONE
|
||||
|
||||
#if !defined(BOARD)
|
||||
#define BOARD BOARD_NONE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -1,375 +1,375 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Common library convenience headers, macros and functions.
|
||||
*
|
||||
* \copydetails Group_Common
|
||||
*/
|
||||
|
||||
/** \defgroup Group_Common Common Utility Headers - LUFA/Drivers/Common/Common.h
|
||||
* \brief Common library convenience headers, macros and functions.
|
||||
*
|
||||
* Common utility headers containing macros, functions, enums and types which are common to all
|
||||
* aspects of the library.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \defgroup Group_GlobalInt Global Interrupt Macros
|
||||
* \brief Convenience macros for the management of interrupts globally within the device.
|
||||
*
|
||||
* Macros and functions to create and control global interrupts within the device.
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_COMMON_H__
|
||||
#define __LUFA_COMMON_H__
|
||||
|
||||
/* Macros: */
|
||||
#define __INCLUDE_FROM_COMMON_H
|
||||
|
||||
/* Includes: */
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(USE_LUFA_CONFIG_HEADER)
|
||||
#include "LUFAConfig.h"
|
||||
#endif
|
||||
|
||||
#include "Architectures.h"
|
||||
#include "BoardTypes.h"
|
||||
#include "ArchitectureSpecific.h"
|
||||
#include "CompilerSpecific.h"
|
||||
#include "Attributes.h"
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Architecture specific utility includes: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Type define for an unsigned integer the same width as the selected architecture's machine register.
|
||||
* This is distinct from the non-specific standard int data type, whose width is machine dependant but
|
||||
* which may not reflect the actual machine register width on some targets (e.g. AVR8).
|
||||
*/
|
||||
typedef MACHINE_REG_t uint_reg_t;
|
||||
#elif (ARCH == ARCH_AVR8)
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <avr/boot.h>
|
||||
#include <math.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
typedef uint8_t uint_reg_t;
|
||||
|
||||
#define ARCH_HAS_EEPROM_ADDRESS_SPACE
|
||||
#define ARCH_HAS_FLASH_ADDRESS_SPACE
|
||||
#define ARCH_HAS_MULTI_ADDRESS_SPACE
|
||||
#define ARCH_LITTLE_ENDIAN
|
||||
|
||||
#include "Endianness.h"
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
#include <avr32/io.h>
|
||||
|
||||
// === TODO: Find abstracted way to handle these ===
|
||||
#define PROGMEM const
|
||||
#define pgm_read_byte(x) *x
|
||||
#define memcmp_P(...) memcmp(__VA_ARGS__)
|
||||
#define memcpy_P(...) memcpy(__VA_ARGS__)
|
||||
// =================================================
|
||||
|
||||
typedef uint32_t uint_reg_t;
|
||||
|
||||
#define ARCH_BIG_ENDIAN
|
||||
|
||||
#include "Endianness.h"
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <math.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
typedef uint8_t uint_reg_t;
|
||||
|
||||
#define ARCH_HAS_EEPROM_ADDRESS_SPACE
|
||||
#define ARCH_HAS_FLASH_ADDRESS_SPACE
|
||||
#define ARCH_HAS_MULTI_ADDRESS_SPACE
|
||||
#define ARCH_LITTLE_ENDIAN
|
||||
|
||||
#include "Endianness.h"
|
||||
#else
|
||||
#error Unknown device architecture specified.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Macro for encasing other multi-statement macros. This should be used along with an opening brace
|
||||
* before the start of any multi-statement macro, so that the macros contents as a whole are treated
|
||||
* as a discrete block and not as a list of separate statements which may cause problems when used as
|
||||
* a block (such as inline \c if statements).
|
||||
*/
|
||||
#define MACROS do
|
||||
|
||||
/** Macro for encasing other multi-statement macros. This should be used along with a preceding closing
|
||||
* brace at the end of any multi-statement macro, so that the macros contents as a whole are treated
|
||||
* as a discrete block and not as a list of separate statements which may cause problems when used as
|
||||
* a block (such as inline \c if statements).
|
||||
*/
|
||||
#define MACROE while (0)
|
||||
|
||||
/** Convenience macro to determine the larger of two values.
|
||||
*
|
||||
* \note This macro should only be used with operands that do not have side effects from being evaluated
|
||||
* multiple times.
|
||||
*
|
||||
* \param[in] x First value to compare
|
||||
* \param[in] y First value to compare
|
||||
*
|
||||
* \return The larger of the two input parameters
|
||||
*/
|
||||
#if !defined(MAX) || defined(__DOXYGEN__)
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
/** Convenience macro to determine the smaller of two values.
|
||||
*
|
||||
* \note This macro should only be used with operands that do not have side effects from being evaluated
|
||||
* multiple times.
|
||||
*
|
||||
* \param[in] x First value to compare
|
||||
* \param[in] y First value to compare
|
||||
*
|
||||
* \return The smaller of the two input parameters
|
||||
*/
|
||||
#if !defined(MIN) || defined(__DOXYGEN__)
|
||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#if !defined(STRINGIFY) || defined(__DOXYGEN__)
|
||||
/** Converts the given input into a string, via the C Preprocessor. This macro puts literal quotation
|
||||
* marks around the input, converting the source into a string literal.
|
||||
*
|
||||
* \param[in] x Input to convert into a string literal.
|
||||
*
|
||||
* \return String version of the input.
|
||||
*/
|
||||
#define STRINGIFY(x) #x
|
||||
|
||||
/** Converts the given input into a string after macro expansion, via the C Preprocessor. This macro puts
|
||||
* literal quotation marks around the expanded input, converting the source into a string literal.
|
||||
*
|
||||
* \param[in] x Input to expand and convert into a string literal.
|
||||
*
|
||||
* \return String version of the expanded input.
|
||||
*/
|
||||
#define STRINGIFY_EXPANDED(x) STRINGIFY(x)
|
||||
#endif
|
||||
|
||||
#if !defined(ISR) || defined(__DOXYGEN__)
|
||||
/** Macro for the definition of interrupt service routines, so that the compiler can insert the required
|
||||
* prologue and epilogue code to properly manage the interrupt routine without affecting the main thread's
|
||||
* state with unintentional side-effects.
|
||||
*
|
||||
* Interrupt handlers written using this macro may still need to be registered with the microcontroller's
|
||||
* Interrupt Controller (if present) before they will properly handle incoming interrupt events.
|
||||
*
|
||||
* \note This macro is only supplied on some architectures, where the standard library does not include a valid
|
||||
* definition. If an existing definition exists, the alternative definition here will be ignored.
|
||||
*
|
||||
* \ingroup Group_GlobalInt
|
||||
*
|
||||
* \param Name Unique name of the interrupt service routine.
|
||||
*/
|
||||
#define ISR(Name, ...) void Name (void) __attribute__((__interrupt__)) __VA_ARGS__; void Name (void)
|
||||
#endif
|
||||
|
||||
/* Inline Functions: */
|
||||
/** Function to reverse the individual bits in a byte - i.e. bit 7 is moved to bit 0, bit 6 to bit 1,
|
||||
* etc.
|
||||
*
|
||||
* \param[in] Byte Byte of data whose bits are to be reversed.
|
||||
*
|
||||
* \return Input data with the individual bits reversed (mirrored).
|
||||
*/
|
||||
static inline uint8_t BitReverse(uint8_t Byte) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
|
||||
static inline uint8_t BitReverse(uint8_t Byte)
|
||||
{
|
||||
Byte = (((Byte & 0xF0) >> 4) | ((Byte & 0x0F) << 4));
|
||||
Byte = (((Byte & 0xCC) >> 2) | ((Byte & 0x33) << 2));
|
||||
Byte = (((Byte & 0xAA) >> 1) | ((Byte & 0x55) << 1));
|
||||
|
||||
return Byte;
|
||||
}
|
||||
|
||||
/** Function to perform a blocking delay for a specified number of milliseconds. The actual delay will be
|
||||
* at a minimum the specified number of milliseconds, however due to loop overhead and internal calculations
|
||||
* may be slightly higher.
|
||||
*
|
||||
* \param[in] Milliseconds Number of milliseconds to delay
|
||||
*/
|
||||
static inline void Delay_MS(uint16_t Milliseconds) ATTR_ALWAYS_INLINE;
|
||||
static inline void Delay_MS(uint16_t Milliseconds)
|
||||
{
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
if (GCC_IS_COMPILE_CONST(Milliseconds))
|
||||
{
|
||||
_delay_ms(Milliseconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (Milliseconds--)
|
||||
_delay_ms(1);
|
||||
}
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
while (Milliseconds--)
|
||||
{
|
||||
__builtin_mtsr(AVR32_COUNT, 0);
|
||||
while ((uint32_t)__builtin_mfsr(AVR32_COUNT) < (F_CPU / 1000));
|
||||
}
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
if (GCC_IS_COMPILE_CONST(Milliseconds))
|
||||
{
|
||||
_delay_ms(Milliseconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (Milliseconds--)
|
||||
_delay_ms(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Retrieves a mask which contains the current state of the global interrupts for the device. This
|
||||
* value can be stored before altering the global interrupt enable state, before restoring the
|
||||
* flag(s) back to their previous values after a critical section using \ref SetGlobalInterruptMask().
|
||||
*
|
||||
* \ingroup Group_GlobalInt
|
||||
*
|
||||
* \return Mask containing the current Global Interrupt Enable Mask bit(s).
|
||||
*/
|
||||
static inline uint_reg_t GetGlobalInterruptMask(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint_reg_t GetGlobalInterruptMask(void)
|
||||
{
|
||||
GCC_MEMORY_BARRIER();
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
return SREG;
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
return __builtin_mfsr(AVR32_SR);
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
return SREG;
|
||||
#endif
|
||||
|
||||
GCC_MEMORY_BARRIER();
|
||||
}
|
||||
|
||||
/** Sets the global interrupt enable state of the microcontroller to the mask passed into the function.
|
||||
* This can be combined with \ref GetGlobalInterruptMask() to save and restore the Global Interrupt Enable
|
||||
* Mask bit(s) of the device after a critical section has completed.
|
||||
*
|
||||
* \ingroup Group_GlobalInt
|
||||
*
|
||||
* \param[in] GlobalIntState Global Interrupt Enable Mask value to use
|
||||
*/
|
||||
static inline void SetGlobalInterruptMask(const uint_reg_t GlobalIntState) ATTR_ALWAYS_INLINE;
|
||||
static inline void SetGlobalInterruptMask(const uint_reg_t GlobalIntState)
|
||||
{
|
||||
GCC_MEMORY_BARRIER();
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
SREG = GlobalIntState;
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
if (GlobalIntState & AVR32_SR_GM)
|
||||
__builtin_ssrf(AVR32_SR_GM_OFFSET);
|
||||
else
|
||||
__builtin_csrf(AVR32_SR_GM_OFFSET);
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
SREG = GlobalIntState;
|
||||
#endif
|
||||
|
||||
GCC_MEMORY_BARRIER();
|
||||
}
|
||||
|
||||
/** Enables global interrupt handling for the device, allowing interrupts to be handled.
|
||||
*
|
||||
* \ingroup Group_GlobalInt
|
||||
*/
|
||||
static inline void GlobalInterruptEnable(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void GlobalInterruptEnable(void)
|
||||
{
|
||||
GCC_MEMORY_BARRIER();
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
sei();
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
__builtin_csrf(AVR32_SR_GM_OFFSET);
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
sei();
|
||||
#endif
|
||||
|
||||
GCC_MEMORY_BARRIER();
|
||||
}
|
||||
|
||||
/** Disabled global interrupt handling for the device, preventing interrupts from being handled.
|
||||
*
|
||||
* \ingroup Group_GlobalInt
|
||||
*/
|
||||
static inline void GlobalInterruptDisable(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void GlobalInterruptDisable(void)
|
||||
{
|
||||
GCC_MEMORY_BARRIER();
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
cli();
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
__builtin_ssrf(AVR32_SR_GM_OFFSET);
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
cli();
|
||||
#endif
|
||||
|
||||
GCC_MEMORY_BARRIER();
|
||||
}
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Common library convenience headers, macros and functions.
|
||||
*
|
||||
* \copydetails Group_Common
|
||||
*/
|
||||
|
||||
/** \defgroup Group_Common Common Utility Headers - LUFA/Drivers/Common/Common.h
|
||||
* \brief Common library convenience headers, macros and functions.
|
||||
*
|
||||
* Common utility headers containing macros, functions, enums and types which are common to all
|
||||
* aspects of the library.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \defgroup Group_GlobalInt Global Interrupt Macros
|
||||
* \brief Convenience macros for the management of interrupts globally within the device.
|
||||
*
|
||||
* Macros and functions to create and control global interrupts within the device.
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_COMMON_H__
|
||||
#define __LUFA_COMMON_H__
|
||||
|
||||
/* Macros: */
|
||||
#define __INCLUDE_FROM_COMMON_H
|
||||
|
||||
/* Includes: */
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(USE_LUFA_CONFIG_HEADER)
|
||||
#include "LUFAConfig.h"
|
||||
#endif
|
||||
|
||||
#include "Architectures.h"
|
||||
#include "BoardTypes.h"
|
||||
#include "ArchitectureSpecific.h"
|
||||
#include "CompilerSpecific.h"
|
||||
#include "Attributes.h"
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Architecture specific utility includes: */
|
||||
#if defined(__DOXYGEN__)
|
||||
/** Type define for an unsigned integer the same width as the selected architecture's machine register.
|
||||
* This is distinct from the non-specific standard int data type, whose width is machine dependant but
|
||||
* which may not reflect the actual machine register width on some targets (e.g. AVR8).
|
||||
*/
|
||||
typedef MACHINE_REG_t uint_reg_t;
|
||||
#elif (ARCH == ARCH_AVR8)
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <avr/boot.h>
|
||||
#include <math.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
typedef uint8_t uint_reg_t;
|
||||
|
||||
#define ARCH_HAS_EEPROM_ADDRESS_SPACE
|
||||
#define ARCH_HAS_FLASH_ADDRESS_SPACE
|
||||
#define ARCH_HAS_MULTI_ADDRESS_SPACE
|
||||
#define ARCH_LITTLE_ENDIAN
|
||||
|
||||
#include "Endianness.h"
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
#include <avr32/io.h>
|
||||
|
||||
// === TODO: Find abstracted way to handle these ===
|
||||
#define PROGMEM const
|
||||
#define pgm_read_byte(x) *x
|
||||
#define memcmp_P(...) memcmp(__VA_ARGS__)
|
||||
#define memcpy_P(...) memcpy(__VA_ARGS__)
|
||||
// =================================================
|
||||
|
||||
typedef uint32_t uint_reg_t;
|
||||
|
||||
#define ARCH_BIG_ENDIAN
|
||||
|
||||
#include "Endianness.h"
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/eeprom.h>
|
||||
#include <math.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
typedef uint8_t uint_reg_t;
|
||||
|
||||
#define ARCH_HAS_EEPROM_ADDRESS_SPACE
|
||||
#define ARCH_HAS_FLASH_ADDRESS_SPACE
|
||||
#define ARCH_HAS_MULTI_ADDRESS_SPACE
|
||||
#define ARCH_LITTLE_ENDIAN
|
||||
|
||||
#include "Endianness.h"
|
||||
#else
|
||||
#error Unknown device architecture specified.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Macro for encasing other multi-statement macros. This should be used along with an opening brace
|
||||
* before the start of any multi-statement macro, so that the macros contents as a whole are treated
|
||||
* as a discrete block and not as a list of separate statements which may cause problems when used as
|
||||
* a block (such as inline \c if statements).
|
||||
*/
|
||||
#define MACROS do
|
||||
|
||||
/** Macro for encasing other multi-statement macros. This should be used along with a preceding closing
|
||||
* brace at the end of any multi-statement macro, so that the macros contents as a whole are treated
|
||||
* as a discrete block and not as a list of separate statements which may cause problems when used as
|
||||
* a block (such as inline \c if statements).
|
||||
*/
|
||||
#define MACROE while (0)
|
||||
|
||||
/** Convenience macro to determine the larger of two values.
|
||||
*
|
||||
* \note This macro should only be used with operands that do not have side effects from being evaluated
|
||||
* multiple times.
|
||||
*
|
||||
* \param[in] x First value to compare
|
||||
* \param[in] y First value to compare
|
||||
*
|
||||
* \return The larger of the two input parameters
|
||||
*/
|
||||
#if !defined(MAX) || defined(__DOXYGEN__)
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
/** Convenience macro to determine the smaller of two values.
|
||||
*
|
||||
* \note This macro should only be used with operands that do not have side effects from being evaluated
|
||||
* multiple times.
|
||||
*
|
||||
* \param[in] x First value to compare
|
||||
* \param[in] y First value to compare
|
||||
*
|
||||
* \return The smaller of the two input parameters
|
||||
*/
|
||||
#if !defined(MIN) || defined(__DOXYGEN__)
|
||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#if !defined(STRINGIFY) || defined(__DOXYGEN__)
|
||||
/** Converts the given input into a string, via the C Preprocessor. This macro puts literal quotation
|
||||
* marks around the input, converting the source into a string literal.
|
||||
*
|
||||
* \param[in] x Input to convert into a string literal.
|
||||
*
|
||||
* \return String version of the input.
|
||||
*/
|
||||
#define STRINGIFY(x) #x
|
||||
|
||||
/** Converts the given input into a string after macro expansion, via the C Preprocessor. This macro puts
|
||||
* literal quotation marks around the expanded input, converting the source into a string literal.
|
||||
*
|
||||
* \param[in] x Input to expand and convert into a string literal.
|
||||
*
|
||||
* \return String version of the expanded input.
|
||||
*/
|
||||
#define STRINGIFY_EXPANDED(x) STRINGIFY(x)
|
||||
#endif
|
||||
|
||||
#if !defined(ISR) || defined(__DOXYGEN__)
|
||||
/** Macro for the definition of interrupt service routines, so that the compiler can insert the required
|
||||
* prologue and epilogue code to properly manage the interrupt routine without affecting the main thread's
|
||||
* state with unintentional side-effects.
|
||||
*
|
||||
* Interrupt handlers written using this macro may still need to be registered with the microcontroller's
|
||||
* Interrupt Controller (if present) before they will properly handle incoming interrupt events.
|
||||
*
|
||||
* \note This macro is only supplied on some architectures, where the standard library does not include a valid
|
||||
* definition. If an existing definition exists, the alternative definition here will be ignored.
|
||||
*
|
||||
* \ingroup Group_GlobalInt
|
||||
*
|
||||
* \param Name Unique name of the interrupt service routine.
|
||||
*/
|
||||
#define ISR(Name, ...) void Name (void) __attribute__((__interrupt__)) __VA_ARGS__; void Name (void)
|
||||
#endif
|
||||
|
||||
/* Inline Functions: */
|
||||
/** Function to reverse the individual bits in a byte - i.e. bit 7 is moved to bit 0, bit 6 to bit 1,
|
||||
* etc.
|
||||
*
|
||||
* \param[in] Byte Byte of data whose bits are to be reversed.
|
||||
*
|
||||
* \return Input data with the individual bits reversed (mirrored).
|
||||
*/
|
||||
static inline uint8_t BitReverse(uint8_t Byte) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
|
||||
static inline uint8_t BitReverse(uint8_t Byte)
|
||||
{
|
||||
Byte = (((Byte & 0xF0) >> 4) | ((Byte & 0x0F) << 4));
|
||||
Byte = (((Byte & 0xCC) >> 2) | ((Byte & 0x33) << 2));
|
||||
Byte = (((Byte & 0xAA) >> 1) | ((Byte & 0x55) << 1));
|
||||
|
||||
return Byte;
|
||||
}
|
||||
|
||||
/** Function to perform a blocking delay for a specified number of milliseconds. The actual delay will be
|
||||
* at a minimum the specified number of milliseconds, however due to loop overhead and internal calculations
|
||||
* may be slightly higher.
|
||||
*
|
||||
* \param[in] Milliseconds Number of milliseconds to delay
|
||||
*/
|
||||
static inline void Delay_MS(uint16_t Milliseconds) ATTR_ALWAYS_INLINE;
|
||||
static inline void Delay_MS(uint16_t Milliseconds)
|
||||
{
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
if (GCC_IS_COMPILE_CONST(Milliseconds))
|
||||
{
|
||||
_delay_ms(Milliseconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (Milliseconds--)
|
||||
_delay_ms(1);
|
||||
}
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
while (Milliseconds--)
|
||||
{
|
||||
__builtin_mtsr(AVR32_COUNT, 0);
|
||||
while ((uint32_t)__builtin_mfsr(AVR32_COUNT) < (F_CPU / 1000));
|
||||
}
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
if (GCC_IS_COMPILE_CONST(Milliseconds))
|
||||
{
|
||||
_delay_ms(Milliseconds);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (Milliseconds--)
|
||||
_delay_ms(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Retrieves a mask which contains the current state of the global interrupts for the device. This
|
||||
* value can be stored before altering the global interrupt enable state, before restoring the
|
||||
* flag(s) back to their previous values after a critical section using \ref SetGlobalInterruptMask().
|
||||
*
|
||||
* \ingroup Group_GlobalInt
|
||||
*
|
||||
* \return Mask containing the current Global Interrupt Enable Mask bit(s).
|
||||
*/
|
||||
static inline uint_reg_t GetGlobalInterruptMask(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
||||
static inline uint_reg_t GetGlobalInterruptMask(void)
|
||||
{
|
||||
GCC_MEMORY_BARRIER();
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
return SREG;
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
return __builtin_mfsr(AVR32_SR);
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
return SREG;
|
||||
#endif
|
||||
|
||||
GCC_MEMORY_BARRIER();
|
||||
}
|
||||
|
||||
/** Sets the global interrupt enable state of the microcontroller to the mask passed into the function.
|
||||
* This can be combined with \ref GetGlobalInterruptMask() to save and restore the Global Interrupt Enable
|
||||
* Mask bit(s) of the device after a critical section has completed.
|
||||
*
|
||||
* \ingroup Group_GlobalInt
|
||||
*
|
||||
* \param[in] GlobalIntState Global Interrupt Enable Mask value to use
|
||||
*/
|
||||
static inline void SetGlobalInterruptMask(const uint_reg_t GlobalIntState) ATTR_ALWAYS_INLINE;
|
||||
static inline void SetGlobalInterruptMask(const uint_reg_t GlobalIntState)
|
||||
{
|
||||
GCC_MEMORY_BARRIER();
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
SREG = GlobalIntState;
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
if (GlobalIntState & AVR32_SR_GM)
|
||||
__builtin_ssrf(AVR32_SR_GM_OFFSET);
|
||||
else
|
||||
__builtin_csrf(AVR32_SR_GM_OFFSET);
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
SREG = GlobalIntState;
|
||||
#endif
|
||||
|
||||
GCC_MEMORY_BARRIER();
|
||||
}
|
||||
|
||||
/** Enables global interrupt handling for the device, allowing interrupts to be handled.
|
||||
*
|
||||
* \ingroup Group_GlobalInt
|
||||
*/
|
||||
static inline void GlobalInterruptEnable(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void GlobalInterruptEnable(void)
|
||||
{
|
||||
GCC_MEMORY_BARRIER();
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
sei();
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
__builtin_csrf(AVR32_SR_GM_OFFSET);
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
sei();
|
||||
#endif
|
||||
|
||||
GCC_MEMORY_BARRIER();
|
||||
}
|
||||
|
||||
/** Disabled global interrupt handling for the device, preventing interrupts from being handled.
|
||||
*
|
||||
* \ingroup Group_GlobalInt
|
||||
*/
|
||||
static inline void GlobalInterruptDisable(void) ATTR_ALWAYS_INLINE;
|
||||
static inline void GlobalInterruptDisable(void)
|
||||
{
|
||||
GCC_MEMORY_BARRIER();
|
||||
|
||||
#if (ARCH == ARCH_AVR8)
|
||||
cli();
|
||||
#elif (ARCH == ARCH_UC3)
|
||||
__builtin_ssrf(AVR32_SR_GM_OFFSET);
|
||||
#elif (ARCH == ARCH_XMEGA)
|
||||
cli();
|
||||
#endif
|
||||
|
||||
GCC_MEMORY_BARRIER();
|
||||
}
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -1,97 +1,97 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Compiler specific definitions for code optimization and correctness.
|
||||
*
|
||||
* \copydetails Group_CompilerSpecific
|
||||
*
|
||||
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_CompilerSpecific Compiler Specific Definitions
|
||||
* \brief Compiler specific definitions for code optimization and correctness.
|
||||
*
|
||||
* Compiler specific definitions to expose certain compiler features which may increase the level of code optimization
|
||||
* for a specific compiler, or correct certain issues that may be present such as memory barriers for use in conjunction
|
||||
* with atomic variable access.
|
||||
*
|
||||
* Where possible, on alternative compilers, these macros will either have no effect, or default to returning a sane value
|
||||
* so that they can be used in existing code without the need for extra compiler checks in the user application code.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_COMPILERSPEC_H__
|
||||
#define __LUFA_COMPILERSPEC_H__
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
#if defined(__GNUC__) || defined(__DOXYGEN__)
|
||||
/** Forces GCC to use pointer indirection (via the device's pointer register pairs) when accessing the given
|
||||
* struct pointer. In some cases GCC will emit non-optimal assembly code when accessing a structure through
|
||||
* a pointer, resulting in a larger binary. When this macro is used on a (non \c const) structure pointer before
|
||||
* use, it will force GCC to use pointer indirection on the elements rather than direct store and load
|
||||
* instructions.
|
||||
*
|
||||
* \param[in, out] StructPtr Pointer to a structure which is to be forced into indirect access mode.
|
||||
*/
|
||||
#define GCC_FORCE_POINTER_ACCESS(StructPtr) __asm__ __volatile__("" : "=b" (StructPtr) : "0" (StructPtr))
|
||||
|
||||
/** Forces GCC to create a memory barrier, ensuring that memory accesses are not reordered past the barrier point.
|
||||
* This can be used before ordering-critical operations, to ensure that the compiler does not re-order the resulting
|
||||
* assembly output in an unexpected manner on sections of code that are ordering-specific.
|
||||
*/
|
||||
#define GCC_MEMORY_BARRIER() __asm__ __volatile__("" ::: "memory");
|
||||
|
||||
/** Determines if the specified value can be determined at compile-time to be a constant value when compiling under GCC.
|
||||
*
|
||||
* \param[in] x Value to check compile-time constantness of.
|
||||
*
|
||||
* \return Boolean true if the given value is known to be a compile time constant, false otherwise.
|
||||
*/
|
||||
#define GCC_IS_COMPILE_CONST(x) __builtin_constant_p(x)
|
||||
#else
|
||||
#define GCC_FORCE_POINTER_ACCESS(StructPtr)
|
||||
#define GCC_MEMORY_BARRIER()
|
||||
#define GCC_IS_COMPILE_CONST(x) 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Compiler specific definitions for code optimization and correctness.
|
||||
*
|
||||
* \copydetails Group_CompilerSpecific
|
||||
*
|
||||
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
|
||||
* functionality.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_CompilerSpecific Compiler Specific Definitions
|
||||
* \brief Compiler specific definitions for code optimization and correctness.
|
||||
*
|
||||
* Compiler specific definitions to expose certain compiler features which may increase the level of code optimization
|
||||
* for a specific compiler, or correct certain issues that may be present such as memory barriers for use in conjunction
|
||||
* with atomic variable access.
|
||||
*
|
||||
* Where possible, on alternative compilers, these macros will either have no effect, or default to returning a sane value
|
||||
* so that they can be used in existing code without the need for extra compiler checks in the user application code.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_COMPILERSPEC_H__
|
||||
#define __LUFA_COMPILERSPEC_H__
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
#if defined(__GNUC__) || defined(__DOXYGEN__)
|
||||
/** Forces GCC to use pointer indirection (via the device's pointer register pairs) when accessing the given
|
||||
* struct pointer. In some cases GCC will emit non-optimal assembly code when accessing a structure through
|
||||
* a pointer, resulting in a larger binary. When this macro is used on a (non \c const) structure pointer before
|
||||
* use, it will force GCC to use pointer indirection on the elements rather than direct store and load
|
||||
* instructions.
|
||||
*
|
||||
* \param[in, out] StructPtr Pointer to a structure which is to be forced into indirect access mode.
|
||||
*/
|
||||
#define GCC_FORCE_POINTER_ACCESS(StructPtr) __asm__ __volatile__("" : "=b" (StructPtr) : "0" (StructPtr))
|
||||
|
||||
/** Forces GCC to create a memory barrier, ensuring that memory accesses are not reordered past the barrier point.
|
||||
* This can be used before ordering-critical operations, to ensure that the compiler does not re-order the resulting
|
||||
* assembly output in an unexpected manner on sections of code that are ordering-specific.
|
||||
*/
|
||||
#define GCC_MEMORY_BARRIER() __asm__ __volatile__("" ::: "memory");
|
||||
|
||||
/** Determines if the specified value can be determined at compile-time to be a constant value when compiling under GCC.
|
||||
*
|
||||
* \param[in] x Value to check compile-time constantness of.
|
||||
*
|
||||
* \return Boolean true if the given value is known to be a compile time constant, false otherwise.
|
||||
*/
|
||||
#define GCC_IS_COMPILE_CONST(x) __builtin_constant_p(x)
|
||||
#else
|
||||
#define GCC_FORCE_POINTER_ACCESS(StructPtr)
|
||||
#define GCC_MEMORY_BARRIER()
|
||||
#define GCC_IS_COMPILE_CONST(x) 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -1,489 +1,489 @@
|
||||
/*
|
||||
LUFA Library
|
||||
Copyright (C) Dean Camera, 2012.
|
||||
|
||||
dean [at] fourwalledcubicle [dot] com
|
||||
www.lufa-lib.org
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name of the author not be used in
|
||||
advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
The author disclaim all warranties with regard to this
|
||||
software, including all implied warranties of merchantability
|
||||
and fitness. In no event shall the author be liable for any
|
||||
special, indirect or consequential damages or any damages
|
||||
whatsoever resulting from loss of use, data or profits, whether
|
||||
in an action of contract, negligence or other tortious action,
|
||||
arising out of or in connection with the use or performance of
|
||||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief Endianness and Byte Ordering macros and functions.
|
||||
*
|
||||
* \copydetails Group_Endianness
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Endianness
|
||||
* \defgroup Group_ByteSwapping Byte Reordering
|
||||
* \brief Macros and functions for forced byte reordering.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Endianness
|
||||
* \defgroup Group_EndianConversion Endianness Conversion
|
||||
* \brief Macros and functions for automatic endianness conversion.
|
||||
*/
|
||||
|
||||
/** \ingroup Group_Common
|
||||
* \defgroup Group_Endianness Endianness and Byte Ordering
|
||||
* \brief Convenience macros and functions relating to byte (re-)ordering
|
||||
*
|
||||
* Common library convenience macros and functions relating to byte (re-)ordering.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __LUFA_ENDIANNESS_H__
|
||||
#define __LUFA_ENDIANNESS_H__
|
||||
|
||||
/* Enable C linkage for C++ Compilers: */
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Preprocessor Checks: */
|
||||
#if !defined(__INCLUDE_FROM_COMMON_H)
|
||||
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
|
||||
#endif
|
||||
|
||||
#if !(defined(ARCH_BIG_ENDIAN) || defined(ARCH_LITTLE_ENDIAN))
|
||||
#error ARCH_BIG_ENDIAN or ARCH_LITTLE_ENDIAN not set for the specified architecture.
|
||||
#endif
|
||||
|
||||
/* Public Interface - May be used in end-application: */
|
||||
/* Macros: */
|
||||
/** Swaps the byte ordering of a 16-bit value at compile-time. Do not use this macro for swapping byte orderings
|
||||
* of dynamic values computed at runtime, use \ref SwapEndian_16() instead. The result of this macro can be used
|
||||
* inside struct or other variable initializers outside of a function, something that is not possible with the
|
||||
* inline function variant.
|
||||