diff --git a/armsrc/appmain.c b/armsrc/appmain.c index a89525ad1..bfc21cf76 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1027,6 +1027,14 @@ void UsbPacketReceived(uint8_t *packet, int len) { SmartCardAtr(); break; } + case CMD_SMART_SETBAUD:{ + SmartCardSetBaud(c->arg[0]); + 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; diff --git a/common/i2c.c b/common/i2c.c index 32e087920..021949389 100644 --- a/common/i2c.c +++ b/common/i2c.c @@ -616,4 +616,32 @@ void SmartCardUpgrade(uint64_t arg0) { } StopTicks(); cmd_send(CMD_ACK, isOK, pos, 0, 0, 0); +} + +void SmartCardSetBaud(uint64_t arg0) { + StartTicks(); + I2C_Reset_EnterMainProgram(); + + bool isOK = true; + //uint16_t baud = arg0; + // Send SET BAUD + // start [C0 04] stop + //I2C_WriteByte(0x00, I2C_DEVICE_CMD_SETBAUD, I2C_DEVICE_ADDRESS_MAIN); + + StopTicks(); + cmd_send(CMD_ACK, isOK, 0, 0, 0, 0); +} + +void SmartCardSetClock(uint64_t arg0) { + StartTicks(); + I2C_Reset_EnterMainProgram(); + + bool isOK = true; + //uint16_t clockrate = arg0; + // Send SIM CLC + // start [C0 04] stop + //I2C_WriteByte(0x00, I2C_DEVICE_CMD_SIM_CLC, I2C_DEVICE_ADDRESS_MAIN); + + StopTicks(); + cmd_send(CMD_ACK, isOK, 0, 0, 0, 0); } \ No newline at end of file diff --git a/common/i2c.h b/common/i2c.h index 569110e3a..0e7e5e5ba 100644 --- a/common/i2c.h +++ b/common/i2c.h @@ -39,6 +39,7 @@ bool I2C_WriteFW(uint8_t *data, uint8_t len, uint8_t msb, uint8_t lsb, uint8_t d void SmartCardAtr(void); void SmartCardRaw(uint64_t arg0, uint64_t arg1, uint8_t *data); void SmartCardUpgrade(uint64_t arg0); - +void SmartCardSetBaud(uint64_t arg0); +void SmartCardSetClock(uint64_t arg0); void I2C_print_status(void); #endif \ No newline at end of file diff --git a/include/usb_cmd.h b/include/usb_cmd.h index c136d8b21..d33ab3d7d 100644 --- a/include/usb_cmd.h +++ b/include/usb_cmd.h @@ -80,6 +80,8 @@ typedef struct{ #define CMD_SMART_UPGRADE 0x0141 #define CMD_SMART_UPLOAD 0x0142 #define CMD_SMART_ATR 0x0143 +#define CMD_SMART_SETBAUD 0x0144 +#define CMD_SMART_SETCLOCK 0x0145 // For low-frequency tags #define CMD_READ_TI_TYPE 0x0202