]>
Commit | Line | Data |
---|---|---|
a553f267 | 1 | //----------------------------------------------------------------------------- |
2 | // Copyright (C) 2010 iZsh <izsh at fail0verflow.com> | |
3 | // | |
4 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, | |
5 | // at your option, any later version. See the LICENSE.txt file for the text of | |
6 | // the license. | |
7 | //----------------------------------------------------------------------------- | |
8 | // Data utilities | |
9 | //----------------------------------------------------------------------------- | |
10 | ||
7fe9b0b7 | 11 | #include <string.h> |
12 | #include <stdint.h> | |
13 | #include "data.h" | |
14 | #include "ui.h" | |
15 | #include "proxusb.h" | |
16 | #include "cmdmain.h" | |
17 | ||
18 | uint8_t sample_buf[SAMPLE_BUFFER_SIZE]; | |
19 | ||
db09cb3a | 20 | void GetFromBigBuf(uint8_t *dest, int bytes, int start_index) |
7fe9b0b7 | 21 | { |
db09cb3a | 22 | start_index = ((start_index/12)*12); |
23 | int n = (((bytes/4)/48)*48) + start_index; | |
24 | /* | |
25 | if (n % 48 != 0) { | |
26 | PrintAndLog("bad len in GetFromBigBuf"); | |
27 | return; | |
28 | } | |
29 | */ | |
30 | for (int i = start_index; i < n; i += 12) { | |
31 | UsbCommand c = {CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K, {i, 0, 0}}; | |
32 | SendCommand(&c); | |
33 | WaitForResponse(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K); | |
34 | memcpy(dest+(i*4), sample_buf, 48); | |
35 | } | |
7fe9b0b7 | 36 | } |