Browse Source

Klondike update code to current git

nfactor-troky
Kano 11 years ago
parent
commit
dc85abd9cd
  1. 4
      Makefile.am
  2. 24
      cgminer.c
  3. 23
      configure.ac
  4. 7
      driver-klondike.c
  5. 6
      miner.h
  6. 26
      usbutils.c
  7. 1
      usbutils.h

4
Makefile.am

@ -88,6 +88,10 @@ if HAS_AVALON
cgminer_SOURCES += driver-avalon.c driver-avalon.h cgminer_SOURCES += driver-avalon.c driver-avalon.h
endif endif
if HAS_KLONDIKE
cgminer_SOURCES += driver-klondike.c
endif
if HAS_MODMINER if HAS_MODMINER
cgminer_SOURCES += driver-modminer.c cgminer_SOURCES += driver-modminer.c
bitstreamsdir = $(bindir)/bitstreams bitstreamsdir = $(bindir)/bitstreams

24
cgminer.c

@ -166,6 +166,9 @@ bool opt_worktime;
#ifdef USE_AVALON #ifdef USE_AVALON
char *opt_avalon_options = NULL; char *opt_avalon_options = NULL;
#endif #endif
#ifdef USE_KLONDIKE
char *opt_klondike_options = NULL;
#endif
#ifdef USE_USBUTILS #ifdef USE_USBUTILS
char *opt_usb_select = NULL; char *opt_usb_select = NULL;
int opt_usbdump = -1; int opt_usbdump = -1;
@ -1026,6 +1029,15 @@ static char *set_avalon_options(const char *arg)
} }
#endif #endif
#ifdef USE_KLONDIKE
static char *set_klondike_options(const char *arg)
{
opt_set_charp(arg, &opt_klondike_options);
return NULL;
}
#endif
#ifdef USE_USBUTILS #ifdef USE_USBUTILS
static char *set_usb_select(const char *arg) static char *set_usb_select(const char *arg)
{ {
@ -1231,6 +1243,11 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--bitburner-voltage", OPT_WITH_ARG("--bitburner-voltage",
opt_set_intval, NULL, &opt_bitburner_core_voltage, opt_set_intval, NULL, &opt_bitburner_core_voltage,
"Set BitBurner core voltage, in millivolts"), "Set BitBurner core voltage, in millivolts"),
#endif
#ifdef USE_KLONDIKE
OPT_WITH_ARG("--klondike-options",
set_klondike_options, NULL, NULL,
"Set klondike options clock:temp1:temp2:fan"),
#endif #endif
OPT_WITHOUT_ARG("--load-balance", OPT_WITHOUT_ARG("--load-balance",
set_loadbalance, &pool_strategy, set_loadbalance, &pool_strategy,
@ -1572,6 +1589,9 @@ static char *opt_verusage_and_exit(const char *extra)
#ifdef USE_ICARUS #ifdef USE_ICARUS
"icarus " "icarus "
#endif #endif
#ifdef USE_KLONDIKE
"klondike "
#endif
#ifdef USE_MODMINER #ifdef USE_MODMINER
"modminer " "modminer "
#endif #endif
@ -4430,6 +4450,10 @@ void write_config(FILE *fcfg)
fprintf(fcfg, ",\n\"icarus-options\" : \"%s\"", json_escape(opt_icarus_options)); fprintf(fcfg, ",\n\"icarus-options\" : \"%s\"", json_escape(opt_icarus_options));
if (opt_icarus_timing) if (opt_icarus_timing)
fprintf(fcfg, ",\n\"icarus-timing\" : \"%s\"", json_escape(opt_icarus_timing)); fprintf(fcfg, ",\n\"icarus-timing\" : \"%s\"", json_escape(opt_icarus_timing));
#ifdef USE_KLONDIKE
if (opt_klondike_options)
fprintf(fcfg, ",\n\"klondike-options\" : \"%s\"", json_escape(opt_icarus_options));
#endif
#ifdef USE_USBUTILS #ifdef USE_USBUTILS
if (opt_usb_select) if (opt_usb_select)
fprintf(fcfg, ",\n\"usb\" : \"%s\"", json_escape(opt_usb_select)); fprintf(fcfg, ",\n\"usb\" : \"%s\"", json_escape(opt_usb_select));

23
configure.ac

@ -275,6 +275,17 @@ if test "x$avalon" = xyes; then
fi fi
AM_CONDITIONAL([HAS_AVALON], [test x$avalon = xyes]) AM_CONDITIONAL([HAS_AVALON], [test x$avalon = xyes])
klondike="no"
AC_ARG_ENABLE([klondike],
[AC_HELP_STRING([--enable-klondike],[Compile support for Klondike (default disabled)])],
[klondike=$enableval]
)
if test "x$klondike" = xyes; then
AC_DEFINE([USE_KLONDIKE], [1], [Defined to 1 if Klondike support is wanted])
fi
AM_CONDITIONAL([HAS_KLONDIKE], [test x$klondike = xyes])
modminer="no" modminer="no"
AC_ARG_ENABLE([modminer], AC_ARG_ENABLE([modminer],
@ -321,7 +332,7 @@ else
]) ])
fi fi
if test x$avalon$bitforce$bitfury$modminer$bflsc$icarus != xnononononono; then if test x$avalon$bitforce$bitfury$modminer$bflsc$icarus$klondike != xnonononononono; then
want_usbutils=true want_usbutils=true
else else
want_usbutils=false want_usbutils=false
@ -493,14 +504,14 @@ if test "x$opencl" != xno; then
else else
echo " OpenCL...............: NOT FOUND. GPU mining support DISABLED" echo " OpenCL...............: NOT FOUND. GPU mining support DISABLED"
if test "x$avalon$bitforce$bitfury$icarus$ztex$modminer$bflsc" = xnonononononono; then if test "x$avalon$bitforce$bitfury$icarus$ztex$modminer$bflsc$klondike" = xnononononononono; then
AC_MSG_ERROR([No mining configured in]) AC_MSG_ERROR([No mining configured in])
fi fi
echo " scrypt...............: Disabled (needs OpenCL)" echo " scrypt...............: Disabled (needs OpenCL)"
fi fi
else else
echo " OpenCL...............: Detection overrided. GPU mining support DISABLED" echo " OpenCL...............: Detection overrided. GPU mining support DISABLED"
if test "x$avalon$bitforce$bitfury$icarus$ztex$modminer$bflsc" = xnonononononono; then if test "x$avalon$bitforce$bitfury$icarus$ztex$modminer$bflsc$klondike" = xnononononononono; then
AC_MSG_ERROR([No mining configured in]) AC_MSG_ERROR([No mining configured in])
fi fi
echo " scrypt...............: Disabled (needs OpenCL)" echo " scrypt...............: Disabled (needs OpenCL)"
@ -547,6 +558,12 @@ else
echo " Icarus.FPGAs.........: Disabled" echo " Icarus.FPGAs.........: Disabled"
fi fi
if test "x$klondike" = xyes; then
echo " Klondike.ASICs.......: Enabled"
else
echo " Klondike.ASICs.......: Disabled"
fi
if test "x$modminer" = xyes; then if test "x$modminer" = xyes; then
echo " ModMiner.FPGAs.......: Enabled" echo " ModMiner.FPGAs.......: Enabled"
else else

7
driver-klondike.c

@ -29,7 +29,6 @@
#include "miner.h" #include "miner.h"
#include "usbutils.h" #include "usbutils.h"
#define KLN "KLN"
#define K1 "K1" #define K1 "K1"
#define K16 "K16" #define K16 "K16"
#define K64 "K64" #define K64 "K64"
@ -295,7 +294,7 @@ static bool klondike_detect_one(struct libusb_device *dev, struct usb_find_devic
return false; return false;
} }
static void klondike_detect(void) static void klondike_detect(bool __maybe_unused hotplug)
{ {
usb_detect(&klondike_drv, klondike_detect_one); usb_detect(&klondike_drv, klondike_detect_one);
} }
@ -602,9 +601,9 @@ static struct api_data *klondike_api_stats(struct cgpu_info *klncgpu)
} }
struct device_drv klondike_drv = { struct device_drv klondike_drv = {
.drv_id = DRIVER_KLONDIKE, .drv_id = DRIVER_klondike,
.dname = "Klondike", .dname = "Klondike",
.name = KLN, .name = "KLN",
.drv_detect = klondike_detect, .drv_detect = klondike_detect,
.get_api_stats = klondike_api_stats, .get_api_stats = klondike_api_stats,
.get_statline_before = get_klondike_statline_before, .get_statline_before = get_klondike_statline_before,

6
miner.h

@ -243,7 +243,8 @@ static inline int fsync (int fd)
#define ASIC_PARSE_COMMANDS(DRIVER_ADD_COMMAND) \ #define ASIC_PARSE_COMMANDS(DRIVER_ADD_COMMAND) \
DRIVER_ADD_COMMAND(bflsc) \ DRIVER_ADD_COMMAND(bflsc) \
DRIVER_ADD_COMMAND(bitfury) \ DRIVER_ADD_COMMAND(bitfury) \
DRIVER_ADD_COMMAND(avalon) DRIVER_ADD_COMMAND(avalon) \
DRIVER_ADD_COMMAND(klondike)
#define DRIVER_PARSE_COMMANDS(DRIVER_ADD_COMMAND) \ #define DRIVER_PARSE_COMMANDS(DRIVER_ADD_COMMAND) \
DRIVER_ADD_COMMAND(opencl) \ DRIVER_ADD_COMMAND(opencl) \
@ -943,6 +944,9 @@ extern bool opt_worktime;
#ifdef USE_AVALON #ifdef USE_AVALON
extern char *opt_avalon_options; extern char *opt_avalon_options;
#endif #endif
#ifdef USE_KLONDIKE
extern char *opt_klondike_options;
#endif
#ifdef USE_USBUTILS #ifdef USE_USBUTILS
extern char *opt_usb_select; extern char *opt_usb_select;
extern int opt_usbdump; extern int opt_usbdump;

26
usbutils.c

@ -50,6 +50,7 @@
#define BITFURY_TIMEOUT_MS 999 #define BITFURY_TIMEOUT_MS 999
#define MODMINER_TIMEOUT_MS 999 #define MODMINER_TIMEOUT_MS 999
#define AVALON_TIMEOUT_MS 999 #define AVALON_TIMEOUT_MS 999
#define KLONDIKE_TIMEOUT_MS 999
#define ICARUS_TIMEOUT_MS 999 #define ICARUS_TIMEOUT_MS 999
#else #else
#define BFLSC_TIMEOUT_MS 300 #define BFLSC_TIMEOUT_MS 300
@ -57,6 +58,7 @@
#define BITFURY_TIMEOUT_MS 100 #define BITFURY_TIMEOUT_MS 100
#define MODMINER_TIMEOUT_MS 100 #define MODMINER_TIMEOUT_MS 100
#define AVALON_TIMEOUT_MS 200 #define AVALON_TIMEOUT_MS 200
#define KLONDIKE_TIMEOUT_MS 200
#define ICARUS_TIMEOUT_MS 200 #define ICARUS_TIMEOUT_MS 200
#endif #endif
@ -139,6 +141,17 @@ static struct usb_intinfo ava_ints[] = {
}; };
#endif #endif
#ifdef USE_KLONDIKE
static struct usb_epinfo kln_epinfos[] = {
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0, 0 },
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(1), 0, 0, 0 }
};
static struct usb_intinfo kln_ints[] = {
USB_EPS(0, kln_epinfos)
};
#endif
#ifdef USE_ICARUS #ifdef USE_ICARUS
static struct usb_epinfo ica_epinfos[] = { static struct usb_epinfo ica_epinfos[] = {
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0, 0, 0 }, { LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0, 0, 0 },
@ -292,6 +305,18 @@ static struct usb_find_devices find_dev[] = {
.latency = 10, .latency = 10,
INTINFO(ava_ints) }, INTINFO(ava_ints) },
#endif #endif
#ifdef USE_KLONDIKE
{
.drv = DRIVER_klondike,
.name = "KLN",
.ident = IDENT_KLN,
.idVendor = 0x04D8,
.idProduct = 0xF60A,
.config = 1,
.timeout = KLONDIKE_TIMEOUT_MS,
.latency = 10,
INTINFO(kln_ints) },
#endif
#ifdef USE_ICARUS #ifdef USE_ICARUS
{ {
.drv = DRIVER_icarus, .drv = DRIVER_icarus,
@ -3103,6 +3128,7 @@ void usb_cleanup()
case DRIVER_modminer: case DRIVER_modminer:
case DRIVER_icarus: case DRIVER_icarus:
case DRIVER_avalon: case DRIVER_avalon:
case DRIVER_klondike:
mutex_lock(cgpu->usbinfo.devlock); mutex_lock(cgpu->usbinfo.devlock);
release_cgpu(cgpu); release_cgpu(cgpu);
mutex_unlock(cgpu->usbinfo.devlock); mutex_unlock(cgpu->usbinfo.devlock);

1
usbutils.h

@ -144,6 +144,7 @@ enum sub_ident {
IDENT_MMQ, IDENT_MMQ,
IDENT_AVA, IDENT_AVA,
IDENT_BTB, IDENT_BTB,
IDENT_KLN,
IDENT_ICA, IDENT_ICA,
IDENT_AMU, IDENT_AMU,
IDENT_BLT, IDENT_BLT,

Loading…
Cancel
Save