Implement an mcp2210 spi cancel function.
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
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 {