1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-23 13:04:29 +00:00

Define a minimum polling time based on frequency of mandatory updates of ftdi responses at 40ms.

This commit is contained in:
Con Kolivas 2013-06-03 23:38:54 +10:00
parent 97a92b26ca
commit 27628cdda9

View File

@ -64,6 +64,8 @@
#define ICARUS_TIMEOUT_MS 200 #define ICARUS_TIMEOUT_MS 200
#endif #endif
#define USB_READ_MINPOLL 40
#ifdef USE_BFLSC #ifdef USE_BFLSC
// N.B. transfer size is 512 with USB2.0, but only 64 with USB1.1 // N.B. transfer size is 512 with USB2.0, but only 64 with USB1.1
static struct usb_endpoints bas_eps[] = { static struct usb_endpoints bas_eps[] = {
@ -2057,6 +2059,8 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
err = LIBUSB_SUCCESS; err = LIBUSB_SUCCESS;
initial_timeout = timeout; initial_timeout = timeout;
sleep_time = initial_timeout / 2; sleep_time = initial_timeout / 2;
if (sleep_time > USB_READ_MINPOLL)
sleep_time = USB_READ_MINPOLL;
max = ((double)timeout) / 1000.0; max = ((double)timeout) / 1000.0;
cgtime(&read_start); cgtime(&read_start);
while (bufleft > 0) { while (bufleft > 0) {
@ -2134,6 +2138,8 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
err = LIBUSB_SUCCESS; err = LIBUSB_SUCCESS;
initial_timeout = timeout; initial_timeout = timeout;
sleep_time = initial_timeout / 2; sleep_time = initial_timeout / 2;
if (sleep_time > USB_READ_MINPOLL)
sleep_time = USB_READ_MINPOLL;
max = ((double)timeout) / 1000.0; max = ((double)timeout) / 1000.0;
cgtime(&read_start); cgtime(&read_start);
while (bufleft > 0) { while (bufleft > 0) {