#include <stdio.h>
#include <string.h>
+#include <inttypes.h>
+
#include "proxmark3.h"
#include "apps.h"
#include "util.h"
void iso14a_set_timeout(uint32_t timeout) {
// adjust timeout by FPGA delays and 2 additional ssp_frames to detect SOF
iso14a_timeout = timeout + (DELAY_AIR2ARM_AS_READER + DELAY_ARM2AIR_AS_READER)/(16*8) + 2;
- if(MF_DBGLEVEL >= 3) Dbprintf("ISO14443A Timeout set to %ld (%dms)", timeout, timeout / 106);
+ if (MF_DBGLEVEL >= 3) Dbprintf("ISO14443A Timeout set to %" PRIu32 " (%dms)", timeout, timeout / 106);
}
set_tracing(true);
- if(param & ISO14A_CLEAR_TRACE) {
+ if (param & ISO14A_CLEAR_TRACE) {
clear_trace();
}
- if(param & ISO14A_REQUEST_TRIGGER) {
+ if (param & ISO14A_REQUEST_TRIGGER) {
iso14a_set_trigger(true);
}
- if(param & ISO14A_CONNECT) {
+ if (param & ISO14A_CONNECT) {
LED_A_ON();
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
if(!(param & ISO14A_NO_SELECT)) {
}
FpgaDisableTracing();
LED_B_ON();
- cmd_send(CMD_ACK,arg0,card->uidlen,0,buf,sizeof(iso14a_card_select_t));
+ cmd_send(CMD_NACK,arg0,card->uidlen,0,buf,sizeof(iso14a_card_select_t));
LED_B_OFF();
}
}
- if(param & ISO14A_SET_TIMEOUT) {
+ if (param & ISO14A_SET_TIMEOUT) {
iso14a_set_timeout(timeout);
}
- if(param & ISO14A_APDU && !cantSELECT) {
+ if (param & ISO14A_APDU && !cantSELECT) {
uint8_t res;
arg0 = iso14_apdu(cmd, len, (param & ISO14A_SEND_CHAINING), buf, &res);
FpgaDisableTracing();
LED_B_OFF();
}
- if(param & ISO14A_RAW && !cantSELECT) {
- if(param & ISO14A_APPEND_CRC) {
+ if (param & ISO14A_RAW && !cantSELECT) {
+ if (param & ISO14A_APPEND_CRC) {
if(param & ISO14A_TOPAZMODE) {
AppendCrc14443b(cmd,len);
} else {
len += 2;
if (lenbits) lenbits += 16;
}
- if(lenbits>0) { // want to send a specific number of bits (e.g. short commands)
- if(param & ISO14A_TOPAZMODE) {
+ if (lenbits > 0) { // want to send a specific number of bits (e.g. short commands)
+ if (param & ISO14A_TOPAZMODE) {
int bits_to_send = lenbits;
uint16_t i = 0;
ReaderTransmitBitsPar(&cmd[i++], MIN(bits_to_send, 7), NULL, NULL); // first byte is always short (7bits) and no parity
ReaderTransmitBitsPar(cmd, lenbits, par, NULL); // bytes are 8 bit with odd parity
}
} else { // want to send complete bytes only
- if(param & ISO14A_TOPAZMODE) {
+ if (param & ISO14A_TOPAZMODE) {
uint16_t i = 0;
ReaderTransmitBitsPar(&cmd[i++], 7, NULL, NULL); // first byte: 7 bits, no paritiy
while (i < len) {
FpgaDisableTracing();
LED_B_ON();
- cmd_send(CMD_ACK,arg0,0,0,buf,sizeof(buf));
+ cmd_send(CMD_ACK, arg0, 0, 0, buf, sizeof(buf));
LED_B_OFF();
}
- if(param & ISO14A_REQUEST_TRIGGER) {
+ if (param & ISO14A_REQUEST_TRIGGER) {
iso14a_set_trigger(false);
}
- if(param & ISO14A_NO_DISCONNECT) {
+ if (param & ISO14A_NO_DISCONNECT) {
return;
}