]>
Commit | Line | Data |
---|---|---|
1 | #ifndef __LFSAMPLING_H | |
2 | #define __LFSAMPLING_H | |
3 | ||
4 | #include "proxmark3.h" | |
5 | #include "apps.h" | |
6 | #include "util.h" | |
7 | #include "string.h" | |
8 | #include "usb_cdc.h" // for usb_poll_validate_length | |
9 | #include "ticks.h" // for StartTicks | |
10 | ||
11 | typedef struct BitstreamOut BitstreamOut; | |
12 | ||
13 | /** | |
14 | * acquisition of Cotag LF signal. Similar to other LF, since the Cotag has such long datarate RF/384 | |
15 | * and is Manchester?, we directly gather the manchester data into bigbuff | |
16 | **/ | |
17 | void doCotagAcquisition(size_t sample_size); | |
18 | uint32_t doCotagAcquisitionManchester(void); | |
19 | ||
20 | /** | |
21 | * acquisition of T55x7 LF signal. Similar to other LF, but adjusted with @marshmellows thresholds | |
22 | * the data is collected in BigBuf. | |
23 | **/ | |
24 | void doT55x7Acquisition(size_t sample_size); | |
25 | ||
26 | /** | |
27 | * Initializes the FPGA for reader-mode (field on), and acquires the samples. | |
28 | * @return number of bits sampled | |
29 | **/ | |
30 | uint32_t SampleLF(bool silent); | |
31 | ||
32 | /** | |
33 | * Initializes the FPGA for snoop-mode (field off), and acquires the samples. | |
34 | * @return number of bits sampled | |
35 | **/ | |
36 | ||
37 | uint32_t SnoopLF(); | |
38 | ||
39 | /** | |
40 | * @brief Does sample acquisition, ignoring the config values set in the sample_config. | |
41 | * This method is typically used by tag-specific readers who just wants to read the samples | |
42 | * the normal way | |
43 | * @param trigger_threshold | |
44 | * @param silent | |
45 | * @return number of bits sampled | |
46 | */ | |
47 | uint32_t DoAcquisition_default(int trigger_threshold, bool silent); | |
48 | /** | |
49 | * @brief Does sample acquisition, using the config values set in the sample_config. | |
50 | * @param trigger_threshold | |
51 | * @param silent | |
52 | * @return number of bits sampled | |
53 | */ | |
54 | ||
55 | uint32_t DoAcquisition_config( bool silent); | |
56 | ||
57 | /** | |
58 | * Setup the FPGA to listen for samples. This method downloads the FPGA bitstream | |
59 | * if not already loaded, sets divisor and starts up the antenna. | |
60 | * @param divisor : 1, 88> 255 or negative ==> 134.8 KHz | |
61 | * 0 or 95 ==> 125 KHz | |
62 | * | |
63 | **/ | |
64 | void LFSetupFPGAForADC(int divisor, bool lf_field); | |
65 | ||
66 | /** | |
67 | * Called from the USB-handler to set the sampling configuration | |
68 | * The sampling config is used for std reading and snooping. | |
69 | * | |
70 | * Other functions may read samples and ignore the sampling config, | |
71 | * such as functions to read the UID from a prox tag or similar. | |
72 | * | |
73 | * Values set to '0' implies no change (except for averaging) | |
74 | * @brief setSamplingConfig | |
75 | * @param sc | |
76 | */ | |
77 | void setSamplingConfig(sample_config *sc); | |
78 | ||
79 | sample_config * getSamplingConfig(); | |
80 | ||
81 | void printConfig(); | |
82 | ||
83 | ||
84 | #endif // __LFSAMPLING_H |