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