]> cvs.zerfleddert.de Git - proxmark3-svn/blob - armsrc/apps.h
5ecd1753c8cf8a2c390456c23b41a4e3ae4c0f33
[proxmark3-svn] / armsrc / apps.h
1 //-----------------------------------------------------------------------------
2 // Jonathan Westhues, Aug 2005
3 // Gerhard de Koning Gans, April 2008
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>
17 typedef unsigned char byte_t;
18
19 // The large multi-purpose buffer, typically used to hold A/D samples,
20 // maybe processed in some way.
21 uint32_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
28 void ReadMem(int addr);
29 void __attribute__((noreturn)) AppMain(void);
30 void SamyRun(void);
31 //void DbpIntegers(int a, int b, int c);
32 void DbpString(char *str);
33 void Dbprintf(const char *fmt, ...);
34
35 void ToSendStuffBit(int b);
36 void ToSendReset(void);
37 void ListenReaderField(int limit);
38 void AcquireRawAdcSamples125k(int at134khz);
39 void DoAcquisition125k(void);
40 extern int ToSendMax;
41 extern uint8_t ToSend[];
42 extern uint32_t BigBuf[];
43
44 /// fpga.h
45 void FpgaSendCommand(uint16_t cmd, uint16_t v);
46 void FpgaWriteConfWord(uint8_t v);
47 void FpgaDownloadAndGo(void);
48 void FpgaGatherVersion(char *dst, int len);
49 void FpgaSetupSsc(void);
50 void SetupSpi(int mode);
51 void FpgaSetupSscDma(uint8_t *buf, int len);
52 void SetAdcMuxFor(uint32_t whichGpio);
53
54 // Definitions for the FPGA commands.
55 #define FPGA_CMD_SET_CONFREG (1<<12)
56 #define FPGA_CMD_SET_DIVISOR (2<<12)
57 // Definitions for the FPGA configuration word.
58 #define FPGA_MAJOR_MODE_LF_READER (0<<5)
59 #define FPGA_MAJOR_MODE_LF_SIMULATOR (1<<5)
60 #define FPGA_MAJOR_MODE_HF_READER_TX (2<<5)
61 #define FPGA_MAJOR_MODE_HF_READER_RX_XCORR (3<<5)
62 #define FPGA_MAJOR_MODE_HF_SIMULATOR (4<<5)
63 #define FPGA_MAJOR_MODE_HF_ISO14443A (5<<5)
64 #define FPGA_MAJOR_MODE_LF_PASSTHRU (6<<5)
65 #define FPGA_MAJOR_MODE_OFF (7<<5)
66 // Options for the HF reader, tx to tag
67 #define FPGA_HF_READER_TX_SHALLOW_MOD (1<<0)
68 // Options for the HF reader, correlating against rx from tag
69 #define FPGA_HF_READER_RX_XCORR_848_KHZ (1<<0)
70 #define FPGA_HF_READER_RX_XCORR_SNOOP (1<<1)
71 #define FPGA_HF_READER_RX_XCORR_QUARTER_FREQ (1<<2)
72 // Options for the HF simulated tag, how to modulate
73 #define FPGA_HF_SIMULATOR_NO_MODULATION (0<<0)
74 #define FPGA_HF_SIMULATOR_MODULATE_BPSK (1<<0)
75 #define FPGA_HF_SIMULATOR_MODULATE_212K (2<<0)
76 // Options for ISO14443A
77 #define FPGA_HF_ISO14443A_SNIFFER (0<<0)
78 #define FPGA_HF_ISO14443A_TAGSIM_LISTEN (1<<0)
79 #define FPGA_HF_ISO14443A_TAGSIM_MOD (2<<0)
80 #define FPGA_HF_ISO14443A_READER_LISTEN (3<<0)
81 #define FPGA_HF_ISO14443A_READER_MOD (4<<0)
82
83 /// lfops.h
84 void AcquireRawAdcSamples125k(int at134khz);
85 void ModThenAcquireRawAdcSamples125k(int delay_off,int period_0,int period_1,uint8_t *command);
86 void ReadTItag(void);
87 void WriteTItag(uint32_t idhi, uint32_t idlo, uint16_t crc);
88 void AcquireTiType(void);
89 void AcquireRawBitsTI(void);
90 void SimulateTagLowFrequency(int period, int gap, int ledcontrol);
91 void CmdHIDsimTAG(int hi, int lo, int ledcontrol);
92 void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol);
93 void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen);
94
95 /// iso14443.h
96 void SimulateIso14443Tag(void);
97 void AcquireRawAdcSamplesIso14443(uint32_t parameter);
98 void ReadSRI512Iso14443(uint32_t parameter);
99 void ReadSRIX4KIso14443(uint32_t parameter);
100 void ReadSTMemoryIso14443(uint32_t parameter,uint32_t dwLast);
101 void SnoopIso14443(void);
102
103 /// iso14443a.h
104 void RAMFUNC SnoopIso14443a(void);
105 void SimulateIso14443aTag(int tagType, int TagUid); // ## simulate iso14443a tag
106 void ReaderIso14443a(UsbCommand * c, UsbCommand * ack);
107 void ReaderMifare(uint32_t parameter);
108
109 /// iso15693.h
110 void AcquireRawAdcSamplesIso15693(void);
111 void ReaderIso15693(uint32_t parameter); // Simulate an ISO15693 reader - greg
112 void SimTagIso15693(uint32_t parameter); // simulate an ISO15693 tag - greg
113
114 /// util.h
115
116 #endif
Impressum, Datenschutz