Add basic SPI comms defines for mcp2210 and build rules for bitfury.
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
diff --git a/Makefile.am b/Makefile.am
index de7bf39..63aacfd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -73,7 +73,7 @@ cgminer_SOURCES += driver-hashfast.c driver-hashfast.h hf_protocol.h hf_protocol
endif
if HAS_BITFURY
-cgminer_SOURCES += driver-bitfury.c driver-bitfury.h
+cgminer_SOURCES += driver-bitfury.c driver-bitfury.h mcp2210.c mcp2210.h
endif
if HAS_DRILLBIT
diff --git a/mcp2210.c b/mcp2210.c
index e69de29..2edf4d2 100644
--- a/mcp2210.c
+++ b/mcp2210.c
@@ -0,0 +1,9 @@
+/*
+ * Copyright 2014 Con Kolivas
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option)
+ * any later version. See COPYING for more details.
+ */
+
diff --git a/mcp2210.h b/mcp2210.h
index e69de29..d50a9c1 100644
--- a/mcp2210.h
+++ b/mcp2210.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2014 Con Kolivas
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option)
+ * any later version. See COPYING for more details.
+ */
+
+#ifndef MCP2210_H
+#define MCP2210_H
+
+#define MCP2210_BUFFER_LENGTH 64
+
+#define MCP2210_GPIO_OUTPUT 0
+#define MCP2210_GPIO_INPUT 1
+
+#define MCP2210_GET_GPIO_SETTING 0x20
+#define MCP2210_SET_GPIO_SETTING 0x21
+#define MCP2210_SET_GPIO_PIN_VAL 0x30
+#define MCP2210_GET_GPIO_PIN_VAL 0x31
+#define MCP2210_SET_GPIO_PIN_DIR 0x32
+#define MCP2210_GET_GPIO_PIN_DIR 0x33
+#define MCP2210_SET_SPI_SETTING 0X40
+#define MCP2210_GET_SPI_SETTING 0X41
+#define MCP2210_SPI_TRANSFER 0x42
+
+#define MCP2210_SPI_TRANSFER_SUCCESS 0x00
+#define MCP2210_SPI_TRANSFER_ERROR_NA 0xF7 // SPI not available due to external owner
+#define MCP2210_SPI_TRANSFER_ERROR_IP 0xF8 // SPI not available due to transfer in progress
+
+#endif MCP2210_H