X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/393c3ef933553e628635590ca2b8237d07e9e0e3..46cd40465a32be6ec9059aa8673ef9d84adb9517:/client/flash.c diff --git a/client/flash.c b/client/flash.c index dc036636..68d3b097 100644 --- a/client/flash.c +++ b/client/flash.c @@ -1,24 +1,13 @@ -#ifdef WIN32 -#include -#include -#define bzero(b,len) (memset((b), '\0', (len)), (void) 0) -BOOL UsbConnect(void); -#else -#include -#endif - -#include #include #include #include -#include +#include "sleep.h" +#include "proxusb.h" #include "flash.h" #include "elf.h" -#include "proxusb.h" static uint32_t ExpectedAddr; static uint8_t QueuedToSend[256]; -static BOOL AllWritten; #define PHYSICAL_FLASH_START 0x100000 #define PHYSICAL_FLASH_END 0x200000 @@ -67,8 +56,6 @@ void WriteBlock(unsigned int block_start, unsigned int len, unsigned char *buf) memcpy(c.d.asBytes, temp_buf+240, 16); SendCommand(&c); WaitForAck(); - - AllWritten = true; } void LoadFlashFromFile(const char *file, int start_addr, int end_addr) @@ -201,7 +188,7 @@ unsigned int EnterFlashState(void) if (state & DEVICE_INFO_FLAG_CURRENT_MODE_OS) { fprintf(stderr,"Entering flash-mode...\n"); UsbCommand c; - bzero(&c, sizeof(c)); + memset(&c, 0, sizeof (c)); if ((state & DEVICE_INFO_FLAG_BOOTROM_PRESENT) && (state & DEVICE_INFO_FLAG_OSIMAGE_PRESENT)) { /* New style handover: Send CMD_START_FLASH, which will reset the board and @@ -219,15 +206,10 @@ unsigned int EnterFlashState(void) fprintf(stderr,"Waiting for Proxmark to reappear on USB... "); } -#ifdef WIN32 - Sleep(1000); - while (!UsbConnect()) { Sleep(1000); } -#else CloseProxmark(); sleep(1); while (!OpenProxmark(0)) { sleep(1); } -#endif fprintf(stderr,"Found.\n"); return GetProxmarkState();