first look at the data

This commit is contained in:
merlokk 2022-06-25 16:11:59 +03:00
parent f007db6661
commit 5784999002
2 changed files with 12 additions and 17 deletions

View file

@ -55,8 +55,6 @@ int HfReadADC(uint32_t samplesCount, bool ledcontrol) {
if (ledcontrol) LED_A_ON();
uint32_t samples = 0;
//uint32_t dma_start_time = 0;
uint16_t *upTo = dma->buf;
uint32_t sbs = samplesCount;
@ -71,11 +69,13 @@ int HfReadADC(uint32_t samplesCount, bool ledcontrol) {
if (behindBy == 0)
continue;
samples++;
if (samples == 1) {
// DMA has transferred the very first data
//dma_start_time = GetCountSspClk() & 0xfffffff0;
}
uint16_t sample = *upTo;
logSample(sample & 0xff, 1, 8, false);
logSample((sample >> 8) & 0xff, 1, 8, false);
upTo++;
if (getSampleCounter() >= samplesCount)
break;
if (upTo >= dma->buf + DMA_BUFFER_SIZE) { // we have read all of the DMA buffer content.
upTo = dma->buf; // start reading the circular buffer from the beginning
@ -97,12 +97,6 @@ int HfReadADC(uint32_t samplesCount, bool ledcontrol) {
WDT_HIT();
}
}
logSample(50, 1, 8, false);
if (getSampleCounter() >= samplesCount)
break;
}
FpgaDisableSscDma();
@ -112,11 +106,10 @@ int HfReadADC(uint32_t samplesCount, bool ledcontrol) {
// Turn the field off
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
reply_ng(CMD_HF_ACQ_RAW_ADC, PM3_SUCCESS, NULL, 0);
uint32_t scnt = getSampleCounter();
reply_ng(CMD_HF_ACQ_RAW_ADC, PM3_SUCCESS, (uint8_t*)&scnt, 4);
if (ledcontrol) LEDsoff();
Dbprintf("-- samples: %d", getSampleCounter());
return 0;
}

View file

@ -51,7 +51,9 @@ static int CmdHFTexkomReader(const char *Cmd) {
return PM3_ETIMEOUT;
}
getSamples(samplesCount, true);
uint32_t size = (resp.data.asDwords[0]);
if (size > 0)
getSamples(samplesCount, true);
return PM3_SUCCESS;
}