mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-06 04:51:36 -07:00
Some minor fixes
Use longer timeout in WaitForRawDataTimeout() to handle CMD_WTX Fix a wrong type Apply changes to other similar part Remove unused instructions
This commit is contained in:
parent
8b6a274e28
commit
ab9f49f86e
5 changed files with 19 additions and 17 deletions
|
@ -493,7 +493,7 @@ void FpgaDownloadAndGo(int bitstream_version) {
|
|||
#endif
|
||||
|
||||
// Send waiting time extension request as this will take a while
|
||||
send_wtx(1500);
|
||||
send_wtx(FPGA_LOAD_WAIT_TIME);
|
||||
|
||||
bool verbose = (g_dbglevel > 3);
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ void logSample(uint8_t sample, uint8_t decimation, uint8_t bits_per_sample, bool
|
|||
|
||||
// write the current byte
|
||||
data.buffer[data.numbits >> 3] |= sample >> bits_offset;
|
||||
int numbits = data.numbits + bits_cap;
|
||||
uint32_t numbits = data.numbits + bits_cap;
|
||||
|
||||
// write the remaining bits to the next byte
|
||||
data.buffer[numbits >> 3] |= sample << (bits_cap);
|
||||
|
@ -306,7 +306,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, in
|
|||
|
||||
// only every 4000th times, in order to save time when collecting samples.
|
||||
// interruptible only when logging not yet triggered
|
||||
if ((checked >= 4000) && trigger_hit == false) {
|
||||
if (unlikely(trigger_hit == false && (checked >= 4000))) {
|
||||
if (data_available()) {
|
||||
checked = -1;
|
||||
break;
|
||||
|
@ -325,11 +325,11 @@ uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, in
|
|||
if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_RXRDY) {
|
||||
volatile uint8_t sample = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||
|
||||
// Test point 8 (TP8) can be used to trigger oscilloscope
|
||||
// (RDV4) Test point 8 (TP8) can be used to trigger oscilloscope
|
||||
if (ledcontrol) LED_D_OFF();
|
||||
|
||||
// threshold either high or low values 128 = center 0. if trigger = 178
|
||||
if (trigger_hit == false) {
|
||||
if (unlikely(trigger_hit == false)) {
|
||||
if ((trigger_threshold > 0) && (sample < (trigger_threshold + 128)) && (sample > (128 - trigger_threshold))) {
|
||||
if (cancel_after > 0) {
|
||||
cancel_counter++;
|
||||
|
@ -338,11 +338,10 @@ uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, in
|
|||
}
|
||||
continue;
|
||||
}
|
||||
trigger_hit = true;
|
||||
}
|
||||
|
||||
trigger_hit = true;
|
||||
|
||||
if (samples_to_skip > 0) {
|
||||
if (unlikely(samples_to_skip > 0)) {
|
||||
samples_to_skip--;
|
||||
continue;
|
||||
}
|
||||
|
@ -371,6 +370,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, in
|
|||
}
|
||||
return data.numbits;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Does sample acquisition, ignoring the config values set in the sample_config.
|
||||
* This method is typically used by tag-specific readers who just wants to read the samples
|
||||
|
@ -441,7 +441,7 @@ int ReadLF_realtime(bool reader_field) {
|
|||
int32_t samples_to_skip = config.samples_to_skip;
|
||||
const uint8_t decimation = config.decimation;
|
||||
|
||||
uint32_t sample_size = 64;
|
||||
uint32_t sample_buffer_len = 64;
|
||||
const int8_t size_threshold_table[9] = {0, 64, 64, 60, 64, 60, 60, 56, 64};
|
||||
const int8_t size_threshold = size_threshold_table[bits_per_sample];
|
||||
|
||||
|
@ -450,14 +450,11 @@ int ReadLF_realtime(bool reader_field) {
|
|||
uint8_t curr_byte = 0;
|
||||
int return_value = PM3_SUCCESS;
|
||||
|
||||
initSampleBuffer(&sample_size); // sample size in bytes
|
||||
if (sample_size != 64) {
|
||||
initSampleBuffer(&sample_buffer_len);
|
||||
if (sample_buffer_len != 64) {
|
||||
return PM3_EFAILED;
|
||||
}
|
||||
|
||||
sample_size <<= 3; // sample size in bits
|
||||
sample_size /= bits_per_sample; // sample count
|
||||
|
||||
bool trigger_hit = false;
|
||||
int16_t checked = 0;
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ static void zx_get(bool ledcontrol) {
|
|||
volatile uint8_t sample = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||
(void)sample;
|
||||
|
||||
// Test point 8 (TP8) can be used to trigger oscilloscope
|
||||
// (RDV4) Test point 8 (TP8) can be used to trigger oscilloscope
|
||||
if (ledcontrol) LED_D_OFF();
|
||||
|
||||
}
|
||||
|
|
|
@ -721,7 +721,7 @@ static int lf_read_internal(bool realtime, bool verbose, uint64_t samples) {
|
|||
sample_bytes = (sample_bytes / 8) + (sample_bytes % 8 != 0);
|
||||
|
||||
SendCommandNG(CMD_LF_ACQ_RAW_ADC, (uint8_t *)&payload, sizeof(payload));
|
||||
sample_bytes = WaitForRawDataTimeout(realtimeBuf, sample_bytes, 1000, true);
|
||||
sample_bytes = WaitForRawDataTimeout(realtimeBuf, sample_bytes, 1000 + FPGA_LOAD_WAIT_TIME, true);
|
||||
samples = sample_bytes * 8 / bits_per_sample;
|
||||
getSamplesFromBufEx(realtimeBuf, samples, bits_per_sample, verbose);
|
||||
|
||||
|
@ -751,6 +751,7 @@ int lf_read(bool verbose, uint64_t samples) {
|
|||
}
|
||||
|
||||
int CmdLFRead(const char *Cmd) {
|
||||
// In real-time mode, the first few bytes might be the response of CMD_WTX rather than the real samples
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "lf read",
|
||||
"Sniff low frequency signal.\n"
|
||||
|
@ -816,7 +817,7 @@ int lf_sniff(bool realtime, bool verbose, uint64_t samples) {
|
|||
sample_bytes = (sample_bytes / 8) + (sample_bytes % 8 != 0);
|
||||
|
||||
SendCommandNG(CMD_LF_SNIFF_RAW_ADC, (uint8_t *)&payload, sizeof(payload));
|
||||
sample_bytes = WaitForRawDataTimeout(realtimeBuf, sample_bytes, 1000, true);
|
||||
sample_bytes = WaitForRawDataTimeout(realtimeBuf, sample_bytes, 1000 + FPGA_LOAD_WAIT_TIME, true);
|
||||
samples = sample_bytes * 8 / bits_per_sample;
|
||||
getSamplesFromBufEx(realtimeBuf, samples, bits_per_sample, verbose);
|
||||
|
||||
|
@ -842,6 +843,7 @@ int lf_sniff(bool realtime, bool verbose, uint64_t samples) {
|
|||
}
|
||||
|
||||
int CmdLFSniff(const char *Cmd) {
|
||||
// In real-time mode, the first few bytes might be the response of CMD_WTX rather than the real samples
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "lf sniff",
|
||||
"Sniff low frequency signal. You need to configure the LF part on the Proxmark3 device manually.\n"
|
||||
|
|
|
@ -196,6 +196,9 @@ extern bool g_tearoff_enabled;
|
|||
#define CLEAR_BIT(data, i) *(data + (i / 8)) &= ~(1 << (7 - (i % 8)))
|
||||
#define FLIP_BIT(data, i) *(data + (i / 8)) ^= (1 << (7 - (i % 8)))
|
||||
|
||||
// time for decompressing and loading the image to the FPGA
|
||||
#define FPGA_LOAD_WAIT_TIME (1500)
|
||||
|
||||
// GCC extension
|
||||
// from client/deps/tinycbor/compilersupport_p.h
|
||||
#ifdef __GNUC__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue