Commit f792b1be97c6f96a7476dfe4792f7c213bc5a1bf

Kano 2013-11-10T11:18:37

Configure source for a new BaB driver

diff --git a/ASIC-README b/ASIC-README
index 5d71f05..bf83045 100644
--- a/ASIC-README
+++ b/ASIC-README
@@ -3,7 +3,8 @@ SUPPORTED DEVICES
 Currently supported devices include the Avalon (including BitBurner and
 Klondike), the Butterfly Labs SC range of devices, the ASICMINER block
 erupters, the BF1 (bitfury) USB (red and blue) devices, KnCminer Mercury,
-Saturn and Jupiter devices, and upcoming Hashfast devices.
+Saturn and Jupiter devices, BlackArrow Bitfury devices and upcoming
+Hashfast devices.
 
 No COM ports on windows or TTY devices will be used by cgminer as it
 communicates directly with them via USB so it is normal for them to not exist or
@@ -34,6 +35,14 @@ in the FPGA-README. Configuring them uses the same mechanism as outlined
 below for getting started with butterfly labs ASICs.
 
 
+BlackArrow Bitfury devices
+
+BlackArrow Bitfury devices need the --enable-bab option when compiling cgminer.
+
+The current BlackArrow Bitfury devices are similar to the Bitfury GPIO mining
+boards and come up as BaB. There are no options available for them.
+
+
 BITFURY devices
 
 Bitfury devices need the --enable-bitfury option when compiling cgminer.
diff --git a/Makefile.am b/Makefile.am
index e6899e9..e7a0993 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -100,6 +100,10 @@ if HAS_KLONDIKE
 cgminer_SOURCES += driver-klondike.c
 endif
 
+if HAS_BAB
+cgminer_SOURCES += driver-bab.c
+endif
+
 if HAS_MODMINER
 cgminer_SOURCES += driver-modminer.c
 bitstreamsdir = $(bindir)/bitstreams
diff --git a/README b/README
index b8da21f..a7d144b 100644
--- a/README
+++ b/README
@@ -121,6 +121,7 @@ CGMiner specific configuration options:
   --enable-hashfast       Compile support for Hashfast (default disabled)
   --enable-icarus         Compile support for Icarus (default disabled)
   --enable-knc            Compile support for KnC miners (default disabled)
+  --enable-bab            Compile support for BlackArrow Bitfury (default disabled)
   --enable-klondike       Compile support for Klondike (default disabled)
   --enable-modminer       Compile support for ModMiner FPGAs(default disabled)
   --without-curses        Compile support for curses TUI (default enabled)
diff --git a/api.c b/api.c
index 3ceaa8e..a9b16f8 100644
--- a/api.c
+++ b/api.c
@@ -29,7 +29,7 @@
 #include "miner.h"
 #include "util.h"
 
-#if defined(USE_BFLSC) || defined(USE_AVALON) || defined(USE_HASHFAST) || defined(USE_BITFURY) || defined(USE_KLONDIKE) || defined(USE_KNC)
+#if defined(USE_BFLSC) || defined(USE_AVALON) || defined(USE_HASHFAST) || defined(USE_BITFURY) || defined(USE_KLONDIKE) || defined(USE_KNC) || defined(USE_BAB)
 #define HAVE_AN_ASIC 1
 #endif
 
@@ -194,6 +194,9 @@ static const char *DEVICECODE = ""
 #ifdef USE_KNC
 			"KnC "
 #endif
+#ifdef USE_BAB
+			"BaB "
+#endif
 #ifdef USE_MODMINER
 			"MMQ "
 #endif
diff --git a/cgminer.c b/cgminer.c
index 00e358d..62455fb 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1628,6 +1628,9 @@ static char *opt_verusage_and_exit(const char *extra)
 #ifdef USE_KNC
 		"KnC "
 #endif
+#ifdef USE_BAB
+		"BaB "
+#endif
 #ifdef USE_MODMINER
 		"modminer "
 #endif
diff --git a/configure.ac b/configure.ac
index 4975449..e5de221 100644
--- a/configure.ac
+++ b/configure.ac
@@ -287,6 +287,17 @@ if test "x$hashfast" = xyes; then
 fi
 AM_CONDITIONAL([HAS_HASHFAST], [test x$hashfast = xyes])
 
+bab="no"
+
+AC_ARG_ENABLE([bab],
+	[AC_HELP_STRING([--enable-bab],[Compile support for BlackArrow Bitfury (default disabled)])],
+	[bab=$enableval]
+	)
+if test "x$bab" = xyes; then
+	AC_DEFINE([USE_BAB], [1], [Defined to 1 if BlackArrow Bitfury support is wanted])
+fi
+AM_CONDITIONAL([HAS_BAB], [test x$bab = xyes])
+
 icarus="no"
 
 AC_ARG_ENABLE([icarus],
@@ -537,14 +548,14 @@ if test "x$opencl" != xno; then
 
 	else
 		echo "  OpenCL...............: NOT FOUND. GPU mining support DISABLED"
-		if test "x$avalon$bitforce$bitfury$icarus$modminer$bflsc$hashfast$klondike$knc" = xnonononononononono; then
+		if test "x$avalon$bitforce$bitfury$icarus$modminer$bflsc$hashfast$klondike$knc$bab" = xnononononononononono; then
 			AC_MSG_ERROR([No mining configured in])
 		fi
 		echo "  scrypt...............: Disabled (needs OpenCL)"
 	fi
 else
 	echo "  OpenCL...............: Detection overrided. GPU mining support DISABLED"
-	if test "x$avalon$bitforce$bitfury$icarus$modminer$bflsc$hashfast$klondike$knc" = xnonononononononono; then
+	if test "x$avalon$bitforce$bitfury$icarus$modminer$bflsc$hashfast$klondike$knc$bab" = xnononononononononono; then
 		AC_MSG_ERROR([No mining configured in])
 	fi
 	echo "  scrypt...............: Disabled (needs OpenCL)"
@@ -597,6 +608,12 @@ else
 	echo "  Hashfast.ASICs.......: Disabled"
 fi
 
+if test "x$bab" = xyes; then
+	echo "  BlackArrow.ASICs.....: Enabled"
+else
+	echo "  BlackArrow.ASICs.....: Disabled"
+fi
+
 if test "x$icarus" = xyes; then
 	echo "  Icarus.ASICs/FPGAs...: Enabled"
 else
diff --git a/driver-bab.c b/driver-bab.c
new file mode 100644
index 0000000..fe29547
--- /dev/null
+++ b/driver-bab.c
@@ -0,0 +1,14 @@
+#include "config.h"
+#include "compat.h"
+#include "miner.h"
+
+static void bab_detect(__maybe_unused bool hotplug)
+{
+}
+
+struct device_drv bab_drv = {
+	.drv_id = DRIVER_bab,
+	.dname = "BlackArrowBitFuryGPIO",
+	.name = "BaB",
+	.drv_detect = bab_detect
+};
diff --git a/miner.h b/miner.h
index ebbfa00..66e85b5 100644
--- a/miner.h
+++ b/miner.h
@@ -249,6 +249,7 @@ static inline int fsync (int fd)
 	DRIVER_ADD_COMMAND(hashfast) \
 	DRIVER_ADD_COMMAND(klondike) \
 	DRIVER_ADD_COMMAND(knc) \
+	DRIVER_ADD_COMMAND(bab) \
 	DRIVER_ADD_COMMAND(avalon)
 
 #define DRIVER_PARSE_COMMANDS(DRIVER_ADD_COMMAND) \