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
This commit is contained in:
joerg_wunsch 2006-10-27 08:45:47 +00:00
parent 2f798223d1
commit 0e4819c0e7
8 changed files with 29 additions and 9 deletions

View File

@ -1,3 +1,17 @@
2006-10-27 Joerg Wunsch <j@uriah.heep.sax.de>
* jtagmkI.c: 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.)
* jtagmkII.c: (Ditto.)
* ser_posix.c: (Ditto.)
* ser_win32.c: (Ditto.)
* serial.h: (Ditto.)
* usb_libusb.c: (Ditto.)
2006-10-26 Joerg Wunsch <j@uriah.heep.sax.de>
* avrdude.conf.in: Add support for the AVR Dragon (JTAG and ISP mode).

5
NEWS
View File

@ -7,6 +7,11 @@ Approximate change log for AVRDUDE by version.
----------------------------------------------------------------------
Current:
* Add support for the AVR Dragon (JTAG and ISP mode).
Version 5.2:
* New devices supported:
- AT90USB646/647/1286/1287

View File

@ -553,7 +553,7 @@ static int jtagmkI_initialize(PROGRAMMER * pgm, AVRPART * p)
jtagmkI_drain(pgm, 0);
if (initial_baudrate != pgm->baudrate) {
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && initial_baudrate != pgm->baudrate) {
if ((b = jtagmkI_get_baud(pgm->baudrate)) == 0) {
fprintf(stderr, "%s: jtagmkI_initialize(): unsupported baudrate %d\n",
progname, pgm->baudrate);

View File

@ -1055,7 +1055,7 @@ static int jtagmkII_initialize(PROGRAMMER * pgm, AVRPART * p)
return -1;
}
if (pgm->baudrate && pgm->baudrate != 19200) {
if ((serdev->flags & SERDEV_FL_CANSETSPEED) && pgm->baudrate && pgm->baudrate != 19200) {
if ((b = jtagmkII_get_baud(pgm->baudrate)) == 0) {
fprintf(stderr, "%s: jtagmkII_initialize(): unsupported baudrate %d\n",
progname, pgm->baudrate);

View File

@ -481,6 +481,7 @@ struct serial_device serial_serdev =
.send = ser_send,
.recv = ser_recv,
.drain = ser_drain,
.flags = SERDEV_FL_CANSETSPEED,
};
struct serial_device *serdev = &serial_serdev;

View File

@ -364,6 +364,7 @@ struct serial_device serial_serdev =
.send = ser_send,
.recv = ser_recv,
.drain = ser_drain,
.flags = SERDEV_FL_CANSETSPEED,
};
struct serial_device *serdev = &serial_serdev;

View File

@ -41,6 +41,10 @@ struct serial_device
int (*send)(int fd, unsigned char * buf, size_t buflen);
int (*recv)(int fd, unsigned char * buf, size_t buflen);
int (*drain)(int fd, int display);
int flags;
#define SERDEV_FL_NONE 0x0000 /* no flags */
#define SERDEV_FL_CANSETSPEED 0x0001 /* device can change speed */
};
extern struct serial_device *serdev;

View File

@ -202,11 +202,6 @@ static int usbdev_open(char * port, long baud)
exit(1);
}
static int usbdev_setspeed(int fd, long baud)
{
return 0;
}
static void usbdev_close(int fd)
{
usb_dev_handle *udev = (usb_dev_handle *)fd;
@ -431,11 +426,11 @@ static int usbdev_drain(int fd, int display)
struct serial_device usb_serdev =
{
.open = usbdev_open,
.setspeed = usbdev_setspeed,
.close = usbdev_close,
.send = usbdev_send,
.recv = usbdev_recv,
.drain = usbdev_drain,
.flags = SERDEV_FL_NONE,
};
/*
@ -444,11 +439,11 @@ struct serial_device usb_serdev =
struct serial_device usb_serdev_frame =
{
.open = usbdev_open,
.setspeed = usbdev_setspeed,
.close = usbdev_close,
.send = usbdev_send,
.recv = usbdev_recv_frame,
.drain = usbdev_drain,
.flags = SERDEV_FL_NONE,
};
#endif /* HAVE_LIBUSB */