Browse Source

Convert the bitfury driver to use the hash_driver_work version of hash_work.

nfactor-troky
Con Kolivas 11 years ago
parent
commit
835ad82441
  1. 2
      cgminer.c
  2. 16
      driver-bitfury.c
  3. 1
      miner.h

2
cgminer.c

@ -5974,7 +5974,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work) @@ -5974,7 +5974,7 @@ static void gen_stratum_work(struct pool *pool, struct work *work)
cgtime(&work->tv_staged);
}
static struct work *get_work(struct thr_info *thr, const int thr_id)
struct work *get_work(struct thr_info *thr, const int thr_id)
{
struct work *work = NULL;

16
driver-bitfury.c

@ -220,18 +220,24 @@ static bool bitfury_checkresults(struct thr_info *thr, struct work *work, uint32 @@ -220,18 +220,24 @@ static bool bitfury_checkresults(struct thr_info *thr, struct work *work, uint32
return false;
}
static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
int64_t __maybe_unused max_nonce)
static int64_t bitfury_scanwork(struct thr_info *thr)
{
struct cgpu_info *bitfury = thr->cgpu;
struct bitfury_info *info = bitfury->device_data;
struct timeval tv_now;
struct work *work;
double nonce_rate;
int64_t ret = 0;
int amount, i;
char buf[45];
int ms_diff;
work = get_work(thr, thr->id);
if (unlikely(thr->work_restart)) {
free_work(work);
return 0;
}
buf[0] = 'W';
memcpy(buf + 1, work->midstate, 32);
memcpy(buf + 33, work->data + 64, 12);
@ -298,8 +304,7 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work, @@ -298,8 +304,7 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
cascade:
for (i = BF1ARRAY_SIZE; i > 0; i--)
info->prevwork[i] = info->prevwork[i - 1];
info->prevwork[0] = copy_work(work);
work->blk.nonce = 0xffffffff;
info->prevwork[0] = work;
info->cycles++;
info->total_nonces += info->nonces;
@ -358,7 +363,8 @@ struct device_drv bitfury_drv = { @@ -358,7 +363,8 @@ struct device_drv bitfury_drv = {
.dname = "bitfury",
.name = "BF1",
.drv_detect = bitfury_detect,
.scanhash = bitfury_scanhash,
.hash_work = &hash_driver_work,
.scanwork = bitfury_scanwork,
.get_api_stats = bitfury_api_stats,
.reinit_device = bitfury_init,
.thread_shutdown = bitfury_shutdown,

1
miner.h

@ -1384,6 +1384,7 @@ extern void submit_tested_work(struct thr_info *thr, struct work *work); @@ -1384,6 +1384,7 @@ extern void submit_tested_work(struct thr_info *thr, struct work *work);
extern bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
extern bool submit_noffset_nonce(struct thr_info *thr, struct work *work, uint32_t nonce,
int noffset);
extern struct work *get_work(struct thr_info *thr, const int thr_id);
extern struct work *get_queued(struct cgpu_info *cgpu);
extern struct work *__find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);
extern struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);

Loading…
Cancel
Save