Browse Source

avalon usbutils requirements

Kano 13 years ago
parent
commit
956d444054
2 changed files with 43 additions and 0 deletions
  1. 1 0
      miner.h
  2. 42 0
      usbutils.c

+ 1 - 0
miner.h

@@ -207,6 +207,7 @@ enum drv_driver {
 	DRIVER_ZTEX,
 	DRIVER_ZTEX,
 	DRIVER_CPU,
 	DRIVER_CPU,
 	DRIVER_BFLSC,
 	DRIVER_BFLSC,
+	DRIVER_AVALON,
 	DRIVER_MAX
 	DRIVER_MAX
 };
 };
 
 

+ 42 - 0
usbutils.c

@@ -41,6 +41,10 @@
 #define DRV_ICARUS 5
 #define DRV_ICARUS 5
 #endif
 #endif
 
 
+#ifdef USE_AVALON
+#define DRV_AVALON 6
+#endif
+
 #define DRV_LAST -1
 #define DRV_LAST -1
 
 
 #define USB_CONFIG 1
 #define USB_CONFIG 1
@@ -52,10 +56,12 @@
 #define BFLSC_TIMEOUT_MS 500
 #define BFLSC_TIMEOUT_MS 500
 #define BITFORCE_TIMEOUT_MS 500
 #define BITFORCE_TIMEOUT_MS 500
 #define MODMINER_TIMEOUT_MS 200
 #define MODMINER_TIMEOUT_MS 200
+#define AVALON_TIMEOUT_MS 500
 #else
 #else
 #define BFLSC_TIMEOUT_MS 200
 #define BFLSC_TIMEOUT_MS 200
 #define BITFORCE_TIMEOUT_MS 200
 #define BITFORCE_TIMEOUT_MS 200
 #define MODMINER_TIMEOUT_MS 100
 #define MODMINER_TIMEOUT_MS 100
+#define AVALON_TIMEOUT_MS 200
 #endif
 #endif
 
 
 #ifdef USE_BFLSC
 #ifdef USE_BFLSC
@@ -81,6 +87,13 @@ static struct usb_endpoints mmq_eps[] = {
 };
 };
 #endif
 #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
 // TODO: Add support for (at least) Isochronous endpoints
 static struct usb_find_devices find_dev[] = {
 static struct usb_find_devices find_dev[] = {
 /*
 /*
@@ -129,6 +142,19 @@ static struct usb_find_devices find_dev[] = {
 		.epcount = ARRAY_SIZE(mmq_eps),
 		.epcount = ARRAY_SIZE(mmq_eps),
 		.eps = mmq_eps },
 		.eps = mmq_eps },
 #endif
 #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
 #ifdef USE_ZTEX
 // This is here so cgminer -n shows them
 // This is here so cgminer -n shows them
 // the ztex driver (as at 201303) doesn't use usbutils
 // 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;
 extern struct device_drv icarus_drv;
 #endif
 #endif
 
 
+#ifdef USE_AVALON
+extern struct device_drv avalon_drv;
+#endif
+
 #define STRBUFLEN 256
 #define STRBUFLEN 256
 static const char *BLANK = "";
 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);
 		return usb_check_each(DRV_MODMINER, drv, dev);
 #endif
 #endif
 
 
+#ifdef USE_AVALON
+	if (drv->drv_id == DRIVER_AVALON)
+		return usb_check_each(DRV_AVALON, drv, dev);
+#endif
+
 	return NULL;
 	return NULL;
 }
 }
 
 
@@ -1786,6 +1821,7 @@ void usb_cleanup()
 			case DRIVER_BFLSC:
 			case DRIVER_BFLSC:
 			case DRIVER_BITFORCE:
 			case DRIVER_BITFORCE:
 			case DRIVER_MODMINER:
 			case DRIVER_MODMINER:
+			case DRIVER_AVALON:
 				release_cgpu(cgpu);
 				release_cgpu(cgpu);
 				break;
 				break;
 			default:
 			default:
@@ -1892,6 +1928,12 @@ void usb_initialise()
 					drv_count[modminer_drv.drv_id].limit = lim;
 					drv_count[modminer_drv.drv_id].limit = lim;
 					found = true;
 					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
 #endif
 				if (!found)
 				if (!found)
 					quit(1, "Invalid --usb DRV:limit - unknown DRV='%s'", ptr);
 					quit(1, "Invalid --usb DRV:limit - unknown DRV='%s'", ptr);