]> git.zerfleddert.de Git - proxmark3-svn/blame_incremental - armsrc/apps.h
replaced string.find with str.find in findbits.search()
[proxmark3-svn] / armsrc / apps.h
... / ...
CommitLineData
1//-----------------------------------------------------------------------------
2// Jonathan Westhues, Aug 2005
3// Gerhard de Koning Gans, April 2008, May 2011
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.
10//-----------------------------------------------------------------------------
11
12#ifndef __APPS_H
13#define __APPS_H
14
15#include <stdint.h>
16#include <stddef.h>
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.
21uint32_t BigBuf[8000];
22
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
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, ...);
34void Dbhexdump(int len, uint8_t *d);
35
36int AvgAdc(int ch);
37
38void ToSendStuffBit(int b);
39void ToSendReset(void);
40void ListenReaderField(int limit);
41void AcquireRawAdcSamples125k(int at134khz);
42void DoAcquisition125k(void);
43extern int ToSendMax;
44extern uint8_t ToSend[];
45extern uint32_t BigBuf[];
46
47/// fpga.h
48void FpgaSendCommand(uint16_t cmd, uint16_t v);
49void FpgaWriteConfWord(uint8_t v);
50void FpgaDownloadAndGo(void);
51void FpgaGatherVersion(char *dst, int len);
52void FpgaSetupSsc(void);
53void SetupSpi(int mode);
54void FpgaSetupSscDma(uint8_t *buf, int len);
55void SetAdcMuxFor(uint32_t whichGpio);
56
57// Definitions for the FPGA commands.
58#define FPGA_CMD_SET_CONFREG (1<<12)
59#define FPGA_CMD_SET_DIVISOR (2<<12)
60// Definitions for the FPGA configuration word.
61#define FPGA_MAJOR_MODE_LF_READER (0<<5)
62#define FPGA_MAJOR_MODE_LF_SIMULATOR (1<<5)
63#define FPGA_MAJOR_MODE_HF_READER_TX (2<<5)
64#define FPGA_MAJOR_MODE_HF_READER_RX_XCORR (3<<5)
65#define FPGA_MAJOR_MODE_HF_SIMULATOR (4<<5)
66#define FPGA_MAJOR_MODE_HF_ISO14443A (5<<5)
67#define FPGA_MAJOR_MODE_LF_PASSTHRU (6<<5)
68#define FPGA_MAJOR_MODE_OFF (7<<5)
69// Options for the HF reader, tx to tag
70#define FPGA_HF_READER_TX_SHALLOW_MOD (1<<0)
71// Options for the HF reader, correlating against rx from tag
72#define FPGA_HF_READER_RX_XCORR_848_KHZ (1<<0)
73#define FPGA_HF_READER_RX_XCORR_SNOOP (1<<1)
74#define FPGA_HF_READER_RX_XCORR_QUARTER_FREQ (1<<2)
75// Options for the HF simulated tag, how to modulate
76#define FPGA_HF_SIMULATOR_NO_MODULATION (0<<0)
77#define FPGA_HF_SIMULATOR_MODULATE_BPSK (1<<0)
78#define FPGA_HF_SIMULATOR_MODULATE_212K (2<<0)
79// Options for ISO14443A
80#define FPGA_HF_ISO14443A_SNIFFER (0<<0)
81#define FPGA_HF_ISO14443A_TAGSIM_LISTEN (1<<0)
82#define FPGA_HF_ISO14443A_TAGSIM_MOD (2<<0)
83#define FPGA_HF_ISO14443A_READER_LISTEN (3<<0)
84#define FPGA_HF_ISO14443A_READER_MOD (4<<0)
85
86/// lfops.h
87void AcquireRawAdcSamples125k(int at134khz);
88void ModThenAcquireRawAdcSamples125k(int delay_off,int period_0,int period_1,uint8_t *command);
89void ReadTItag(void);
90void WriteTItag(uint32_t idhi, uint32_t idlo, uint16_t crc);
91void AcquireTiType(void);
92void AcquireRawBitsTI(void);
93void SimulateTagLowFrequency(int period, int gap, int ledcontrol);
94void CmdHIDsimTAG(int hi, int lo, int ledcontrol);
95void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol);
96void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen);
97void CopyHIDtoT5567(int hi, int lo); // Clone an HID card to T5557/T5567
98void WriteEM410x(uint32_t card, uint32_t id_hi, uint32_t id_lo);
99
100/// iso14443.h
101void SimulateIso14443Tag(void);
102void AcquireRawAdcSamplesIso14443(uint32_t parameter);
103void ReadSRI512Iso14443(uint32_t parameter);
104void ReadSRIX4KIso14443(uint32_t parameter);
105void ReadSTMemoryIso14443(uint32_t parameter,uint32_t dwLast);
106void RAMFUNC SnoopIso14443(void);
107
108/// iso14443a.h
109void RAMFUNC SnoopIso14443a(void);
110void SimulateIso14443aTag(int tagType, int TagUid); // ## simulate iso14443a tag
111void ReaderIso14443a(UsbCommand * c, UsbCommand * ack);
112
113// mifarecmd.h
114void ReaderMifare(uint32_t parameter);
115void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *data);
116void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
117void MifareWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
118void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
119void MifareChkKeys(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
120void Mifare1ksim(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
121void MifareSetDbgLvl(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
122void MifareEMemClr(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
123void MifareEMemSet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
124void MifareEMemGet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
125void MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
126
127/// iso15693.h
128void RecordRawAdcSamplesIso15693(void);
129void AcquireRawAdcSamplesIso15693(void);
130void ReaderIso15693(uint32_t parameter); // Simulate an ISO15693 reader - greg
131void SimTagIso15693(uint32_t parameter); // simulate an ISO15693 tag - greg
132void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag - atrox
133void DirectTag15693Command(uint32_t datalen,uint32_t speed, uint32_t recv, uint8_t data[]); // send arbitrary commands from CLI - atrox
134void SetDebugIso15693(uint32_t flag);
135
136/// iclass.h
137void RAMFUNC SnoopIClass(void);
138
139/// util.h
140
141#endif
Impressum, Datenschutz