Commit df8566a78cc8a21e1b7a8f85f0f61be1f0c4da69

Kano 2013-05-28T22:44:03

usb/ica add more (incomplete) CMR settings

diff --git a/driver-icarus.c b/driver-icarus.c
index 7730cb6..f1d90e9 100644
--- a/driver-icarus.c
+++ b/driver-icarus.c
@@ -253,7 +253,8 @@ static void icarus_initialise(struct cgpu_info *icarus, __maybe_unused int baud)
 	switch (icarus->usbdev->ident) {
 		case IDENT_BLT:
 		case IDENT_LLT:
-		case IDENT_CMR:
+		case IDENT_CMR1:
+		case IDENT_CMR2:
 			// Latency
 			transfer(icarus, FTDI_TYPE_OUT, FTDI_REQUEST_LATENCY, FTDI_VALUE_LATENCY,
 				 icarus->usbdev->found->interface, C_LATENCY);
@@ -275,10 +276,14 @@ static void icarus_initialise(struct cgpu_info *icarus, __maybe_unused int baud)
 			if (icarus->usbinfo.nodev)
 				return;
 
-			// Set the baud
-			transfer(icarus, FTDI_TYPE_OUT, FTDI_REQUEST_BAUD, FTDI_VALUE_BAUD_BLT,
-				 (FTDI_INDEX_BAUD_BLT & 0xff00) | icarus->usbdev->found->interface,
-				 C_SETBAUD);
+			// TODO: Get the baud settings for the 2 CMRs
+			if (icarus->usbdev->ident != IDENT_CMR1 &&
+			    icarus->usbdev->ident != IDENT_CMR2) {
+				// Set the baud
+				transfer(icarus, FTDI_TYPE_OUT, FTDI_REQUEST_BAUD, FTDI_VALUE_BAUD_BLT,
+					 (FTDI_INDEX_BAUD_BLT & 0xff00) | icarus->usbdev->found->interface,
+					 C_SETBAUD);
+			}
 
 			if (icarus->usbinfo.nodev)
 				return;
@@ -484,7 +489,9 @@ static void set_timing_mode(int this_option_offset, struct cgpu_info *icarus)
 		case IDENT_AMU:
 			info->Hs = ASICMINERUSB_HASH_TIME;
 			break;
-		case IDENT_CMR:
+		// TODO: ?
+		case IDENT_CMR1:
+		case IDENT_CMR2:
 			info->Hs = CAIRNSMORE1_HASH_TIME;
 			break;
 		default:
@@ -617,7 +624,9 @@ static void get_options(int this_option_offset, struct cgpu_info *icarus, int *b
 			*work_division = 1;
 			*fpga_count = 1;
 			break;
-		case IDENT_CMR:
+		// TODO: ?
+		case IDENT_CMR1:
+		case IDENT_CMR2:
 			*baud = ICARUS_IO_SPEED;
 			*work_division = 2;
 			*fpga_count = 2;
diff --git a/usbutils.c b/usbutils.c
index 02faa0b..f2b25f8 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -106,7 +106,24 @@ static struct usb_endpoints llt_eps[] = {
 	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPI(1), 0 },
 	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPO(2), 0 }
 };
-static struct usb_endpoints cmr_eps[] = {
+static struct usb_endpoints cmr1_eps[] = {
+	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPI(1), 0 },
+	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPO(2), 0 }
+/*
+ Interface 1
+	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPI(3), 0 },
+	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPO(4), 0 },
+
+ Interface 2
+	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPI(5), 0 },
+	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPO(6), 0 },
+
+ Interface 3
+	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPI(7), 0 },
+	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPO(8), 0 }
+*/
+};
+static struct usb_endpoints cmr2_eps[] = {
 	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPI(1), 0 },
 	{ LIBUSB_TRANSFER_TYPE_BULK,	64,	EPO(2), 0 }
 };
@@ -230,7 +247,7 @@ static struct usb_find_devices find_dev[] = {
 	{
 		.drv = DRV_ICARUS,
 		.name = "CMR",
-		.ident = IDENT_CMR,
+		.ident = IDENT_CMR1,
 		.idVendor = IDVENDOR_FTDI,
 		.idProduct = 0x8350,
 		.iProduct = "Cairnsmore1",
@@ -238,12 +255,12 @@ static struct usb_find_devices find_dev[] = {
 		.config = 1,
 		.interface = 0,
 		.timeout = ICARUS_TIMEOUT_MS,
-		.epcount = ARRAY_SIZE(cmr_eps),
+		.epcount = ARRAY_SIZE(cmr1_eps),
 		.eps = cmr_eps },
 	{
 		.drv = DRV_ICARUS,
 		.name = "CMR",
-		.ident = IDENT_CMR,
+		.ident = IDENT_CMR2,
 		.idVendor = IDVENDOR_FTDI,
 		.idProduct = 0x6014,
 		.iProduct = "Cairnsmore1",
@@ -251,7 +268,7 @@ static struct usb_find_devices find_dev[] = {
 		.config = 1,
 		.interface = 0,
 		.timeout = ICARUS_TIMEOUT_MS,
-		.epcount = ARRAY_SIZE(cmr_eps),
+		.epcount = ARRAY_SIZE(cmr2_eps),
 		.eps = cmr_eps },
 #endif
 #ifdef USE_ZTEX
diff --git a/usbutils.h b/usbutils.h
index 36688d8..4bc27c6 100644
--- a/usbutils.h
+++ b/usbutils.h
@@ -108,7 +108,8 @@ enum sub_ident {
 	IDENT_AMU,
 	IDENT_BLT,
 	IDENT_LLT,
-	IDENT_CMR,
+	IDENT_CMR1,
+	IDENT_CMR2,
 	IDENT_ZTX
 };