DbpIntegers(0, data[i], data[i+1]);
}
+void SendVersion(void)
+{
+ char temp[48]; /* Limited data payload in USB packets */
+ DbpString("Prox/RFID mark3 RFID instrument");
+ FpgaGatherVersion(temp, sizeof(temp));
+ DbpString(temp);
+}
+
// samy's sniff and repeat routine
void SamyRun()
{
case CMD_SET_LF_DIVISOR:
FpgaSendCommand(FPGA_CMD_SET_DIVISOR, c->ext1);
break;
+ case CMD_VERSION:
+ SendVersion();
+ break;
#ifdef WITH_LCD
case CMD_LCD_RESET:
LCDReset();
void FpgaSendCommand(WORD cmd, WORD v);\r
void FpgaWriteConfWord(BYTE v);\r
void FpgaDownloadAndGo(void);\r
+void FpgaGatherVersion(char *dst, int len);\r
void FpgaSetupSsc(void);\r
void SetupSpi(int mode);\r
void FpgaSetupSscDma(BYTE *buf, int len);\r
void *memcpy(void *dest, const void *src, int len);\r
void *memset(void *dest, int c, int len);\r
int memcmp(const void *av, const void *bv, int len);\r
+char *strncat(char *dest, const char *src, unsigned int n);\r
void SpinDelay(int ms);\r
void SpinDelayUs(int us);\r
void LED(int led, int ms);\r
DownloadFPGA((DWORD *)0x2000, 10524, 1);\r
}\r
\r
+void FpgaGatherVersion(char *dst, int len)\r
+{\r
+ char *fpga_info; \r
+ unsigned int fpga_info_len;\r
+ dst[0] = 0;\r
+ if(!bitparse_find_section('e', (void**)&fpga_info, &fpga_info_len)) {\r
+ strncat(dst, "FPGA image: legacy image without version information", len-1);\r
+ } else {\r
+ strncat(dst, "FPGA image built", len-1);\r
+ /* USB packets only have 48 bytes data payload, so be terse */\r
+#if 0\r
+ if(bitparse_find_section('a', (void**)&fpga_info, &fpga_info_len) && fpga_info[fpga_info_len-1] == 0 ) {\r
+ strncat(dst, " from ", len-1);\r
+ strncat(dst, fpga_info, len-1);\r
+ }\r
+ if(bitparse_find_section('b', (void**)&fpga_info, &fpga_info_len) && fpga_info[fpga_info_len-1] == 0 ) {\r
+ strncat(dst, " for ", len-1);\r
+ strncat(dst, fpga_info, len-1);\r
+ }\r
+#endif\r
+ if(bitparse_find_section('c', (void**)&fpga_info, &fpga_info_len) && fpga_info[fpga_info_len-1] == 0 ) {\r
+ strncat(dst, " on ", len-1);\r
+ strncat(dst, fpga_info, len-1);\r
+ }\r
+ if(bitparse_find_section('d', (void**)&fpga_info, &fpga_info_len) && fpga_info[fpga_info_len-1] == 0 ) {\r
+ strncat(dst, " at ", len-1);\r
+ strncat(dst, fpga_info, len-1);\r
+ }\r
+ }\r
+}\r
+\r
//-----------------------------------------------------------------------------\r
// Send a 16 bit command/data pair to the FPGA.\r
// The bit format is: C3 C2 C1 C0 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0\r
return l;\r
}\r
\r
+char* strncat(char *dest, const char *src, unsigned int n)\r
+{\r
+ unsigned int dest_len = strlen(dest);\r
+ unsigned int i;\r
+ \r
+ for (i = 0 ; i < n && src[i] != '\0' ; i++)\r
+ dest[dest_len + i] = src[i];\r
+ dest[dest_len + i] = '\0';\r
+ \r
+ return dest;\r
+}\r
+\r
+\r
void LEDsoff()\r
{\r
LED_A_OFF();\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
SendCommand(&c, FALSE);\r
}\r
\r
+static void CmdVersion(char *str)\r
+{\r
+ UsbCommand c;\r
+ c.cmd = CMD_VERSION;\r
+ SendCommand(&c, FALSE);\r
+}\r
+\r
static void CmdLcdReset(char *str)\r
{\r
UsbCommand c;\r
{"tiwrite", CmdTIWrite, 0, "Write new data to a r/w TI 134 kHz tag"},\r
{"threshold", CmdThreshold, 1, "Maximize/minimize every value in the graph window depending on threshold"},\r
{"tune", CmdTune, 0, "Measure antenna tuning"},\r
+ {"version", CmdVersion, 0, "Show version inforation about the connected Proxmark"},\r
{"vchdemod", CmdVchdemod, 0, "['clone'] -- Demodulate samples for VeriChip"},\r
{"zerocrossings", CmdZerocrossings, 1, "Count time between zero-crossings"},\r
};\r