Better Olimex compatibility.

Timeouts have been increased to 30 seconds. Reset is not sent until
after enabling power.
This commit is contained in:
Daniel Beer 2012-09-28 06:37:32 +12:00
parent ce64ff10b5
commit 1de9e43187
5 changed files with 14 additions and 12 deletions

View File

@ -656,13 +656,6 @@ int try_open(struct fet_device *dev, const struct device_args *args,
if (do_configure(dev, args) < 0)
return -1;
if (send_reset || args->flags & DEVICE_FLAG_FORCE_RESET) {
printc_dbg("Sending reset...\n");
if (fet_proto_xfer(&dev->proto, C_RESET, NULL, 0,
3, FET_RESET_ALL, 0, 0) < 0)
printc_err("warning: fet: reset failed\n");
}
/* set VCC */
if (fet_proto_xfer(&dev->proto, C_VCC, NULL, 0,
1, args->vcc_mv) < 0)
@ -670,6 +663,13 @@ int try_open(struct fet_device *dev, const struct device_args *args,
else
printc_dbg("Set Vcc: %d mV\n", args->vcc_mv);
if (send_reset || args->flags & DEVICE_FLAG_FORCE_RESET) {
printc_dbg("Sending reset...\n");
if (fet_proto_xfer(&dev->proto, C_RESET, NULL, 0,
3, FET_RESET_ALL, 0, 0) < 0)
printc_err("warning: fet: reset failed\n");
}
/* Identify the chip */
if (do_identify(dev, args->forced_chip_id) < 0) {
printc_err("fet: identify failed\n");

View File

@ -47,7 +47,7 @@ struct cdc_acm_transport {
#define CDC_INTERFACE_CLASS 10
#define TIMEOUT 10000
#define TIMEOUT 30000
/* CDC requests */
#define CDC_REQTYPE_HOST_TO_DEVICE 0x21

View File

@ -67,7 +67,7 @@ struct cp210x_transport {
#define CP210X_WRITE_DTR 0x0100
#define CP210X_WRITE_RTS 0x0200
#define TIMEOUT 10000
#define TIMEOUT 30000
static int configure_port(struct cp210x_transport *tr, int baud_rate)
{

View File

@ -36,7 +36,7 @@ struct ftdi_transport {
#define EP_IN 0x81
#define EP_OUT 0x02
#define TIMEOUT_S 10
#define TIMEOUT_S 30
#define REQ_TIMEOUT_MS 100
#define REQTYPE_HOST_TO_DEVICE 0x40

View File

@ -29,6 +29,8 @@
#include <linux/serial.h>
#endif
#define TIMEOUT_S 30
#ifndef __Windows__
#ifndef B460800
@ -157,7 +159,7 @@ int sport_read(sport_t s, uint8_t *data, int len)
do {
struct timeval tv = {
.tv_sec = 5,
.tv_sec = TIMEOUT_S,
.tv_usec = 0
};
@ -262,7 +264,7 @@ static int xfer_wait(sport_t s, LPOVERLAPPED ovl)
return -1;
}
r = WaitForSingleObject(ctrlc_win32_event(), 5000);
r = WaitForSingleObject(ctrlc_win32_event(), TIMEOUT_S * 1000);
if (r == WAIT_TIMEOUT) {
CancelIo(s);
SetLastError(WAIT_TIMEOUT);