mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 23:37:54 +00:00
Merge branch 'master' of github.com:ckolivas/cgminer
This commit is contained in:
commit
5f10ac8056
@ -74,6 +74,7 @@ ASSERT1(sizeof(uint32_t) == 4);
|
|||||||
|
|
||||||
// USB ms timeout to wait - user specified timeouts are multiples of this
|
// USB ms timeout to wait - user specified timeouts are multiples of this
|
||||||
#define ICARUS_WAIT_TIMEOUT 100
|
#define ICARUS_WAIT_TIMEOUT 100
|
||||||
|
#define ICARUS_CMR2_TIMEOUT 1
|
||||||
|
|
||||||
// Defined in multiples of ICARUS_WAIT_TIMEOUT
|
// Defined in multiples of ICARUS_WAIT_TIMEOUT
|
||||||
// Must of course be greater than ICARUS_READ_COUNT_TIMING/ICARUS_WAIT_TIMEOUT
|
// Must of course be greater than ICARUS_READ_COUNT_TIMING/ICARUS_WAIT_TIMEOUT
|
||||||
@ -186,6 +187,8 @@ struct ICARUS_INFO {
|
|||||||
struct ICARUS_HISTORY history[INFO_HISTORY+1];
|
struct ICARUS_HISTORY history[INFO_HISTORY+1];
|
||||||
uint32_t min_data_count;
|
uint32_t min_data_count;
|
||||||
|
|
||||||
|
int timeout;
|
||||||
|
|
||||||
// seconds per Hash
|
// seconds per Hash
|
||||||
double Hs;
|
double Hs;
|
||||||
// ms til we abort
|
// ms til we abort
|
||||||
@ -434,7 +437,7 @@ static int icarus_get_nonce(struct cgpu_info *icarus, unsigned char *buf, struct
|
|||||||
struct ICARUS_INFO *info = (struct ICARUS_INFO *)(icarus->device_data);
|
struct ICARUS_INFO *info = (struct ICARUS_INFO *)(icarus->device_data);
|
||||||
struct timeval read_start, read_finish;
|
struct timeval read_start, read_finish;
|
||||||
int err, amt;
|
int err, amt;
|
||||||
int rc = 0;
|
int rc = 0, delay;
|
||||||
int read_amount = ICARUS_READ_SIZE;
|
int read_amount = ICARUS_READ_SIZE;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
@ -446,7 +449,7 @@ static int icarus_get_nonce(struct cgpu_info *icarus, unsigned char *buf, struct
|
|||||||
cgtime(&read_start);
|
cgtime(&read_start);
|
||||||
err = usb_read_ii_timeout(icarus, info->intinfo,
|
err = usb_read_ii_timeout(icarus, info->intinfo,
|
||||||
(char *)buf, read_amount, &amt,
|
(char *)buf, read_amount, &amt,
|
||||||
ICARUS_WAIT_TIMEOUT, C_GETRESULTS);
|
info->timeout, C_GETRESULTS);
|
||||||
cgtime(&read_finish);
|
cgtime(&read_finish);
|
||||||
if (err < 0 && err != LIBUSB_ERROR_TIMEOUT) {
|
if (err < 0 && err != LIBUSB_ERROR_TIMEOUT) {
|
||||||
applog(LOG_ERR, "%s%i: Comms error (rerr=%d amt=%d)",
|
applog(LOG_ERR, "%s%i: Comms error (rerr=%d amt=%d)",
|
||||||
@ -471,10 +474,7 @@ static int icarus_get_nonce(struct cgpu_info *icarus, unsigned char *buf, struct
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (thr && thr->work_restart) {
|
if (thr && thr->work_restart) {
|
||||||
if (opt_debug) {
|
applog(LOG_DEBUG, "Icarus Read: Work restart at %d ms", rc);
|
||||||
applog(LOG_DEBUG,
|
|
||||||
"Icarus Read: Work restart at %d ms", rc);
|
|
||||||
}
|
|
||||||
return ICA_NONCE_RESTART;
|
return ICA_NONCE_RESTART;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,6 +483,18 @@ static int icarus_get_nonce(struct cgpu_info *icarus, unsigned char *buf, struct
|
|||||||
read_amount -= amt;
|
read_amount -= amt;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info->timeout < ICARUS_WAIT_TIMEOUT) {
|
||||||
|
delay = ICARUS_WAIT_TIMEOUT - rc;
|
||||||
|
if (delay > 0) {
|
||||||
|
cgsleep_ms(delay);
|
||||||
|
|
||||||
|
if (thr && thr->work_restart) {
|
||||||
|
applog(LOG_DEBUG, "Icarus Read: Work restart at %d ms", rc);
|
||||||
|
return ICA_NONCE_RESTART;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -796,6 +808,7 @@ static bool icarus_detect_one(struct libusb_device *dev, struct usb_find_devices
|
|||||||
int baud, uninitialised_var(work_division), uninitialised_var(fpga_count);
|
int baud, uninitialised_var(work_division), uninitialised_var(fpga_count);
|
||||||
struct cgpu_info *icarus;
|
struct cgpu_info *icarus;
|
||||||
int ret, err, amount, tries;
|
int ret, err, amount, tries;
|
||||||
|
enum sub_ident ident;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
icarus = usb_alloc_cgpu(&icarus_drv, 1);
|
icarus = usb_alloc_cgpu(&icarus_drv, 1);
|
||||||
@ -814,6 +827,23 @@ static bool icarus_detect_one(struct libusb_device *dev, struct usb_find_devices
|
|||||||
quit(1, "Failed to malloc ICARUS_INFO");
|
quit(1, "Failed to malloc ICARUS_INFO");
|
||||||
icarus->device_data = (void *)info;
|
icarus->device_data = (void *)info;
|
||||||
|
|
||||||
|
ident = usb_ident(icarus);
|
||||||
|
switch (ident) {
|
||||||
|
case IDENT_ICA:
|
||||||
|
case IDENT_BLT:
|
||||||
|
case IDENT_LLT:
|
||||||
|
case IDENT_AMU:
|
||||||
|
case IDENT_CMR1:
|
||||||
|
info->timeout = ICARUS_WAIT_TIMEOUT;
|
||||||
|
break;
|
||||||
|
case IDENT_CMR2:
|
||||||
|
info->timeout = ICARUS_CMR2_TIMEOUT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
quit(1, "%s icarus_detect_one() invalid %s ident=%d",
|
||||||
|
icarus->drv->dname, icarus->drv->dname, ident);
|
||||||
|
}
|
||||||
|
|
||||||
tries = 2;
|
tries = 2;
|
||||||
ok = false;
|
ok = false;
|
||||||
while (!ok && tries-- > 0) {
|
while (!ok && tries-- > 0) {
|
||||||
@ -1019,12 +1049,10 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
|
|||||||
if (unlikely(estimate_hashes > 0xffffffff))
|
if (unlikely(estimate_hashes > 0xffffffff))
|
||||||
estimate_hashes = 0xffffffff;
|
estimate_hashes = 0xffffffff;
|
||||||
|
|
||||||
if (opt_debug) {
|
|
||||||
applog(LOG_DEBUG, "%s%d: no nonce = 0x%08lX hashes (%ld.%06lds)",
|
applog(LOG_DEBUG, "%s%d: no nonce = 0x%08lX hashes (%ld.%06lds)",
|
||||||
icarus->drv->name, icarus->device_id,
|
icarus->drv->name, icarus->device_id,
|
||||||
(long unsigned int)estimate_hashes,
|
(long unsigned int)estimate_hashes,
|
||||||
elapsed.tv_sec, elapsed.tv_usec);
|
elapsed.tv_sec, elapsed.tv_usec);
|
||||||
}
|
|
||||||
|
|
||||||
return estimate_hashes;
|
return estimate_hashes;
|
||||||
}
|
}
|
||||||
@ -1056,12 +1084,10 @@ static int64_t icarus_scanhash(struct thr_info *thr, struct work *work,
|
|||||||
if (opt_debug || info->do_icarus_timing)
|
if (opt_debug || info->do_icarus_timing)
|
||||||
timersub(&tv_finish, &tv_start, &elapsed);
|
timersub(&tv_finish, &tv_start, &elapsed);
|
||||||
|
|
||||||
if (opt_debug) {
|
|
||||||
applog(LOG_DEBUG, "%s%d: nonce = 0x%08x = 0x%08lX hashes (%ld.%06lds)",
|
applog(LOG_DEBUG, "%s%d: nonce = 0x%08x = 0x%08lX hashes (%ld.%06lds)",
|
||||||
icarus->drv->name, icarus->device_id,
|
icarus->drv->name, icarus->device_id,
|
||||||
nonce, (long unsigned int)hash_count,
|
nonce, (long unsigned int)hash_count,
|
||||||
elapsed.tv_sec, elapsed.tv_usec);
|
elapsed.tv_sec, elapsed.tv_usec);
|
||||||
}
|
|
||||||
|
|
||||||
// Ignore possible end condition values ... and hw errors
|
// Ignore possible end condition values ... and hw errors
|
||||||
// TODO: set limitations on calculated values depending on the device
|
// TODO: set limitations on calculated values depending on the device
|
||||||
|
Loading…
Reference in New Issue
Block a user