mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 02:34:48 +08:00
fix bunch of printf api warnings in common/lfdemod.c
This commit is contained in:
parent
89dd574f53
commit
9fac99025b
1 changed files with 18 additions and 18 deletions
|
@ -324,13 +324,13 @@ bool preambleSearchEx(uint8_t *bits, uint8_t *preamble, size_t pLen, size_t *siz
|
||||||
//first index found
|
//first index found
|
||||||
foundCnt++;
|
foundCnt++;
|
||||||
if (foundCnt == 1) {
|
if (foundCnt == 1) {
|
||||||
if (g_debugMode >= 1) prnt("DEBUG: (preambleSearchEx) preamble found at %i", idx);
|
if (g_debugMode >= 1) prnt("DEBUG: (preambleSearchEx) preamble found at %zu", idx);
|
||||||
*startIdx = idx;
|
*startIdx = idx;
|
||||||
if (findone)
|
if (findone)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (foundCnt == 2) {
|
if (foundCnt == 2) {
|
||||||
if (g_debugMode >= 1) prnt("DEBUG: (preambleSearchEx) preamble 2 found at %i", idx);
|
if (g_debugMode >= 1) prnt("DEBUG: (preambleSearchEx) preamble 2 found at %zu", idx);
|
||||||
*size = idx - *startIdx;
|
*size = idx - *startIdx;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ static size_t findModStart(uint8_t *src, size_t size, uint8_t expWaveSize) {
|
||||||
}
|
}
|
||||||
if (thresholdCnt > 10) break;
|
if (thresholdCnt > 10) break;
|
||||||
}
|
}
|
||||||
if (g_debugMode == 2) prnt("DEBUG: threshold Count reached at index %u, count: %u", i, thresholdCnt);
|
if (g_debugMode == 2) prnt("DEBUG: threshold Count reached at index %zu, count: %u", i, thresholdCnt);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ size_t pskFindFirstPhaseShift(uint8_t *samples, size_t size, uint8_t *curPhase,
|
||||||
// find peak // was "samples[i] + fc" but why? must have been used to weed out some wave error... removed..
|
// find peak // was "samples[i] + fc" but why? must have been used to weed out some wave error... removed..
|
||||||
if (samples[i] < samples[i + 1] && samples[i + 1] >= samples[i + 2]) {
|
if (samples[i] < samples[i + 1] && samples[i + 1] >= samples[i + 2]) {
|
||||||
waveEnd = i + 1;
|
waveEnd = i + 1;
|
||||||
if (g_debugMode == 2) prnt("DEBUG PSK: waveEnd: %u, waveStart: %u", waveEnd, waveStart);
|
if (g_debugMode == 2) prnt("DEBUG PSK: waveEnd: %zu, waveStart: %zu", waveEnd, waveStart);
|
||||||
waveLenCnt = waveEnd - waveStart;
|
waveLenCnt = waveEnd - waveStart;
|
||||||
if (waveLenCnt > fc && waveStart > fc && !(waveLenCnt > fc + 8)) { //not first peak and is a large wave but not out of whack
|
if (waveLenCnt > fc && waveStart > fc && !(waveLenCnt > fc + 8)) { //not first peak and is a large wave but not out of whack
|
||||||
lastAvgWaveVal = avgWaveVal / (waveLenCnt);
|
lastAvgWaveVal = avgWaveVal / (waveLenCnt);
|
||||||
|
@ -1021,7 +1021,7 @@ uint16_t countFC(uint8_t *bits, size_t size, bool fskAdj) {
|
||||||
fcL = fcLens[best1];
|
fcL = fcLens[best1];
|
||||||
}
|
}
|
||||||
if ((size - 180) / fcH / 3 > fcCnts[best1] + fcCnts[best2]) {
|
if ((size - 180) / fcH / 3 > fcCnts[best1] + fcCnts[best2]) {
|
||||||
if (g_debugMode == 2) prnt("DEBUG countfc: fc is too large: %u > %u. Not psk or fsk", (size - 180) / fcH / 3, fcCnts[best1] + fcCnts[best2]);
|
if (g_debugMode == 2) prnt("DEBUG countfc: fc is too large: %zu > %u. Not psk or fsk", (size - 180) / fcH / 3, fcCnts[best1] + fcCnts[best2]);
|
||||||
return 0; //lots of waves not psk or fsk
|
return 0; //lots of waves not psk or fsk
|
||||||
}
|
}
|
||||||
// TODO: take top 3 answers and compare to known Field clocks to get top 2
|
// TODO: take top 3 answers and compare to known Field clocks to get top 2
|
||||||
|
@ -1072,7 +1072,7 @@ int DetectPSKClock(uint8_t *dest, size_t size, int clock, size_t *firstPhaseShif
|
||||||
}
|
}
|
||||||
|
|
||||||
*firstPhaseShift = firstFullWave;
|
*firstPhaseShift = firstFullWave;
|
||||||
if (g_debugMode == 2) prnt("DEBUG PSK: firstFullWave: %d, waveLen: %d", firstFullWave, fullWaveLen);
|
if (g_debugMode == 2) prnt("DEBUG PSK: firstFullWave: %zu, waveLen: %d", firstFullWave, fullWaveLen);
|
||||||
|
|
||||||
//test each valid clock from greatest to smallest to see which lines up
|
//test each valid clock from greatest to smallest to see which lines up
|
||||||
for (clkCnt = 7; clkCnt >= 1 ; clkCnt--) {
|
for (clkCnt = 7; clkCnt >= 1 ; clkCnt--) {
|
||||||
|
@ -1081,7 +1081,7 @@ int DetectPSKClock(uint8_t *dest, size_t size, int clock, size_t *firstPhaseShif
|
||||||
size_t waveStart = 0;
|
size_t waveStart = 0;
|
||||||
uint16_t errCnt = 0;
|
uint16_t errCnt = 0;
|
||||||
uint16_t peakcnt = 0;
|
uint16_t peakcnt = 0;
|
||||||
if (g_debugMode == 2) prnt("DEBUG PSK: clk: %d, lastClkBit: %d", clk[clkCnt], lastClkBit);
|
if (g_debugMode == 2) prnt("DEBUG PSK: clk: %d, lastClkBit: %zu", clk[clkCnt], lastClkBit);
|
||||||
|
|
||||||
for (i = firstFullWave + fullWaveLen - 1; i < loopCnt - 2; i++) {
|
for (i = firstFullWave + fullWaveLen - 1; i < loopCnt - 2; i++) {
|
||||||
//top edge of wave = start of new wave
|
//top edge of wave = start of new wave
|
||||||
|
@ -1093,7 +1093,7 @@ int DetectPSKClock(uint8_t *dest, size_t size, int clock, size_t *firstPhaseShif
|
||||||
waveLenCnt = waveEnd - waveStart;
|
waveLenCnt = waveEnd - waveStart;
|
||||||
if (waveLenCnt > *fc) {
|
if (waveLenCnt > *fc) {
|
||||||
//if this wave is a phase shift
|
//if this wave is a phase shift
|
||||||
if (g_debugMode == 2) prnt("DEBUG PSK: phase shift at: %d, len: %d, nextClk: %d, i: %d, fc: %d", waveStart, waveLenCnt, lastClkBit + clk[clkCnt] - tol, i + 1, *fc);
|
if (g_debugMode == 2) prnt("DEBUG PSK: phase shift at: %zu, len: %d, nextClk: %zu, i: %zu, fc: %d", waveStart, waveLenCnt, lastClkBit + clk[clkCnt] - tol, i + 1, *fc);
|
||||||
if (i + 1 >= lastClkBit + clk[clkCnt] - tol) { //should be a clock bit
|
if (i + 1 >= lastClkBit + clk[clkCnt] - tol) { //should be a clock bit
|
||||||
peakcnt++;
|
peakcnt++;
|
||||||
lastClkBit += clk[clkCnt];
|
lastClkBit += clk[clkCnt];
|
||||||
|
@ -1325,7 +1325,7 @@ bool DetectST(uint8_t *buffer, size_t *size, int *foundclock, size_t *ststart, s
|
||||||
// padd the amount off - could be problematic... but shouldn't happen often
|
// padd the amount off - could be problematic... but shouldn't happen often
|
||||||
datalen -= datalen % clk;
|
datalen -= datalen % clk;
|
||||||
} else {
|
} else {
|
||||||
if (g_debugMode == 2) prnt("DEBUG STT: datalen not divisible by clk: %u %% %d = %d - quitting", datalen, clk, datalen % clk);
|
if (g_debugMode == 2) prnt("DEBUG STT: datalen not divisible by clk: %zu %% %d = %zu - quitting", datalen, clk, datalen % clk);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if datalen is less than one t55xx block - ERROR
|
// if datalen is less than one t55xx block - ERROR
|
||||||
|
@ -1346,7 +1346,7 @@ bool DetectST(uint8_t *buffer, size_t *size, int *foundclock, size_t *ststart, s
|
||||||
|
|
||||||
size_t newloc = 0;
|
size_t newloc = 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
if (g_debugMode == 2) prnt("DEBUG STT: Starting STT trim - start: %d, datalen: %d ", dataloc, datalen);
|
if (g_debugMode == 2) prnt("DEBUG STT: Starting STT trim - start: %zu, datalen: %zu ", dataloc, datalen);
|
||||||
bool firstrun = true;
|
bool firstrun = true;
|
||||||
// warning - overwriting buffer given with raw wave data with ST removed...
|
// warning - overwriting buffer given with raw wave data with ST removed...
|
||||||
while (dataloc < bufsize - (clk / 2)) {
|
while (dataloc < bufsize - (clk / 2)) {
|
||||||
|
@ -1376,7 +1376,7 @@ bool DetectST(uint8_t *buffer, size_t *size, int *foundclock, size_t *ststart, s
|
||||||
}
|
}
|
||||||
newloc += i;
|
newloc += i;
|
||||||
//skip next ST - we just assume it will be there from now on...
|
//skip next ST - we just assume it will be there from now on...
|
||||||
if (g_debugMode == 2) prnt("DEBUG STT: skipping STT at %d to %d", dataloc, dataloc + (clk * 4));
|
if (g_debugMode == 2) prnt("DEBUG STT: skipping STT at %zu to %zu", dataloc, dataloc + (clk * 4));
|
||||||
dataloc += clk * 4;
|
dataloc += clk * 4;
|
||||||
}
|
}
|
||||||
*size = newloc;
|
*size = newloc;
|
||||||
|
@ -1549,7 +1549,7 @@ static uint16_t cleanAskRawDemod(uint8_t *bits, size_t *size, int clk, int inver
|
||||||
if (smplCnt > clk + cl_4 + 1) {
|
if (smplCnt > clk + cl_4 + 1) {
|
||||||
//too many samples
|
//too many samples
|
||||||
errCnt++;
|
errCnt++;
|
||||||
if (g_debugMode == 2) prnt("DEBUG ASK: cleanAskRawDemod ASK Modulation Error FULL at: %u [%u > %u]", i, smplCnt, clk + cl_4 + 1);
|
if (g_debugMode == 2) prnt("DEBUG ASK: cleanAskRawDemod ASK Modulation Error FULL at: %zu [%zu > %u]", i, smplCnt, clk + cl_4 + 1);
|
||||||
bits[bitCnt++] = 7;
|
bits[bitCnt++] = 7;
|
||||||
} else if (waveHigh) {
|
} else if (waveHigh) {
|
||||||
bits[bitCnt++] = invert;
|
bits[bitCnt++] = invert;
|
||||||
|
@ -1570,7 +1570,7 @@ static uint16_t cleanAskRawDemod(uint8_t *bits, size_t *size, int clk, int inver
|
||||||
|
|
||||||
if (smplCnt > cl_2 + cl_4 + 1) { //too many samples
|
if (smplCnt > cl_2 + cl_4 + 1) { //too many samples
|
||||||
errCnt++;
|
errCnt++;
|
||||||
if (g_debugMode == 2) prnt("DEBUG ASK: cleanAskRawDemod ASK Modulation Error HALF at: %u [%u]", i, smplCnt);
|
if (g_debugMode == 2) prnt("DEBUG ASK: cleanAskRawDemod ASK Modulation Error HALF at: %zu [%zu]", i, smplCnt);
|
||||||
bits[bitCnt++] = 7;
|
bits[bitCnt++] = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1645,7 +1645,7 @@ int askdemod_ext(uint8_t *bits, size_t *size, int *clk, int *invert, int maxErr,
|
||||||
errCnt = manrawdecode(bits, size, 0, &alignPos);
|
errCnt = manrawdecode(bits, size, 0, &alignPos);
|
||||||
*startIdx += ((*clk / 2) * alignPos);
|
*startIdx += ((*clk / 2) * alignPos);
|
||||||
|
|
||||||
prnt("DEBUG: (askdemod_ext) CLEAN: startIdx %i, alignPos %u , bestError %u", *startIdx, alignPos, errCnt);
|
prnt("DEBUG: (askdemod_ext) CLEAN: startIdx %i, alignPos %u , bestError %zu", *startIdx, alignPos, errCnt);
|
||||||
}
|
}
|
||||||
return errCnt;
|
return errCnt;
|
||||||
}
|
}
|
||||||
|
@ -1870,10 +1870,10 @@ static size_t aggregate_bits(uint8_t *dest, size_t size, uint8_t clk, uint8_t in
|
||||||
if (numBits == 0) {
|
if (numBits == 0) {
|
||||||
if (lastval == 1) { //high to low
|
if (lastval == 1) { //high to low
|
||||||
*startIdx += (fclow * i) - (n * clk);
|
*startIdx += (fclow * i) - (n * clk);
|
||||||
if (g_debugMode == 2) prnt("DEBUG (aggregate_bits) FSK startIdx %i, fclow*idx %i, n*clk %u", *startIdx, fclow * i, n * clk);
|
if (g_debugMode == 2) prnt("DEBUG (aggregate_bits) FSK startIdx %i, fclow*idx %zu, n*clk %u", *startIdx, fclow * i, n * clk);
|
||||||
} else {
|
} else {
|
||||||
*startIdx += (fchigh * i) - (n * clk);
|
*startIdx += (fchigh * i) - (n * clk);
|
||||||
if (g_debugMode == 2) prnt("DEBUG (aggregate_bits) FSK startIdx %i, fchigh*idx %i, n*clk %u", *startIdx, fchigh * i, n * clk);
|
if (g_debugMode == 2) prnt("DEBUG (aggregate_bits) FSK startIdx %i, fchigh*idx %zu, n*clk %u", *startIdx, fchigh * i, n * clk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1984,8 +1984,8 @@ int pskRawDemod_ext(uint8_t *dest, size_t *size, int *clock, int *invert, int *s
|
||||||
//set start of wave as clock align
|
//set start of wave as clock align
|
||||||
lastClkBit = firstFullWave;
|
lastClkBit = firstFullWave;
|
||||||
if (g_debugMode == 2) {
|
if (g_debugMode == 2) {
|
||||||
prnt("DEBUG PSK: firstFullWave: %u, waveLen: %u, startIdx %i", firstFullWave, fullWaveLen, *startIdx);
|
prnt("DEBUG PSK: firstFullWave: %zu, waveLen: %u, startIdx %i", firstFullWave, fullWaveLen, *startIdx);
|
||||||
prnt("DEBUG PSK: clk: %d, lastClkBit: %u, fc: %u", *clock, lastClkBit, fc);
|
prnt("DEBUG PSK: clk: %d, lastClkBit: %zu, fc: %u", *clock, lastClkBit, fc);
|
||||||
}
|
}
|
||||||
|
|
||||||
waveStart = 0;
|
waveStart = 0;
|
||||||
|
|
Loading…
Reference in a new issue