X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/7fe9b0b742d7dae9c5af1d292d11840b5c3cbfae..8de6b69d1ef8f20c9cd7baa79590ff7a61c7254f:/client/data.c diff --git a/client/data.c b/client/data.c index 1fc7408f..eeae8cc5 100644 --- a/client/data.c +++ b/client/data.c @@ -1,3 +1,13 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2010 iZsh +// +// This code is licensed to you under the terms of the GNU GPL, version 2 or, +// at your option, any later version. See the LICENSE.txt file for the text of +// the license. +//----------------------------------------------------------------------------- +// Data utilities +//----------------------------------------------------------------------------- + #include #include #include "data.h" @@ -7,19 +17,20 @@ uint8_t sample_buf[SAMPLE_BUFFER_SIZE]; -void GetFromBigBuf(uint8_t *dest, int bytes) +void GetFromBigBuf(uint8_t *dest, int bytes, int start_index) { - int n = bytes/4; - - if (n % 48 != 0) { - PrintAndLog("bad len in GetFromBigBuf"); - return; - } - - for (int i = 0; i < n; i += 12) { - UsbCommand c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {i, 0, 0}}; - SendCommand(&c); - WaitForResponse(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K); - memcpy(dest+(i*4), sample_buf, 48); - } + start_index = ((start_index/12)*12); + int n = (((bytes/4)/48)*48) + start_index; + /* + if (n % 48 != 0) { + PrintAndLog("bad len in GetFromBigBuf"); + return; + } + */ + for (int i = start_index; i < n; i += 12) { + UsbCommand c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {i, 0, 0}}; + SendCommand(&c); + WaitForResponse(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K); + memcpy(dest+(i*4), sample_buf, 48); + } }