mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
increase upload block size for 15 eload, was 64 now 256
This commit is contained in:
parent
2972ff9694
commit
a6fa662d3c
2 changed files with 23 additions and 14 deletions
|
@ -1293,13 +1293,24 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_HF_ISO15693_EML_CLEAR: {
|
case CMD_HF_ISO15693_EML_CLEAR: {
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Note: we call FpgaDownloadAndGo(FPGA_BITSTREAM_HF_15) here although FPGA is not
|
||||||
|
// involved in dealing with emulator memory. But if it is called later, it might
|
||||||
|
// destroy the Emulator Memory.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
EmlClearIso15693();
|
EmlClearIso15693();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_HF_ISO15693_EML_SETMEM: {
|
case CMD_HF_ISO15693_EML_SETMEM: {
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Note: we call FpgaDownloadAndGo(FPGA_BITSTREAM_HF_15) here although FPGA is not
|
||||||
|
// involved in dealing with emulator memory. But if it is called later, it might
|
||||||
|
// destroy the Emulator Memory.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
FpgaDownloadAndGo(FPGA_BITSTREAM_HF_15);
|
||||||
struct p {
|
struct p {
|
||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
uint8_t count;
|
uint16_t count;
|
||||||
uint8_t data[];
|
uint8_t data[];
|
||||||
} PACKED;
|
} PACKED;
|
||||||
struct p *payload = (struct p *) packet->data.asBytes;
|
struct p *payload = (struct p *) packet->data.asBytes;
|
||||||
|
|
|
@ -1114,32 +1114,30 @@ static int CmdHF15Reader(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hf15EmlClear(void) {
|
static void hf15EmlClear(void) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_EML_CLEAR, NULL, 0);
|
SendCommandNG(CMD_HF_ISO15693_EML_CLEAR, NULL, 0);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
WaitForResponse(CMD_HF_ISO15693_EML_CLEAR, &resp);
|
WaitForResponse(CMD_HF_ISO15693_EML_CLEAR, &resp);
|
||||||
return PM3_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hf15EmlSetMem(uint8_t *data, uint8_t count, size_t offset) {
|
static int hf15EmlSetMem(uint8_t *data, uint16_t count, size_t offset) {
|
||||||
struct p {
|
struct p {
|
||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
uint8_t count;
|
uint16_t count;
|
||||||
uint8_t data[];
|
uint8_t data[];
|
||||||
} PACKED;
|
} PACKED;
|
||||||
|
|
||||||
size_t size = count;
|
if (count > (PM3_CMD_DATA_SIZE - sizeof(struct p))) {
|
||||||
if (size > (PM3_CMD_DATA_SIZE - sizeof(struct p))) {
|
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t paylen = sizeof(struct p) + size;
|
size_t paylen = sizeof(struct p) + count;
|
||||||
struct p *payload = calloc(1, paylen);
|
struct p *payload = calloc(1, paylen);
|
||||||
|
|
||||||
payload->offset = offset;
|
payload->offset = offset;
|
||||||
payload->count = count;
|
payload->count = count;
|
||||||
memcpy(payload->data, data, size);
|
memcpy(payload->data, data, count);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO15693_EML_SETMEM, (uint8_t *)payload, paylen);
|
SendCommandNG(CMD_HF_ISO15693_EML_SETMEM, (uint8_t *)payload, paylen);
|
||||||
|
@ -1194,7 +1192,7 @@ static int CmdHF15ELoad(const char *Cmd) {
|
||||||
// fast push mode
|
// fast push mode
|
||||||
g_conn.block_after_ACK = true;
|
g_conn.block_after_ACK = true;
|
||||||
|
|
||||||
int chuncksize = 64;
|
size_t chuncksize = 256;
|
||||||
size_t offset = 0;
|
size_t offset = 0;
|
||||||
|
|
||||||
while (bytes_read > 0) {
|
while (bytes_read > 0) {
|
||||||
|
@ -1203,8 +1201,8 @@ static int CmdHF15ELoad(const char *Cmd) {
|
||||||
g_conn.block_after_ACK = false;
|
g_conn.block_after_ACK = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tosend = MIN(chuncksize, bytes_read);
|
uint16_t bytestosend = MIN(chuncksize, bytes_read);
|
||||||
if (hf15EmlSetMem(data + offset, tosend, offset) != PM3_SUCCESS) {
|
if (hf15EmlSetMem(data + offset, bytestosend, offset) != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(FAILED, "Can't set emulator memory at offest: %zu / 0x%zx", offset, offset);
|
PrintAndLogEx(FAILED, "Can't set emulator memory at offest: %zu / 0x%zx", offset, offset);
|
||||||
free(data);
|
free(data);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -1212,8 +1210,8 @@ static int CmdHF15ELoad(const char *Cmd) {
|
||||||
PrintAndLogEx(NORMAL, "." NOLF);
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
offset += tosend;
|
offset += bytestosend;
|
||||||
bytes_read -= tosend;
|
bytes_read -= bytestosend;
|
||||||
}
|
}
|
||||||
free(data);
|
free(data);
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue