Browse Source

Bugfix: Turn spidevc into lowl-spi to fix building the knc driver without the bitfury driver

Luke Dashjr 11 years ago
parent
commit
09f996130f
14 changed files with 29 additions and 18 deletions
  1. 5 1
      Makefile.am
  2. 9 0
      configure.ac
  3. 1 1
      driver-bfsb.c
  4. 1 1
      driver-bfx.c
  5. 1 1
      driver-bitfury.c
  6. 1 1
      driver-hashbuster.c
  7. 2 2
      driver-knc.c
  8. 2 2
      driver-littlefury.c
  9. 1 1
      driver-metabank.c
  10. 1 1
      driver-nanofury.c
  11. 1 2
      libbitfury.c
  12. 1 1
      libbitfury.h
  13. 1 2
      lowl-spi.c
  14. 2 2
      lowl-spi.h

+ 5 - 1
Makefile.am

@@ -267,7 +267,7 @@ bfgminer_SOURCES += driver-bifury.c
 endif
 
 if HAS_BITFURY
-bfgminer_SOURCES += driver-bitfury.c driver-bitfury.h libbitfury.c libbitfury.h spidevc.h spidevc.c
+bfgminer_SOURCES += driver-bitfury.c driver-bitfury.h libbitfury.c libbitfury.h
 
 if HAS_BFSB
 bfgminer_SOURCES += driver-bfsb.c
@@ -316,6 +316,10 @@ if NEED_BFG_LOWL_PCI
 bfgminer_SOURCES += lowl-pci.c lowl-pci.h
 endif
 
+if NEED_BFG_LOWL_SPI
+bfgminer_SOURCES += lowl-spi.h lowl-spi.c
+endif
+
 bin_PROGRAMS += bfgminer-rpc
 bfgminer_rpc_SOURCES = api-example.c
 bfgminer_rpc_LDADD = @WS2_LIBS@

+ 9 - 0
configure.ac

@@ -127,6 +127,7 @@ need_lowlevel=no
 need_lowl_ftdi=no
 need_lowl_hid=no
 need_lowl_pci=no
+need_lowl_spi=no
 need_lowl_usb=no
 have_cygwin=false
 have_win32=false
@@ -503,6 +504,7 @@ if test "x$knc" = xyes; then
 		#endif
 	])
 	AC_DEFINE([USE_KNC], [1], [Defined to 1 if KnC support is wanted])
+	need_lowl_spi=yes
 fi
 AM_CONDITIONAL([USE_KNC], [test x$knc = xyes])
 
@@ -722,6 +724,7 @@ AC_ARG_ENABLE([bitfury],
 	)
 if test "x$bitfury" = xyes; then
 	AC_DEFINE([USE_BITFURY], [1], [Defined to 1 if Bitfury support is wanted])
+	need_lowl_spi=yes
 fi
 AM_CONDITIONAL([HAS_BITFURY], [test x$bitfury = xyes])
 
@@ -1017,6 +1020,11 @@ if test x$need_lowl_ftdi = xyes; then
 	need_lowl_usb=yes
 fi
 
+lowllist="$lowllist spi/need_lowl_spi"
+if test x$need_lowl_spi = xyes; then
+	AC_DEFINE([NEED_BFG_LOWL_SPI], [1], [Defined to 1 if lowlevel SPI drivers are being used])
+fi
+
 if test "x$need_lowl_usb" = "xno"; then
 	libusb=no
 	LIBUSB_LIBS=''
@@ -1301,6 +1309,7 @@ AM_CONDITIONAL([NEED_BFG_LOWL_VCOM], [test x$need_lowl_vcom = xyes])
 AM_CONDITIONAL([NEED_BFG_LOWL_FTDI], [test x$need_lowl_ftdi = xyes])
 AM_CONDITIONAL([NEED_BFG_LOWL_HID], [test x$need_lowl_hid = xyes])
 AM_CONDITIONAL([NEED_BFG_LOWL_PCI], [test x$need_lowl_pci = xyes])
+AM_CONDITIONAL([NEED_BFG_LOWL_SPI], [test x$need_lowl_spi = xyes])
 AM_CONDITIONAL([NEED_BFG_LOWLEVEL], [test x$need_lowlevel = xyes])
 AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
 AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])

+ 1 - 1
driver-bfsb.c

@@ -28,8 +28,8 @@
 
 #include "deviceapi.h"
 #include "libbitfury.h"
-#include "spidevc.h"
 #include "driver-bitfury.h"
+#include "lowl-spi.h"
 
 BFG_REGISTER_DRIVER(bfsb_drv)
 

+ 1 - 1
driver-bfx.c

@@ -226,7 +226,7 @@ bool bfx_init(struct thr_info * const thr)
 		return false;
 	}
 	
-	/* Be careful, read spidevc.h comments for warnings */
+	/* Be careful, read lowl-spi.h comments for warnings */
 	memset(port, 0, sizeof(*port));
 	port->txrx = bfx_spi_txrx;
 	port->cgpu = cgpu;

+ 1 - 1
driver-bitfury.c

@@ -34,8 +34,8 @@
 #include "deviceapi.h"
 #include "driver-bitfury.h"
 #include "libbitfury.h"
+#include "lowl-spi.h"
 #include "util.h"
-#include "spidevc.h"
 
 BFG_REGISTER_DRIVER(bitfury_drv)
 const struct bfg_set_device_definition bitfury_set_device_funcs[];

+ 1 - 1
driver-hashbuster.c

@@ -239,7 +239,7 @@ bool hashbuster_init(struct thr_info * const thr)
 	if (!port)
 		applogr(false, LOG_ERR, "%s: Failed to allocate spi_port", cgpu->dev_repr);
 	
-	/* Be careful, read spidevc.h comments for warnings */
+	/* Be careful, read lowl-spi.h comments for warnings */
 	memset(port, 0, sizeof(*port));
 	port->txrx = hashbuster_spi_txrx;
 	port->userp = h;

+ 2 - 2
driver-knc.c

@@ -29,8 +29,8 @@
 
 #include "deviceapi.h"
 #include "logging.h"
+#include "lowl-spi.h"
 #include "miner.h"
-#include "spidevc.h"
 
 #define KNC_POLL_INTERVAL_US 10000
 #define KNC_SPI_SPEED 3000000
@@ -318,7 +318,7 @@ nomorecores: ;
 		.workqueue_max = 1,
 	};
 	
-	/* Be careful, read spidevc.h comments for warnings */
+	/* Be careful, read lowl-spi.h comments for warnings */
 	memset(spi, 0, sizeof(*spi));
 	spi->txrx = knc_spi_txrx;
 	spi->cgpu = cgpu;

+ 2 - 2
driver-littlefury.c

@@ -19,9 +19,9 @@
 #include "libbitfury.h"
 #include "logging.h"
 #include "lowlevel.h"
+#include "lowl-spi.h"
 #include "lowl-vcom.h"
 #include "miner.h"
-#include "spidevc.h"
 #include "util.h"
 
 
@@ -365,7 +365,7 @@ bool littlefury_thread_init(struct thr_info *thr)
 	{
 		spi = malloc(sizeof(*spi));
 		
-		/* Be careful, read spidevc.h comments for warnings */
+		/* Be careful, read lowl-spi.h comments for warnings */
 		memset(spi, 0, sizeof(*spi));
 		spi->txrx = littlefury_txrx;
 		spi->cgpu = proc;

+ 1 - 1
driver-metabank.c

@@ -29,7 +29,7 @@
 #include "deviceapi.h"
 #include "driver-bitfury.h"
 #include "libbitfury.h"
-#include "spidevc.h"
+#include "lowl-spi.h"
 #include "tm_i2c.h"
 
 BFG_REGISTER_DRIVER(metabank_drv)

+ 1 - 1
driver-nanofury.c

@@ -352,7 +352,7 @@ bool nanofury_init(struct thr_info * const thr)
 		return false;
 	}
 	
-	/* Be careful, read spidevc.h comments for warnings */
+	/* Be careful, read lowl-spi.h comments for warnings */
 	memset(port, 0, sizeof(*port));
 	port->txrx = nanofury_spi_txrx;
 	port->cgpu = cgpu;

+ 1 - 2
libbitfury.c

@@ -33,8 +33,7 @@
 #include "logging.h"
 #include "miner.h"
 #include "libbitfury.h"
-
-#include "spidevc.h"
+#include "lowl-spi.h"
 #include "sha2.h"
 
 #include <time.h>

+ 1 - 1
libbitfury.h

@@ -4,8 +4,8 @@
 #include <stdbool.h>
 #include <stdint.h>
 
+#include "lowl-spi.h"
 #include "miner.h"
-#include "spidevc.h"
 
 struct work;
 

+ 1 - 2
spidevc.c → lowl-spi.c

@@ -27,8 +27,6 @@
 #define HAVE_LINUX_SPI
 #endif
 
-#include "spidevc.h"
-
 #include <stdbool.h>
 #include <stdint.h>
 #include <unistd.h>
@@ -51,6 +49,7 @@
 #endif
 
 #include "logging.h"
+#include "lowl-spi.h"
 
 #ifdef HAVE_LINUX_SPI
 bool sys_spi_txrx(struct spi_port *port);

+ 2 - 2
spidevc.h → lowl-spi.h

@@ -1,5 +1,5 @@
-#ifndef SPIDEVC_H
-#define SPIDEVC_H
+#ifndef BFG_LOWL_SPI_H
+#define BFG_LOWL_SPI_H
 
 #include <stdbool.h>
 #include <stdint.h>