]> git.zerfleddert.de Git - proxmark3-svn/blob - armsrc/apps.h
Make the bootrom correctly nack in case of flash write error (e.g. due to lock bits)
[proxmark3-svn] / armsrc / apps.h
1 //-----------------------------------------------------------------------------
2 // Definitions internal to the app source.
3 // Jonathan Westhues, Aug 2005
4 // Added ISO14443-A support by Gerhard de Koning Gans, April 2008
5 //-----------------------------------------------------------------------------
6
7 #ifndef __APPS_H
8 #define __APPS_H
9
10 #include "stdint.h"
11 #include "stddef.h"
12 typedef unsigned char byte_t;
13
14 // The large multi-purpose buffer, typically used to hold A/D samples,
15 // maybe processed in some way.
16 DWORD BigBuf[12000];
17
18 /// appmain.h
19 void ReadMem(int addr);
20 void __attribute__((noreturn)) AppMain(void);
21 void SamyRun(void);
22 void DbpIntegers(int a, int b, int c);
23 void DbpString(char *str);
24 void ToSendStuffBit(int b);
25 void ToSendReset(void);
26 void ListenReaderField(int limit);
27 void AcquireRawAdcSamples125k(BOOL at134khz);
28 void DoAcquisition125k(void);
29 extern int ToSendMax;
30 extern BYTE ToSend[];
31 extern DWORD BigBuf[];
32
33 /// fpga.h
34 void FpgaSendCommand(WORD cmd, WORD v);
35 void FpgaWriteConfWord(BYTE v);
36 void FpgaDownloadAndGo(void);
37 void FpgaGatherVersion(char *dst, int len);
38 void FpgaSetupSsc(void);
39 void SetupSpi(int mode);
40 void FpgaSetupSscDma(BYTE *buf, int len);
41 void SetAdcMuxFor(DWORD whichGpio);
42
43 // Definitions for the FPGA commands.
44 #define FPGA_CMD_SET_CONFREG (1<<12)
45 #define FPGA_CMD_SET_DIVISOR (2<<12)
46 // Definitions for the FPGA configuration word.
47 #define FPGA_MAJOR_MODE_LF_READER (0<<5)
48 #define FPGA_MAJOR_MODE_LF_SIMULATOR (1<<5)
49 #define FPGA_MAJOR_MODE_HF_READER_TX (2<<5)
50 #define FPGA_MAJOR_MODE_HF_READER_RX_XCORR (3<<5)
51 #define FPGA_MAJOR_MODE_HF_SIMULATOR (4<<5)
52 #define FPGA_MAJOR_MODE_HF_ISO14443A (5<<5)
53 #define FPGA_MAJOR_MODE_LF_PASSTHRU (6<<5)
54 #define FPGA_MAJOR_MODE_OFF (7<<5)
55 // Options for the HF reader, tx to tag
56 #define FPGA_HF_READER_TX_SHALLOW_MOD (1<<0)
57 // Options for the HF reader, correlating against rx from tag
58 #define FPGA_HF_READER_RX_XCORR_848_KHZ (1<<0)
59 #define FPGA_HF_READER_RX_XCORR_SNOOP (1<<1)
60 #define FPGA_HF_READER_RX_XCORR_QUARTER_FREQ (1<<2)
61 // Options for the HF simulated tag, how to modulate
62 #define FPGA_HF_SIMULATOR_NO_MODULATION (0<<0)
63 #define FPGA_HF_SIMULATOR_MODULATE_BPSK (1<<0)
64 #define FPGA_HF_SIMULATOR_MODULATE_212K (2<<0)
65 // Options for ISO14443A
66 #define FPGA_HF_ISO14443A_SNIFFER (0<<0)
67 #define FPGA_HF_ISO14443A_TAGSIM_LISTEN (1<<0)
68 #define FPGA_HF_ISO14443A_TAGSIM_MOD (2<<0)
69 #define FPGA_HF_ISO14443A_READER_LISTEN (3<<0)
70 #define FPGA_HF_ISO14443A_READER_MOD (4<<0)
71
72 /// lfops.h
73 void AcquireRawAdcSamples125k(BOOL at134khz);
74 void ModThenAcquireRawAdcSamples125k(int delay_off,int period_0,int period_1,BYTE *command);
75 void ReadTItag(void);
76 void WriteTItag(DWORD idhi, DWORD idlo, WORD crc);
77 void AcquireTiType(void);
78 void AcquireRawBitsTI(void);
79 void SimulateTagLowFrequency(int period, int ledcontrol);
80 void CmdHIDsimTAG(int hi, int lo, int ledcontrol);
81 void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol);
82 void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen);
83
84 /// iso14443.h
85 void SimulateIso14443Tag(void);
86 void AcquireRawAdcSamplesIso14443(DWORD parameter);
87 void ReadSRI512Iso14443(DWORD parameter);
88 void ReadSRIX4KIso14443(DWORD parameter);
89 void ReadSTMemoryIso14443(DWORD parameter,DWORD dwLast);
90 void SnoopIso14443(void);
91
92 /// iso14443a.h
93 void SnoopIso14443a(void);
94 void SimulateIso14443aTag(int tagType, int TagUid); // ## simulate iso14443a tag
95 void ReaderIso14443a(DWORD parameter);
96 void ReaderMifare(DWORD parameter);
97
98 /// iso15693.h
99 void AcquireRawAdcSamplesIso15693(void);
100 void ReaderIso15693(DWORD parameter); // Simulate an ISO15693 reader - greg
101 void SimTagIso15693(DWORD parameter); // simulate an ISO15693 tag - greg
102
103 /// util.h
104 #define LED_RED 1
105 #define LED_ORANGE 2
106 #define LED_GREEN 4
107 #define LED_RED2 8
108 #define BUTTON_HOLD 1
109 #define BUTTON_NO_CLICK 0
110 #define BUTTON_SINGLE_CLICK -1
111 #define BUTTON_DOUBLE_CLICK -2
112 #define BUTTON_ERROR -99
113 int strlen(char *str);
114 void *memcpy(void *dest, const void *src, int len);
115 void *memset(void *dest, int c, int len);
116 int memcmp(const void *av, const void *bv, int len);
117 char *strncat(char *dest, const char *src, unsigned int n);
118 void num_to_bytes(uint64_t n, size_t len, byte_t* dest);
119 uint64_t bytes_to_num(byte_t* src, size_t len);
120
121 void SpinDelay(int ms);
122 void SpinDelayUs(int us);
123 void LED(int led, int ms);
124 void LEDsoff();
125 int BUTTON_CLICKED(int ms);
126 int BUTTON_HELD(int ms);
127 void FormatVersionInformation(char *dst, int len, const char *prefix, void *version_information);
128
129 #endif
Impressum, Datenschutz