mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
add: 'mem info' - rudamentary support for new command.
This commit is contained in:
parent
110a7b28cb
commit
6b7819276d
3 changed files with 51 additions and 5 deletions
|
@ -1169,7 +1169,7 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_WIPE_FLASH_MEM:
|
case CMD_WIPE_FLASH_MEM: {
|
||||||
LED_B_ON();
|
LED_B_ON();
|
||||||
uint8_t page = c->arg[0];
|
uint8_t page = c->arg[0];
|
||||||
uint8_t initalwipe = c->arg[1];
|
uint8_t initalwipe = c->arg[1];
|
||||||
|
@ -1186,6 +1186,7 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
||||||
cmd_send(CMD_ACK, isok, 0, 0, 0, 0);
|
cmd_send(CMD_ACK, isok, 0, 0, 0, 0);
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case CMD_DOWNLOAND_FLASH_MEM: {
|
case CMD_DOWNLOAND_FLASH_MEM: {
|
||||||
|
|
||||||
LED_B_ON();
|
LED_B_ON();
|
||||||
|
@ -1197,8 +1198,6 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
||||||
// arg0 = startindex
|
// arg0 = startindex
|
||||||
// arg1 = length bytes to transfer
|
// arg1 = length bytes to transfer
|
||||||
// arg2 = RFU
|
// arg2 = RFU
|
||||||
//Dbprintf("transfer to client parameters: %" PRIu32 " | %" PRIu32 " | %" PRIu32, startidx, numofbytes, c->arg[2]);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < numofbytes; i += USB_CMD_DATA_SIZE) {
|
for (size_t i = 0; i < numofbytes; i += USB_CMD_DATA_SIZE) {
|
||||||
len = MIN((numofbytes - i), USB_CMD_DATA_SIZE);
|
len = MIN((numofbytes - i), USB_CMD_DATA_SIZE);
|
||||||
|
|
||||||
|
@ -1215,6 +1214,23 @@ void UsbPacketReceived(uint8_t *packet, int len) {
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CMD_INFO_FLASH_MEM: {
|
||||||
|
|
||||||
|
LED_B_ON();
|
||||||
|
rdv40_validation_t *info = (rdv40_validation_t*)BigBuf_malloc( sizeof(rdv40_validation_t) );
|
||||||
|
|
||||||
|
bool isok = Flash_ReadData(FLASH_MEM_SIGNATURE_OFFSET, info->signature, FLASH_MEM_SIGNATURE_LEN);
|
||||||
|
|
||||||
|
if (FlashInit()) {
|
||||||
|
Flash_UniqueID( info->flashid);
|
||||||
|
FlashStop();
|
||||||
|
}
|
||||||
|
cmd_send(CMD_ACK, isok, 0, 0, info, sizeof(rdv40_validation_t));
|
||||||
|
BigBuf_free();
|
||||||
|
|
||||||
|
LED_B_OFF();
|
||||||
|
break;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
case CMD_SET_LF_DIVISOR:
|
case CMD_SET_LF_DIVISOR:
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Interlib Definitions
|
// Interlib Definitions
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -46,6 +46,35 @@ extern int MF_DBGLEVEL;
|
||||||
#endif
|
#endif
|
||||||
#define RAMFUNC __attribute((long_call, section(".ramfunc")))
|
#define RAMFUNC __attribute((long_call, section(".ramfunc")))
|
||||||
|
|
||||||
|
// RDV40 Section
|
||||||
|
#ifndef FLASH_MEM_BLOCK_SIZE
|
||||||
|
# define FLASH_MEM_BLOCK_SIZE 256
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FLASH_MEM_MAX_SIZE
|
||||||
|
# define FLASH_MEM_MAX_SIZE 0x3FFFF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FLASH_MEM_ID_LEN
|
||||||
|
# define FLASH_MEM_ID_LEN 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FLASH_MEM_SIGNATURE_LEN
|
||||||
|
# define FLASH_MEM_SIGNATURE_LEN 128
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FLASH_MEM_SIGNATURE_OFFSET
|
||||||
|
# define FLASH_MEM_SIGNATURE_OFFSET (FLASH_MEM_MAX_SIZE - FLASH_MEM_SIGNATURE_LEN)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// RDV40, validation structure to help identifying that client/firmware is talking with RDV40
|
||||||
|
typedef struct {
|
||||||
|
uint8_t magic[4];
|
||||||
|
uint8_t flashid[FLASH_MEM_ID_LEN];
|
||||||
|
uint8_t signature[FLASH_MEM_SIGNATURE_LEN];
|
||||||
|
} __attribute__((__packed__)) rdv40_validation_t;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,12 +67,13 @@ typedef struct{
|
||||||
#define CMD_DOWNLOAD_EML_BIGBUF 0x0110
|
#define CMD_DOWNLOAD_EML_BIGBUF 0x0110
|
||||||
#define CMD_DOWNLOADED_EML_BIGBUF 0x0111
|
#define CMD_DOWNLOADED_EML_BIGBUF 0x0111
|
||||||
|
|
||||||
// For Flash memory operations
|
// RDV40, Flash memory operations
|
||||||
#define CMD_READ_FLASH_MEM 0x0120
|
#define CMD_READ_FLASH_MEM 0x0120
|
||||||
#define CMD_WRITE_FLASH_MEM 0x0121
|
#define CMD_WRITE_FLASH_MEM 0x0121
|
||||||
#define CMD_WIPE_FLASH_MEM 0x0122
|
#define CMD_WIPE_FLASH_MEM 0x0122
|
||||||
#define CMD_DOWNLOAND_FLASH_MEM 0x0123
|
#define CMD_DOWNLOAND_FLASH_MEM 0x0123
|
||||||
#define CMD_DOWNLOADED_FLASHMEM 0x0124
|
#define CMD_DOWNLOADED_FLASHMEM 0x0124
|
||||||
|
#define CMD_INFO_FLASH_MEM 0x0125
|
||||||
|
|
||||||
// For low-frequency tags
|
// For low-frequency tags
|
||||||
#define CMD_READ_TI_TYPE 0x0202
|
#define CMD_READ_TI_TYPE 0x0202
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue