|
|
@ -189,8 +189,10 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct cgpu_info *bitfury = thr->cgpu; |
|
|
|
struct cgpu_info *bitfury = thr->cgpu; |
|
|
|
struct bitfury_info *info = bitfury->device_data; |
|
|
|
struct bitfury_info *info = bitfury->device_data; |
|
|
|
|
|
|
|
struct timeval tv_now; |
|
|
|
int amount, i; |
|
|
|
int amount, i; |
|
|
|
char buf[45]; |
|
|
|
char buf[45]; |
|
|
|
|
|
|
|
int ms_diff; |
|
|
|
|
|
|
|
|
|
|
|
buf[0] = 'W'; |
|
|
|
buf[0] = 'W'; |
|
|
|
memcpy(buf + 1, work->midstate, 32); |
|
|
|
memcpy(buf + 1, work->midstate, 32); |
|
|
@ -199,14 +201,23 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
/* New results may spill out from the latest work, making us drop out
|
|
|
|
/* New results may spill out from the latest work, making us drop out
|
|
|
|
* too early so read whatever we get for the first half nonce and then |
|
|
|
* too early so read whatever we get for the first half nonce and then |
|
|
|
* look for the results to prev work. */ |
|
|
|
* look for the results to prev work. */ |
|
|
|
usb_read_timeout(bitfury, info->buf, 512, &amount, 600, C_BF1_GETRES); |
|
|
|
cgtime(&tv_now); |
|
|
|
info->tot += amount; |
|
|
|
ms_diff = 600 - ms_tdiff(&tv_now, &info->tv_start); |
|
|
|
|
|
|
|
if (ms_diff > 0) { |
|
|
|
|
|
|
|
usb_read_timeout(bitfury, info->buf, 512, &amount, ms_diff, C_BF1_GETRES); |
|
|
|
|
|
|
|
info->tot += amount; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(thr->work_restart)) |
|
|
|
if (unlikely(thr->work_restart)) |
|
|
|
goto cascade; |
|
|
|
goto cascade; |
|
|
|
|
|
|
|
|
|
|
|
/* Now look for the bulk of the previous work results, they will come
|
|
|
|
/* Now look for the bulk of the previous work results, they will come
|
|
|
|
* in a batch following the first data. */ |
|
|
|
* in a batch following the first data. */ |
|
|
|
usb_read_once_timeout(bitfury, info->buf + info->tot, 7, &amount, 1000, C_BF1_GETRES); |
|
|
|
cgtime(&tv_now); |
|
|
|
|
|
|
|
ms_diff = BF1WAIT - ms_tdiff(&tv_now, &info->tv_start); |
|
|
|
|
|
|
|
if (unlikely(ms_diff < 10)) |
|
|
|
|
|
|
|
ms_diff = 10; |
|
|
|
|
|
|
|
usb_read_once_timeout(bitfury, info->buf + info->tot, 7, &amount, ms_diff, C_BF1_GETRES); |
|
|
|
info->tot += amount; |
|
|
|
info->tot += amount; |
|
|
|
while (amount) { |
|
|
|
while (amount) { |
|
|
|
usb_read_once_timeout(bitfury, info->buf + info->tot, 512, &amount, 10, C_BF1_GETRES); |
|
|
|
usb_read_once_timeout(bitfury, info->buf + info->tot, 512, &amount, 10, C_BF1_GETRES); |
|
|
@ -218,6 +229,7 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
|
|
|
|
|
|
|
|
/* Send work */ |
|
|
|
/* Send work */ |
|
|
|
usb_write(bitfury, buf, 45, &amount, C_BF1_REQWORK); |
|
|
|
usb_write(bitfury, buf, 45, &amount, C_BF1_REQWORK); |
|
|
|
|
|
|
|
cgtime(&info->tv_start); |
|
|
|
/* Get response acknowledging work */ |
|
|
|
/* Get response acknowledging work */ |
|
|
|
usb_read(bitfury, buf, 7, &amount, C_BF1_GETWORK); |
|
|
|
usb_read(bitfury, buf, 7, &amount, C_BF1_GETWORK); |
|
|
|
|
|
|
|
|
|
|
|