]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/lfsampling.c
FIX: 'standalone_14a mode' - cleaned up the standalone14a mode code. It now detects...
[proxmark3-svn] / armsrc / lfsampling.c
index 94ddc7274d9ae98add2e56ca01158724b4bc9acc..d726ba20c7c823fce1d25beb883cec7262cd308c 100644 (file)
@@ -48,11 +48,11 @@ sample_config* getSamplingConfig() {
        return &config;
 }
 
-typedef struct {
+struct BitstreamOut {
        uint8_t * buffer;
        uint32_t numbits;
        uint32_t position;
-} BitstreamOut;
+};
 
 /**
  * @brief Pushes bit onto the stream
@@ -110,7 +110,7 @@ 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) {
        //bigbuf, to hold the aquired raw data signal
        uint8_t *dest = BigBuf_get_addr();
     uint16_t bufsize = BigBuf_max_traceLen();
@@ -224,14 +224,20 @@ uint32_t ReadLF(bool activeField, bool silent) {
 * @return number of bits sampled
 **/
 uint32_t SampleLF(bool printCfg) {
-       return ReadLF(true, printCfg);
+       BigBuf_Clear_ext(false);
+       uint32_t ret = ReadLF(true, printCfg);
+       FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
+       return ret;     
 }
 /**
 * Initializes the FPGA for snoop-mode (field off), and acquires the samples.
 * @return number of bits sampled
 **/
 uint32_t SnoopLF() {
-       return ReadLF(false, true);
+       BigBuf_Clear_ext(false);
+       uint32_t ret = ReadLF(false, true);
+       FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
+       return ret;     
 }
 
 /**
@@ -259,7 +265,7 @@ void doT55x7Acquisition(size_t sample_size) {
        while(!BUTTON_PRESS() && !usb_poll_validate_length() && skipCnt < 1000 && (i < bufsize) ) {
                WDT_HIT();              
                if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_TXRDY) {
-                       AT91C_BASE_SSC->SSC_THR = 0x43;
+                       AT91C_BASE_SSC->SSC_THR = 0x43; //43
                        LED_D_ON();
                }
                if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) {
@@ -275,7 +281,7 @@ void doT55x7Acquisition(size_t sample_size) {
                                skipCnt++;
                                continue;
                        }
-                       // skip until the first Low sample below threshold
+                       // skip until the first low sample below threshold
                        if (!startFound && curSample < T55xx_READ_LOWER_THRESHOLD) {
                                //if (curSample > lastSample) 
                                lastSample = curSample;
Impressum, Datenschutz