#include "cmd.h"
#include "proxmark3.h"
#include "apps.h"
+#include "fpga.h"
#include "util.h"
#include "printf.h"
#include "string.h"
#include "legicrf.h"
+#include "legicrfsim.h"
#include "hitag2.h"
#include "hitagS.h"
#include "lfsampling.h"
#ifdef WITH_LCD
#include "LCD.h"
#endif
+#ifdef WITH_SMARTCARD
+ #include "i2c.h"
+#endif
+
// Craig Young - 14a stand-alone code
#ifdef WITH_ISO14443a
extern struct version_information version_information;
/* bootrom version information is pointed to from _bootphase1_version_pointer */
extern char *_bootphase1_version_pointer, _flash_start, _flash_end, _bootrom_start, _bootrom_end, __data_src_start__;
+
void SendVersion(void)
{
char temp[USB_CMD_DATA_SIZE]; /* Limited data payload in USB packets */
FormatVersionInformation(temp, sizeof(temp), "os: ", &version_information);
strncat(VersionString, temp, sizeof(VersionString) - strlen(VersionString) - 1);
- FpgaGatherVersion(FPGA_BITSTREAM_LF, temp, sizeof(temp));
- strncat(VersionString, temp, sizeof(VersionString) - strlen(VersionString) - 1);
- FpgaGatherVersion(FPGA_BITSTREAM_HF, temp, sizeof(temp));
- strncat(VersionString, temp, sizeof(VersionString) - strlen(VersionString) - 1);
+ for (int i = 0; i < fpga_bitstream_num; i++) {
+ strncat(VersionString, fpga_version_information[i], sizeof(VersionString) - strlen(VersionString) - 1);
+ if (i < fpga_bitstream_num - 1) {
+ strncat(VersionString, "\n", sizeof(VersionString) - strlen(VersionString) - 1);
+ }
+ }
// Send Chip ID and used flash memory
uint32_t text_and_rodata_section_size = (uint32_t)&__data_src_start__ - (uint32_t)&_flash_start;
{
BigBuf_print_status();
Fpga_print_status();
+#ifdef WITH_SMARTCARD
+ I2C_print_status();
+#endif
printConfig(); //LF Sampling config
printUSBSpeed();
Dbprintf("Various");
- Dbprintf(" MF_DBGLEVEL......%d", MF_DBGLEVEL);
- Dbprintf(" ToSendMax........%d",ToSendMax);
- Dbprintf(" ToSendBit........%d",ToSendBit);
+ Dbprintf(" MF_DBGLEVEL........%d", MF_DBGLEVEL);
+ Dbprintf(" ToSendMax..........%d", ToSendMax);
+ Dbprintf(" ToSendBit..........%d", ToSendBit);
cmd_send(CMD_ACK,1,0,0,0,0);
}
-#if defined(WITH_ISO14443a_StandAlone) || defined(WITH_LF)
+#if defined(WITH_ISO14443a_StandAlone) || defined(WITH_LF_StandAlone)
#define OPTS 2
}
}
}
-#elif WITH_LF
+#elif WITH_LF_StandAlone
// samy's sniff and repeat routine
void SamyRun()
{
#ifdef WITH_LEGICRF
case CMD_SIMULATE_TAG_LEGIC_RF:
- LegicRfSimulate(c->arg[0], c->arg[1], c->arg[2]);
+ LegicRfSimulate(c->arg[0]);
break;
case CMD_WRITER_LEGIC_RF:
HfSnoop(c->arg[0], c->arg[1]);
break;
#endif
+#ifdef WITH_SMARTCARD
+ case CMD_SMART_ATR: {
+ SmartCardAtr();
+ break;
+ }
+ case CMD_SMART_SETCLOCK:{
+ SmartCardSetClock(c->arg[0]);
+ break;
+ }
+ case CMD_SMART_RAW: {
+ SmartCardRaw(c->arg[0], c->arg[1], c->d.asBytes);
+ break;
+ }
+ case CMD_SMART_UPLOAD: {
+ // upload file from client
+ uint8_t *mem = BigBuf_get_addr();
+ memcpy( mem + c->arg[0], c->d.asBytes, USB_CMD_DATA_SIZE);
+ cmd_send(CMD_ACK,1,0,0,0,0);
+ break;
+ }
+ case CMD_SMART_UPGRADE: {
+ SmartCardUpgrade(c->arg[0]);
+ break;
+ }
+#endif
case CMD_BUFF_CLEAR:
BigBuf_Clear();
}
WDT_HIT();
-#ifdef WITH_LF
+#ifdef WITH_LF_StandAlone
#ifndef WITH_ISO14443a_StandAlone
if (BUTTON_HELD(1000) > 0)
SamyRun();