|
|
@ -222,32 +222,32 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work, |
|
|
|
usb_read(bitfury, buf, 7, &amount, C_BF1_GETWORK); |
|
|
|
usb_read(bitfury, buf, 7, &amount, C_BF1_GETWORK); |
|
|
|
|
|
|
|
|
|
|
|
/* Only happens on startup */ |
|
|
|
/* Only happens on startup */ |
|
|
|
if (unlikely(!info->prevwork2)) |
|
|
|
if (unlikely(!info->prevwork[BF1ARRAY_SIZE])) |
|
|
|
goto cascade; |
|
|
|
goto cascade; |
|
|
|
|
|
|
|
|
|
|
|
/* Search for what work the nonce matches in order of likelihood. Last
|
|
|
|
/* Search for what work the nonce matches in order of likelihood. Last
|
|
|
|
* entry is end of result marker. */ |
|
|
|
* entry is end of result marker. */ |
|
|
|
for (i = 0; i < info->tot - 7; i += 7) { |
|
|
|
for (i = 0; i < info->tot - 7; i += 7) { |
|
|
|
uint32_t nonce; |
|
|
|
uint32_t nonce; |
|
|
|
|
|
|
|
int j; |
|
|
|
|
|
|
|
|
|
|
|
/* Ignore state & switched data in results for now. */ |
|
|
|
/* Ignore state & switched data in results for now. */ |
|
|
|
memcpy(&nonce, info->buf + i + 3, 4); |
|
|
|
memcpy(&nonce, info->buf + i + 3, 4); |
|
|
|
nonce = decnonce(nonce); |
|
|
|
nonce = decnonce(nonce); |
|
|
|
if (bitfury_checkresults(thr, info->prevwork1, nonce)) { |
|
|
|
for (j = 0; j < BF1ARRAY_SIZE; j++) { |
|
|
|
info->nonces++; |
|
|
|
if (bitfury_checkresults(thr, info->prevwork[j], nonce)) { |
|
|
|
continue; |
|
|
|
info->nonces++; |
|
|
|
} |
|
|
|
break; |
|
|
|
if (bitfury_checkresults(thr, info->prevwork2, nonce)) { |
|
|
|
} |
|
|
|
info->nonces++; |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
info->tot = 0; |
|
|
|
info->tot = 0; |
|
|
|
free_work(info->prevwork2); |
|
|
|
free_work(info->prevwork[BF1ARRAY_SIZE]); |
|
|
|
cascade: |
|
|
|
cascade: |
|
|
|
info->prevwork2 = info->prevwork1; |
|
|
|
for (i = BF1ARRAY_SIZE; i > 0; i--) |
|
|
|
info->prevwork1 = copy_work(work); |
|
|
|
info->prevwork[i] = info->prevwork[i - 1]; |
|
|
|
|
|
|
|
info->prevwork[0] = copy_work(work); |
|
|
|
work->blk.nonce = 0xffffffff; |
|
|
|
work->blk.nonce = 0xffffffff; |
|
|
|
if (info->nonces) { |
|
|
|
if (info->nonces) { |
|
|
|
info->nonces--; |
|
|
|
info->nonces--; |
|
|
@ -256,9 +256,20 @@ cascade: |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static struct api_data *bitfury_api_stats(struct cgpu_info __maybe_unused *cgpu) |
|
|
|
static struct api_data *bitfury_api_stats(struct cgpu_info *cgpu) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return NULL; |
|
|
|
struct bitfury_info *info = cgpu->device_data; |
|
|
|
|
|
|
|
struct api_data *root = NULL; |
|
|
|
|
|
|
|
char serial[16]; |
|
|
|
|
|
|
|
int version; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
version = info->version; |
|
|
|
|
|
|
|
root = api_add_int(root, "Version", &version, true); |
|
|
|
|
|
|
|
root = api_add_string(root, "Product", info->product, false); |
|
|
|
|
|
|
|
sprintf(serial, "%0x", info->serial); |
|
|
|
|
|
|
|
root = api_add_string(root, "Serial", serial, true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return root; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void bitfury_init(struct cgpu_info *bitfury) |
|
|
|
static void bitfury_init(struct cgpu_info *bitfury) |
|
|
|