Commit 6f9b576722de5ff1ada3a803b41ce80b7311306b

Con Kolivas 2014-01-04T09:35:10

Implement an mcp2210 spi cancel function.

diff --git a/mcp2210.c b/mcp2210.c
index 07c655f..416a43b 100644
--- a/mcp2210.c
+++ b/mcp2210.c
@@ -218,3 +218,12 @@ bool mcp2210_set_gpio_pindir(struct cgpu_info *cgpu, int pin, int dir)
 	}
 	return mcp2210_send_recv(cgpu, buf, C_MCP_SETGPIOPINDIR);
 }
+
+bool mcp2210_spi_cancel(struct cgpu_info *cgpu)
+{
+	char buf[MCP2210_BUFFER_LENGTH];
+
+	memset(buf, 0, MCP2210_BUFFER_LENGTH);
+	buf[0] = MCP2210_SPI_CANCEL;
+	return mcp2210_send_recv(cgpu, buf, C_MCP_SPICANCEL);
+}
diff --git a/mcp2210.h b/mcp2210.h
index cdf7eb0..3c811dd 100644
--- a/mcp2210.h
+++ b/mcp2210.h
@@ -22,6 +22,7 @@
 #define MCP2210_GPIO_OUTPUT		0
 #define MCP2210_GPIO_INPUT		1
 
+#define MCP2210_SPI_CANCEL		0x11
 #define MCP2210_GET_GPIO_SETTING	0x20
 #define MCP2210_SET_GPIO_SETTING	0x21
 #define MCP2210_SET_GPIO_PIN_VAL	0x30
diff --git a/usbutils.h b/usbutils.h
index 50e6aab..e308565 100644
--- a/usbutils.h
+++ b/usbutils.h
@@ -395,7 +395,8 @@ struct cg_usb_info {
 	USB_ADD_COMMAND(C_MCP_SETGPIOPINDIR, "MCPSetGPIOPinDir") \
 	USB_ADD_COMMAND(C_MCP_SETSPISETTING, "MCPSetSPISetting") \
 	USB_ADD_COMMAND(C_MCP_GETSPISETTING, "MCPGetSPISetting") \
-	USB_ADD_COMMAND(C_MCP_SPITRANSFER, "MCPSPITransfer")
+	USB_ADD_COMMAND(C_MCP_SPITRANSFER, "MCPSPITransfer") \
+	USB_ADD_COMMAND(C_MCP_SPICANCEL, "MCPSPICancel")
 
 /* Create usb_cmds enum from USB_PARSE_COMMANDS macro */
 enum usb_cmds {