Add Smartcard functions (RDV4.0) (#646)

* allow common makefile options-defines

* remove non-existing file references

* Uncomment lcd option (still) not enabled by default

use Makefile_Enabled_Options.common
to enable lcd if desired.

* Add Smartcard Functions

* add smartcard to menu + make get atr work

sc is now functioning as far as my limited knowledge takes me

* sc cleanup - add init to all sc commands...

because cmds won't work until the first init happens.  (multiple inits
don't appear to affect it negatively)

* default options to exclude Smartcard

for main repo

* update changelog
This commit is contained in:
marshmellow42 2018-08-20 23:08:49 -04:00 committed by pwpiwi
commit 43591e6464
14 changed files with 1661 additions and 22 deletions

View file

@ -30,6 +30,10 @@
#ifdef WITH_LCD
#include "LCD.h"
#endif
#ifdef WITH_SMARTCARD
#include "i2c.h"
#endif
// Craig Young - 14a stand-alone code
#ifdef WITH_ISO14443a
@ -357,12 +361,15 @@ void SendStatus(void)
{
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);
}
@ -1253,6 +1260,31 @@ void UsbPacketReceived(uint8_t *packet, int len)
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();