Changeset 112 for sandbox/JamPlayerUSB
- Timestamp:
- Feb 6, 2011, 11:27:09 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/JamPlayerUSB/jbistub.c
r111 r112 27 27 /****************************************************************************/ 28 28 29 #include <windows.h>30 31 29 #include <stdio.h> 32 #include <stdlib.h>33 30 #include <string.h> 34 #include <io.h> 35 #include <fcntl.h> 36 #include <process.h> 31 #include <unistd.h> 37 32 #include <malloc.h> 33 #include <ctype.h> 34 #include <sys/stat.h> 35 38 36 #define POINTER_ALIGNMENT sizeof(BYTE) 39 #include <time.h>40 #include <conio.h>41 #include <ctype.h>42 #include <sys/types.h>43 #include <sys/stat.h>44 37 45 38 #include "jbiexprt.h" … … 54 47 long file_length = 0L; 55 48 56 /* delay count for one millisecond delay */ 57 long one_ms_delay = 0L; 49 /******************************************************************/ 50 51 #include <windows.h> 52 #include "ftd2xx.h" 58 53 59 54 BOOL jtag_hardware_initialized = FALSE; 60 55 61 /* function prototypes to allow forward reference */62 extern void delay_loop(long count);63 64 56 BOOL verbose = FALSE; 65 57 66 /******************************************************************/67 68 #include "ftd2xx.h"69 70 58 static FT_HANDLE ftdih = NULL; 71 72 BYTE usb_buf[64];73 int usb_buf_pos;74 59 75 60 /******************************************************************/ … … 116 101 117 102 FT_STATUS status; 118 119 usb_buf_pos = 0;120 103 121 104 if ((status = FT_OpenEx("USB-Blaster", FT_OPEN_BY_DESCRIPTION, &ftdih)) != FT_OK) … … 429 412 void jbi_delay(long microseconds) 430 413 { 431 delay_loop(microseconds * 432 ((one_ms_delay / 1000L) + ((one_ms_delay % 1000L) ? 1 : 0))); 414 usleep(microseconds); 433 415 } 434 416 … … 451 433 free(ptr); 452 434 } 453 }454 455 void calibrate_delay(void)456 {457 one_ms_delay = 0L;458 435 } 459 436 … … 508 485 int exit_code = 0; 509 486 int format_version = 0; 510 time_t start_time = 0;511 time_t end_time = 0;512 int time_delta = 0;513 487 char *workspace = NULL; 514 488 char *action = NULL; … … 680 654 { 681 655 /* 682 * Calibrate the delay loop function683 */684 calibrate_delay();685 686 /*687 656 * Check CRC 688 657 */ … … 786 755 * Execute the Jam STAPL ByteCode program 787 756 */ 788 time(&start_time);789 757 exec_result = jbi_execute(file_buffer, file_length, workspace, 790 758 workspace_size, action, init_list, reset_jtag, 791 759 &error_address, &exit_code, &format_version); 792 time(&end_time);793 760 794 761 if (exec_result == JBIC_SUCCESS) … … 858 825 printf("Unknown error code %d\n", exec_result); 859 826 } 860 861 /*862 * Print out elapsed time863 */864 if (verbose)865 {866 time_delta = (int) (end_time - start_time);867 printf("Elapsed time = %02u:%02u:%02u\n",868 time_delta / 3600, /* hours */869 (time_delta % 3600) / 60, /* minutes */870 time_delta % 60); /* seconds */871 }872 827 } 873 828 } … … 881 836 return (exit_status); 882 837 } 883 884 void delay_loop(long count)885 {886 while (count != 0L) count--;887 }
Note:
See TracChangeset
for help on using the changeset viewer.