for(i = 0; i < n; i += 12) {\r
UsbCommand c;\r
c.cmd = CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K;\r
- c.ext1 = i;\r
+ c.arg[0] = i;\r
SendCommand(&c, FALSE);\r
ReceiveCommand(&c);\r
if(c.cmd != CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) {\r
{\r
UsbCommand c;\r
c.cmd = CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443;\r
- c.ext1 = atoi(str);\r
+ c.arg[0] = atoi(str);\r
SendCommand(&c, FALSE);\r
}\r
\r
{\r
UsbCommand c;\r
c.cmd = CMD_READ_SRI512_TAG;\r
- c.ext1 = atoi(str);\r
+ c.arg[0] = atoi(str);\r
SendCommand(&c, FALSE);\r
}\r
-
-/* New command to read the contents of a SRIX4K tag
- * SRIX4K tags are ISO14443-B modulated memory tags,
- * this command just dumps the contents of the memory/
- */
-static void CmdSrix4kread(char *str)
-{
- UsbCommand c;
- c.cmd = CMD_READ_SRIX4K_TAG;
- c.ext1 = atoi(str);
- SendCommand(&c, FALSE);
-}
-
-
+\r
+/* New command to read the contents of a SRIX4K tag\r
+ * SRIX4K tags are ISO14443-B modulated memory tags,\r
+ * this command just dumps the contents of the memory/\r
+ */\r
+static void CmdSrix4kread(char *str)\r
+{\r
+ UsbCommand c;\r
+ c.cmd = CMD_READ_SRIX4K_TAG;\r
+ c.arg[0] = atoi(str);\r
+ SendCommand(&c, FALSE);\r
+}\r
+\r
+\r
\r
// ## New command\r
static void CmdHi14areader(char *str)\r
{\r
UsbCommand c;\r
c.cmd = CMD_READER_ISO_14443a;\r
- c.ext1 = atoi(str);\r
+ c.arg[0] = atoi(str);\r
SendCommand(&c, FALSE);\r
}\r
\r
{\r
UsbCommand c;\r
c.cmd = CMD_READER_ISO_15693;\r
- c.ext1 = atoi(str);\r
+ c.arg[0] = atoi(str);\r
SendCommand(&c, FALSE);\r
}\r
\r
{\r
UsbCommand c;\r
c.cmd = CMD_SIMTAG_ISO_15693;\r
- c.ext1 = atoi(str);\r
+ c.arg[0] = atoi(str);\r
SendCommand(&c, FALSE);\r
}\r
\r
{\r
UsbCommand c;\r
c.cmd = CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM;\r
- c.ext1 = atoi(str);\r
+ c.arg[0] = atoi(str);\r
SendCommand(&c, FALSE);\r
}\r
\r
{\r
UsbCommand c;\r
c.cmd = CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443;\r
- c.ext1 = atoi(str);\r
+ c.arg[0] = atoi(str);\r
SendCommand(&c, FALSE);\r
\r
//CmdHisamplest(str);\r
while(CmdHisamplest(str,atoi(str))==0) {\r
c.cmd = CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443;\r
- c.ext1 = atoi(str);\r
+ c.arg[0] = atoi(str);\r
SendCommand(&c, FALSE);\r
}\r
RepaintGraphWindow();\r
\r
c.cmd = CMD_SIMULATE_TAG_ISO_14443a;\r
// c.ext should be set to *str or convert *str to the correct format for a uid\r
- c.ext1 = hi;\r
- c.ext2 = lo;\r
+ c.arg[0] = hi;\r
+ c.arg[1] = lo;\r
PrintToScrollback("Emulating 14443A TAG with UID %x%16x", hi, lo);\r
SendCommand(&c, FALSE);\r
}\r
c.d.asBytes[j] = GraphBuffer[i+j];\r
}\r
c.cmd = CMD_DOWNLOADED_SIM_SAMPLES_125K;\r
- c.ext1 = i;\r
+ c.arg[0] = i;\r
SendCommand(&c, FALSE);\r
}\r
\r
UsbCommand c;\r
c.cmd = CMD_SIMULATE_TAG_125K;\r
- c.ext1 = GraphTraceLen;\r
+ c.arg[0] = GraphTraceLen;\r
SendCommand(&c, FALSE);\r
}\r
\r
{\r
UsbCommand c;\r
c.cmd = CMD_LF_SIMULATE_BIDIR;\r
- c.ext1 = 47; /* Set ADC to twice the carrier for a slight supersampling */\r
- c.ext2 = 384;\r
+ c.arg[0] = 47; /* Set ADC to twice the carrier for a slight supersampling */\r
+ c.arg[1] = 384;\r
SendCommand(&c, FALSE);\r
}\r
\r
UsbCommand c;\r
// 'h' means higher-low-frequency, 134 kHz\r
if(*str == 'h') {\r
- c.ext1 = 1;\r
+ c.arg[0] = 1;\r
} else if (*str == '\0') {\r
- c.ext1 = 0;\r
+ c.arg[0] = 0;\r
} else {\r
PrintToScrollback("use 'loread' or 'loread h'");\r
return;\r
UsbCommand c;\r
// 'l' means LF - 125/134 kHz\r
if(*str == 'l') {\r
- c.ext1 = 1;\r
+ c.arg[0] = 1;\r
} else if (*str == 'h') {\r
- c.ext1 = 2;\r
+ c.arg[0] = 2;\r
} else if (*str != '\0') {\r
PrintToScrollback("use 'detectreader' or 'detectreader l' or 'detectreader h'");\r
return;\r
\r
UsbCommand c;\r
c.cmd = CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K;\r
- sscanf(str, "%i %i %i %s %s", &c.ext1, &c.ext2, &c.ext3, (char *) &c.d.asBytes,(char *) &dummy+1);\r
+ sscanf(str, "%i %i %i %s %s", &c.arg[0], &c.arg[1], &c.arg[2], (char *) &c.d.asBytes,(char *) &dummy+1);\r
// in case they specified 'h'\r
strcpy((char *)&c.d.asBytes + strlen((char *)c.d.asBytes), dummy);\r
SendCommand(&c, FALSE);\r
for(i = 0; i < n; i += 12) {\r
UsbCommand c;\r
c.cmd = CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K;\r
- c.ext1 = i;\r
+ c.arg[0] = i;\r
SendCommand(&c, FALSE);\r
ReceiveCommand(&c);\r
if(c.cmd != CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) {\r
for(i = 0; i < n; i += 12) {\r
UsbCommand c;\r
c.cmd = CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K;\r
- c.ext1 = i;\r
+ c.arg[0] = i;\r
SendCommand(&c, FALSE);\r
ReceiveCommand(&c);\r
if(c.cmd != CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) {\r
for(i = 0; i < n; i += 12) {\r
UsbCommand c;\r
c.cmd = CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K;\r
- c.ext1 = i;\r
+ c.arg[0] = i;\r
SendCommand(&c, FALSE);\r
ReceiveCommand(&c);\r
if(c.cmd != CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) {\r
for(i = 0; i < n; i += 12) {\r
UsbCommand c;\r
c.cmd = CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K;\r
- c.ext1 = i;\r
+ c.arg[0] = i;\r
SendCommand(&c, FALSE);\r
ReceiveCommand(&c);\r
if(c.cmd != CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) {\r
for(i = 0; i < n; i += 12) {\r
UsbCommand c;\r
c.cmd = CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K;\r
- c.ext1 = i;\r
+ c.arg[0] = i;\r
SendCommand(&c, FALSE);\r
ReceiveCommand(&c);\r
if(c.cmd != CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) {\r
for(i = 0; i < n; i += 12) {\r
UsbCommand c;\r
c.cmd = CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K;\r
- c.ext1 = i;\r
+ c.arg[0] = i;\r
SendCommand(&c, FALSE);\r
ReceiveCommand(&c);\r
if(c.cmd != CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K) {\r
int res=0;\r
\r
c.cmd = CMD_WRITE_TI_TYPE;\r
- res = sscanf(str, "0x%x 0x%x 0x%x ", &c.ext1, &c.ext2, &c.ext3);\r
- if (res == 2) c.ext3=0;\r
+ res = sscanf(str, "0x%x 0x%x 0x%x ", &c.arg[0], &c.arg[1], &c.arg[2]);\r
+ if (res == 2) c.arg[2]=0;\r
if (res<2)\r
PrintToScrollback("Please specify the data as two hex strings, optionally the CRC as a third");\r
else\r
PrintToScrollback("Emulating tag with ID %x%16x", hi, lo);\r
\r
c.cmd = CMD_HID_SIM_TAG;\r
- c.ext1 = hi;\r
- c.ext2 = lo;\r
+ c.arg[0] = hi;\r
+ c.arg[1] = lo;\r
SendCommand(&c, FALSE);\r
}\r
\r
{\r
UsbCommand c;\r
c.cmd = CMD_READ_MEM;\r
- c.ext1 = atoi(str);\r
+ c.arg[0] = atoi(str);\r
SendCommand(&c, FALSE);\r
}\r
\r
{\r
UsbCommand c;\r
c.cmd = CMD_LCD_RESET;\r
- c.ext1 = atoi(str);\r
+ c.arg[0] = atoi(str);\r
SendCommand(&c, FALSE);\r
}\r
\r
c.cmd = CMD_LCD;\r
sscanf(str, "%x %d", &i, &j);\r
while (j--) {\r
- c.ext1 = i&0x1ff;\r
+ c.arg[0] = i&0x1ff;\r
SendCommand(&c, FALSE);\r
}\r
}\r
{\r
UsbCommand c;\r
c.cmd = CMD_SET_LF_DIVISOR;\r
- c.ext1 = atoi(str);\r
- if (( c.ext1<0) || (c.ext1>255)) {\r
+ c.arg[0] = atoi(str);\r
+ if (( c.arg[0]<0) || (c.arg[0]>255)) {\r
PrintToScrollback("divisor must be between 19 and 255");\r
} else {\r
SendCommand(&c, FALSE);\r
- PrintToScrollback("Divisor set, expected freq=%dHz", 12000000/(c.ext1+1));\r
+ PrintToScrollback("Divisor set, expected freq=%dHz", 12000000/(c.arg[0]+1));\r
}\r
}\r
\r
UsbCommand c;\r
c.cmd = CMD_SET_ADC_MUX;\r
if(strcmp(str, "lopkd") == 0) {\r
- c.ext1 = 0;\r
+ c.arg[0] = 0;\r
} else if(strcmp(str, "loraw") == 0) {\r
- c.ext1 = 1;\r
+ c.arg[0] = 1;\r
} else if(strcmp(str, "hipkd") == 0) {\r
- c.ext1 = 2;\r
+ c.arg[0] = 2;\r
} else if(strcmp(str, "hiraw") == 0) {\r
- c.ext1 = 3;\r
+ c.arg[0] = 3;\r
}\r
SendCommand(&c, FALSE);\r
}\r
{"setlfdivisor", CmdSetDivisor, 0, "<19 - 255> -- Drive LF antenna at 12Mhz/(divisor+1)"},\r
{"setmux", CmdSetMux, 0, "<loraw|hiraw|lopkd|hipkd> -- Set the ADC mux to a specific value"},\r
{"sri512read", CmdSri512read, 0, "<int> -- Read contents of a SRI512 tag"},\r
- {"srix4kread", CmdSrix4kread, 0, "<int> -- Read contents of a SRIX4K tag"},
+ {"srix4kread", CmdSrix4kread, 0, "<int> -- Read contents of a SRIX4K tag"},\r
{"tidemod", CmdTIDemod, 1, "Demodulate raw bits for TI-type LF tag"},\r
{"tiread", CmdTIRead, 0, "Read and decode a TI 134 kHz tag"},\r
{"tiwrite", CmdTIWrite, 0, "Write new data to a r/w TI 134 kHz tag"},\r
switch(c->cmd) {\r
case CMD_DEBUG_PRINT_STRING: {\r
char s[100];\r
- if(c->ext1 > 70 || c->ext1 < 0) {\r
- c->ext1 = 0;\r
+ if(c->arg[0] > 70 || c->arg[0] < 0) {\r
+ c->arg[0] = 0;\r
}\r
- memcpy(s, c->d.asBytes, c->ext1);\r
- s[c->ext1] = '\0';\r
+ memcpy(s, c->d.asBytes, c->arg[0]);\r
+ s[c->arg[0]] = '\0';\r
PrintToScrollback("#db# %s", s);\r
break;\r
}\r
\r
case CMD_DEBUG_PRINT_INTEGERS:\r
- PrintToScrollback("#db# %08x, %08x, %08x\r\n", c->ext1, c->ext2, c->ext3);\r
+ PrintToScrollback("#db# %08x, %08x, %08x\r\n", c->arg[0], c->arg[1], c->arg[2]);\r
break;\r
\r
case CMD_MEASURED_ANTENNA_TUNING: {\r
int peakv, peakf;\r
int vLf125, vLf134, vHf;\r
- vLf125 = c->ext1 & 0xffff;\r
- vLf134 = c->ext1 >> 16;\r
- vHf = c->ext2 & 0xffff;;\r
- peakf = c->ext3 & 0xffff;\r
- peakv = c->ext3 >> 16;\r
+ vLf125 = c->arg[0] & 0xffff;\r
+ vLf134 = c->arg[0] >> 16;\r
+ vHf = c->arg[1] & 0xffff;;\r
+ peakf = c->arg[2] & 0xffff;\r
+ peakv = c->arg[2] >> 16;\r
PrintToScrollback("");\r
PrintToScrollback("");\r
PrintToScrollback("# LF antenna: %5.2f V @ 125.00 kHz", vLf125/1000.0);\r
for(i = 0; i < 240; i += 48) {
c.cmd = CMD_SETUP_WRITE;
memcpy(c.d.asBytes, QueuedToSend+i, 48);
- c.ext1 = (i/4);
+ c.arg[0] = (i/4);
SendCommand(&c, TRUE);
}
c.cmd = CMD_FINISH_WRITE;
- c.ext1 = (ExpectedAddr-1) & (~255);
+ c.arg[0] = (ExpectedAddr-1) & (~255);
if(translate) {
- c.ext1 -= PHYSICAL_FLASH_START;
+ c.arg[0] -= PHYSICAL_FLASH_START;
}
- printf("c.ext1 = %08x\r", c.ext1);
+ printf("c.arg[0] = %08x\r", c.arg[0]);
memcpy(c.d.asBytes, QueuedToSend+240, 16);
SendCommand(&c, TRUE);
if(state & DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH) {
UsbCommand c;
c.cmd = CMD_START_FLASH;
- c.ext1 = p->start;
- c.ext2 = p->end;
+ c.arg[0] = p->start;
+ c.arg[1] = p->end;
/* Only send magic when flashing bootrom */
if(p->precious) {
- c.ext3 = START_FLASH_MAGIC;
+ c.arg[2] = START_FLASH_MAGIC;
} else {
- c.ext3 = 0;
+ c.arg[2] = 0;
}
SendCommand(&c, TRUE);
translate = 0;
state = DEVICE_INFO_FLAG_CURRENT_MODE_OS;
break;
case CMD_DEVICE_INFO:
- state = resp.ext1;
+ state = resp.arg[0];
break;
default:
fprintf(stderr, "Couldn't get proxmark state, bad response type: 0x%04X\n", resp.cmd);
for(i = 0; i < 240; i += 48) {\r
c.cmd = CMD_SETUP_WRITE;\r
memcpy(c.d.asBytes, QueuedToSend+i, 48);\r
- c.ext1 = (i/4);\r
+ c.arg[0] = (i/4);\r
SendCommand(&c, TRUE);\r
}\r
\r
c.cmd = CMD_FINISH_WRITE;\r
- c.ext1 = (ExpectedAddr-1) & (~255);\r
+ c.arg[0] = (ExpectedAddr-1) & (~255);\r
if(translate) {\r
- c.ext1 -= PHYSICAL_FLASH_START;\r
+ c.arg[0] -= PHYSICAL_FLASH_START;\r
}\r
- printf("Flashing address: %08x\r", c.ext1);\r
+ printf("Flashing address: %08x\r", c.arg[0]);\r
memcpy(c.d.asBytes, QueuedToSend+240, 16);\r
SendCommand(&c, TRUE);\r
\r
if(state & DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH) {\r
UsbCommand c;\r
c.cmd = CMD_START_FLASH;\r
- c.ext1 = p->start;\r
- c.ext2 = p->end;\r
+ c.arg[0] = p->start;\r
+ c.arg[1] = p->end;\r
\r
/* Only send magic when flashing bootrom */\r
if(p->precious) {\r
- c.ext3 = START_FLASH_MAGIC;\r
+ c.arg[2] = START_FLASH_MAGIC;\r
} else {\r
- c.ext3 = 0;\r
+ c.arg[2] = 0;\r
}\r
SendCommand(&c, TRUE);\r
translate = 0;\r
state = DEVICE_INFO_FLAG_CURRENT_MODE_OS;\r
break;\r
case CMD_DEVICE_INFO:\r
- state = resp.ext1;\r
+ state = resp.arg[0];\r
break;\r
default:\r
fprintf(stderr, "Couldn't get proxmark state, bad response type: 0x%04X\n", resp.cmd);\r
#ifndef __PROX_H\r
#define __PROX_H\r
-\r
+#ifdef _MSC_VER\r
+typedef DWORD uint32_t;\r
+typedef BYTE uint8_t;\r
+typedef WORD uint16_t;\r
+#define bool BOOL\r
+#else\r
+#include <stdint.h>\r
+#include <stdbool.h>\r
+#endif\r
#include "../include/usb_cmd.h"\r
\r
// prox.cpp\r
void ReceiveCommand(UsbCommand *c);\r
-BOOL ReceiveCommandPoll(UsbCommand *c);\r
-void SendCommand(UsbCommand *c, BOOL wantAck);\r
+bool ReceiveCommandPoll(UsbCommand *c);\r
+void SendCommand(UsbCommand *c, bool);\r
+void wait_for_response(uint32_t command_type);\r
\r
// gui.cpp\r
-void ShowGui();\r
+void ShowGui(void);\r
void HideGraphWindow(void);\r
void ShowGraphWindow(void);\r
void RepaintGraphWindow(void);\r
\r
// command.cpp\r
static void CmdBuffClear(char *str);\r
-static void GetFromBigBuf(BYTE *dest, int bytes);\r
+static void GetFromBigBuf(uint8_t *dest, int bytes);\r
static void CmdReset(char *str);\r
static void CmdQuit(char *str);\r
static void CmdEM410xread(char *str);\r
static int CmdHisamplest(char *str, int nrlow);\r
static void CmdHexsamples(char *str);\r
static void CmdHisampless(char *str);\r
-static WORD Iso15693Crc(BYTE *v, int n);\r
+static uint16_t Iso15693Crc(uint8_t *v, int n);\r
static void CmdHi14bdemod(char *str);\r
static void CmdHi14list(char *str);\r
static void CmdHi14alist(char *str);\r
#include <string.h>
#include <errno.h>
-#include "translate.h"
+//#include "translate.h"
#include "prox.h"
#include "proxmark3.h"
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
#include <unistd.h>
#include <usb.h>
#include <strings.h>
#include <errno.h>
-#include "translate.h"
#include "prox.h"
#include "proxmark3.h"
unsigned char return_on_error = 0;
unsigned char error_occured = 0;
-void SendCommand(UsbCommand *c, BOOL wantAck) {
+void SendCommand(UsbCommand *c, bool wantAck) {
int ret;
#if 0
\r
#ifndef __USB_CMD_H\r
#define __USB_CMD_H\r
+#ifdef _MSC_VER\r
+typedef DWORD uint32_t;\r
+typedef BYTE uint8_t;\r
+#define PACKED\r
+// stuff\r
+#else\r
+#include <stdint.h>\r
+#include <stdbool.h>\r
+#define PACKED __attribute__((packed))\r
+#endif\r
\r
typedef struct {\r
- DWORD cmd;\r
- DWORD ext1;\r
- DWORD ext2;\r
- DWORD ext3;\r
+ uint32_t cmd;\r
+ uint32_t arg[3];\r
union {\r
- BYTE asBytes[48];\r
- DWORD asDwords[12];\r
+ uint8_t asBytes[48];\r
+ uint32_t asDwords[12];\r
} d;\r
-} UsbCommand;\r
+} PACKED UsbCommand;\r
\r
// For the bootloader\r
-#define CMD_DEVICE_INFO 0x0000\r
-#define CMD_SETUP_WRITE 0x0001\r
-#define CMD_FINISH_WRITE 0x0003\r
-#define CMD_HARDWARE_RESET 0x0004\r
-#define CMD_START_FLASH 0x0005\r
-#define CMD_NACK 0x00fe\r
-#define CMD_ACK 0x00ff\r
+#define CMD_DEVICE_INFO 0x0000\r
+#define CMD_SETUP_WRITE 0x0001\r
+#define CMD_FINISH_WRITE 0x0003\r
+#define CMD_HARDWARE_RESET 0x0004\r
+#define CMD_START_FLASH 0x0005\r
+#define CMD_NACK 0x00fe\r
+#define CMD_ACK 0x00ff\r
\r
// For general mucking around\r
-#define CMD_DEBUG_PRINT_STRING 0x0100\r
-#define CMD_DEBUG_PRINT_INTEGERS 0x0101\r
-#define CMD_DEBUG_PRINT_BYTES 0x0102\r
-#define CMD_LCD_RESET 0x0103\r
-#define CMD_LCD 0x0104\r
-#define CMD_BUFF_CLEAR 0x0105\r
-#define CMD_READ_MEM 0x0106\r
-#define CMD_VERSION 0x0107\r
+#define CMD_DEBUG_PRINT_STRING 0x0100\r
+#define CMD_DEBUG_PRINT_INTEGERS 0x0101\r
+#define CMD_DEBUG_PRINT_BYTES 0x0102\r
+#define CMD_LCD_RESET 0x0103\r
+#define CMD_LCD 0x0104\r
+#define CMD_BUFF_CLEAR 0x0105\r
+#define CMD_READ_MEM 0x0106\r
+#define CMD_VERSION 0x0107\r
\r
// For low-frequency tags\r
-#define CMD_READ_TI_TYPE 0x0202\r
-#define CMD_WRITE_TI_TYPE 0x0203\r
-#define CMD_DOWNLOADED_RAW_BITS_TI_TYPE 0x0204\r
-#define CMD_ACQUIRE_RAW_ADC_SAMPLES_125K 0x0205\r
-#define CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K 0x0206\r
-#define CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K 0x0207\r
-#define CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K 0x0208\r
-#define CMD_DOWNLOADED_SIM_SAMPLES_125K 0x0209\r
-#define CMD_SIMULATE_TAG_125K 0x020A\r
-#define CMD_HID_DEMOD_FSK 0x020B\r
-#define CMD_HID_SIM_TAG 0x020C\r
-#define CMD_SET_LF_DIVISOR 0x020D\r
-#define CMD_LF_SIMULATE_BIDIR 0x020E\r
-#define CMD_SET_ADC_MUX 0x020F\r
+#define CMD_READ_TI_TYPE 0x0202\r
+#define CMD_WRITE_TI_TYPE 0x0203\r
+#define CMD_DOWNLOADED_RAW_BITS_TI_TYPE 0x0204\r
+#define CMD_ACQUIRE_RAW_ADC_SAMPLES_125K 0x0205\r
+#define CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K 0x0206\r
+#define CMD_DOWNLOAD_RAW_ADC_SAMPLES_125K 0x0207\r
+#define CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K 0x0208\r
+#define CMD_DOWNLOADED_SIM_SAMPLES_125K 0x0209\r
+#define CMD_SIMULATE_TAG_125K 0x020A\r
+#define CMD_HID_DEMOD_FSK 0x020B\r
+#define CMD_HID_SIM_TAG 0x020C\r
+#define CMD_SET_LF_DIVISOR 0x020D\r
+#define CMD_LF_SIMULATE_BIDIR 0x020E\r
+#define CMD_SET_ADC_MUX 0x020F\r
/* CMD_SET_ADC_MUX: ext1 is 0 for lopkd, 1 for loraw, 2 for hipkd, 3 for hiraw */\r
\r
// For the 13.56 MHz tags\r
-#define CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693 0x0300\r
-#define CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443 0x0301\r
-#define CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM 0x0302\r
-#define CMD_READ_SRI512_TAG 0x0303\r
-#define CMD_READ_SRIX4K_TAG 0x0304\r
-#define CMD_READER_ISO_15693 0x0310
-#define CMD_SIMTAG_ISO_15693 0x0311\r
-#define CMD_SIMULATE_TAG_HF_LISTEN 0x0380\r
-#define CMD_SIMULATE_TAG_ISO_14443 0x0381\r
-#define CMD_SNOOP_ISO_14443 0x0382\r
-#define CMD_SNOOP_ISO_14443a 0x0383\r
-#define CMD_SIMULATE_TAG_ISO_14443a 0x0384\r
-#define CMD_READER_ISO_14443a 0x0385\r
-#define CMD_SIMULATE_MIFARE_CARD 0x0386\r
-#define CMD_SIMULATE_TAG_LEGIC_RF 0x387\r
-#define CMD_READER_LEGIC_RF 0x388\r
+#define CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693 0x0300\r
+#define CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443 0x0301\r
+#define CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443_SIM 0x0302\r
+#define CMD_READ_SRI512_TAG 0x0303\r
+#define CMD_READ_SRIX4K_TAG 0x0304\r
+#define CMD_READER_ISO_15693 0x0310\r
+#define CMD_SIMTAG_ISO_15693 0x0311\r
+#define CMD_SIMULATE_TAG_HF_LISTEN 0x0380\r
+#define CMD_SIMULATE_TAG_ISO_14443 0x0381\r
+#define CMD_SNOOP_ISO_14443 0x0382\r
+#define CMD_SNOOP_ISO_14443a 0x0383\r
+#define CMD_SIMULATE_TAG_ISO_14443a 0x0384\r
+#define CMD_READER_ISO_14443a 0x0385\r
+#define CMD_SIMULATE_MIFARE_CARD 0x0386\r
+#define CMD_SIMULATE_TAG_LEGIC_RF 0x0387\r
+#define CMD_READER_LEGIC_RF 0x0388\r
\r
// For measurements of the antenna tuning\r
-#define CMD_MEASURE_ANTENNA_TUNING 0x0400\r
-#define CMD_MEASURED_ANTENNA_TUNING 0x0401\r
-#define CMD_LISTEN_READER_FIELD 0x0402\r
+#define CMD_MEASURE_ANTENNA_TUNING 0x0400\r
+#define CMD_MEASURED_ANTENNA_TUNING 0x0401\r
+#define CMD_LISTEN_READER_FIELD 0x0402\r
\r
// For direct FPGA control\r
-#define CMD_FPGA_MAJOR_MODE_OFF 0x0500\r
+#define CMD_FPGA_MAJOR_MODE_OFF 0x0500\r
+\r
+#define CMD_UNKNOWN 0xFFFF\r
+\r
+// CMD_DEVICE_INFO response packet has flags in arg[0], flag definitions:\r
+/* Whether a bootloader that understands the common_area is present */ \r
+#define DEVICE_INFO_FLAG_BOOTROM_PRESENT (1<<0)\r
+\r
+/* Whether a osimage that understands the common_area is present */\r
+#define DEVICE_INFO_FLAG_OSIMAGE_PRESENT (1<<1)\r
+\r
+/* Set if the bootloader is currently executing */\r
+#define DEVICE_INFO_FLAG_CURRENT_MODE_BOOTROM (1<<2)\r
+\r
+/* Set if the OS is currently executing */\r
+#define DEVICE_INFO_FLAG_CURRENT_MODE_OS (1<<3)\r
+\r
+/* Set if this device understands the extend start flash command */\r
+#define DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH (1<<4)\r
\r
-// CMD_DEVICE_INFO response packet has flags in ext1, flag definitions:\r
-#define DEVICE_INFO_FLAG_BOOTROM_PRESENT (1<<0) /* Whether a bootloader that understands the common_area is present */ \r
-#define DEVICE_INFO_FLAG_OSIMAGE_PRESENT (1<<1) /* Whether a osimage that understands the common_area is present */\r
-#define DEVICE_INFO_FLAG_CURRENT_MODE_BOOTROM (1<<2) /* Set if the bootloader is currently executing */\r
-#define DEVICE_INFO_FLAG_CURRENT_MODE_OS (1<<3) /* Set if the OS is currently executing */\r
-#define DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH (1<<4) /* Set if this device understands the extend start flash command */\r
+/* CMD_START_FLASH may have three arguments: start of area to flash, \r
+ end of area to flash, optional magic.\r
+ The bootrom will not allow to overwrite itself unless this magic\r
+ is given as third parameter */\r
\r
-// CMD_START_FLASH may have three arguments: start of area to flash, end of area to flash, optional magic defined below\r
-#define START_FLASH_MAGIC 0x54494f44 /* The bootrom will not allow to overwrite itself unless this magic is given as third parameter */\r
+#define START_FLASH_MAGIC 0x54494f44 // 'DOIT'\r
\r
#endif\r