mirror of
https://github.com/RfidResearchGroup/ChameleonMini.git
synced 2026-05-12 11:20:37 -07:00
Major improvements (amongst others Mifare Ultralight and 7-Byte UID MF Plus support) and major bug fixes. Thanks to Simon Küppers and Julius Schmalz.
This commit is contained in:
@@ -1,73 +1,61 @@
|
||||
<?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.toolchain.winavr.base.720540428">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.toolchain.winavr.base.720540428" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<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"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration buildProperties="" description="" id="de.innot.avreclipse.toolchain.winavr.base.720540428" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="de.innot.avreclipse.toolchain.winavr.base.720540428.864400725" name="/" resourcePath="">
|
||||
<toolChain id="de.innot.avreclipse.toolchain.winavr.base.625530456" name="de.innot.avreclipse.toolchain.winavr.base" superClass="de.innot.avreclipse.toolchain.winavr.base">
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.1919154489" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.1313973385" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.1414051856" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.298606093" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.411222645" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="de.innot.avreclipse.targetplatform.avr.1191155032" name="AVR Cross-Target" osList="all" superClass="de.innot.avreclipse.targetplatform.avr"/>
|
||||
<builder id="de.innot.avreclipse.target.builder.winavr.base.250904887" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.assembler.winavr.base.841764623" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.base">
|
||||
<inputType id="de.innot.avreclipse.tool.assembler.input.1184664290" superClass="de.innot.avreclipse.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.compiler.winavr.base.1325637126" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.base">
|
||||
<option id="de.innot.avreclipse.compiler.option.def.866285530" name="Define Syms (-D)" superClass="de.innot.avreclipse.compiler.option.def"/>
|
||||
<inputType id="de.innot.avreclipse.compiler.winavr.input.1708545975" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cppcompiler.base.639738460" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.base">
|
||||
<inputType id="de.innot.avreclipse.cppcompiler.input.442210684" superClass="de.innot.avreclipse.cppcompiler.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.linker.winavr.base.700245056" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.cpplinker.base.67603066" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.1170966503" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="Chameleon-Mini.null.383706674" name="Chameleon-Mini"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="refreshScope"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
|
||||
<buildTargets>
|
||||
<target name="program" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||
<buildCommand>make</buildCommand>
|
||||
<buildArguments/>
|
||||
<buildTarget>program</buildTarget>
|
||||
<stopOnError>true</stopOnError>
|
||||
<useDefaultCommand>true</useDefaultCommand>
|
||||
<runAllBuilders>true</runAllBuilders>
|
||||
</target>
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.toolchain.winavr.base.720540428;de.innot.avreclipse.toolchain.winavr.base.720540428.864400725;de.innot.avreclipse.tool.compiler.winavr.base.1325637126;de.innot.avreclipse.compiler.winavr.input.1708545975">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.toolchain.winavr.base.720540428;de.innot.avreclipse.toolchain.winavr.base.720540428.864400725;de.innot.avreclipse.tool.cppcompiler.base.639738460;de.innot.avreclipse.cppcompiler.input.442210684">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileCPP"/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<?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.toolchain.winavr.base.1057527408">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="de.innot.avreclipse.toolchain.winavr.base.1057527408" moduleId="org.eclipse.cdt.core.settings" name="Default">
|
||||
<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"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildProperties="" description="" id="de.innot.avreclipse.toolchain.winavr.base.1057527408" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="de.innot.avreclipse.toolchain.winavr.base.1057527408.559924164" name="/" resourcePath="">
|
||||
<toolChain id="de.innot.avreclipse.toolchain.winavr.base.1327462121" name="de.innot.avreclipse.toolchain.winavr.base" superClass="de.innot.avreclipse.toolchain.winavr.base">
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash.1593543359" name="Generate HEX file for Flash memory" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.flash"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom.862161803" name="Generate HEX file for EEPROM" superClass="de.innot.avreclipse.toolchain.options.toolchain.objcopy.eeprom"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.objdump.1542891943" name="Generate Extended Listing (Source + generated Assembler)" superClass="de.innot.avreclipse.toolchain.options.toolchain.objdump"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.size.2035337674" name="Print Size" superClass="de.innot.avreclipse.toolchain.options.toolchain.size"/>
|
||||
<option id="de.innot.avreclipse.toolchain.options.toolchain.avrdude.570777058" name="AVRDude" superClass="de.innot.avreclipse.toolchain.options.toolchain.avrdude"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="de.innot.avreclipse.targetplatform.avr.498975967" name="AVR Cross-Target" osList="all" superClass="de.innot.avreclipse.targetplatform.avr"/>
|
||||
<builder id="de.innot.avreclipse.target.builder.winavr.base.1804067063" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="AVR GNU Make Builder" superClass="de.innot.avreclipse.target.builder.winavr.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.assembler.winavr.base.2066544390" name="AVR Assembler" superClass="de.innot.avreclipse.tool.assembler.winavr.base">
|
||||
<inputType id="de.innot.avreclipse.tool.assembler.input.1737411148" superClass="de.innot.avreclipse.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.compiler.winavr.base.26462211" name="AVR Compiler" superClass="de.innot.avreclipse.tool.compiler.winavr.base">
|
||||
<option id="de.innot.avreclipse.compiler.option.def.765562977" name="Define Syms (-D)" superClass="de.innot.avreclipse.compiler.option.def" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="__AVR_ATxmega32A4U__"/>
|
||||
</option>
|
||||
<inputType id="de.innot.avreclipse.compiler.winavr.input.1155924719" name="C Source Files" superClass="de.innot.avreclipse.compiler.winavr.input"/>
|
||||
</tool>
|
||||
<tool id="de.innot.avreclipse.tool.cppcompiler.base.921697723" name="AVR C++ Compiler" superClass="de.innot.avreclipse.tool.cppcompiler.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.linker.winavr.base.940593463" name="AVR C Linker" superClass="de.innot.avreclipse.tool.linker.winavr.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.cpplinker.base.209921345" name="AVR C++ Linker" superClass="de.innot.avreclipse.tool.cpplinker.base"/>
|
||||
<tool id="de.innot.avreclipse.tool.archiver.winavr.base.1570538572" name="AVR Archiver" superClass="de.innot.avreclipse.tool.archiver.winavr.base"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="Chameleon-Mini.null.1239738726" name="Chameleon-Mini"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope" versionNumber="1">
|
||||
<resource resourceType="PROJECT" workspacePath="/Chameleon-Mini"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.toolchain.winavr.base.1057527408;de.innot.avreclipse.toolchain.winavr.base.1057527408.559924164;de.innot.avreclipse.tool.compiler.winavr.base.26462211;de.innot.avreclipse.compiler.winavr.input.1155924719">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="de.innot.avreclipse.toolchain.winavr.base.1057527408;de.innot.avreclipse.toolchain.winavr.base.1057527408.559924164">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="de.innot.avreclipse.core.AVRGCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
</cproject>
|
||||
|
||||
@@ -9,6 +9,58 @@
|
||||
<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.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>
|
||||
@@ -20,15 +72,8 @@
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</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>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>Doxyfile</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/Doc/Doxyfile</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
||||
|
||||
@@ -1,56 +1,8 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
/*
|
||||
* AntennaLevel.h
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
* Created on: 24.11.2013
|
||||
* Author: skuser
|
||||
*/
|
||||
|
||||
#ifndef ANTENNALEVEL_H_
|
||||
|
||||
@@ -1,56 +1,8 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
/*
|
||||
* Application.h
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
* Created on: 18.02.2013
|
||||
* Author: skuser
|
||||
*/
|
||||
|
||||
#ifndef APPLICATION_H_
|
||||
@@ -58,10 +10,13 @@
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../Configuration.h"
|
||||
#include "../Log.h"
|
||||
|
||||
/* Applications */
|
||||
#include "MifareUltralight.h"
|
||||
#include "MifareClassic.h"
|
||||
|
||||
|
||||
/* Function wrappers */
|
||||
INLINE void ApplicationInit(void) {
|
||||
ActiveConfiguration.ApplicationInitFunc();
|
||||
@@ -77,6 +32,7 @@ INLINE uint16_t ApplicationProcess(uint8_t* ByteBuffer, uint16_t ByteCount) {
|
||||
|
||||
INLINE void ApplicationReset(void) {
|
||||
ActiveConfiguration.ApplicationResetFunc();
|
||||
//LogEntry(LOG_INFO_APP_RESET, NULL, 0);
|
||||
}
|
||||
|
||||
INLINE void ApplicationGetUid(ConfigurationUidType Uid) {
|
||||
|
||||
@@ -1,58 +1,3 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
*/
|
||||
|
||||
#include "Crypto1.h"
|
||||
|
||||
#define PRNG_MASK 0x002D0000UL
|
||||
|
||||
@@ -1,58 +1,3 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
*/
|
||||
|
||||
#ifndef CRYPTO1_H
|
||||
#define CRYPTO1_H
|
||||
|
||||
|
||||
@@ -1,56 +1,8 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
/*
|
||||
* ISO14443A.c
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
* Created on: 19.03.2013
|
||||
* Author: skuser
|
||||
*/
|
||||
|
||||
#include "ISO14443-3A.h"
|
||||
|
||||
@@ -1,56 +1,8 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
/*
|
||||
* ISO14443-2A.h
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
* Created on: 19.03.2013
|
||||
* Author: skuser
|
||||
*/
|
||||
|
||||
#ifndef ISO14443_3A_H_
|
||||
|
||||
@@ -1,56 +1,8 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
/*
|
||||
* MifareClassic.c
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
* Created on: 13.05.2013
|
||||
* Author: skuser
|
||||
*/
|
||||
|
||||
#include "MifareClassic.h"
|
||||
@@ -62,13 +14,18 @@
|
||||
#include "../Random.h"
|
||||
|
||||
#define MFCLASSIC_1K_ATQA_VALUE 0x0004
|
||||
#define MFPlus_ATQA_VALUE 0x0044
|
||||
#define MFCLASSIC_4K_ATQA_VALUE 0x0002
|
||||
#define MFCLASSIC_1K_SAK_CL1_VALUE 0x08
|
||||
#define MFCLASSIC_4K_SAK_CL1_VALUE 0x18
|
||||
#define SAK_CL1_VALUE ISO14443A_SAK_INCOMPLETE
|
||||
#define SAK_CL2_VALUE ISO14443A_SAK_COMPLETE_NOT_COMPLIANT
|
||||
|
||||
#define MEM_UID_CL1_ADDRESS 0x00
|
||||
#define MEM_UID_CL1_SIZE 4
|
||||
#define MEM_UID_BCC1_ADDRESS 0x04
|
||||
#define MEM_UID_CL2_ADDRESS 0x03
|
||||
#define MEM_UID_CL2_SIZE 4
|
||||
#define MEM_KEY_A_OFFSET 48 /* Bytes */
|
||||
#define MEM_KEY_B_OFFSET 58 /* Bytes */
|
||||
#define MEM_KEY_SIZE 6 /* Bytes */
|
||||
@@ -105,11 +62,17 @@
|
||||
#define CMD_RESTORE_FRAME_SIZE 2 /* Bytes without CRCA */
|
||||
#define CMD_TRANSFER 0xB0
|
||||
#define CMD_TRANSFER_FRAME_SIZE 2 /* Bytes without CRCA */
|
||||
#define CMD_CHINESE_UNLOCK 0x40
|
||||
#define CMD_CHINESE_WIPE 0x41
|
||||
#define CMD_CHINESE_UNLOCK_RW 0x43
|
||||
|
||||
static enum {
|
||||
STATE_HALT,
|
||||
STATE_IDLE,
|
||||
STATE_READY,
|
||||
STATE_CHINESE_IDLE,
|
||||
STATE_CHINESE_WRITE,
|
||||
STATE_READY1,
|
||||
STATE_READY2,
|
||||
STATE_ACTIVE,
|
||||
STATE_AUTHING,
|
||||
STATE_AUTHED_IDLE,
|
||||
@@ -126,6 +89,8 @@ static uint8_t BlockBuffer[MEM_BYTES_PER_BLOCK];
|
||||
static uint16_t CardATQAValue;
|
||||
static uint8_t CardSAKValue;
|
||||
|
||||
static uint8_t _7BUID = 0x00;
|
||||
|
||||
INLINE bool CheckValueIntegrity(uint8_t* Block)
|
||||
{
|
||||
/* Value Blocks contain a value stored three times, with
|
||||
@@ -173,6 +138,16 @@ void MifareClassicAppInit1K(void)
|
||||
State = STATE_IDLE;
|
||||
CardATQAValue = MFCLASSIC_1K_ATQA_VALUE;
|
||||
CardSAKValue = MFCLASSIC_1K_SAK_CL1_VALUE;
|
||||
_7BUID = 0x00;
|
||||
}
|
||||
|
||||
void MifarePlus1kAppInit_7B(void)
|
||||
{
|
||||
State = STATE_IDLE;
|
||||
CardATQAValue = MFPlus_ATQA_VALUE;
|
||||
CardSAKValue = MFCLASSIC_1K_SAK_CL1_VALUE;
|
||||
uint8_t UidSize = ActiveConfiguration.UidSize;
|
||||
_7BUID = (UidSize == 7);
|
||||
}
|
||||
|
||||
void MifareClassicAppInit4K(void)
|
||||
@@ -180,6 +155,7 @@ void MifareClassicAppInit4K(void)
|
||||
State = STATE_IDLE;
|
||||
CardATQAValue = MFCLASSIC_4K_ATQA_VALUE;
|
||||
CardSAKValue = MFCLASSIC_4K_SAK_CL1_VALUE;
|
||||
_7BUID = 0x00;
|
||||
}
|
||||
|
||||
void MifareClassicAppReset(void)
|
||||
@@ -198,22 +174,109 @@ uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
||||
case STATE_IDLE:
|
||||
case STATE_HALT:
|
||||
if (ISO14443AWakeUp(Buffer, &BitCount, CardATQAValue)) {
|
||||
State = STATE_READY;
|
||||
State = STATE_READY1;
|
||||
return BitCount;
|
||||
}
|
||||
#ifdef SUPPORT_MF_CLASSIC_MAGIC_MODE
|
||||
else if (Buffer[0] == CMD_CHINESE_UNLOCK) {
|
||||
State = STATE_CHINESE_IDLE;
|
||||
Buffer[0] = ACK_VALUE;
|
||||
return ACK_NAK_FRAME_SIZE;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifdef SUPPORT_MF_CLASSIC_MAGIC_MODE
|
||||
case STATE_CHINESE_IDLE:
|
||||
/* Support special china commands that dont require authentication. */
|
||||
if (Buffer[0] == CMD_CHINESE_UNLOCK_RW) {
|
||||
/* Unlock read and write commands */
|
||||
Buffer[0] = ACK_VALUE;
|
||||
return ACK_NAK_FRAME_SIZE;
|
||||
} else if (Buffer[0] == CMD_CHINESE_WIPE) {
|
||||
/* Wipe memory */
|
||||
Buffer[0] = ACK_VALUE;
|
||||
return ACK_NAK_FRAME_SIZE;
|
||||
} else if (Buffer[0] == CMD_READ) {
|
||||
if (ISO14443ACheckCRCA(Buffer, CMD_READ_FRAME_SIZE)) {
|
||||
/* Read command. Read data from memory and append CRCA. */
|
||||
MemoryReadBlock(Buffer, (uint16_t) Buffer[1] * MEM_BYTES_PER_BLOCK, MEM_BYTES_PER_BLOCK);
|
||||
ISO14443AAppendCRCA(Buffer, MEM_BYTES_PER_BLOCK);
|
||||
|
||||
return (CMD_READ_RESPONSE_FRAME_SIZE + ISO14443A_CRCA_SIZE )
|
||||
* BITS_PER_BYTE;
|
||||
} else {
|
||||
Buffer[0] = NAK_CRC_ERROR;
|
||||
return ACK_NAK_FRAME_SIZE;
|
||||
}
|
||||
} else if (Buffer[0] == CMD_WRITE) {
|
||||
if (ISO14443ACheckCRCA(Buffer, CMD_WRITE_FRAME_SIZE)) {
|
||||
/* Write command. Store the address and prepare for the upcoming data.
|
||||
* Respond with ACK. */
|
||||
CurrentAddress = Buffer[1];
|
||||
State = STATE_CHINESE_WRITE;
|
||||
|
||||
Buffer[0] = ACK_VALUE;
|
||||
return ACK_NAK_FRAME_SIZE;
|
||||
} else {
|
||||
Buffer[0] = NAK_CRC_ERROR;
|
||||
return ACK_NAK_FRAME_SIZE;
|
||||
}
|
||||
} else if (Buffer[0] == CMD_HALT) {
|
||||
/* Halts the tag. According to the ISO14443, the second
|
||||
* byte is supposed to be 0. */
|
||||
if (Buffer[1] == 0) {
|
||||
if (ISO14443ACheckCRCA(Buffer, CMD_HALT_FRAME_SIZE)) {
|
||||
/* According to ISO14443, we must not send anything
|
||||
* in order to acknowledge the HALT command. */
|
||||
State = STATE_HALT;
|
||||
return ISO14443A_APP_NO_RESPONSE;
|
||||
} else {
|
||||
Buffer[0] = NAK_CRC_ERROR;
|
||||
return ACK_NAK_FRAME_SIZE;
|
||||
}
|
||||
} else {
|
||||
Buffer[0] = NAK_INVALID_ARG;
|
||||
return ACK_NAK_FRAME_SIZE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_READY:
|
||||
case STATE_CHINESE_WRITE:
|
||||
if (ISO14443ACheckCRCA(Buffer, MEM_BYTES_PER_BLOCK)) {
|
||||
/* CRC check passed. Write data into memory and send ACK. */
|
||||
if (!ActiveConfiguration.ReadOnly) {
|
||||
MemoryWriteBlock(Buffer, CurrentAddress * MEM_BYTES_PER_BLOCK, MEM_BYTES_PER_BLOCK);
|
||||
}
|
||||
|
||||
Buffer[0] = ACK_VALUE;
|
||||
} else {
|
||||
/* CRC Error. */
|
||||
Buffer[0] = NAK_CRC_ERROR;
|
||||
}
|
||||
|
||||
State = STATE_CHINESE_IDLE;
|
||||
|
||||
return ACK_NAK_FRAME_SIZE;
|
||||
#endif
|
||||
|
||||
case STATE_READY1:
|
||||
if (ISO14443AWakeUp(Buffer, &BitCount, CardATQAValue)) {
|
||||
State = STATE_READY;
|
||||
State = STATE_READY1;
|
||||
return BitCount;
|
||||
} else if (Buffer[0] == ISO14443A_CMD_SELECT_CL1) {
|
||||
/* Load UID CL1 and perform anticollision */
|
||||
uint8_t UidCL1[4];
|
||||
MemoryReadBlock(UidCL1, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
||||
|
||||
if (ISO14443ASelect(Buffer, &BitCount, UidCL1, CardSAKValue)) {
|
||||
State = STATE_ACTIVE;
|
||||
uint8_t UidCL1[ISO14443A_CL_UID_SIZE];
|
||||
|
||||
if (_7BUID) {
|
||||
MemoryReadBlock(&UidCL1[1], MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE-1);
|
||||
UidCL1[0] = ISO14443A_UID0_CT;
|
||||
if (ISO14443ASelect(Buffer, &BitCount, UidCL1, SAK_CL1_VALUE))
|
||||
State = STATE_READY2;
|
||||
} else {
|
||||
MemoryReadBlock(UidCL1, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
||||
if (ISO14443ASelect(Buffer, &BitCount, UidCL1, CardSAKValue))
|
||||
State = STATE_ACTIVE;
|
||||
}
|
||||
|
||||
return BitCount;
|
||||
@@ -223,9 +286,29 @@ uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_READY2:
|
||||
if (ISO14443AWakeUp(Buffer, &BitCount, CardATQAValue)) {
|
||||
State = STATE_READY1;
|
||||
return BitCount;
|
||||
} else if (Buffer[0] == ISO14443A_CMD_SELECT_CL2) {
|
||||
/* Load UID CL2 and perform anticollision */
|
||||
uint8_t UidCL2[ISO14443A_CL_UID_SIZE];
|
||||
MemoryReadBlock(UidCL2, MEM_UID_CL2_ADDRESS, MEM_UID_CL2_SIZE);
|
||||
|
||||
if (ISO14443ASelect(Buffer, &BitCount, UidCL2, CardSAKValue)) {
|
||||
State = STATE_ACTIVE;
|
||||
}
|
||||
|
||||
return BitCount;
|
||||
} else {
|
||||
/* Unknown command. Enter HALT state. */
|
||||
State = STATE_HALT;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_ACTIVE:
|
||||
if (ISO14443AWakeUp(Buffer, &BitCount, MFCLASSIC_1K_ATQA_VALUE)) {
|
||||
State = STATE_READY;
|
||||
if (ISO14443AWakeUp(Buffer, &BitCount, CardATQAValue)) {
|
||||
State = STATE_READY1;
|
||||
return BitCount;
|
||||
} else if (Buffer[0] == CMD_HALT) {
|
||||
/* Halts the tag. According to the ISO14443, the second
|
||||
@@ -255,7 +338,10 @@ uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
||||
|
||||
/* Generate a random nonce and read UID and key from memory */
|
||||
RandomGetBuffer(CardNonce, sizeof(CardNonce));
|
||||
MemoryReadBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
||||
if (_7BUID)
|
||||
MemoryReadBlock(Uid, MEM_UID_CL2_ADDRESS, MEM_UID_CL2_SIZE);
|
||||
else
|
||||
MemoryReadBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
||||
MemoryReadBlock(Key, KeyAddress, MEM_KEY_SIZE);
|
||||
|
||||
/* Precalculate the reader response from card-nonce */
|
||||
@@ -416,7 +502,10 @@ uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
||||
|
||||
/* Generate a random nonce and read UID and key from memory */
|
||||
RandomGetBuffer(CardNonce, sizeof(CardNonce));
|
||||
MemoryReadBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
||||
if (_7BUID)
|
||||
MemoryReadBlock(Uid, MEM_UID_CL2_ADDRESS, MEM_UID_CL2_SIZE);
|
||||
else
|
||||
MemoryReadBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
||||
MemoryReadBlock(Key, KeyAddress, MEM_KEY_SIZE);
|
||||
|
||||
/* Precalculate the reader response from card-nonce */
|
||||
@@ -538,15 +627,27 @@ uint16_t MifareClassicAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
||||
|
||||
void MifareClassicGetUid(ConfigurationUidType Uid)
|
||||
{
|
||||
MemoryReadBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
||||
if (_7BUID) {
|
||||
//Uid[0]=0x88;
|
||||
MemoryReadBlock(&Uid[0], MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE-1);
|
||||
MemoryReadBlock(&Uid[3], MEM_UID_CL2_ADDRESS, MEM_UID_CL2_SIZE);
|
||||
}
|
||||
else
|
||||
MemoryReadBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
||||
}
|
||||
|
||||
void MifareClassicSetUid(ConfigurationUidType Uid)
|
||||
{
|
||||
uint8_t BCC = Uid[0] ^ Uid[1] ^ Uid[2] ^ Uid[3];
|
||||
if (_7BUID) {
|
||||
//Uid[0]=0x88;
|
||||
MemoryWriteBlock(Uid, MEM_UID_CL1_ADDRESS, ActiveConfiguration.UidSize);
|
||||
}
|
||||
else {
|
||||
uint8_t BCC = Uid[0] ^ Uid[1] ^ Uid[2] ^ Uid[3];
|
||||
|
||||
MemoryWriteBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
||||
MemoryWriteBlock(&BCC, MEM_UID_BCC1_ADDRESS, ISO14443A_CL_BCC_SIZE);
|
||||
MemoryWriteBlock(Uid, MEM_UID_CL1_ADDRESS, MEM_UID_CL1_SIZE);
|
||||
MemoryWriteBlock(&BCC, MEM_UID_BCC1_ADDRESS, ISO14443A_CL_BCC_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,56 +1,8 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
/*
|
||||
* MifareClassic.h
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
* Created on: 13.05.2013
|
||||
* Author: skuser
|
||||
*/
|
||||
|
||||
#ifndef MIFARECLASSIC_H_
|
||||
@@ -64,6 +16,7 @@
|
||||
#define MIFARE_CLASSIC_4K_MEM_SIZE 4096
|
||||
|
||||
void MifareClassicAppInit1K(void);
|
||||
void MifarePlus1kAppInit_7B(void);
|
||||
void MifareClassicAppInit4K(void);
|
||||
void MifareClassicAppReset(void);
|
||||
void MifareClassicAppTask(void);
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* MifareUltralight.c
|
||||
*
|
||||
* Created on: 20.03.2013
|
||||
* Author: skuser
|
||||
*/
|
||||
|
||||
#include "MifareUltralight.h"
|
||||
#include "ISO14443-3A.h"
|
||||
#include "../Codec/ISO14443-2A.h"
|
||||
#include "../Memory.h"
|
||||
|
||||
|
||||
#define ATQA_VALUE 0x0044
|
||||
#define SAK_CL1_VALUE ISO14443A_SAK_INCOMPLETE
|
||||
#define SAK_CL2_VALUE ISO14443A_SAK_COMPLETE_NOT_COMPLIANT
|
||||
|
||||
#define ACK_VALUE 0x0A
|
||||
#define ACK_FRAME_SIZE 4 /* Bits */
|
||||
#define NAK_INVALID_ARG 0x00
|
||||
#define NAK_CRC_ERROR 0x01
|
||||
#define NAK_EEPROM_ERROR 0x05
|
||||
#define NAK_OTHER_ERROR 0x06
|
||||
#define NAK_FRAME_SIZE 4
|
||||
|
||||
#define CMD_READ 0x30
|
||||
#define CMD_READ_FRAME_SIZE 2 /* without CRC bytes */
|
||||
#define CMD_WRITE 0xA2
|
||||
#define CMD_WRITE_FRAME_SIZE 6 /* without CRC bytes */
|
||||
#define CMD_COMPAT_WRITE 0xA0
|
||||
#define CMD_COMPAT_WRITE_FRAME_SIZE 2
|
||||
#define CMD_HALT 0x50
|
||||
|
||||
#define UID_CL1_ADDRESS 0x00 /* In Card Memory */
|
||||
#define UID_CL1_SIZE 3 /* In Bytes */
|
||||
#define UID_BCC1_ADDRESS 0x03
|
||||
#define UID_CL2_ADDRESS 0x04
|
||||
#define UID_CL2_SIZE 4
|
||||
#define UID_BCC2_ADDRESS 0x08
|
||||
|
||||
#define BYTES_PER_PAGE 4
|
||||
#define PAGE_ADDRESS_MASK 0x0F
|
||||
|
||||
#define BYTES_PER_READ 16
|
||||
#define PAGE_READ_MIN 0x00
|
||||
#define PAGE_READ_MAX 0x0F
|
||||
|
||||
#define BYTES_PER_WRITE 4
|
||||
#define PAGE_WRITE_MIN 0x02
|
||||
#define PAGE_WRITE_MAX 0x0F
|
||||
|
||||
#define BYTES_PER_COMPAT_WRITE 16
|
||||
|
||||
static enum {
|
||||
STATE_HALT,
|
||||
STATE_IDLE,
|
||||
STATE_READY1,
|
||||
STATE_READY2,
|
||||
STATE_ACTIVE,
|
||||
STATE_COMPAT_WRITE
|
||||
} State;
|
||||
|
||||
static uint8_t CompatWritePageAddress;
|
||||
|
||||
void MifareUltralightAppInit(void)
|
||||
{
|
||||
State = STATE_IDLE;
|
||||
}
|
||||
|
||||
void MifareUltralightAppReset(void)
|
||||
{
|
||||
State = STATE_IDLE;
|
||||
}
|
||||
|
||||
void MifareUltralightAppTask(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint16_t MifareUltralightAppProcess(uint8_t* Buffer, uint16_t BitCount)
|
||||
{
|
||||
uint8_t Cmd = Buffer[0];
|
||||
|
||||
switch(State) {
|
||||
case STATE_IDLE:
|
||||
case STATE_HALT:
|
||||
if (ISO14443AWakeUp(Buffer, &BitCount, ATQA_VALUE)) {
|
||||
/* We received a REQA or WUPA command, so wake up. */
|
||||
State = STATE_READY1;
|
||||
return BitCount;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_READY1:
|
||||
if (ISO14443AWakeUp(Buffer, &BitCount, ATQA_VALUE)) {
|
||||
State = STATE_READY1;
|
||||
return BitCount;
|
||||
} else if (Cmd == ISO14443A_CMD_SELECT_CL1) {
|
||||
/* Load UID CL1 and perform anticollision. Since
|
||||
* MF Ultralight use a double-sized UID, the first byte
|
||||
* of CL1 has to be the cascade-tag byte. */
|
||||
uint8_t UidCL1[ISO14443A_CL_UID_SIZE] = { [0] = ISO14443A_UID0_CT };
|
||||
|
||||
MemoryReadBlock(&UidCL1[1], UID_CL1_ADDRESS, UID_CL1_SIZE);
|
||||
|
||||
if (ISO14443ASelect(Buffer, &BitCount, UidCL1, SAK_CL1_VALUE)) {
|
||||
/* CL1 stage has ended successfully */
|
||||
State = STATE_READY2;
|
||||
}
|
||||
|
||||
return BitCount;
|
||||
} else {
|
||||
/* Unknown command. Enter halt state */
|
||||
State = STATE_IDLE;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_READY2:
|
||||
if (ISO14443AWakeUp(Buffer, &BitCount, ATQA_VALUE)) {
|
||||
State = STATE_READY1;
|
||||
return BitCount;
|
||||
} else if (Cmd == ISO14443A_CMD_SELECT_CL2) {
|
||||
/* Load UID CL2 and perform anticollision */
|
||||
uint8_t UidCL2[ISO14443A_CL_UID_SIZE];
|
||||
|
||||
MemoryReadBlock(UidCL2, UID_CL2_ADDRESS, UID_CL2_SIZE);
|
||||
|
||||
if (ISO14443ASelect(Buffer, &BitCount, UidCL2, SAK_CL2_VALUE)) {
|
||||
/* CL2 stage has ended successfully. This means
|
||||
* our complete UID has been sent to the reader. */
|
||||
State = STATE_ACTIVE;
|
||||
}
|
||||
|
||||
return BitCount;
|
||||
} else {
|
||||
/* Unknown command. Enter halt state */
|
||||
State = STATE_IDLE;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_ACTIVE:
|
||||
if (ISO14443AWakeUp(Buffer, &BitCount, ATQA_VALUE)) {
|
||||
State = STATE_READY1;
|
||||
return BitCount;
|
||||
} else if (Cmd == CMD_READ) {
|
||||
uint8_t PageAddress = Buffer[1];
|
||||
|
||||
if (ISO14443ACheckCRCA(Buffer, CMD_READ_FRAME_SIZE)) {
|
||||
if ( (PageAddress >= PAGE_READ_MIN)
|
||||
&& (PageAddress <= PAGE_READ_MAX) ) {
|
||||
/* TODO: Missing address wrap around behaviour.
|
||||
* Implement using a for-loop copying 4 bytes each iteration
|
||||
* and mask pageaddress */
|
||||
MemoryReadBlock(Buffer, PageAddress * BYTES_PER_PAGE, BYTES_PER_READ);
|
||||
ISO14443AAppendCRCA(Buffer, BYTES_PER_READ);
|
||||
return (BYTES_PER_READ + ISO14443A_CRCA_SIZE) * 8;
|
||||
} else {
|
||||
Buffer[0] = NAK_INVALID_ARG;
|
||||
return NAK_FRAME_SIZE;
|
||||
}
|
||||
} else {
|
||||
Buffer[0] = NAK_CRC_ERROR;
|
||||
return NAK_FRAME_SIZE;
|
||||
}
|
||||
} else if (Cmd == CMD_WRITE) {
|
||||
/* This is a write command containing 4 bytes of data that
|
||||
* should be written to the given page address. */
|
||||
uint8_t PageAddress = Buffer[1];
|
||||
if (ISO14443ACheckCRCA(Buffer, CMD_WRITE_FRAME_SIZE)) {
|
||||
/* CRC check passed */
|
||||
if ( (PageAddress >= PAGE_WRITE_MIN)
|
||||
&& (PageAddress <= PAGE_WRITE_MAX) ) {
|
||||
/* PageAddress is within bounds. */
|
||||
|
||||
if (!ActiveConfiguration.ReadOnly) {
|
||||
MemoryWriteBlock(&Buffer[2], PageAddress * BYTES_PER_PAGE, BYTES_PER_WRITE);
|
||||
} else {
|
||||
/* If the chameleon is in read only mode, it silently
|
||||
* ignores any attempt to write data. */
|
||||
}
|
||||
|
||||
Buffer[0] = ACK_VALUE;
|
||||
return ACK_FRAME_SIZE;
|
||||
|
||||
} else {
|
||||
Buffer[0] = NAK_INVALID_ARG;
|
||||
return NAK_FRAME_SIZE;
|
||||
}
|
||||
} else {
|
||||
Buffer[0] = NAK_CRC_ERROR;
|
||||
return NAK_FRAME_SIZE;
|
||||
}
|
||||
} else if (Cmd == CMD_COMPAT_WRITE) {
|
||||
/* The Mifare compatbility write command is a 2-frame command.
|
||||
* The first frame contains the page-address and the second frame
|
||||
* holds the data. */
|
||||
uint8_t PageAddress = Buffer[1];
|
||||
|
||||
if (ISO14443ACheckCRCA(Buffer, CMD_COMPAT_WRITE_FRAME_SIZE)) {
|
||||
if ( (PageAddress >= PAGE_WRITE_MIN)
|
||||
&& (PageAddress <= PAGE_WRITE_MAX) ) {
|
||||
/* CRC check passed and page-address is within bounds.
|
||||
* Store address and proceed to receiving the data. */
|
||||
CompatWritePageAddress = PageAddress;
|
||||
State = STATE_COMPAT_WRITE;
|
||||
|
||||
Buffer[0] = ACK_VALUE;
|
||||
return ACK_FRAME_SIZE;
|
||||
} else {
|
||||
Buffer[0] = NAK_INVALID_ARG;
|
||||
return NAK_FRAME_SIZE;
|
||||
}
|
||||
} else {
|
||||
Buffer[0] = NAK_CRC_ERROR;
|
||||
return NAK_FRAME_SIZE;
|
||||
}
|
||||
} else if (Cmd == CMD_HALT) {
|
||||
/* Halts the tag. According to the ISO14443, the second
|
||||
* byte is supposed to be 0. */
|
||||
if (Buffer[1] == 0) {
|
||||
if (ISO14443ACheckCRCA(Buffer, 2)) {
|
||||
/* According to ISO14443, we must not send anything
|
||||
* in order to acknowledge the HALT command. */
|
||||
State = STATE_HALT;
|
||||
return ISO14443A_APP_NO_RESPONSE;
|
||||
} else {
|
||||
Buffer[0] = NAK_CRC_ERROR;
|
||||
return NAK_FRAME_SIZE;
|
||||
}
|
||||
} else {
|
||||
Buffer[0] = NAK_INVALID_ARG;
|
||||
return NAK_FRAME_SIZE;
|
||||
}
|
||||
} else {
|
||||
/* Unknown command. Enter halt state */
|
||||
State = STATE_IDLE;
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_COMPAT_WRITE:
|
||||
/* Compatibility write. Receiving 16 bytes of data of which 4 bytes are valid. */
|
||||
if (ISO14443ACheckCRCA(Buffer, BYTES_PER_COMPAT_WRITE)) {
|
||||
/* We don't perform any checks here. You will be able to program the
|
||||
* whole memory. Also there is no OTP behaviour. */
|
||||
if (!ActiveConfiguration.ReadOnly) {
|
||||
MemoryWriteBlock(Buffer, CompatWritePageAddress * BYTES_PER_PAGE, BYTES_PER_WRITE);
|
||||
} else {
|
||||
/* If we are told to be read only, we silently ignore the write command
|
||||
* and pretend to have written data. */
|
||||
}
|
||||
|
||||
State = STATE_ACTIVE;
|
||||
Buffer[0] = ACK_VALUE;
|
||||
return ACK_FRAME_SIZE;
|
||||
} else {
|
||||
State = STATE_ACTIVE;
|
||||
Buffer[0] = NAK_CRC_ERROR;
|
||||
return NAK_FRAME_SIZE;
|
||||
}
|
||||
|
||||
default:
|
||||
/* Unknown state? Should never happen. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* No response has been sent, when we reach here */
|
||||
return ISO14443A_APP_NO_RESPONSE;
|
||||
}
|
||||
|
||||
void MifareUltralightGetUid(ConfigurationUidType Uid)
|
||||
{
|
||||
/* Read UID from memory */
|
||||
MemoryReadBlock(&Uid[0], UID_CL1_ADDRESS, UID_CL1_SIZE);
|
||||
MemoryReadBlock(&Uid[UID_CL1_SIZE], UID_CL2_ADDRESS, UID_CL2_SIZE);
|
||||
}
|
||||
|
||||
void MifareUltralightSetUid(ConfigurationUidType Uid)
|
||||
{
|
||||
/* Calculate check bytes and write everything into memory */
|
||||
uint8_t BCC1 = ISO14443A_UID0_CT ^ Uid[0] ^ Uid[1] ^ Uid[2];
|
||||
uint8_t BCC2 = Uid[3] ^ Uid[4] ^ Uid[5] ^ Uid[6];
|
||||
|
||||
MemoryWriteBlock(&Uid[0], UID_CL1_ADDRESS, UID_CL1_SIZE);
|
||||
MemoryWriteBlock(&BCC1, UID_BCC1_ADDRESS, ISO14443A_CL_BCC_SIZE);
|
||||
MemoryWriteBlock(&Uid[UID_CL1_SIZE], UID_CL2_ADDRESS, UID_CL2_SIZE);
|
||||
MemoryWriteBlock(&BCC2, UID_BCC2_ADDRESS, ISO14443A_CL_BCC_SIZE);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* MifareUltralight.h
|
||||
*
|
||||
* Created on: 20.03.2013
|
||||
* Author: skuser
|
||||
*/
|
||||
|
||||
#ifndef MIFAREULTRALIGHT_H_
|
||||
#define MIFAREULTRALIGHT_H_
|
||||
|
||||
#include "Application.h"
|
||||
#include "ISO14443-3A.h"
|
||||
|
||||
#define MIFARE_ULTRALIGHT_UID_SIZE ISO14443A_UID_SIZE_DOUBLE
|
||||
#define MIFARE_ULTRALIGHT_MEM_SIZE 64
|
||||
|
||||
void MifareUltralightAppInit(void);
|
||||
void MifareUltralightAppReset(void);
|
||||
void MifareUltralightAppTask(void);
|
||||
|
||||
uint16_t MifareUltralightAppProcess(uint8_t* Buffer, uint16_t BitCount);
|
||||
|
||||
void MifareUltralightGetUid(ConfigurationUidType Uid);
|
||||
void MifareUltralightSetUid(ConfigurationUidType Uid);
|
||||
|
||||
|
||||
|
||||
#endif /* MIFAREULTRALIGHT_H_ */
|
||||
+137
-155
@@ -1,64 +1,11 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
*/
|
||||
|
||||
#include "Button.h"
|
||||
#include "Random.h"
|
||||
#include "Common.h"
|
||||
#include "Settings.h"
|
||||
#include "Memory.h"
|
||||
|
||||
#define LONG_PRESS_TICK_COUNT 10
|
||||
|
||||
static const char PROGMEM ButtonActionTable[][32] =
|
||||
{
|
||||
[BUTTON_ACTION_NONE] = "NONE",
|
||||
@@ -72,6 +19,97 @@ static const char PROGMEM ButtonActionTable[][32] =
|
||||
[BUTTON_ACTION_RECALL_MEM] = "RECALL_MEM",
|
||||
};
|
||||
|
||||
static void ExecuteButtonAction(ButtonActionEnum ButtonAction)
|
||||
{
|
||||
uint8_t UidBuffer[32];
|
||||
|
||||
if (ButtonAction == BUTTON_ACTION_UID_RANDOM) {
|
||||
for (uint8_t i=0; i<ActiveConfiguration.UidSize; i++) {
|
||||
UidBuffer[i] = RandomGetByte();
|
||||
}
|
||||
|
||||
ApplicationSetUid(UidBuffer);
|
||||
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_INCREMENT) {
|
||||
ApplicationGetUid(UidBuffer);
|
||||
bool Carry = 1;
|
||||
uint8_t i;
|
||||
|
||||
for (i=0; i<ActiveConfiguration.UidSize; i++) {
|
||||
if (Carry) {
|
||||
if (UidBuffer[i] == 0xFF) {
|
||||
Carry = 1;
|
||||
} else {
|
||||
Carry = 0;
|
||||
}
|
||||
|
||||
UidBuffer[i] = (UidBuffer[i] + 1) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationSetUid(UidBuffer);
|
||||
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_INCREMENT) {
|
||||
ApplicationGetUid(UidBuffer);
|
||||
bool Carry = 1;
|
||||
uint8_t i = ActiveConfiguration.UidSize;
|
||||
|
||||
while(i-- > 0) {
|
||||
if (Carry) {
|
||||
if (UidBuffer[i] == 0xFF) {
|
||||
Carry = 1;
|
||||
} else {
|
||||
Carry = 0;
|
||||
}
|
||||
|
||||
UidBuffer[i] = (UidBuffer[i] + 1) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationSetUid(UidBuffer);
|
||||
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_DECREMENT) {
|
||||
ApplicationGetUid(UidBuffer);
|
||||
bool Carry = 1;
|
||||
uint8_t i;
|
||||
|
||||
for (i=0; i<ActiveConfiguration.UidSize; i++) {
|
||||
if (Carry) {
|
||||
if (UidBuffer[i] == 0x00) {
|
||||
Carry = 1;
|
||||
} else {
|
||||
Carry = 0;
|
||||
}
|
||||
|
||||
UidBuffer[i] = (UidBuffer[i] - 1) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationSetUid(UidBuffer);
|
||||
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_DECREMENT) {
|
||||
ApplicationGetUid(UidBuffer);
|
||||
bool Carry = 1;
|
||||
uint8_t i = ActiveConfiguration.UidSize;
|
||||
|
||||
while(i-- > 0) {
|
||||
if (Carry) {
|
||||
if (UidBuffer[i] == 0x00) {
|
||||
Carry = 1;
|
||||
} else {
|
||||
Carry = 0;
|
||||
}
|
||||
|
||||
UidBuffer[i] = (UidBuffer[i] - 1) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationSetUid(UidBuffer);
|
||||
} else if (ButtonAction == BUTTON_ACTION_CYCLE_SETTINGS) {
|
||||
SettingsCycle();
|
||||
} else if (ButtonAction == BUTTON_ACTION_STORE_MEM) {
|
||||
MemoryStore();
|
||||
} else if (ButtonAction == BUTTON_ACTION_RECALL_MEM) {
|
||||
MemoryRecall();
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonInit(void)
|
||||
{
|
||||
BUTTON_PORT.DIRCLR = BUTTON_MASK;
|
||||
@@ -80,101 +118,31 @@ void ButtonInit(void)
|
||||
|
||||
void ButtonTick(void)
|
||||
{
|
||||
static uint8_t LastButtonState = 0;
|
||||
static uint8_t PressTickCounter = 0;
|
||||
uint8_t ThisButtonState = ~BUTTON_PORT.IN;
|
||||
uint8_t ThisButtonChange = ThisButtonState ^ LastButtonState;
|
||||
uint8_t ThisButtonPress = ThisButtonChange & ThisButtonState;
|
||||
LastButtonState = ThisButtonState;
|
||||
|
||||
if ( ThisButtonPress & BUTTON_MASK ) {
|
||||
uint8_t UidBuffer[32];
|
||||
ButtonActionEnum ButtonAction = GlobalSettings.ActiveSettingPtr->ButtonAction;
|
||||
if (ThisButtonState & BUTTON_MASK) {
|
||||
/* Button is currently pressed */
|
||||
if (PressTickCounter < LONG_PRESS_TICK_COUNT) {
|
||||
/* Count ticks while button is being pressed */
|
||||
PressTickCounter++;
|
||||
} else if (PressTickCounter == LONG_PRESS_TICK_COUNT) {
|
||||
/* Long button press detected execute button action and advance PressTickCounter
|
||||
* to an invalid state. */
|
||||
ExecuteButtonAction(GlobalSettings.ActiveSettingPtr->ButtonLongAction);
|
||||
PressTickCounter++;
|
||||
} else {
|
||||
/* Button is still pressed, ignore */
|
||||
}
|
||||
} else if (!(ThisButtonState & BUTTON_MASK)) {
|
||||
/* Button is currently not being pressed. Check if PressTickCounter contains
|
||||
* a recent short button press. */
|
||||
if ( (PressTickCounter > 0) && (PressTickCounter <= LONG_PRESS_TICK_COUNT) ) {
|
||||
/* We have a short button press */
|
||||
ExecuteButtonAction(GlobalSettings.ActiveSettingPtr->ButtonAction);
|
||||
}
|
||||
|
||||
if (ButtonAction == BUTTON_ACTION_UID_RANDOM) {
|
||||
for (uint8_t i=0; i<ActiveConfiguration.UidSize; i++) {
|
||||
UidBuffer[i] = RandomGetByte();
|
||||
}
|
||||
|
||||
ApplicationSetUid(UidBuffer);
|
||||
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_INCREMENT) {
|
||||
ApplicationGetUid(UidBuffer);
|
||||
bool Carry = 1;
|
||||
uint8_t i;
|
||||
|
||||
for (i=0; i<ActiveConfiguration.UidSize; i++) {
|
||||
if (Carry) {
|
||||
if (UidBuffer[i] == 0xFF) {
|
||||
Carry = 1;
|
||||
} else {
|
||||
Carry = 0;
|
||||
}
|
||||
|
||||
UidBuffer[i] = (UidBuffer[i] + 1) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationSetUid(UidBuffer);
|
||||
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_INCREMENT) {
|
||||
ApplicationGetUid(UidBuffer);
|
||||
bool Carry = 1;
|
||||
uint8_t i = ActiveConfiguration.UidSize;
|
||||
|
||||
while(i-- > 0) {
|
||||
if (Carry) {
|
||||
if (UidBuffer[i] == 0xFF) {
|
||||
Carry = 1;
|
||||
} else {
|
||||
Carry = 0;
|
||||
}
|
||||
|
||||
UidBuffer[i] = (UidBuffer[i] + 1) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationSetUid(UidBuffer);
|
||||
} else if (ButtonAction == BUTTON_ACTION_UID_LEFT_DECREMENT) {
|
||||
ApplicationGetUid(UidBuffer);
|
||||
bool Carry = 1;
|
||||
uint8_t i;
|
||||
|
||||
for (i=0; i<ActiveConfiguration.UidSize; i++) {
|
||||
if (Carry) {
|
||||
if (UidBuffer[i] == 0x00) {
|
||||
Carry = 1;
|
||||
} else {
|
||||
Carry = 0;
|
||||
}
|
||||
|
||||
UidBuffer[i] = (UidBuffer[i] - 1) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationSetUid(UidBuffer);
|
||||
} else if (ButtonAction == BUTTON_ACTION_UID_RIGHT_DECREMENT) {
|
||||
ApplicationGetUid(UidBuffer);
|
||||
bool Carry = 1;
|
||||
uint8_t i = ActiveConfiguration.UidSize;
|
||||
|
||||
while(i-- > 0) {
|
||||
if (Carry) {
|
||||
if (UidBuffer[i] == 0x00) {
|
||||
Carry = 1;
|
||||
} else {
|
||||
Carry = 0;
|
||||
}
|
||||
|
||||
UidBuffer[i] = (UidBuffer[i] - 1) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationSetUid(UidBuffer);
|
||||
} else if (ButtonAction == BUTTON_ACTION_CYCLE_SETTINGS) {
|
||||
SettingsCycle();
|
||||
} else if (ButtonAction == BUTTON_ACTION_STORE_MEM) {
|
||||
MemoryStore();
|
||||
} else if (ButtonAction == BUTTON_ACTION_RECALL_MEM) {
|
||||
MemoryRecall();
|
||||
}
|
||||
PressTickCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,30 +175,45 @@ void ButtonGetActionList(char* ListOut, uint16_t BufferSize)
|
||||
*ListOut = '\0';
|
||||
}
|
||||
|
||||
void ButtonSetActionById(ButtonActionEnum Action)
|
||||
void ButtonSetActionById(ButtonTypeEnum Type, ButtonActionEnum Action)
|
||||
{
|
||||
#ifndef BUTTON_SETTING_GLOBAL
|
||||
GlobalSettings.ActiveSettingPtr->ButtonAction = Action;
|
||||
if (Type == BUTTON_PRESS_SHORT) {
|
||||
GlobalSettings.ActiveSettingPtr->ButtonAction = Action;
|
||||
} else if (Type == BUTTON_PRESS_LONG) {
|
||||
GlobalSettings.ActiveSettingPtr->ButtonLongAction = Action;
|
||||
}
|
||||
#else
|
||||
/* Write button action to all settings when using global settings */
|
||||
for (uint8_t i=0; i<SETTINGS_COUNT; i++) {
|
||||
GlobalSettings.Settings[i].ButtonAction = Action;
|
||||
if (Type == BUTTON_PRESS_SHORT) {
|
||||
GlobalSettings.Settings[i].ButtonAction = Action;
|
||||
} else if (Type == BUTTON_PRESS_LONG) {
|
||||
GlobalSettings.Settings[i].ButtonLongAction = Action;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ButtonGetActionByName(char* ActionOut, uint16_t BufferSize)
|
||||
void ButtonGetActionByName(ButtonTypeEnum Type, char* ActionOut, uint16_t BufferSize)
|
||||
{
|
||||
strncpy_P(ActionOut, ButtonActionTable[GlobalSettings.ActiveSettingPtr->ButtonAction], BufferSize);
|
||||
if (Type == BUTTON_PRESS_SHORT) {
|
||||
strncpy_P(ActionOut, ButtonActionTable[GlobalSettings.ActiveSettingPtr->ButtonAction], BufferSize);
|
||||
} else if (Type == BUTTON_PRESS_LONG) {
|
||||
strncpy_P(ActionOut, ButtonActionTable[GlobalSettings.ActiveSettingPtr->ButtonLongAction], BufferSize);
|
||||
} else {
|
||||
/* Should not happen (TM) */
|
||||
*ActionOut = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
bool ButtonSetActionByName(const char* Action)
|
||||
bool ButtonSetActionByName(ButtonTypeEnum Type, const char* Action)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for (i=0; i<BUTTON_ACTION_COUNT; i++) {
|
||||
if (strcmp_P(Action, ButtonActionTable[i]) == 0) {
|
||||
ButtonSetActionById(i);
|
||||
ButtonSetActionById(Type, i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -238,4 +221,3 @@ bool ButtonSetActionByName(const char* Action)
|
||||
/* Button action not found */
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,56 +1,8 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
/*
|
||||
* Button.h
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
* Created on: 13.05.2013
|
||||
* Author: skuser
|
||||
*/
|
||||
|
||||
#ifndef BUTTON_H_
|
||||
@@ -64,6 +16,11 @@
|
||||
#define BUTTON_MASK PIN6_bm
|
||||
#define BUTTON_PINCTRL PIN6CTRL
|
||||
|
||||
typedef enum {
|
||||
BUTTON_PRESS_SHORT,
|
||||
BUTTON_PRESS_LONG
|
||||
} ButtonTypeEnum;
|
||||
|
||||
typedef enum {
|
||||
BUTTON_ACTION_NONE,
|
||||
BUTTON_ACTION_UID_RANDOM,
|
||||
@@ -83,8 +40,8 @@ void ButtonInit(void);
|
||||
void ButtonTick(void);
|
||||
|
||||
void ButtonGetActionList(char* ListOut, uint16_t BufferSize);
|
||||
void ButtonSetActionById(ButtonActionEnum Action);
|
||||
void ButtonGetActionByName(char* ActionOut, uint16_t BufferSize);
|
||||
bool ButtonSetActionByName(const char* Action);
|
||||
void ButtonSetActionById(ButtonTypeEnum Type, ButtonActionEnum Action);
|
||||
void ButtonGetActionByName(ButtonTypeEnum Type, char* ActionOut, uint16_t BufferSize);
|
||||
bool ButtonSetActionByName(ButtonTypeEnum Type, const char* Action);
|
||||
|
||||
#endif /* BUTTON_H_ */
|
||||
|
||||
Binary file not shown.
@@ -1,64 +1,10 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
*/
|
||||
|
||||
#include "Chameleon-Mini.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
SystemInit();
|
||||
SettingsLoad();
|
||||
LogInit();
|
||||
LEDInit();
|
||||
MemoryInit();
|
||||
ConfigurationInit();
|
||||
@@ -68,18 +14,21 @@ int main(void)
|
||||
AntennaLevelInit();
|
||||
|
||||
SystemInterruptInit();
|
||||
SystemSleepEnable();
|
||||
|
||||
while(1) {
|
||||
TerminalTask();
|
||||
CodecTask();
|
||||
ApplicationTask();
|
||||
|
||||
if (SystemTick100ms()) {
|
||||
RandomTick();
|
||||
TerminalTick();
|
||||
ButtonTick();
|
||||
LogTick();
|
||||
LEDTick();
|
||||
}
|
||||
|
||||
TerminalTask();
|
||||
ApplicationTask();
|
||||
LogTask();
|
||||
CodecTask();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
:1000000000002506000600060006000600060006A1
|
||||
:03001000000600E7
|
||||
:10000000000C290608000003010608000003010691
|
||||
:1000100008000003010608000003010608000003B1
|
||||
:10002000010608000003010608000003010608009D
|
||||
:03003000000301C9
|
||||
:00000001FF
|
||||
|
||||
Binary file not shown.
@@ -1,58 +1,3 @@
|
||||
/* Copyright 2013 Timo Kasper, Simon Küppers, David Oswald ("ORIGINAL
|
||||
* AUTHORS"). All rights reserved.
|
||||
*
|
||||
* DEFINITIONS:
|
||||
*
|
||||
* "WORK": The material covered by this license includes the schematic
|
||||
* diagrams, designs, circuit or circuit board layouts, mechanical
|
||||
* drawings, documentation (in electronic or printed form), source code,
|
||||
* binary software, data files, assembled devices, and any additional
|
||||
* material provided by the ORIGINAL AUTHORS in the ChameleonMini project
|
||||
* (https://github.com/skuep/ChameleonMini).
|
||||
*
|
||||
* LICENSE TERMS:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* Redistributions and use of this WORK, with or without modification, or
|
||||
* of substantial portions of this WORK must include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the following
|
||||
* attribution:
|
||||
*
|
||||
* "Based on ChameleonMini an open-source RFID emulator:
|
||||
* https://github.com/skuep/ChameleonMini"
|
||||
*
|
||||
* The attribution must be clearly visible to a user, for example, by being
|
||||
* printed on the circuit board and an enclosure, and by being displayed by
|
||||
* software (both in binary and source code form).
|
||||
*
|
||||
* At any time, the majority of the ORIGINAL AUTHORS may decide to give
|
||||
* written permission to an entity to use or redistribute the WORK (with or
|
||||
* without modification) WITHOUT having to include the above copyright
|
||||
* notice, this list of conditions, the below disclaimer, and the above
|
||||
* attribution.
|
||||
*
|
||||
* DISCLAIMER:
|
||||
*
|
||||
* THIS PRODUCT IS PROVIDED BY THE ORIGINAL AUTHORS "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ORIGINAL AUTHORS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS PRODUCT, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the hardware, software, and
|
||||
* documentation should not be interpreted as representing official
|
||||
* policies, either expressed or implied, of the ORIGINAL AUTHORS.
|
||||
*/
|
||||
|
||||
#ifndef CHAMELEON_MINI_H
|
||||
#define CHAMELEON_MINI_H
|
||||
|
||||
@@ -70,6 +15,7 @@
|
||||
#include "Configuration.h"
|
||||
#include "Random.h"
|
||||
#include "Button.h"
|
||||
#include "Log.h"
|
||||
#include "AntennaLevel.h"
|
||||
#include "Settings.h"
|
||||
|
||||
|
||||
+1587
-1268
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user