Commit Graph

31 Commits

Author SHA1 Message Date
Dawid Buchwald b6e72dce4c Implemented basic serial code refactoring for upcoming SerialUPDI implementation
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/branches/serial_refactoring@1511 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-12-18 15:25:27 +01:00
Joerg Wunsch 4396674aa7 patch #9304: [Bug #48767] Implemented WinSock variation of "ser_drain(...)" functionality
Submitted by Christopher Cooper:
* ser_win32.c (ser_drain): Implement a network drain
function.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1499 81a1dc3b-b13d-400b-aceb-764788c761c2
2021-11-27 21:15:55 +00:00
Joerg Wunsch 5f1c98ed9d Properly declare arg #2 of net_send() (in ser_win32.c) as being a pointer
to const data.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1353 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-11-26 09:38:15 +00:00
Joerg Wunsch 3fd1765025 patch #8437: [PATCH] Serial-over-ethernet for Win32
* configure.ac: Check for ws2_32 library
* ser_win32.c: Add hooks for forwarding serial data over
TCP connections
* avrdude.1: Drop previous restriction of -P net:
* doc/avrdude.conf: (Dito.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1350 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-11-25 20:00:33 +00:00
Rene Liebscher 8fd3870861 bug #42662 clang warnings under FreeBSD 10.x
* avrftdi.c: remove warnings
* buspirate.c: (Dito.)
* dfu.c: (Dito.)
* fileio.c: (Dito.)
* libavrdude.h: (Dito.)
* pickit2.c: (Dito.)
* safemode.c: (Dito.)
* ser_avrdoper.c: (Dito.)
* ser_posix.c: (Dito.)
* ser_win32.c: (Dito.)
* stk500v2.c: (Dito.)
* usb_libusb.c: (Dito.)
* usbasp.c: (Dito.)

* config_gram.y: fix problem when using parent part with usbpid lists
                 (existing list was extended not overwritten)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1328 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-07-16 20:02:01 +00:00
Axel Wachtler c6788bd795 added verbose level in avrdude_message()
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1321 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-06-13 20:07:40 +00:00
Joerg Wunsch d09bc2e1fb Join the former "public" header files (avr.h avrpart.h pindefs.h
serial.h fileio.h safemode.h update.h pgm_type.h config.h confwin.h
lists.h) into a single header that can be included by anyone wanting
to link against the library.

Adapt everything to cope with this situation.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1311 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-05-19 10:01:59 +00:00
Axel Wachtler eb5fcb581f Exchange of fprintf(stderr, ...) with avrdude_message(...).
This change was made for the shared library, since library functions
should not write to std-streams directly. Instead avrdude_message()
has to be implemented by the library user. For the avrdude application
this function is implemented in main.c.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1305 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-05-18 08:41:46 +00:00
Joerg Wunsch 57903bdeb8 Replace all occurences of exit() in potential library code
by appropriate return values.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1301 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-05-16 15:52:25 +00:00
Joerg Wunsch f80f51f6a9 Change the second parameter of the ser_open method from "baud" into a
"union pinfo", so the USB parameters can be passed without hacks.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1276 81a1dc3b-b13d-400b-aceb-764788c761c2
2014-02-21 13:44:11 +00:00
Joerg Wunsch 147137a218 Replace outdated FSF postal address by a reference to
the GPL info on their website.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1107 81a1dc3b-b13d-400b-aceb-764788c761c2
2012-11-20 14:03:50 +00:00
Rene Liebscher df51dbd421 patch #7680: Fixing timeout problem in ser_recv in ser_win32.c
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1024 81a1dc3b-b13d-400b-aceb-764788c761c2
2011-12-17 20:18:36 +00:00
Nils Springob dd4ec6f74e * serial_open() calls will now return -1 on error (no call to exit())
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@949 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-10-22 14:44:53 +00:00
Joerg Wunsch ee6146f808 Submitted by Gerard:
patch #6828: Using arbitrary BAUD rates
* ser_posix.c (serial_baud_lookup): Allow non-standard baud
rates.
* ser_win32.c (serial_baud_lookup): (Dito.)



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@890 81a1dc3b-b13d-400b-aceb-764788c761c2
2010-01-08 10:39:18 +00:00
Michal Ludvig 61ce206272 * buspirate.c: Replace GNU-only %as with %s in sscanf call.
* ser_win32.c(ser_set_dtr_rts): Fixed typo in parameter name.
	* NEWS: Announce BusPirate.



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@865 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-12 06:51:53 +00:00
Michal Ludvig 819bb7dfeb Support for Arduino auto-reset:
* serial.h, ser_avrdoper.c, ser_posix.c, ser_win32.c: Added 
	  serial_device.set_dtr_rts implementations.
	* arduino.c, stk500.c, stk500.h: Call serial_set_dtr_rts()
	  to reset Arduino board before program upload.
	Inspired by patch #6866, resolves bug #26703



git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@845 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-10-10 01:41:40 +00:00
Joerg Wunsch 922d1e5465 bug #22234: WINDOWS version: HOWTO: Specify Serial Ports Larger than COM9
* ser_win32.c (ser_open): prepend \\.\ to any COM port name, so it is
safe to be used for COM ports above 9.




git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@825 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-07-02 10:23:57 +00:00
Joerg Wunsch 8b35dc3620 More fixes for Solaris, including fixes for the Sunpro compiler:
* avr.h: Remove stray semicolon.
* configure.ac: Add check for predefined types uint_t and ulong_t.
* confwin.c: Include "avrdude.h" on top to avoid empty translation
unit warning.
* ppwin.c: (Ditto.)
* ser_win32.c: (Ditto.)
* serbb_win32.c: (Ditto.)
* jtagmkII.c (jtagmkII_recv): remove unreachable "return".
* stk500.c (stk500_initialize): (Ditto.)
* par.c: Test for both, __sun__ and __sun to see whether we are
being compiled on Solaris.
* ppi.c: (Ditto.)
* stk500v2.c: Implement the DEBUG and DEBUGRECV macros in a way
that is compatible with the ISO C99 standard.
* usbtiny.c: Only typedef uint_t and ulong_t if they have not
been found already by the autoconf checks.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@804 81a1dc3b-b13d-400b-aceb-764788c761c2
2009-02-23 22:04:57 +00:00
Joerg Wunsch d508683427 bug #21076: -vvvv serial receive prints are empty in Win32 build
In ser_recv(): Drop the essentially unused variable "len", and use the
variable "read" in order to track how many bytes have just been read
in.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@753 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-10-29 21:51:07 +00:00
Joerg Wunsch 27e16e8371 Something I always wanted to do: replace all those private "extern"
declarations in each file by a central header file "avrdude.h".


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@721 81a1dc3b-b13d-400b-aceb-764788c761c2
2007-01-24 21:07:54 +00:00
Joerg Wunsch 7e20e7571f Make the code compile warning-free:
- declare a dummy "struct timezone" for some Win32 systems (MinGW)
- fix a few printf() argument types
- get rid off the prevailing "all filedescriptors are of type int"
  attitude

The last item required a large sweep across the code, in order to
replace all "int fd"s by "struct filedescriptor *fd"s, and pass
pointers (as we cannot pass a union directly).  In return, the
code is now supposed to be fully 64-bit safe, rather than relying
on a 64-bit pointer being converted to a (32-bit) int and back
to a pointer as we did previously.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@694 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-12-11 12:47:35 +00:00
Joerg Wunsch 4e81a6be72 Implement a flags field in struct serdev, and populate it with a flag
that indicates whether the underlying communication can dynamically
change its speed or not.  This flag is set for true serial
communication but clear for USB communication.  Don't try to adjust
the speed when talking over a communication channel that doesn't
support it.  (The Dragon does not even support the respective
parameter.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@676 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-10-27 08:45:47 +00:00
Joerg Wunsch 9e0c0b850a The major part of this change has been contributed by
<andyw@pobox.com>.

Implements patch #4635: Add support for terminal/console servers for
serial programmers

* ser_posix.c: Add net_open(), and divert to it for net:host:port.
* ser_win32.c: Recognize net:host:port, and bail out.
* avrdude.1: Document the net:host:port connection option.
* doc/avrdude.texi: (Ditto.)


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@635 81a1dc3b-b13d-400b-aceb-764788c761c2
2006-08-31 20:52:47 +00:00
Colin O Flynn a17ddb9978 *Added Brian Dean's patch to ser_win32.c, fixing bug 14681 "-vvvv causes communication to fail"
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@546 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-11-24 15:00:49 +00:00
Joerg Wunsch f5882fc781 Implement and document a libusb-based USB transport for the JTAG ICE
mkII.

The serial transport methods have been moved out into a record of
function pointers for that purpose, defaulting to the actual serial
connection that natively applies to the hosting system.  Iff inside
the JTAG ICE mkII handler a port name starting with "usb" has been
detected, the record of function pointers is switched to USB.
Optionally, a serial number might be specified, so only the JTAG ICE
mkII matching the given serial number will be opened.  The match is
done right-to-left, so only the least significant bytes of the serial
number need to be given.

In order to make the change as least intrusive to existing drivers as
possible, the entire naming scheme of the serial_foo() function entry
points has been maintained as access macros that encapsulate these
into the respective indirect function calls via serdev->foo().


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@478 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-06-19 21:38:03 +00:00
Joerg Wunsch 04831af970 Mega-commit to bring in both, the STK500v2 support from Erik
Walthinsen, as well as JTAG ICE mkII support (by me).

Erik's submission has been cleaned up a little bit, mostly to add his
name and the current year to the copyright of the new file, remove
trailing white space before importing the files, and fix the minor
syntax errors in his avrdude.conf.in additions (missing semicolons).

The JTAG ICE mkII support should be considered alpha to beta quality
at this point.  Few things are still to be done, like defering the
hfuse (OCDEN) tweaks until they are really required.  Also, for
reasons not yet known, the target MCU doesn't start to run after
signing off from the ICE, it needs a power-cycle first (at least on my
STK500).

Note that for the JTAG ICE, I did change a few things in the internal
API.  Notably I made the serial receive timeout configurable by the
backends via an exported variable (done in both the Posix and the
Win32 implementation), and I made the serial_recv() function return a
-1 instead of bailing out with exit(1) upon encountering a receive
timeout (currently only done in the Posix implementation).  Both
measures together allow me to receive a datastreem from the ICE at 115
kbps on a somewhat lossy PCI multi-UART card that occasionally drops a
character.  The JTAG ICE mkII protocol has enough of safety layers to
allow recovering from these events, but the previous code wasn't
prepared for any kind of recovery.  The Win32 change for this still
has to be done, and the traditional drivers need to be converted to
exit(1) upon encountering a timeout (as they're now getting a -1
returned they didn't see before in that case).


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@451 81a1dc3b-b13d-400b-aceb-764788c761c2
2005-05-10 19:17:12 +00:00
Theodore A. Roth 5b7f00e024 * 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
2004-07-15 17:29:35 +00:00
Theodore A. Roth 443cc23ae9 * AUTHORS: Add names of recent major contributors.
* ser_win32.c: Assign copyright to Martin J. Thomas since he did all
real work on this file.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@429 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-07-08 23:49:33 +00:00
kiwi64ajs be4f46c49e merged in changes to allow native Win32 build with no cygwin DLL dependancy
git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@419 81a1dc3b-b13d-400b-aceb-764788c761c2
2004-06-24 11:05:07 +00:00
Theodore A. Roth ad5d7d687c * ser_posix.c, ser_win32.c, serial.h:
Change baud from int to long to avoid a 16-bit int overflow.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@291 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-03-13 19:25:27 +00:00
Theodore A. Roth 09c3137489 * Makefile.am (avrdude_SOURCES): Add avr910.[ch], serial.h and
ser_posix.c files.
* avr910.c: New file (stubs for avr910 serial programmer).
* avr910.h: New file.
* ser_posix.c: New file.
* ser_win32.c: New file (just stubs for now).
* serial.h: New file.
* stk500.c: Move all the code for accessing the posix serial ports
into ser_posix. This will make a native win32 port easier and allows
the avr910 programmer to share the serial code.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@289 81a1dc3b-b13d-400b-aceb-764788c761c2
2003-03-13 03:52:19 +00:00