#define OUR_VID 0x9ac4\r
#define OUR_PID 0x4b8f\r
\r
+int offline = 0;\r
HANDLE UsbHandle;\r
\r
static void ShowError(void)\r
\r
DWORD written;\r
OVERLAPPED ov;\r
+\r
memset(&ov, 0, sizeof(ov));\r
WriteFile(UsbHandle, buf, 65, &written, &ov);\r
if(GetLastError() != ERROR_IO_PENDING) {\r
UsbCommand c;\r
memset(&c, 0, sizeof(c));\r
\r
- printf("expected = %08x flush, ", ExpectedAddr);\r
-\r
int i;\r
for(i = 0; i < 240; i += 48) {\r
c.cmd = CMD_SETUP_WRITE;\r
\r
c.cmd = CMD_FINISH_WRITE;\r
c.ext1 = (ExpectedAddr-1) & (~255);\r
- printf("c.ext1 = %08x\r", c.ext1);\r
+ printf("Flashing address: %08x\r", c.ext1);\r
memcpy(c.d.asBytes, QueuedToSend+240, 16);\r
SendCommand(&c, TRUE);\r
\r
int main(int argc, char **argv)\r
{\r
int i = 0;\r
-\r
+ \r
if(argc < 2) {\r
printf("Usage: %s bootrom file.s19\n", argv[0]);\r
printf(" %s load osimage.s19\n", argv[0]);\r
printf(" %s fpga fpgaimg.s19\n", argv[0]);\r
printf(" %s gui\n", argv[0]);\r
+ printf(" %s offline\n", argv[0]);\r
return -1;\r
}\r
-\r
- for(;;) {\r
- if(UsbConnect()) {\r
- break;\r
- }\r
- if(i == 0) {\r
- printf("...no device connected, polling for it now\n");\r
- }\r
- if(i > 50000) {\r
- printf("Could not connect to USB device; exiting.\n");\r
- return -1;\r
+ \r
+ // Only do this if NOT in offline mode\r
+ if (strcmp(argv[1], "offline"))\r
+ {\r
+ for(;;) {\r
+ if(UsbConnect()) {\r
+ break;\r
+ }\r
+ if(i == 0) {\r
+ printf("...no device connected, polling for it now\n");\r
+ }\r
+ if(i > 50000) {\r
+ printf("Could not connect to USB device; exiting.\n");\r
+ return -1;\r
+ }\r
+ i++;\r
+ Sleep(5);\r
}\r
- i++;\r
- Sleep(5);\r
}\r
-\r
+ \r
if(strcmp(argv[1], "bootrom")==0 || strcmp(argv[1], "load")==0 || strcmp(argv[1], "fpga")==0) {\r
if(argc != 3) {\r
printf("Need filename.\n");\r
}\r
} else if(strcmp(argv[1], "gui")==0) {\r
ShowGui();\r
+ } else if(strcmp(argv[1], "offline")==0) {\r
+ offline = 1;\r
+ ShowGui();\r
} else if(strcmp(argv[1], "cmd")==0) {\r
if(argc != 3) {\r
printf("Need command.\n");\r