Browse Source

Rename BF1 devices BF1

nfactor-troky
Con Kolivas 11 years ago
parent
commit
435065c86b
  1. 24
      driver-bitfury.c
  2. 2
      usbutils.c
  3. 18
      usbutils.h

24
driver-bitfury.c

@ -20,13 +20,13 @@ struct device_drv bitfury_drv; @@ -20,13 +20,13 @@ struct device_drv bitfury_drv;
static void bitfury_open(struct cgpu_info *bitfury)
{
/* Magic open sequence */
usb_transfer(bitfury, 0x21, 0x22, 0x0003, 0, C_BFO_OPEN);
usb_transfer(bitfury, 0x21, 0x22, 0x0003, 0, C_BF1_OPEN);
}
static void bitfury_close(struct cgpu_info *bitfury)
{
/* Magic close sequence */
usb_transfer(bitfury, 0x21, 0x22, 0, 0, C_BFO_CLOSE);
usb_transfer(bitfury, 0x21, 0x22, 0, 0, C_BF1_CLOSE);
}
static void bitfury_empty_buffer(struct cgpu_info *bitfury)
@ -73,8 +73,8 @@ static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_device @@ -73,8 +73,8 @@ static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_device
bitfury_open(bitfury);
/* Send getinfo request */
usb_write(bitfury, "I", 1, &amount, C_BFO_REQINFO);
usb_read(bitfury, buf, 14, &amount, C_BFO_GETINFO);
usb_write(bitfury, "I", 1, &amount, C_BF1_REQINFO);
usb_read(bitfury, buf, 14, &amount, C_BF1_GETINFO);
if (amount != 14) {
applog(LOG_WARNING, "%s%d: Getinfo received %d bytes",
bitfury->drv->name, bitfury->device_id, amount);
@ -89,8 +89,8 @@ static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_device @@ -89,8 +89,8 @@ static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_device
bitfury_empty_buffer(bitfury);
/* Send reset request */
usb_write(bitfury, "R", 1, &amount, C_BFO_REQRESET);
usb_read_timeout(bitfury, buf, 7, &amount, BF1WAIT, C_BFO_GETRESET);
usb_write(bitfury, "R", 1, &amount, C_BF1_REQRESET);
usb_read_timeout(bitfury, buf, 7, &amount, BF1WAIT, C_BF1_GETRESET);
if (amount != 7) {
applog(LOG_WARNING, "%s%d: Getreset received %d bytes",
@ -179,17 +179,17 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work, @@ -179,17 +179,17 @@ 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
* too early so read whatever we get for the first half nonce and then
* look for the results to prev work. */
usb_read_timeout(bitfury, info->buf, 512, &amount, 600, C_BFO_GETRES);
usb_read_timeout(bitfury, info->buf, 512, &amount, 600, C_BF1_GETRES);
info->tot += amount;
if (unlikely(thr->work_restart))
goto cascade;
/* Now look for the bulk of the previous work results, they will come
* in a batch following the first data. */
usb_read_once_timeout(bitfury, info->buf + info->tot, 7, &amount, 1000, C_BFO_GETRES);
usb_read_once_timeout(bitfury, info->buf + info->tot, 7, &amount, 1000, C_BF1_GETRES);
info->tot += amount;
while (amount) {
usb_read_once_timeout(bitfury, info->buf + info->tot, 512, &amount, 10, C_BFO_GETRES);
usb_read_once_timeout(bitfury, info->buf + info->tot, 512, &amount, 10, C_BF1_GETRES);
info->tot += amount;
};
@ -197,9 +197,9 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work, @@ -197,9 +197,9 @@ static int64_t bitfury_scanhash(struct thr_info *thr, struct work *work,
goto cascade;
/* Send work */
usb_write(bitfury, buf, 45, &amount, C_BFO_REQWORK);
usb_write(bitfury, buf, 45, &amount, C_BF1_REQWORK);
/* Get response acknowledging work */
usb_read(bitfury, buf, 7, &amount, C_BFO_GETWORK);
usb_read(bitfury, buf, 7, &amount, C_BF1_GETWORK);
/* Only happens on startup */
if (unlikely(!info->prevwork2))
@ -256,7 +256,7 @@ static void bitfury_shutdown(struct thr_info __maybe_unused *thr) @@ -256,7 +256,7 @@ static void bitfury_shutdown(struct thr_info __maybe_unused *thr)
struct device_drv bitfury_drv = {
.drv_id = DRIVER_BITFURY,
.dname = "bitfury",
.name = "BFO",
.name = "BF1",
.drv_detect = bitfury_detect,
.scanhash = bitfury_scanhash,
.get_api_stats = bitfury_api_stats,

2
usbutils.c

@ -266,7 +266,7 @@ static struct usb_find_devices find_dev[] = { @@ -266,7 +266,7 @@ static struct usb_find_devices find_dev[] = {
#ifdef USE_BITFURY
{
.drv = DRV_BITFURY,
.name = "BFO",
.name = "BF1",
.ident = IDENT_BFU,
.idVendor = 0x03eb,
.idProduct = 0x204b,

18
usbutils.h

@ -322,15 +322,15 @@ struct cg_usb_info { @@ -322,15 +322,15 @@ struct cg_usb_info {
USB_ADD_COMMAND(C_ENABLE_UART, "EnableUART") \
USB_ADD_COMMAND(C_BB_SET_VOLTAGE, "SetCoreVoltage") \
USB_ADD_COMMAND(C_BB_GET_VOLTAGE, "GetCoreVoltage") \
USB_ADD_COMMAND(C_BFO_OPEN, "BF1Open") \
USB_ADD_COMMAND(C_BFO_CLOSE, "BF1Close") \
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_REQWORK, "BF1RequestWork") \
USB_ADD_COMMAND(C_BFO_GETWORK, "BF1GetWork") \
USB_ADD_COMMAND(C_BFO_GETRES, "BF1GetResults")
USB_ADD_COMMAND(C_BF1_OPEN, "BF1Open") \
USB_ADD_COMMAND(C_BF1_CLOSE, "BF1Close") \
USB_ADD_COMMAND(C_BF1_REQINFO, "BF1RequestInfo") \
USB_ADD_COMMAND(C_BF1_GETINFO, "BF1GetInfo") \
USB_ADD_COMMAND(C_BF1_REQRESET, "BF1RequestReset") \
USB_ADD_COMMAND(C_BF1_GETRESET, "BF1GetReset") \
USB_ADD_COMMAND(C_BF1_REQWORK, "BF1RequestWork") \
USB_ADD_COMMAND(C_BF1_GETWORK, "BF1GetWork") \
USB_ADD_COMMAND(C_BF1_GETRES, "BF1GetResults")
/* Create usb_cmds enum from USB_PARSE_COMMANDS macro */
#define USB_ADD_COMMAND(X, Y) X,

Loading…
Cancel
Save