Merge pull request #409 from kanoi/bflsc avalon usbutils requirements
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
diff --git a/miner.h b/miner.h
index ee8ce52..b3ac3ae 100644
--- a/miner.h
+++ b/miner.h
@@ -207,6 +207,7 @@ enum drv_driver {
DRIVER_ZTEX,
DRIVER_CPU,
DRIVER_BFLSC,
+ DRIVER_AVALON,
DRIVER_MAX
};
diff --git a/usbutils.c b/usbutils.c
index a088a39..1c32461 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -41,6 +41,10 @@
#define DRV_ICARUS 5
#endif
+#ifdef USE_AVALON
+#define DRV_AVALON 6
+#endif
+
#define DRV_LAST -1
#define USB_CONFIG 1
@@ -52,10 +56,12 @@
#define BFLSC_TIMEOUT_MS 500
#define BITFORCE_TIMEOUT_MS 500
#define MODMINER_TIMEOUT_MS 200
+#define AVALON_TIMEOUT_MS 500
#else
#define BFLSC_TIMEOUT_MS 200
#define BITFORCE_TIMEOUT_MS 200
#define MODMINER_TIMEOUT_MS 100
+#define AVALON_TIMEOUT_MS 200
#endif
#ifdef USE_BFLSC
@@ -81,6 +87,13 @@ static struct usb_endpoints mmq_eps[] = {
};
#endif
+#ifdef USE_AVALON
+static struct usb_endpoints ava_eps[] = {
+ { LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0 },
+ { LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0 }
+};
+#endif
+
// TODO: Add support for (at least) Isochronous endpoints
static struct usb_find_devices find_dev[] = {
/*
@@ -129,6 +142,19 @@ static struct usb_find_devices find_dev[] = {
.epcount = ARRAY_SIZE(mmq_eps),
.eps = mmq_eps },
#endif
+#ifdef USE_AVALON
+ {
+ .drv = DRV_AVALON,
+ .name = "AVA",
+ .idVendor = 0x0403,
+ .idProduct = 0x6001,
+ .kernel = 0,
+ .config = 1,
+ .interface = 1,
+ .timeout = AVALON_TIMEOUT_MS,
+ .epcount = ARRAY_SIZE(ava_eps),
+ .eps = ava_eps },
+#endif
#ifdef USE_ZTEX
// This is here so cgminer -n shows them
// the ztex driver (as at 201303) doesn't use usbutils
@@ -163,6 +189,10 @@ extern struct device_drv modminer_drv;
extern struct device_drv icarus_drv;
#endif
+#ifdef USE_AVALON
+extern struct device_drv avalon_drv;
+#endif
+
#define STRBUFLEN 256
static const char *BLANK = "";
@@ -1327,6 +1357,11 @@ static struct usb_find_devices *usb_check(__maybe_unused struct device_drv *drv,
return usb_check_each(DRV_MODMINER, drv, dev);
#endif
+#ifdef USE_AVALON
+ if (drv->drv_id == DRIVER_AVALON)
+ return usb_check_each(DRV_AVALON, drv, dev);
+#endif
+
return NULL;
}
@@ -1786,6 +1821,7 @@ void usb_cleanup()
case DRIVER_BFLSC:
case DRIVER_BITFORCE:
case DRIVER_MODMINER:
+ case DRIVER_AVALON:
release_cgpu(cgpu);
break;
default:
@@ -1893,6 +1929,12 @@ void usb_initialise()
found = true;
}
#endif
+#ifdef USE_AVALON
+ if (!found && strcasecmp(ptr, avalon_drv.name) == 0) {
+ drv_count[avalon_drv.drv_id].limit = lim;
+ found = true;
+ }
+#endif
if (!found)
quit(1, "Invalid --usb DRV:limit - unknown DRV='%s'", ptr);