X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/39864b0bd41dd5e896bcb8eeabcf2c3932f2203a..d16d20b1fbb74d5b273005a48d39da24f8d54858:/armsrc/mifaresniff.c diff --git a/armsrc/mifaresniff.c b/armsrc/mifaresniff.c index aefe6962..f95ca3df 100644 --- a/armsrc/mifaresniff.c +++ b/armsrc/mifaresniff.c @@ -31,18 +31,19 @@ int MfSniffInit(void){ } int MfSniffEnd(void){ - UsbCommand ack = {CMD_ACK, {0, 0, 0}}; +// UsbCommand ack = {CMD_ACK, {0, 0, 0}}; LED_B_ON(); - UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand)); + cmd_send(CMD_ACK,0,0,0,0,0); +// UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand)); LED_B_OFF(); return 0; } -int RAMFUNC MfSniffLogic(const uint8_t * data, int len, int bitCnt, int reader) { +int RAMFUNC MfSniffLogic(const uint8_t * data, int len, uint32_t parity, int bitCnt, int reader) { - if ((len == 1) && (bitCnt = 9)) { + if ((len == 1) && (bitCnt = 9) && (data[0] > 0x0F)) { sniffState = SNF_INIT; } @@ -121,18 +122,18 @@ int RAMFUNC MfSniffLogic(const uint8_t * data, int len, int bitCnt, int reader) sniffBuf[11] = sniffSAK; sniffBuf[12] = 0xFF; sniffBuf[13] = 0xFF; - LogTrace(sniffBuf, 14, 0, 0, true); + LogTrace(sniffBuf, 14, 0, parity, true); timerData = GetTickCount(); } case SNF_CARD_CMD:{ - LogTrace(data, len, 0, 0, true); + LogTrace(data, len, 0, parity, true); sniffState = SNF_CARD_RESP; timerData = GetTickCount(); break; } case SNF_CARD_RESP:{ - LogTrace(data, len, 0, 0, false); + LogTrace(data, len, 0, parity, false); sniffState = SNF_CARD_CMD; timerData = GetTickCount(); @@ -163,26 +164,28 @@ int intMfSniffSend() { if (!traceLen) return 0; - AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS; + FpgaDisableSscDma(); while (pckLen > 0) { - pckSize = min(32, pckLen); - UsbCommand ack = {CMD_ACK, {1, pckSize, pckNum}}; - memcpy(ack.d.asBytes, trace + traceLen - pckLen, pckSize); + pckSize = MIN(32, pckLen); +// UsbCommand ack = {CMD_ACK, {1, pckSize, pckNum}}; +// memcpy(ack.d.asBytes, trace + traceLen - pckLen, pckSize); LED_B_ON(); - UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand)); - SpinDelay(20); + cmd_send(CMD_ACK,1,pckSize,pckNum,trace + traceLen - pckLen,pckSize); +// UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand)); +// SpinDelay(20); LED_B_OFF(); pckLen -= pckSize; pckNum++; } - UsbCommand ack = {CMD_ACK, {2, 0, 0}}; +// UsbCommand ack = {CMD_ACK, {2, 0, 0}}; LED_B_ON(); - UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand)); + cmd_send(CMD_ACK,2,0,0,0,0); +// UsbSendPacket((uint8_t *)&ack, sizeof(UsbCommand)); LED_B_OFF(); traceLen = 0;