chg: 'analyze a' - some fpc test changes.

This commit is contained in:
Chris 2018-11-16 23:59:14 +01:00
commit aa3b322d0f

View file

@ -1080,26 +1080,28 @@ void UsbPacketReceived(uint8_t *packet, int len) {
static const char* welcome = "Proxmark3 Serial interface ready\n"; static const char* welcome = "Proxmark3 Serial interface ready\n";
strncat(dest, welcome, sizeof(dest) - strlen(dest) - 1); strncat(dest, welcome, sizeof(dest) - strlen(dest) - 1);
sprintf(dest + strlen(dest) - 1, "Arg0 | 0x%" PRIx64 " \n", c->arg[0]); sprintf(dest + strlen(dest) - 1, "| Arg0 0x%" PRIx64 " \n", c->arg[0]);
sprintf(dest + strlen(dest) - 1, "Arg1 | 0x%" PRIx64 " \n", c->arg[1]); sprintf(dest + strlen(dest) - 1, "| Arg1 0x%" PRIx64 " \n", c->arg[1]);
sprintf(dest + strlen(dest) - 1, "Arg2 | 0x%" PRIx64 " \n", c->arg[2]); sprintf(dest + strlen(dest) - 1, "| Arg2 0x%" PRIx64 " \n", c->arg[2]);
sprintf(dest + strlen(dest) - 1, "bytes | 0x%02x 0x%02x 0x%02x 0x%02x \n" sprintf(dest + strlen(dest) - 1, "| bytes 0x%02x 0x%02x 0x%02x 0x%02x \n"
,c->d.asBytes[0], c->d.asBytes[1], c->d.asBytes[2], c->d.asBytes[3]); ,c->d.asBytes[0], c->d.asBytes[1], c->d.asBytes[2], c->d.asBytes[3]);
/*
UsbCommand txcmd; UsbCommand txcmd;
for (size_t i=0; i < sizeof(UsbCommand); i++) for (size_t i=0; i < sizeof(UsbCommand); i++)
((uint8_t*)&txcmd)[i] = 0x00; ((uint8_t*)&txcmd)[i] = 0x00;
// Compose the outgoing command frame // Compose the outgoing command frame
txcmd.cmd = CMD_DEBUG_PRINT_STRING; txcmd.cmd = CMD_DEBUG_PRINT_STRING;
txcmd.arg[0] = len; txcmd.arg[0] = strlen(dest);
txcmd.arg[1] = 0; txcmd.arg[1] = 0;
txcmd.arg[2] = 0; txcmd.arg[2] = 0;
memcpy(txcmd.d.asBytes, dest, USB_CMD_DATA_SIZE); memcpy(txcmd.d.asBytes, dest, USB_CMD_DATA_SIZE);
usart_init();
usart_writebuffer((uint8_t*)&txcmd, sizeof(UsbCommand)); usart_writebuffer((uint8_t*)&txcmd, sizeof(UsbCommand));
*/
DbpString("Starting to listen"); DbpString("Justs send to usart");
LED_A_ON(); LED_A_ON();
/* /*
uint8_t rx[sizeof(UsbCommand)]; uint8_t rx[sizeof(UsbCommand)];
@ -1110,7 +1112,7 @@ void UsbPacketReceived(uint8_t *packet, int len) {
DbpString("got 544"); DbpString("got 544");
} }
*/ */
cmd_send(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest)); //cmd_send(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest));
//DbpString("finished"); //DbpString("finished");
LED_A_OFF(); LED_A_OFF();
cmd_send(CMD_ACK,0,0,0,0,0); cmd_send(CMD_ACK,0,0,0,0,0);
@ -1196,7 +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);
@ -1231,7 +1232,6 @@ void UsbPacketReceived(uint8_t *packet, int len) {
if (!FlashInit()) { if (!FlashInit()) {
break; break;
} }
//Flash_CheckBusy(BUSY_TIMEOUT);
for(size_t i = 0; i < len; i += size) { for(size_t i = 0; i < len; i += size) {
len = MIN((len - i), size); len = MIN((len - i), size);