X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/902cb3c00b49535f0de9a3b6d5ba0c54260ccac1..ca363c2348145c3c7e67d27aa9a64ff065459d55:/armsrc/appmain.c?ds=sidebyside diff --git a/armsrc/appmain.c b/armsrc/appmain.c index e501dfdd..7fc399a6 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -79,7 +79,8 @@ void ToSendStuffBit(int b) void DbpString(char *str) { - cmd_send(CMD_DEBUG_PRINT_STRING,strlen(str),0,0,(byte_t*)str,strlen(str)); + byte_t len = strlen(str); + cmd_send(CMD_DEBUG_PRINT_STRING,len,0,0,(byte_t*)str,len); // /* this holds up stuff unless we're connected to usb */ // if (!UsbConnected()) // return; @@ -387,8 +388,9 @@ void SamyRun() for (;;) { - UsbPoll(FALSE); - WDT_HIT(); +// UsbPoll(FALSE); + usb_poll(); + WDT_HIT(); // Was our button held down or pressed? int button_pressed = BUTTON_HELD(1000); @@ -635,8 +637,8 @@ void UsbPacketReceived(uint8_t *packet, int len) case CMD_HID_SIM_TAG: CmdHIDsimTAG(c->arg[0], c->arg[1], 1); // Simulate HID tag by ID break; - case CMD_HID_CLONE_TAG: - CopyHIDtoT55x7(c->arg[0], c->arg[1]); // Clone HID tag by ID to T55x7 + case CMD_HID_CLONE_TAG: // Clone HID tag by ID to T55x7 + CopyHIDtoT55x7(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes[0]); break; case CMD_EM410X_WRITE_TAG: WriteEM410x(c->arg[0], c->arg[1], c->arg[2]); @@ -661,6 +663,26 @@ void UsbPacketReceived(uint8_t *packet, int len) case CMD_INDALA_CLONE_TAG_L: // Clone Indala 224-bit tag by UID to T55x7 CopyIndala224toT55x7(c->d.asDwords[0], c->d.asDwords[1], c->d.asDwords[2], c->d.asDwords[3], c->d.asDwords[4], c->d.asDwords[5], c->d.asDwords[6]); break; + case CMD_T55XX_READ_BLOCK: + T55xxReadBlock(c->arg[1], c->arg[2],c->d.asBytes[0]); + break; + case CMD_T55XX_WRITE_BLOCK: + T55xxWriteBlock(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes[0]); + break; + case CMD_T55XX_READ_TRACE: // Clone HID tag by ID to T55x7 + T55xxReadTrace(); + break; + case CMD_PCF7931_READ: // Read PCF7931 tag + ReadPCF7931(); + cmd_send(CMD_ACK,0,0,0,0,0); +// UsbSendPacket((uint8_t*)&ack, sizeof(ack)); + break; + case CMD_EM4X_READ_WORD: + EM4xReadWord(c->arg[1], c->arg[2],c->d.asBytes[0]); + break; + case CMD_EM4X_WRITE_WORD: + EM4xWriteWord(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes[0]); + break; #endif #ifdef WITH_HITAG @@ -743,7 +765,7 @@ void UsbPacketReceived(uint8_t *packet, int len) ReaderIso14443a(c); break; case CMD_SIMULATE_TAG_ISO_14443a: - SimulateIso14443aTag(c->arg[0], c->arg[1], c->arg[2]); // ## Simulate iso14443a tag - pass tag type & UID + SimulateIso14443aTag(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes); // ## Simulate iso14443a tag - pass tag type & UID break; case CMD_EPA_PACE_COLLECT_NONCE: EPA_PACE_Collect_Nonce(c); @@ -905,7 +927,7 @@ void UsbPacketReceived(uint8_t *packet, int len) case CMD_SETUP_WRITE: case CMD_FINISH_WRITE: case CMD_HARDWARE_RESET: { - USB_D_PLUS_PULLUP_OFF(); + usb_disable(); SpinDelay(1000); SpinDelay(1000); AT91C_BASE_RSTC->RSTC_RCR = RST_CONTROL_KEY | AT91C_RSTC_PROCRST; @@ -918,7 +940,7 @@ void UsbPacketReceived(uint8_t *packet, int len) if(common_area.flags.bootrom_present) { common_area.command = COMMON_AREA_COMMAND_ENTER_FLASH_MODE; } - USB_D_PLUS_PULLUP_OFF(); + usb_disable(); AT91C_BASE_RSTC->RSTC_RCR = RST_CONTROL_KEY | AT91C_RSTC_PROCRST; for(;;); } break; @@ -953,9 +975,8 @@ void __attribute__((noreturn)) AppMain(void) LED_B_OFF(); LED_A_OFF(); - // Init USB device + // Init USB device` usb_enable(); - UsbStart(); // UsbStart(); // The FPGA gets its clock from us from PCK0 output, so set that up.