Better Olimex compatibility.
Timeouts have been increased to 30 seconds. Reset is not sent until after enabling power.
This commit is contained in:
parent
ce64ff10b5
commit
1de9e43187
|
@ -656,13 +656,6 @@ int try_open(struct fet_device *dev, const struct device_args *args,
|
||||||
if (do_configure(dev, args) < 0)
|
if (do_configure(dev, args) < 0)
|
||||||
return -1;
|
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 */
|
/* set VCC */
|
||||||
if (fet_proto_xfer(&dev->proto, C_VCC, NULL, 0,
|
if (fet_proto_xfer(&dev->proto, C_VCC, NULL, 0,
|
||||||
1, args->vcc_mv) < 0)
|
1, args->vcc_mv) < 0)
|
||||||
|
@ -670,6 +663,13 @@ int try_open(struct fet_device *dev, const struct device_args *args,
|
||||||
else
|
else
|
||||||
printc_dbg("Set Vcc: %d mV\n", args->vcc_mv);
|
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 */
|
/* Identify the chip */
|
||||||
if (do_identify(dev, args->forced_chip_id) < 0) {
|
if (do_identify(dev, args->forced_chip_id) < 0) {
|
||||||
printc_err("fet: identify failed\n");
|
printc_err("fet: identify failed\n");
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct cdc_acm_transport {
|
||||||
|
|
||||||
#define CDC_INTERFACE_CLASS 10
|
#define CDC_INTERFACE_CLASS 10
|
||||||
|
|
||||||
#define TIMEOUT 10000
|
#define TIMEOUT 30000
|
||||||
|
|
||||||
/* CDC requests */
|
/* CDC requests */
|
||||||
#define CDC_REQTYPE_HOST_TO_DEVICE 0x21
|
#define CDC_REQTYPE_HOST_TO_DEVICE 0x21
|
||||||
|
|
|
@ -67,7 +67,7 @@ struct cp210x_transport {
|
||||||
#define CP210X_WRITE_DTR 0x0100
|
#define CP210X_WRITE_DTR 0x0100
|
||||||
#define CP210X_WRITE_RTS 0x0200
|
#define CP210X_WRITE_RTS 0x0200
|
||||||
|
|
||||||
#define TIMEOUT 10000
|
#define TIMEOUT 30000
|
||||||
|
|
||||||
static int configure_port(struct cp210x_transport *tr, int baud_rate)
|
static int configure_port(struct cp210x_transport *tr, int baud_rate)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct ftdi_transport {
|
||||||
#define EP_IN 0x81
|
#define EP_IN 0x81
|
||||||
#define EP_OUT 0x02
|
#define EP_OUT 0x02
|
||||||
|
|
||||||
#define TIMEOUT_S 10
|
#define TIMEOUT_S 30
|
||||||
#define REQ_TIMEOUT_MS 100
|
#define REQ_TIMEOUT_MS 100
|
||||||
|
|
||||||
#define REQTYPE_HOST_TO_DEVICE 0x40
|
#define REQTYPE_HOST_TO_DEVICE 0x40
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include <linux/serial.h>
|
#include <linux/serial.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TIMEOUT_S 30
|
||||||
|
|
||||||
#ifndef __Windows__
|
#ifndef __Windows__
|
||||||
|
|
||||||
#ifndef B460800
|
#ifndef B460800
|
||||||
|
@ -157,7 +159,7 @@ int sport_read(sport_t s, uint8_t *data, int len)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
struct timeval tv = {
|
struct timeval tv = {
|
||||||
.tv_sec = 5,
|
.tv_sec = TIMEOUT_S,
|
||||||
.tv_usec = 0
|
.tv_usec = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -262,7 +264,7 @@ static int xfer_wait(sport_t s, LPOVERLAPPED ovl)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = WaitForSingleObject(ctrlc_win32_event(), 5000);
|
r = WaitForSingleObject(ctrlc_win32_event(), TIMEOUT_S * 1000);
|
||||||
if (r == WAIT_TIMEOUT) {
|
if (r == WAIT_TIMEOUT) {
|
||||||
CancelIo(s);
|
CancelIo(s);
|
||||||
SetLastError(WAIT_TIMEOUT);
|
SetLastError(WAIT_TIMEOUT);
|
||||||
|
|
Loading…
Reference in New Issue