@@ -7,6 +7,10 @@
#include "miner.h"
+#define BFG_REGISTER_DRIVER(drv) \
+ struct device_drv drv; \
+// END BFG_REGISTER_DRIVER
+
extern void request_work(struct thr_info *);
extern struct work *get_work(struct thr_info *);
extern bool hashes_done(struct thr_info *, int64_t hashes, struct timeval *tvp_hashes, uint32_t *max_nonce);
@@ -42,8 +42,9 @@
#include "logging.h"
#include "util.h"
+BFG_REGISTER_DRIVER(avalon_drv)
static int option_offset = -1;
-struct device_drv avalon_drv;
static int avalon_init_task(struct avalon_task *at,
uint8_t reset, uint8_t ff, uint8_t fan,
@@ -31,7 +31,7 @@
#include "spidevc.h"
#include "driver-bitfury.h"
-struct device_drv bfsb_drv;
+BFG_REGISTER_DRIVER(bfsb_drv)
static
bool bfsb_spi_txrx(struct spi_port *port)
@@ -29,7 +29,7 @@
#include <stdio.h>
-struct device_drv bigpic_drv;
+BFG_REGISTER_DRIVER(bigpic_drv)
//------------------------------------------------------------------------------
static bool bigpic_detect_custom(const char *devpath, struct device_drv *api, struct bigpic_info *info)
@@ -61,8 +61,8 @@ static const char *protonames[] = {
"parallel queue",
};
-struct device_drv bitforce_drv;
-struct device_drv bitforce_queue_api;
+BFG_REGISTER_DRIVER(bitforce_drv)
+BFG_REGISTER_DRIVER(bitforce_queue_api)
// Code must deal with a timeout
#define BFopen(devpath) serial_open(devpath, 0, 250, true)
@@ -37,7 +37,7 @@
-struct device_drv bitfury_drv;
+BFG_REGISTER_DRIVER(bitfury_drv)
int bitfury_autodetect()
@@ -27,7 +27,7 @@
#define CAIRNSMORE1_DEFAULT_CLOCK 200
#define CAIRNSMORE1_MAXIMUM_CLOCK 210
-struct device_drv cairnsmore_drv;
+BFG_REGISTER_DRIVER(cairnsmore_drv)
static void cairnsmore_drv_init();
@@ -42,6 +42,8 @@
#include <fcntl.h>
#endif
+BFG_REGISTER_DRIVER(cpu_drv)
#if defined(__linux) && defined(CPU_ZERO) /* Linux specific policy and affinity management */
#include <sched.h>
static inline void drop_policy(void)
@@ -18,8 +18,8 @@
#define ERUPTER_IO_SPEED 115200
#define ERUPTER_HASH_TIME 0.0000000029761
-extern struct device_drv erupter_drv;
-extern struct device_drv erupter_drv_emerald;
+BFG_REGISTER_DRIVER(erupter_drv)
+BFG_REGISTER_DRIVER(erupter_drv_emerald)
static bool _erupter_detect_one(const char *devpath, struct device_drv *drv)
{
@@ -169,7 +169,7 @@ static const char *MODE_UNKNOWN_STR = "unknown";
//
-struct device_drv icarus_drv;
+BFG_REGISTER_DRIVER(icarus_drv)
extern void convert_icarus_to_cairnsmore(struct cgpu_info *);
@@ -76,7 +76,7 @@ enum knc_i2c_core_status {
KNC_I2CSTATUS_ENABLED = 3,
-struct device_drv knc_drv;
+BFG_REGISTER_DRIVER(knc_drv)
struct knc_device {
int i2c;
@@ -35,7 +35,7 @@ enum littlefury_opcode {
LFOP_ADC = 7,
-struct device_drv littlefury_drv;
+BFG_REGISTER_DRIVER(littlefury_drv)
static uint16_t crc16tab[] = {
0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7,
@@ -32,7 +32,7 @@
#include "tm_i2c.h"
-struct device_drv metabank_drv;
+BFG_REGISTER_DRIVER(metabank_drv)
bool metabank_spi_txrx(struct spi_port *port)
@@ -48,7 +48,7 @@
#define FPGAID_ALL 4
-struct device_drv modminer_drv;
+BFG_REGISTER_DRIVER(modminer_drv)
struct modminer_fpga_state {
bool work_running;
@@ -30,7 +30,7 @@
#define NANOFURY_MAX_BYTES_PER_SPI_TRANSFER 60 // due to MCP2210 limitation
-struct device_drv nanofury_drv;
+BFG_REGISTER_DRIVER(nanofury_drv)
// Bit-banging reset, to reset more chips in chain - toggle for longer period... Each 3 reset cycles reset first chip in chain
@@ -787,7 +787,7 @@ char *set_intensity(char *arg)
#ifdef HAVE_OPENCL
-struct device_drv opencl_api;
+BFG_REGISTER_DRIVER(opencl_drv)
char *print_ndevs_and_exit(int *ndevs)
@@ -18,7 +18,7 @@
-struct device_drv proxy_drv;
+BFG_REGISTER_DRIVER(proxy_drv)
struct proxy_client *proxy_clients;
@@ -40,7 +40,7 @@
#define X6500_DEFAULT_CLOCK 190
#define X6500_MAXIMUM_CLOCK 250
-struct device_drv x6500_api;
+BFG_REGISTER_DRIVER(x6500_api)
#define fromlebytes(ca, j) (ca[j] | (((uint16_t)ca[j+1])<<8) | (((uint32_t)ca[j+2])<<16) | (((uint32_t)ca[j+3])<<24))
#define GOLDEN_BACKLOG 5
-struct device_drv ztex_drv;
+BFG_REGISTER_DRIVER(ztex_drv)
// Forward declarations
static void ztex_disable(struct thr_info* thr);