* main.c (main): Don't indent CPP directives.

When showing update progress in a no tty situation, use unbuffered IO
for all systems, not just win32 native.
Update copyright year when printing version.
Remove warning about native win32 being experimental.
Split a line string.
* ppiwin.c: Update copyright year.
Add cvs Id keyword.
(usleep): Cleanup debug CPP directives to improve readability.
* ser_win32.c: Include <stdio.h> to fix failing build.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@430 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Theodore A. Roth 2004-07-15 17:29:35 +00:00
parent 443cc23ae9
commit 5b7f00e024
4 changed files with 47 additions and 27 deletions

View File

@ -1,3 +1,16 @@
2004-07-15 Theodore A. Roth <troth@openavr.org>
* main.c (main): Don't indent CPP directives.
When showing update progress in a no tty situation, use unbuffered IO
for all systems, not just win32 native.
Update copyright year when printing version.
Remove warning about native win32 being experimental.
Split a line string.
* ppiwin.c: Update copyright year.
Add cvs Id keyword.
(usleep): Cleanup debug CPP directives to improve readability.
* ser_win32.c: Include <stdio.h> to fix failing build.
2004-07-08 Theodore A. Roth <troth@openavr.org> 2004-07-08 Theodore A. Roth <troth@openavr.org>
* AUTHORS: Add names of recent major contributors. * AUTHORS: Add names of recent major contributors.

12
main.c
View File

@ -904,13 +904,11 @@ int main(int argc, char * argv [])
update_progress = update_progress_tty; update_progress = update_progress_tty;
else { else {
update_progress = update_progress_no_tty; update_progress = update_progress_no_tty;
#if defined(WIN32NATIVE)
/* disable all buffering of stderr for compatibility with /* disable all buffering of stderr for compatibility with
software that captures and redirects output to a GUI software that captures and redirects output to a GUI
i.e. Programmers Notepad */ i.e. Programmers Notepad */
setvbuf( stderr, NULL, _IONBF, 0 ); setvbuf( stderr, NULL, _IONBF, 0 );
setvbuf( stdout, NULL, _IONBF, 0 ); setvbuf( stdout, NULL, _IONBF, 0 );
#endif /* WIN32NATIVE */
} }
} }
@ -921,13 +919,8 @@ int main(int argc, char * argv [])
*/ */
fprintf(stderr, fprintf(stderr,
"\n%s: Version %s\n" "\n%s: Version %s\n"
"%sCopyright (c) 2000-2003 Brian Dean, bsd@bsdhome.com\n\n", "%sCopyright (c) 2000-2004 Brian Dean, bsd@bsdhome.com\n\n",
progname, version, progbuf); progname, version, progbuf);
#if defined(WIN32NATIVE)
#warning "Experimental Win32 Native Build"
fprintf(stderr,"%sExperimental Windows32 native build by Martin Thomas\n\n",
progbuf);
#endif
} }
if (verbose) { if (verbose) {
@ -1218,7 +1211,8 @@ int main(int argc, char * argv [])
if ((strcasecmp(m->desc, "flash") == 0) && (upd->op == DEVICE_WRITE)) { if ((strcasecmp(m->desc, "flash") == 0) && (upd->op == DEVICE_WRITE)) {
erase = 1; erase = 1;
fprintf(stderr, fprintf(stderr,
"%s: NOTE: FLASH memory has been specified, an erase cycle will be performed\n" "%s: NOTE: FLASH memory has been specified, an erase cycle "
"will be performed\n"
"%sTo disable this feature, specify the -D option.\n", "%sTo disable this feature, specify the -D option.\n",
progname, progbuf); progname, progbuf);
break; break;

View File

@ -1,6 +1,6 @@
/* /*
* avrdude - A Downloader/Uploader for AVR device programmers * avrdude - A Downloader/Uploader for AVR device programmers
* Copyright (C) 2003 Eric B. Weddington <eric@ecentral.com> * Copyright (C) 2003, 2004 Eric B. Weddington <ericw@evcohs.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* $Id$ */
/* /*
This is the parallel port interface for Windows built using Cygwin. This is the parallel port interface for Windows built using Cygwin.
@ -327,13 +328,30 @@ void gettimeofday(struct timeval*tv, void*z){
// #define W32USLEEPDBG // #define W32USLEEPDBG
#ifdef W32USLEEPDBG
# define DEBUG_QueryPerformanceCounter(arg) QueryPerformanceCounter(arg)
# define DEBUG_DisplayTimingInfo(start, stop, freq, us, has_highperf) \
do { \
unsigned long dt; \
dt = (unsigned long)((stop.QuadPart - start.QuadPart) * 1000 * 1000 \
/ freq.QuadPart); \
fprintf(stderr, \
"hpt:%i usleep usec:%lu sleep msec:%lu timed usec:%lu\n", \
has_highperf, us, ((us + 999) / 1000), dt); \
} while (0)
#else
# define DEBUG_QueryPerformanceCounter(arg)
# define DEBUG_DisplayTimingInfo(start, stop, freq, us, has_highperf)
#endif
void usleep(unsigned long us) void usleep(unsigned long us)
{ {
int has_highperf; int has_highperf;
LARGE_INTEGER freq,start,stop,loopend; LARGE_INTEGER freq,start,stop,loopend;
#ifdef W32USLEEPDBG
unsigned long dt;
#endif
// workaround: although usleep is very precise if using // workaround: although usleep is very precise if using
// high-performance-timers there are sometimes problems with // high-performance-timers there are sometimes problems with
@ -354,21 +372,15 @@ void usleep(unsigned long us)
} while (stop.QuadPart<=loopend.QuadPart); } while (stop.QuadPart<=loopend.QuadPart);
} }
else { else {
#ifdef W32USLEEPDBG DEBUG_QueryPerformanceCounter(&start);
QueryPerformanceCounter(&start);
#endif
Sleep(1); Sleep(1);
Sleep( (DWORD)((us+999)/1000) ); Sleep( (DWORD)((us+999)/1000) );
#ifdef W32USLEEPDBG
QueryPerformanceCounter(&stop); DEBUG_QueryPerformanceCounter(&stop);
#endif
} }
#ifdef W32USLEEPDBG DEBUG_DisplayTimingInfo(start, stop, freq, us, has_highperf);
dt=(unsigned long)((stop.QuadPart-start.QuadPart)*1000*1000/freq.QuadPart);
fprintf(stderr,"hpt:%i usleep usec:%lu sleep msec:%lu timed usec:%lu\n",
has_highperf,us,((us+999)/1000),dt);
#endif
} }
#endif #endif

View File

@ -26,6 +26,7 @@
#if defined(WIN32NATIVE) #if defined(WIN32NATIVE)
#include <windows.h> #include <windows.h>
#include <stdio.h>
#include <ctype.h> /* for isprint */ #include <ctype.h> /* for isprint */
#include "serial.h" #include "serial.h"