X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/1dea88f97640f5979b977a14347c558fabd5496c..b961ef035a58d8c5fb12386ddad4c56648fbe153:/bootrom/bootrom.c diff --git a/bootrom/bootrom.c b/bootrom/bootrom.c index f98c1108..83794d9f 100644 --- a/bootrom/bootrom.c +++ b/bootrom/bootrom.c @@ -117,8 +117,16 @@ void UsbPacketReceived(BYTE *packet, int len) MC_FLASH_COMMAND_PAGEN((c->arg[0]-(int)&_flash_start)/AT91C_IFLASH_PAGE_SIZE) | AT91C_MC_FCMD_START_PROG; } - while(!(AT91C_BASE_EFC0->EFC_FSR & MC_FLASH_STATUS_READY)) + + uint32_t sr; + + while(!((sr = AT91C_BASE_EFC0->EFC_FSR) & MC_FLASH_STATUS_READY)) ; + if(sr & (MC_FLASH_STATUS_LOCKE | MC_FLASH_STATUS_PROGE)) { + dont_ack = 1; + c->cmd = CMD_NACK; + UsbSendPacket(packet, len); + } break; case CMD_HARDWARE_RESET: