X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/5f5b83b7435ae85f2ffa06f1f8994bda22ce64b2..57e1e31dce70a58da1736b9579a869c1df313a13:/armsrc/lfsampling.c diff --git a/armsrc/lfsampling.c b/armsrc/lfsampling.c index 841bfab8..fe595bf2 100644 --- a/armsrc/lfsampling.c +++ b/armsrc/lfsampling.c @@ -116,10 +116,10 @@ void LFSetupFPGAForADC(int divisor, bool lf_field) { * @param silent - is true, now outputs are made. If false, dbprints the status * @return the number of bits occupied by the samples. */ -uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averaging, int trigger_threshold, bool silent) { +uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averaging, int trigger_threshold, bool silent, int bufsize) { //bigbuf, to hold the aquired raw data signal uint8_t *dest = BigBuf_get_addr(); - uint16_t bufsize = BigBuf_max_traceLen(); + bufsize = (bufsize > 0 && bufsize < BigBuf_max_traceLen()) ? bufsize : BigBuf_max_traceLen(); //BigBuf_Clear_ext(false); //creates issues with cmdread (marshmellow) @@ -208,14 +208,19 @@ uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averag * @return number of bits sampled */ uint32_t DoAcquisition_default(int trigger_threshold, bool silent) { - return DoAcquisition(1,8,0,trigger_threshold,silent); + return DoAcquisition(1, 8, 0,trigger_threshold, silent, 0); } uint32_t DoAcquisition_config( bool silent) { return DoAcquisition(config.decimation ,config.bits_per_sample ,config.averaging ,config.trigger_threshold - ,silent); + ,silent + ,0); +} + +uint32_t DoPartialAcquisition(int trigger_threshold, bool silent, int sample_size) { + return DoAcquisition(1, 8, 0, trigger_threshold, silent, sample_size); } uint32_t ReadLF(bool activeField, bool silent) { @@ -252,9 +257,9 @@ uint32_t SnoopLF() { **/ void doT55x7Acquisition(size_t sample_size) { - #define T55xx_READ_UPPER_THRESHOLD 128+40 // 60 grph - #define T55xx_READ_LOWER_THRESHOLD 128-40 // -60 grph - #define T55xx_READ_TOL 2 + #define T55xx_READ_UPPER_THRESHOLD 128+60 // 60 grph + #define T55xx_READ_LOWER_THRESHOLD 128-60 // -60 grph + #define T55xx_READ_TOL 5 uint8_t *dest = BigBuf_get_addr(); uint16_t bufsize = BigBuf_max_traceLen(); @@ -319,6 +324,9 @@ void doT55x7Acquisition(size_t sample_size) { #define COTAG_T2 (COTAG_T1>>1) #define COTAG_ONE_THRESHOLD 128+30 #define COTAG_ZERO_THRESHOLD 128-30 +#ifndef COTAG_BITS +#define COTAG_BITS 264 +#endif void doCotagAcquisition(size_t sample_size) { uint8_t *dest = BigBuf_get_addr(); @@ -371,8 +379,8 @@ uint32_t doCotagAcquisitionManchester() { uint8_t *dest = BigBuf_get_addr(); uint16_t bufsize = BigBuf_max_traceLen(); - if ( bufsize > 320 ) - bufsize = 320; + if ( bufsize > COTAG_BITS ) + bufsize = COTAG_BITS; dest[0] = 0; uint8_t sample = 0, firsthigh = 0, firstlow = 0;