X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/e4b65f5bc16eef150efb5327d9aa9e2e48e999be..dd0a4fe4775f50c4eb506d3166d73ba8a98febea:/armsrc/lfops.c diff --git a/armsrc/lfops.c b/armsrc/lfops.c index 4e1b7e34..90b8d0b3 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -400,6 +400,17 @@ void SimulateTagLowFrequency(int period, int gap, int ledcontrol) FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_EDGE_DETECT); //FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_EDGE_DETECT | FPGA_LF_EDGE_DETECT_READER_FIELD); //FpgaWriteConfWord(FPGA_MAJOR_MODE_LF_EDGE_DETECT | FPGA_LF_EDGE_DETECT_TOGGLE_MODE ); + + // set frequency, get values from 'lf config' command + sample_config *sc = getSamplingConfig(); + + if ( (sc->divisor == 1) || (sc->divisor < 0) || (sc->divisor > 255) ) + FpgaSendCommand(FPGA_CMD_SET_DIVISOR, 88); //134.8Khz + else if (sc->divisor == 0) + FpgaSendCommand(FPGA_CMD_SET_DIVISOR, 95); //125Khz + else + FpgaSendCommand(FPGA_CMD_SET_DIVISOR, sc->divisor); + SetAdcMuxFor(GPIO_MUXSEL_LOPKD); AT91C_BASE_PIOA->PIO_PER = GPIO_SSC_DOUT | GPIO_SSC_CLK; @@ -854,14 +865,13 @@ void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol) if (ledcontrol) LED_A_OFF(); *high = hi; *low = lo; - goto OUT; + break; } // reset } hi2 = hi = lo = idx = 0; WDT_HIT(); } -OUT: FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); DbpString("Stopped"); if (ledcontrol) LED_A_OFF(); @@ -960,12 +970,12 @@ void CmdAWIDdemodFSK(int findone, int *high, int *low, int ledcontrol) break; } if (findone) - goto OUT; + break; idx = 0; WDT_HIT(); } -OUT: + FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); DbpString("Stopped"); if (ledcontrol) LED_A_OFF(); @@ -1021,13 +1031,14 @@ void CmdEM410xdemod(int findone, int *high, int *low, int ledcontrol) if (ledcontrol) LED_A_OFF(); *high=lo>>32; *low=lo & 0xFFFFFFFF; - return; + break; } } WDT_HIT(); hi = lo = size = idx = 0; clk = invert = errCnt = 0; } + FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); DbpString("Stopped"); if (ledcontrol) LED_A_OFF(); } @@ -1106,7 +1117,7 @@ void CmdIOdemodFSK(int findone, int *high, int *low, int ledcontrol) if (ledcontrol) LED_A_OFF(); *high=code; *low=code2; - goto OUT; + break; } code=code2=0; version=facilitycode=0; @@ -1115,7 +1126,6 @@ void CmdIOdemodFSK(int findone, int *high, int *low, int ledcontrol) WDT_HIT(); } -OUT: FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); DbpString("Stopped"); if (ledcontrol) LED_A_OFF();