Browse Source

Name the work request and result usb commands for BF1

nfactor-troky
Con Kolivas 11 years ago
parent
commit
55c6e55c84
  1. 8
      driver-bitfury.c
  2. 5
      usbutils.h

8
driver-bitfury.c

@ -229,18 +229,18 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work, @@ -229,18 +229,18 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
sendbuf[0] = 'W';
memcpy(sendbuf + 1, work->midstate, 32);
memcpy(sendbuf + 33, work->data + 64, 12);
usb_write(bitfury, sendbuf, 45, &amount, C_PING);
usb_read(bitfury, buf, 7, &amount, C_PING);
usb_write(bitfury, sendbuf, 45, &amount, C_BFO_REQWORK);
usb_read(bitfury, buf, 7, &amount, C_BFO_GETWORK);
if (unlikely(!info->prevwork)) {
info->prevwork = copy_work(work);
return 0;
}
usb_read_once_timeout(bitfury, buf, 7, &amount, BF1WAIT, C_PING);
usb_read_once_timeout(bitfury, buf, 7, &amount, BF1WAIT, C_BFO_GETRES);
tot = amount;
while (amount) {
usb_read_once_timeout(bitfury, buf + tot, 512, &amount, 10, C_PING);
usb_read_once_timeout(bitfury, buf + tot, 512, &amount, 10, C_BFO_GETRES);
tot += amount;
}

5
usbutils.h

@ -327,7 +327,10 @@ struct cg_usb_info { @@ -327,7 +327,10 @@ struct cg_usb_info {
USB_ADD_COMMAND(C_BFO_REQINFO, "BF1RequestInfo") \
USB_ADD_COMMAND(C_BFO_GETINFO, "BF1GetInfo") \
USB_ADD_COMMAND(C_BFO_REQRESET, "BF1RequestReset") \
USB_ADD_COMMAND(C_BFO_GETRESET, "BF1GetReset")
USB_ADD_COMMAND(C_BFO_GETRESET, "BF1GetReset") \
USB_ADD_COMMAND(C_BFO_REQWORK, "BF1RequestWork") \
USB_ADD_COMMAND(C_BFO_GETWORK, "BF1GetWork") \
USB_ADD_COMMAND(C_BFO_GETRES, "BF1GetResults")
/* Create usb_cmds enum from USB_PARSE_COMMANDS macro */
#define USB_ADD_COMMAND(X, Y) X,

Loading…
Cancel
Save