mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-21 13:53:26 -07:00
minor cleanups
This commit is contained in:
parent
78711df115
commit
9f669cb26f
8 changed files with 80 additions and 67 deletions
|
@ -946,7 +946,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
|
|||
CmdIOdemodFSK(c->arg[0], 0, 0, 1);
|
||||
break;
|
||||
case CMD_IO_CLONE_TAG:
|
||||
CopyIOtoT55x7(c->arg[0], c->arg[1], c->d.asBytes[0]);
|
||||
CopyIOtoT55x7(c->arg[0], c->arg[1]);
|
||||
break;
|
||||
case CMD_EM410X_DEMOD:
|
||||
CmdEM410xdemod(c->arg[0], 0, 0, 1);
|
||||
|
|
|
@ -73,7 +73,7 @@ void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol);
|
|||
void CmdAWIDdemodFSK(int findone, int *high, int *low, int ledcontrol); // Realtime demodulation mode for AWID26
|
||||
void CmdEM410xdemod(int findone, int *high, int *low, int ledcontrol);
|
||||
void CmdIOdemodFSK(int findone, int *high, int *low, int ledcontrol);
|
||||
void CopyIOtoT55x7(uint32_t hi, uint32_t lo, uint8_t longFMT); // Clone an ioProx card to T5557/T5567
|
||||
void CopyIOtoT55x7(uint32_t hi, uint32_t lo); // Clone an ioProx card to T5557/T5567
|
||||
void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen);
|
||||
void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT); // Clone an HID card to T5557/T5567
|
||||
void WriteEM410x(uint32_t card, uint32_t id_hi, uint32_t id_lo);
|
||||
|
|
|
@ -1113,6 +1113,9 @@ void T55xxWriteBit(int bit) {
|
|||
// Send T5577 reset command then read stream (see if we can identify the start of the stream)
|
||||
void T55xxResetRead(void) {
|
||||
LED_A_ON();
|
||||
//clear buffer now so it does not interfere with timing later
|
||||
BigBuf_Clear_ext(false);
|
||||
|
||||
// Set up FPGA, 125kHz
|
||||
LFSetupFPGAForADC(95, true);
|
||||
|
||||
|
@ -1128,7 +1131,7 @@ void T55xxResetRead(void) {
|
|||
TurnReadLFOn(READ_GAP);
|
||||
|
||||
// Acquisition
|
||||
doT55x7Acquisition(39999);
|
||||
doT55x7Acquisition(BigBuf_max_traceLen());
|
||||
|
||||
// Turn the field off
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); // field off
|
||||
|
@ -1266,7 +1269,7 @@ void T55xxWakeUp(uint32_t Pwd){
|
|||
void WriteT55xx(uint32_t *blockdata, uint8_t startblock, uint8_t numblocks) {
|
||||
// write last block first and config block last (if included)
|
||||
for (uint8_t i = numblocks+startblock; i > startblock; i--) {
|
||||
Dbprintf("write- Blk: %d, d:%08X",i-1,blockdata[i-1]);
|
||||
//Dbprintf("write- Blk: %d, d:%08X",i-1,blockdata[i-1]);
|
||||
T55xxWriteBlockExt(blockdata[i-1],i-1,0,0);
|
||||
}
|
||||
}
|
||||
|
@ -1319,7 +1322,7 @@ void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT) {
|
|||
DbpString("DONE!");
|
||||
}
|
||||
|
||||
void CopyIOtoT55x7(uint32_t hi, uint32_t lo, uint8_t longFMT) {
|
||||
void CopyIOtoT55x7(uint32_t hi, uint32_t lo) {
|
||||
uint32_t data[] = {T55x7_BITRATE_RF_64 | T55x7_MODULATION_FSK2a | (2 << T55x7_MAXBLOCK_SHIFT), hi, lo};
|
||||
|
||||
LED_D_ON();
|
||||
|
|
|
@ -255,7 +255,7 @@ uint32_t SnoopLF()
|
|||
**/
|
||||
void doT55x7Acquisition(size_t sample_size) {
|
||||
|
||||
#define T55xx_READ_UPPER_THRESHOLD 128+40 // 50
|
||||
#define T55xx_READ_UPPER_THRESHOLD 128+40 // 40 grph
|
||||
#define T55xx_READ_TOL 5
|
||||
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
|
@ -264,8 +264,6 @@ void doT55x7Acquisition(size_t sample_size) {
|
|||
if ( bufsize > sample_size )
|
||||
bufsize = sample_size;
|
||||
|
||||
//memset(dest, 0, bufsize);
|
||||
|
||||
uint16_t i = 0;
|
||||
bool startFound = false;
|
||||
bool highFound = false;
|
||||
|
@ -282,7 +280,7 @@ void doT55x7Acquisition(size_t sample_size) {
|
|||
curSample = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||
LED_D_OFF();
|
||||
|
||||
// find first high sample
|
||||
// skip until the first high sample above threshold
|
||||
if (!startFound && curSample > T55xx_READ_UPPER_THRESHOLD) {
|
||||
if (curSample > firstSample)
|
||||
firstSample = curSample;
|
||||
|
@ -292,15 +290,17 @@ void doT55x7Acquisition(size_t sample_size) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// skip until samples begin to change
|
||||
// skip until first high samples begin to change
|
||||
if (startFound || curSample < firstSample-T55xx_READ_TOL){
|
||||
if (!startFound)
|
||||
// if just found start - recover last sample
|
||||
if (!startFound) {
|
||||
dest[i++] = firstSample;
|
||||
startFound = true;
|
||||
startFound = true;
|
||||
}
|
||||
// collect samples
|
||||
dest[i++] = curSample;
|
||||
if (i >= bufsize-1) break;
|
||||
}
|
||||
}
|
||||
//skipCnt++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue