]>
Commit | Line | Data |
---|---|---|
15c4dc5a | 1 | //----------------------------------------------------------------------------- |
15c4dc5a | 2 | // Jonathan Westhues, Aug 2005 |
bd20f8f4 | 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. | |
15c4dc5a | 10 | //----------------------------------------------------------------------------- |
11 | ||
12 | #ifndef __APPS_H | |
13 | #define __APPS_H | |
14 | ||
f7e3ed82 | 15 | #include <stdint.h> |
16 | #include <stddef.h> | |
15c4dc5a | 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. | |
f7e3ed82 | 21 | uint32_t BigBuf[8000]; |
15c4dc5a | 22 | |
23 | /// appmain.h | |
24 | void ReadMem(int addr); | |
25 | void __attribute__((noreturn)) AppMain(void); | |
26 | void SamyRun(void); | |
27 | //void DbpIntegers(int a, int b, int c); | |
28 | void DbpString(char *str); | |
29 | void Dbprintf(const char *fmt, ...); | |
30 | ||
31 | void ToSendStuffBit(int b); | |
32 | void ToSendReset(void); | |
33 | void ListenReaderField(int limit); | |
f7e3ed82 | 34 | void AcquireRawAdcSamples125k(int at134khz); |
15c4dc5a | 35 | void DoAcquisition125k(void); |
36 | extern int ToSendMax; | |
f7e3ed82 | 37 | extern uint8_t ToSend[]; |
38 | extern uint32_t BigBuf[]; | |
15c4dc5a | 39 | |
40 | /// fpga.h | |
f7e3ed82 | 41 | void FpgaSendCommand(uint16_t cmd, uint16_t v); |
42 | void FpgaWriteConfWord(uint8_t v); | |
15c4dc5a | 43 | void FpgaDownloadAndGo(void); |
44 | void FpgaGatherVersion(char *dst, int len); | |
45 | void FpgaSetupSsc(void); | |
46 | void SetupSpi(int mode); | |
f7e3ed82 | 47 | void FpgaSetupSscDma(uint8_t *buf, int len); |
48 | void SetAdcMuxFor(uint32_t whichGpio); | |
15c4dc5a | 49 | |
50 | // Definitions for the FPGA commands. | |
51 | #define FPGA_CMD_SET_CONFREG (1<<12) | |
52 | #define FPGA_CMD_SET_DIVISOR (2<<12) | |
53 | // Definitions for the FPGA configuration word. | |
54 | #define FPGA_MAJOR_MODE_LF_READER (0<<5) | |
55 | #define FPGA_MAJOR_MODE_LF_SIMULATOR (1<<5) | |
56 | #define FPGA_MAJOR_MODE_HF_READER_TX (2<<5) | |
57 | #define FPGA_MAJOR_MODE_HF_READER_RX_XCORR (3<<5) | |
58 | #define FPGA_MAJOR_MODE_HF_SIMULATOR (4<<5) | |
59 | #define FPGA_MAJOR_MODE_HF_ISO14443A (5<<5) | |
60 | #define FPGA_MAJOR_MODE_LF_PASSTHRU (6<<5) | |
61 | #define FPGA_MAJOR_MODE_OFF (7<<5) | |
62 | // Options for the HF reader, tx to tag | |
63 | #define FPGA_HF_READER_TX_SHALLOW_MOD (1<<0) | |
64 | // Options for the HF reader, correlating against rx from tag | |
65 | #define FPGA_HF_READER_RX_XCORR_848_KHZ (1<<0) | |
66 | #define FPGA_HF_READER_RX_XCORR_SNOOP (1<<1) | |
67 | #define FPGA_HF_READER_RX_XCORR_QUARTER_FREQ (1<<2) | |
68 | // Options for the HF simulated tag, how to modulate | |
69 | #define FPGA_HF_SIMULATOR_NO_MODULATION (0<<0) | |
70 | #define FPGA_HF_SIMULATOR_MODULATE_BPSK (1<<0) | |
71 | #define FPGA_HF_SIMULATOR_MODULATE_212K (2<<0) | |
72 | // Options for ISO14443A | |
73 | #define FPGA_HF_ISO14443A_SNIFFER (0<<0) | |
74 | #define FPGA_HF_ISO14443A_TAGSIM_LISTEN (1<<0) | |
75 | #define FPGA_HF_ISO14443A_TAGSIM_MOD (2<<0) | |
76 | #define FPGA_HF_ISO14443A_READER_LISTEN (3<<0) | |
77 | #define FPGA_HF_ISO14443A_READER_MOD (4<<0) | |
78 | ||
79 | /// lfops.h | |
f7e3ed82 | 80 | void AcquireRawAdcSamples125k(int at134khz); |
81 | void ModThenAcquireRawAdcSamples125k(int delay_off,int period_0,int period_1,uint8_t *command); | |
15c4dc5a | 82 | void ReadTItag(void); |
f7e3ed82 | 83 | void WriteTItag(uint32_t idhi, uint32_t idlo, uint16_t crc); |
15c4dc5a | 84 | void AcquireTiType(void); |
85 | void AcquireRawBitsTI(void); | |
86 | void SimulateTagLowFrequency(int period, int gap, int ledcontrol); | |
87 | void CmdHIDsimTAG(int hi, int lo, int ledcontrol); | |
88 | void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol); | |
89 | void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen); | |
90 | ||
91 | /// iso14443.h | |
92 | void SimulateIso14443Tag(void); | |
f7e3ed82 | 93 | void AcquireRawAdcSamplesIso14443(uint32_t parameter); |
94 | void ReadSRI512Iso14443(uint32_t parameter); | |
95 | void ReadSRIX4KIso14443(uint32_t parameter); | |
96 | void ReadSTMemoryIso14443(uint32_t parameter,uint32_t dwLast); | |
15c4dc5a | 97 | void SnoopIso14443(void); |
98 | ||
99 | /// iso14443a.h | |
100 | void SnoopIso14443a(void); | |
101 | void SimulateIso14443aTag(int tagType, int TagUid); // ## simulate iso14443a tag | |
f7e3ed82 | 102 | void ReaderIso14443a(uint32_t parameter); |
103 | void ReaderMifare(uint32_t parameter); | |
15c4dc5a | 104 | |
105 | /// iso15693.h | |
106 | void AcquireRawAdcSamplesIso15693(void); | |
f7e3ed82 | 107 | void ReaderIso15693(uint32_t parameter); // Simulate an ISO15693 reader - greg |
108 | void SimTagIso15693(uint32_t parameter); // simulate an ISO15693 tag - greg | |
15c4dc5a | 109 | |
110 | /// util.h | |
15c4dc5a | 111 | |
112 | #endif |