2017-01-25 07:33:03 +08:00
|
|
|
#ifndef __LFSAMPLING_H
|
|
|
|
#define __LFSAMPLING_H
|
2015-01-31 06:03:44 +08:00
|
|
|
|
2019-08-08 22:57:33 +08:00
|
|
|
#include "common.h"
|
|
|
|
#include "pm3_cmd.h"
|
2016-09-23 22:35:26 +08:00
|
|
|
|
2017-01-25 07:33:03 +08:00
|
|
|
typedef struct BitstreamOut BitstreamOut;
|
|
|
|
|
2015-10-15 16:23:15 +08:00
|
|
|
/**
|
2017-02-02 22:32:21 +08:00
|
|
|
* acquisition of Cotag LF signal. Similar to other LF, since the Cotag has such long datarate RF/384
|
|
|
|
* and is Manchester?, we directly gather the manchester data into bigbuff
|
|
|
|
**/
|
|
|
|
void doCotagAcquisition(size_t sample_size);
|
|
|
|
uint32_t doCotagAcquisitionManchester(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* acquisition of T55x7 LF signal. Similar to other LF, but adjusted with @marshmellows thresholds
|
2015-10-15 16:23:15 +08:00
|
|
|
* the data is collected in BigBuf.
|
|
|
|
**/
|
2015-11-03 03:46:17 +08:00
|
|
|
void doT55x7Acquisition(size_t sample_size);
|
2015-10-15 16:23:15 +08:00
|
|
|
|
2015-01-31 06:03:44 +08:00
|
|
|
/**
|
|
|
|
* Initializes the FPGA for reader-mode (field on), and acquires the samples.
|
|
|
|
* @return number of bits sampled
|
|
|
|
**/
|
2017-07-30 15:17:48 +08:00
|
|
|
uint32_t SampleLF(bool silent, int sample_size);
|
2015-01-31 06:03:44 +08:00
|
|
|
|
|
|
|
/**
|
2019-03-12 20:15:39 +08:00
|
|
|
* Initializes the FPGA for sniff-mode (field off), and acquires the samples.
|
2015-01-31 06:03:44 +08:00
|
|
|
* @return number of bits sampled
|
|
|
|
**/
|
2019-03-12 20:15:39 +08:00
|
|
|
uint32_t SniffLF();
|
2015-01-31 06:03:44 +08:00
|
|
|
|
2017-02-24 22:45:24 +08:00
|
|
|
// adds sample size to default options
|
2018-02-28 14:59:41 +08:00
|
|
|
uint32_t DoPartialAcquisition(int trigger_threshold, bool silent, int sample_size, uint32_t cancel_after);
|
2017-02-24 22:45:24 +08:00
|
|
|
|
2015-01-31 06:03:44 +08:00
|
|
|
/**
|
|
|
|
* @brief Does sample acquisition, ignoring the config values set in the sample_config.
|
|
|
|
* This method is typically used by tag-specific readers who just wants to read the samples
|
|
|
|
* the normal way
|
|
|
|
* @param trigger_threshold
|
|
|
|
* @param silent
|
|
|
|
* @return number of bits sampled
|
|
|
|
*/
|
|
|
|
uint32_t DoAcquisition_default(int trigger_threshold, bool silent);
|
|
|
|
/**
|
|
|
|
* @brief Does sample acquisition, using the config values set in the sample_config.
|
|
|
|
* @param trigger_threshold
|
|
|
|
* @param silent
|
|
|
|
* @return number of bits sampled
|
|
|
|
*/
|
|
|
|
|
2017-07-30 15:17:48 +08:00
|
|
|
uint32_t DoAcquisition_config(bool silent, int sample_size);
|
2015-01-31 06:03:44 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Setup the FPGA to listen for samples. This method downloads the FPGA bitstream
|
|
|
|
* if not already loaded, sets divisor and starts up the antenna.
|
2019-05-09 07:07:34 +08:00
|
|
|
* @param divisor : 1, 88> 255 or negative ==> 134.8 kHz
|
|
|
|
* 0 or 95 ==> 125 kHz
|
2015-01-31 06:03:44 +08:00
|
|
|
*
|
|
|
|
**/
|
|
|
|
void LFSetupFPGAForADC(int divisor, bool lf_field);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called from the USB-handler to set the sampling configuration
|
2019-03-12 20:15:39 +08:00
|
|
|
* The sampling config is used for std reading and sniffing.
|
2015-01-31 06:03:44 +08:00
|
|
|
*
|
|
|
|
* Other functions may read samples and ignore the sampling config,
|
|
|
|
* such as functions to read the UID from a prox tag or similar.
|
|
|
|
*
|
|
|
|
* Values set to '0' implies no change (except for averaging)
|
|
|
|
* @brief setSamplingConfig
|
|
|
|
* @param sc
|
|
|
|
*/
|
|
|
|
void setSamplingConfig(sample_config *sc);
|
|
|
|
|
2019-03-10 07:00:59 +08:00
|
|
|
sample_config *getSamplingConfig();
|
2015-07-23 05:00:52 +08:00
|
|
|
|
|
|
|
void printConfig();
|
|
|
|
|
2017-01-25 07:33:03 +08:00
|
|
|
#endif // __LFSAMPLING_H
|