Browse Source

Add magic BF1 bitfury open and close control sequences.

nfactor-troky
Con Kolivas 11 years ago
parent
commit
9a3684b809
  1. 26
      driver-bitfury.c
  2. 4
      usbutils.h

26
driver-bitfury.c

@ -14,6 +14,23 @@
struct device_drv bitfury_drv; 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);
}
static void bitfury_close(struct cgpu_info *bitfury)
{
/* Magic close sequence */
usb_transfer(bitfury, 0x21, 0x22, 0, 0, C_BFO_CLOSE);
}
static void bitfury_initialise(struct cgpu_info *bitfury)
{
bitfury_open(bitfury);
}
static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_devices *found) static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_devices *found)
{ {
struct cgpu_info *bitfury; struct cgpu_info *bitfury;
@ -26,7 +43,11 @@ static bool bitfury_detect_one(struct libusb_device *dev, struct usb_find_device
} }
applog(LOG_WARNING, "%s%d: Found at %s", bitfury->drv->name, applog(LOG_WARNING, "%s%d: Found at %s", bitfury->drv->name,
bitfury->device_id, bitfury->device_path); bitfury->device_id, bitfury->device_path);
return true;
bitfury_initialise(bitfury);
bitfury_close(bitfury);
return false;
} }
static void bitfury_detect(void) static void bitfury_detect(void)
@ -69,6 +90,9 @@ static void bitfury_init(struct cgpu_info __maybe_unused *bitfury)
static void bitfury_shutdown(struct thr_info __maybe_unused *thr) static void bitfury_shutdown(struct thr_info __maybe_unused *thr)
{ {
struct cgpu_info *bitfury = thr->cgpu;
bitfury_close(bitfury);
} }
/* Currently hardcoded to BF1 devices */ /* Currently hardcoded to BF1 devices */

4
usbutils.h

@ -321,7 +321,9 @@ struct cg_usb_info {
USB_ADD_COMMAND(C_FTDI_STATUS, "FTDIStatus") \ USB_ADD_COMMAND(C_FTDI_STATUS, "FTDIStatus") \
USB_ADD_COMMAND(C_ENABLE_UART, "EnableUART") \ USB_ADD_COMMAND(C_ENABLE_UART, "EnableUART") \
USB_ADD_COMMAND(C_BB_SET_VOLTAGE, "SetCoreVoltage") \ USB_ADD_COMMAND(C_BB_SET_VOLTAGE, "SetCoreVoltage") \
USB_ADD_COMMAND(C_BB_GET_VOLTAGE, "GetCoreVoltage") USB_ADD_COMMAND(C_BB_GET_VOLTAGE, "GetCoreVoltage") \
USB_ADD_COMMAND(C_BFO_OPEN, "BF1Open") \
USB_ADD_COMMAND(C_BFO_CLOSE, "BF1Close")
/* Create usb_cmds enum from USB_PARSE_COMMANDS macro */ /* Create usb_cmds enum from USB_PARSE_COMMANDS macro */
#define USB_ADD_COMMAND(X, Y) X, #define USB_ADD_COMMAND(X, Y) X,

Loading…
Cancel
Save