Added iClass eavesdrop support for Proxmark3
[proxmark3-svn] / armsrc / apps.h
CommitLineData
15c4dc5a 1//-----------------------------------------------------------------------------
15c4dc5a 2// Jonathan Westhues, Aug 2005
cee5a30d 3// Gerhard de Koning Gans, April 2008, May 2011
bd20f8f4 4//
5// This code is licensed to you under the terms of the GNU GPL, version 2 or,
6// at your option, any later version. See the LICENSE.txt file for the text of
7// the license.
8//-----------------------------------------------------------------------------
9// Definitions internal to the app source.
15c4dc5a 10//-----------------------------------------------------------------------------
11
12#ifndef __APPS_H
13#define __APPS_H
14
f7e3ed82 15#include <stdint.h>
16#include <stddef.h>
15c4dc5a 17typedef unsigned char byte_t;
18
19// The large multi-purpose buffer, typically used to hold A/D samples,
20// maybe processed in some way.
f7e3ed82 21uint32_t BigBuf[8000];
15c4dc5a 22
6c1e2d95 23// This may be used (sparingly) to declare a function to be copied to
24// and executed from RAM
25#define RAMFUNC __attribute((long_call, section(".ramfunc")))
26
15c4dc5a 27/// appmain.h
28void ReadMem(int addr);
29void __attribute__((noreturn)) AppMain(void);
30void SamyRun(void);
31//void DbpIntegers(int a, int b, int c);
32void DbpString(char *str);
33void Dbprintf(const char *fmt, ...);
9455b51c 34void Dbhexdump(int len, uint8_t *d);
15c4dc5a 35
36void ToSendStuffBit(int b);
37void ToSendReset(void);
38void ListenReaderField(int limit);
f7e3ed82 39void AcquireRawAdcSamples125k(int at134khz);
15c4dc5a 40void DoAcquisition125k(void);
41extern int ToSendMax;
f7e3ed82 42extern uint8_t ToSend[];
43extern uint32_t BigBuf[];
15c4dc5a 44
45/// fpga.h
f7e3ed82 46void FpgaSendCommand(uint16_t cmd, uint16_t v);
47void FpgaWriteConfWord(uint8_t v);
15c4dc5a 48void FpgaDownloadAndGo(void);
49void FpgaGatherVersion(char *dst, int len);
50void FpgaSetupSsc(void);
51void SetupSpi(int mode);
f7e3ed82 52void FpgaSetupSscDma(uint8_t *buf, int len);
53void SetAdcMuxFor(uint32_t whichGpio);
15c4dc5a 54
55// Definitions for the FPGA commands.
56#define FPGA_CMD_SET_CONFREG (1<<12)
57#define FPGA_CMD_SET_DIVISOR (2<<12)
58// Definitions for the FPGA configuration word.
59#define FPGA_MAJOR_MODE_LF_READER (0<<5)
60#define FPGA_MAJOR_MODE_LF_SIMULATOR (1<<5)
61#define FPGA_MAJOR_MODE_HF_READER_TX (2<<5)
62#define FPGA_MAJOR_MODE_HF_READER_RX_XCORR (3<<5)
63#define FPGA_MAJOR_MODE_HF_SIMULATOR (4<<5)
64#define FPGA_MAJOR_MODE_HF_ISO14443A (5<<5)
65#define FPGA_MAJOR_MODE_LF_PASSTHRU (6<<5)
66#define FPGA_MAJOR_MODE_OFF (7<<5)
67// Options for the HF reader, tx to tag
68#define FPGA_HF_READER_TX_SHALLOW_MOD (1<<0)
69// Options for the HF reader, correlating against rx from tag
70#define FPGA_HF_READER_RX_XCORR_848_KHZ (1<<0)
71#define FPGA_HF_READER_RX_XCORR_SNOOP (1<<1)
72#define FPGA_HF_READER_RX_XCORR_QUARTER_FREQ (1<<2)
73// Options for the HF simulated tag, how to modulate
74#define FPGA_HF_SIMULATOR_NO_MODULATION (0<<0)
75#define FPGA_HF_SIMULATOR_MODULATE_BPSK (1<<0)
76#define FPGA_HF_SIMULATOR_MODULATE_212K (2<<0)
77// Options for ISO14443A
78#define FPGA_HF_ISO14443A_SNIFFER (0<<0)
79#define FPGA_HF_ISO14443A_TAGSIM_LISTEN (1<<0)
80#define FPGA_HF_ISO14443A_TAGSIM_MOD (2<<0)
81#define FPGA_HF_ISO14443A_READER_LISTEN (3<<0)
82#define FPGA_HF_ISO14443A_READER_MOD (4<<0)
83
84/// lfops.h
f7e3ed82 85void AcquireRawAdcSamples125k(int at134khz);
86void ModThenAcquireRawAdcSamples125k(int delay_off,int period_0,int period_1,uint8_t *command);
15c4dc5a 87void ReadTItag(void);
f7e3ed82 88void WriteTItag(uint32_t idhi, uint32_t idlo, uint16_t crc);
15c4dc5a 89void AcquireTiType(void);
90void AcquireRawBitsTI(void);
91void SimulateTagLowFrequency(int period, int gap, int ledcontrol);
92void CmdHIDsimTAG(int hi, int lo, int ledcontrol);
93void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol);
94void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen);
95
96/// iso14443.h
97void SimulateIso14443Tag(void);
f7e3ed82 98void AcquireRawAdcSamplesIso14443(uint32_t parameter);
99void ReadSRI512Iso14443(uint32_t parameter);
100void ReadSRIX4KIso14443(uint32_t parameter);
101void ReadSTMemoryIso14443(uint32_t parameter,uint32_t dwLast);
15c4dc5a 102void SnoopIso14443(void);
103
104/// iso14443a.h
6c1e2d95 105void RAMFUNC SnoopIso14443a(void);
15c4dc5a 106void SimulateIso14443aTag(int tagType, int TagUid); // ## simulate iso14443a tag
534983d7 107void ReaderIso14443a(UsbCommand * c, UsbCommand * ack);
f7e3ed82 108void ReaderMifare(uint32_t parameter);
15c4dc5a 109
110/// iso15693.h
9455b51c 111void RecordRawAdcSamplesIso15693(void);
15c4dc5a 112void AcquireRawAdcSamplesIso15693(void);
f7e3ed82 113void ReaderIso15693(uint32_t parameter); // Simulate an ISO15693 reader - greg
114void SimTagIso15693(uint32_t parameter); // simulate an ISO15693 tag - greg
9455b51c 115void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag - atrox
116void DirectTag15693Command(uint32_t datalen,uint32_t speed, uint32_t recv, uint8_t data[]); // send arbitrary commands from CLI - atrox
117void SetDebugIso15693(uint32_t flag);
15c4dc5a 118
cee5a30d 119/// iclass.h
120void RAMFUNC SnoopIClass(void);
121
15c4dc5a 122/// util.h
15c4dc5a 123
124#endif
Impressum, Datenschutz