+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// LCD code
+//-----------------------------------------------------------------------------
+
#include "proxmark3.h"
#include "apps.h"
#include "LCD.h"
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// LCD code
+//-----------------------------------------------------------------------------
+
#ifndef __LCD_H
#define __LCD_H
+#-----------------------------------------------------------------------------
+# This code is licensed to you under the terms of the GNU GPL, version 2 or,
+# at your option, any later version. See the LICENSE.txt file for the text of
+# the license.
+#-----------------------------------------------------------------------------
# Makefile for armsrc, see ../common/Makefile.common for common settings
+#-----------------------------------------------------------------------------
APP_INCLUDES = apps.h
//-----------------------------------------------------------------------------
-// The main application code. This is the first thing called after start.c
-// executes.
// Jonathan Westhues, Mar 2006
// Edits by Gerhard de Koning Gans, Sep 2007 (##)
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// The main application code. This is the first thing called after start.c
+// executes.
//-----------------------------------------------------------------------------
#include "proxmark3.h"
//-----------------------------------------------------------------------------
-// Definitions internal to the app source.
// Jonathan Westhues, Aug 2005
-// Added ISO14443-A support by Gerhard de Koning Gans, April 2008
+// Gerhard de Koning Gans, April 2008
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Definitions internal to the app source.
//-----------------------------------------------------------------------------
#ifndef __APPS_H
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Fonts for the LCD
+//-----------------------------------------------------------------------------
+
const char FONT6x8[97][8] = {
{0x06,0x08,0x08,0x00,0x00,0x00,0x00,0x00}, // columns, rows, bytes per char
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // space
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Fonts for the LCD
+//-----------------------------------------------------------------------------
+
#ifndef __FONTS_H
#define __FONTS_H
//-----------------------------------------------------------------------------
+// Jonathan Westhues, April 2006
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
// Routines to load the FPGA image, and then to configure the FPGA's major
// mode once it is configured.
-//
-// Jonathan Westhues, April 2006
//-----------------------------------------------------------------------------
+
#include "proxmark3.h"
#include "apps.h"
#include "util.h"
-/*
- * Hitag2 emulation
- *
- * Contains state and functions for an emulated Hitag2 tag. Offers an entry
- * point to handle commands, needs a callback to send response.
- *
- * (c) 2009 Henryk Plötz <henryk@ploetzli.ch>
- */
+//-----------------------------------------------------------------------------
+// (c) 2009 Henryk Plötz <henryk@ploetzli.ch>
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Hitag2 emulation
+//
+// Contains state and functions for an emulated Hitag2 tag. Offers an entry
+// point to handle commands, needs a callback to send response.
+//-----------------------------------------------------------------------------
#include "proxmark3.h"
#include "apps.h"
-/*
- * Hitag2 emulation public interface
- *
- * (c) 2009 Henryk Plötz <henryk@ploetzli.ch>
- */
+//-----------------------------------------------------------------------------
+// (c) 2009 Henryk Plötz <henryk@ploetzli.ch>
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Hitag2 emulation public interface
+//-----------------------------------------------------------------------------
#ifndef __HITAG2_H
#define __HITAG2_H
//-----------------------------------------------------------------------------
+// Jonathan Westhues, split Nov 2006
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
// Routines to support ISO 14443. This includes both the reader software and
// the `fake tag' modes. At the moment only the Type B modulation is
// supported.
-// Jonathan Westhues, split Nov 2006
//-----------------------------------------------------------------------------
+
#include "proxmark3.h"
#include "apps.h"
#include "util.h"
//-----------------------------------------------------------------------------
-// Routines to support ISO 14443 type A.
-//
// Gerhard de Koning Gans - May 2008
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
//-----------------------------------------------------------------------------
+// Routines to support ISO 14443 type A.
+//-----------------------------------------------------------------------------
+
#include "proxmark3.h"
#include "apps.h"
#include "util.h"
//-----------------------------------------------------------------------------
+// Jonathan Westhues, split Nov 2006
+// Modified by Greg Jones, Jan 2009
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
// Routines to support ISO 15693. This includes both the reader software and
// the `fake tag' modes, but at the moment I've implemented only the reader
// stuff, and that barely.
-// Jonathan Westhues, split Nov 2006
-
-// Modified by Greg Jones, Jan 2009 to perform modulation onboard in arm rather than on PC
+// Modified to perform modulation onboard in arm rather than on PC
// Also added additional reader commands (SELECT, READ etc.)
-
//-----------------------------------------------------------------------------
+
#include "proxmark3.h"
#include "util.h"
#include "apps.h"
-/*
- * LEGIC RF simulation code
- *
- * (c) 2009 Henryk Plötz <henryk@ploetzli.ch>
- */
+//-----------------------------------------------------------------------------
+// (c) 2009 Henryk Plötz <henryk@ploetzli.ch>
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// LEGIC RF simulation code
+//-----------------------------------------------------------------------------
#include "proxmark3.h"
#include "apps.h"
-/*
- * LEGIC RF emulation public interface
- *
- * (c) 2009 Henryk Plötz <henryk@ploetzli.ch>
- */
+//-----------------------------------------------------------------------------
+// (c) 2009 Henryk Plötz <henryk@ploetzli.ch>
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// LEGIC RF emulation public interface
+//-----------------------------------------------------------------------------
#ifndef __LEGICRF_H
#define __LEGICRF_H
//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
// Miscellaneous routines for low frequency tag operations.
// Tags supported here so far are Texas Instruments (TI), HID
// Also routines for raw mode reading/simulating of LF waveform
-//
//-----------------------------------------------------------------------------
+
#include "proxmark3.h"
#include "apps.h"
#include "util.h"
+//-----------------------------------------------------------------------------
+// Copyright (C) 2010 Hector Martin "marcan" <marcan@marcansoft.com>
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Common *printf() functions
+//-----------------------------------------------------------------------------
+
#ifndef __PRINTF_H
#define __PRINTF_H
//-----------------------------------------------------------------------------
+// Jonathan Westhues, Mar 2006
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
// Just vector to AppMain(). This is in its own file so that I can place it
// with the linker script.
-// Jonathan Westhues, Mar 2006
//-----------------------------------------------------------------------------
+
#include "proxmark3.h"
#include "apps.h"
-/*
- * Replacement stdint.h because GCC doesn't come with it yet (C99)
- */
+//-----------------------------------------------------------------------------
+// Copyright (C) 2010 Hector Martin "marcan" <marcan@marcansoft.com>
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Replacement stdint.h because GCC doesn't come with it yet (C99)
+//-----------------------------------------------------------------------------
#ifndef __STDINT_H
#define __STDINT_H
-/* Implementations of the common string.h functions */
+//-----------------------------------------------------------------------------
+// Jonathan Westhues, Sept 2005
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Common string.h functions
+//-----------------------------------------------------------------------------
+
#include "string.h"
#include <stdint.h>
+//-----------------------------------------------------------------------------
+// Jonathan Westhues, Aug 2005
+// Copyright (C) 2010 Hector Martin "marcan" <marcan@marcansoft.com>
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Common string.h functions
+//-----------------------------------------------------------------------------
+
#ifndef __STRING_H
#define __STRING_H
//-----------------------------------------------------------------------------
-// Utility functions used in many places, not specific to any piece of code.
// Jonathan Westhues, Sept 2005
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Utility functions used in many places, not specific to any piece of code.
//-----------------------------------------------------------------------------
+
#include "proxmark3.h"
#include "util.h"
#include "string.h"
+//-----------------------------------------------------------------------------
+// Jonathan Westhues, Aug 2005
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Utility functions used in many places, not specific to any piece of code.
+//-----------------------------------------------------------------------------
+
#ifndef __UTIL_H
#define __UTIL_H
+#-----------------------------------------------------------------------------
+# This code is licensed to you under the terms of the GNU GPL, version 2 or,
+# at your option, any later version. See the LICENSE.txt file for the text of
+# the license.
+#-----------------------------------------------------------------------------
# Makefile for bootrom, see ../common/Makefile.common for common settings
+#-----------------------------------------------------------------------------
# DO NOT use thumb mode in the phase 1 bootloader since that generates a section with glue code
ARMSRC = fromflash.c
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Main code for the bootloader
+//-----------------------------------------------------------------------------
+
#include <proxmark3.h>
struct common_area common_area __attribute__((section(".commonarea")));
+@-----------------------------------------------------------------------------
+@ This code is licensed to you under the terms of the GNU GPL, version 2 or,
+@ at your option, any later version. See the LICENSE.txt file for the text of
+@ the license.
+@-----------------------------------------------------------------------------
+@ Reset vector for running from FLASH
+@-----------------------------------------------------------------------------
+
.extern CopyBootToRAM
.section .startup,"ax"
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Helper function for launching the bootloader from FLASH
+//-----------------------------------------------------------------------------
+
#include <proxmark3.h>
extern char __bootphase2_src_start__, __bootphase2_start__, __bootphase2_end__;
+/*
+-----------------------------------------------------------------------------
+ This code is licensed to you under the terms of the GNU GPL, version 2 or,
+ at your option, any later version. See the LICENSE.txt file for the text of
+ the license.
+-----------------------------------------------------------------------------
+ Bootrom linker script
+-----------------------------------------------------------------------------
+*/
+
INCLUDE ../common/ldscript.common
ENTRY(flashstart)
+@-----------------------------------------------------------------------------
+@ This code is licensed to you under the terms of the GNU GPL, version 2 or,
+@ at your option, any later version. See the LICENSE.txt file for the text of
+@ the license.
+@-----------------------------------------------------------------------------
+@ RAM reset vector for relaunching the bootloader
+@-----------------------------------------------------------------------------
+
.extern BootROM
.section .startphase2,"ax"
-/*
- * Replacement stdint.h because GCC doesn't come with it yet (C99)
- */
+//-----------------------------------------------------------------------------
+// Copyright (C) 2010 Hector Martin "marcan" <marcan@marcansoft.com>
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Replacement stdint.h because GCC doesn't come with it yet (C99)
+//-----------------------------------------------------------------------------
#ifndef __STDINT_H
#define __STDINT_H
+#-----------------------------------------------------------------------------
+# This code is licensed to you under the terms of the GNU GPL, version 2 or,
+# at your option, any later version. See the LICENSE.txt file for the text of
+# the license.
+#-----------------------------------------------------------------------------
+# Common makefile functions for all platforms
+#-----------------------------------------------------------------------------
+
# This new makefile replaces the previous Makefile/Makefile.linux
# with as much common code for both environments as possible.
# Following is a short OS detection to set up variables, all the
-/*
- * crc.c
- *
- * Generic CRC calculation code.
- *
- */
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Generic CRC calculation code.
+//-----------------------------------------------------------------------------
#include "crc.h"
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// CRC16
+//-----------------------------------------------------------------------------
+
#include "crc16.h"
unsigned short update_crc16( unsigned short crc, unsigned char c )
-#ifndef CRC16_H__
-#define CRC16_H__
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// CRC16
+//-----------------------------------------------------------------------------
+
+#ifndef __CRC16_H
+#define __CRC16_H
unsigned short update_crc16(unsigned short crc, unsigned char c);
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// ISO14443 CRC calculation code.
+//-----------------------------------------------------------------------------
+
#include "iso14443crc.h"
static unsigned short UpdateCrc14443(unsigned char ch, unsigned short *lpwCrc)
-#ifndef ISO14443CRC_H__
-#define ISO14443CRC_H__
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// ISO14443 CRC calculation code.
+//-----------------------------------------------------------------------------
+
+#ifndef __ISO14443CRC_H
+#define __ISO14443CRC_H
//-----------------------------------------------------------------------------
// Routines to compute the CRCs (two different flavours, just for confusion)
+/*
+-----------------------------------------------------------------------------
+ This code is licensed to you under the terms of the GNU GPL, version 2 or,
+ at your option, any later version. See the LICENSE.txt file for the text of
+ the license.
+-----------------------------------------------------------------------------
+ Common linker script
+-----------------------------------------------------------------------------
+*/
+
/* AT91SAM7S256 has 256k Flash and 64k RAM */
MEMORY
{
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// LEFIC's obfuscation function
+//-----------------------------------------------------------------------------
+
#include "legic_prng.h"
-/* legic's obfuscation function */
struct lfsr {
uint8_t a;
//-----------------------------------------------------------------------------
-// My USB driver. This has to be common, because it exists in both the
-// bootrom and the application.
// Jonathan Westhues, split Aug 14 2005
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
//-----------------------------------------------------------------------------
+// The common USB driver used for both the bootloader and the application.
+//-----------------------------------------------------------------------------
+
#include <proxmark3.h>
#define min(a, b) (((a) > (b)) ? (b) : (a))
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// GPIO pin mapping for the Proxmark3
+//-----------------------------------------------------------------------------
+
#ifndef __CONFIG_GPIO_H
#define __CONFIG_GPIO_H
-/*
- * crc.h
- *
- * Generic CRC calculation code.
- *
- */
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Generic CRC calculation code.
+//-----------------------------------------------------------------------------
#ifndef __CRC_H
#define __CRC_H
+//-----------------------------------------------------------------------------
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// LEFIC's obfuscation function
+//-----------------------------------------------------------------------------
+
#ifndef __LEGIC_PRNG_H
#define __LEGIC_PRNG_H
//-----------------------------------------------------------------------------
-// Definitions of interest to most of the software for this project.
// Jonathan Westhues, Mar 2006
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Hardware and interface definitions
//-----------------------------------------------------------------------------
#ifndef __PROXMARK3_H
//-----------------------------------------------------------------------------
-// Definitions for all the types of commands that may be sent over USB; our
-// own protocol.
// Jonathan Westhues, Mar 2006
// Edits by Gerhard de Koning Gans, Sep 2007
+//
+// This code is licensed to you under the terms of the GNU GPL, version 2 or,
+// at your option, any later version. See the LICENSE.txt file for the text of
+// the license.
+//-----------------------------------------------------------------------------
+// Definitions for all the types of commands that may be sent over USB; our
+// own protocol.
//-----------------------------------------------------------------------------
#ifndef __USB_CMD_H