Klondike update code to current git
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
diff --git a/Makefile.am b/Makefile.am
index 2389d67..ae6b829 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -88,6 +88,10 @@ if HAS_AVALON
cgminer_SOURCES += driver-avalon.c driver-avalon.h
endif
+if HAS_KLONDIKE
+cgminer_SOURCES += driver-klondike.c
+endif
+
if HAS_MODMINER
cgminer_SOURCES += driver-modminer.c
bitstreamsdir = $(bindir)/bitstreams
diff --git a/cgminer.c b/cgminer.c
index 08a3fd4..9f63a22 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -166,6 +166,9 @@ bool opt_worktime;
#ifdef USE_AVALON
char *opt_avalon_options = NULL;
#endif
+#ifdef USE_KLONDIKE
+char *opt_klondike_options = NULL;
+#endif
#ifdef USE_USBUTILS
char *opt_usb_select = NULL;
int opt_usbdump = -1;
@@ -1026,6 +1029,15 @@ static char *set_avalon_options(const char *arg)
}
#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
static char *set_usb_select(const char *arg)
{
@@ -1232,6 +1244,11 @@ static struct opt_table opt_config_table[] = {
opt_set_intval, NULL, &opt_bitburner_core_voltage,
"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
OPT_WITHOUT_ARG("--load-balance",
set_loadbalance, &pool_strategy,
"Change multipool strategy from failover to quota based balance"),
@@ -1572,6 +1589,9 @@ static char *opt_verusage_and_exit(const char *extra)
#ifdef USE_ICARUS
"icarus "
#endif
+#ifdef USE_KLONDIKE
+ "klondike "
+#endif
#ifdef USE_MODMINER
"modminer "
#endif
@@ -4430,6 +4450,10 @@ void write_config(FILE *fcfg)
fprintf(fcfg, ",\n\"icarus-options\" : \"%s\"", json_escape(opt_icarus_options));
if (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
if (opt_usb_select)
fprintf(fcfg, ",\n\"usb\" : \"%s\"", json_escape(opt_usb_select));
diff --git a/configure.ac b/configure.ac
index 95795bc..9781f9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -275,6 +275,17 @@ if test "x$avalon" = xyes; then
fi
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"
AC_ARG_ENABLE([modminer],
@@ -321,7 +332,7 @@ else
])
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
else
want_usbutils=false
@@ -493,14 +504,14 @@ if test "x$opencl" != xno; then
else
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])
fi
echo " scrypt...............: Disabled (needs OpenCL)"
fi
else
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])
fi
echo " scrypt...............: Disabled (needs OpenCL)"
@@ -547,6 +558,12 @@ else
echo " Icarus.FPGAs.........: Disabled"
fi
+if test "x$klondike" = xyes; then
+ echo " Klondike.ASICs.......: Enabled"
+else
+ echo " Klondike.ASICs.......: Disabled"
+fi
+
if test "x$modminer" = xyes; then
echo " ModMiner.FPGAs.......: Enabled"
else
diff --git a/driver-klondike.c b/driver-klondike.c
index 27e0196..8480d94 100644
--- a/driver-klondike.c
+++ b/driver-klondike.c
@@ -29,7 +29,6 @@
#include "miner.h"
#include "usbutils.h"
-#define KLN "KLN"
#define K1 "K1"
#define K16 "K16"
#define K64 "K64"
@@ -295,7 +294,7 @@ static bool klondike_detect_one(struct libusb_device *dev, struct usb_find_devic
return false;
}
-static void klondike_detect(void)
+static void klondike_detect(bool __maybe_unused hotplug)
{
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 = {
- .drv_id = DRIVER_KLONDIKE,
+ .drv_id = DRIVER_klondike,
.dname = "Klondike",
- .name = KLN,
+ .name = "KLN",
.drv_detect = klondike_detect,
.get_api_stats = klondike_api_stats,
.get_statline_before = get_klondike_statline_before,
diff --git a/miner.h b/miner.h
index 697b8ee..4efe30b 100644
--- a/miner.h
+++ b/miner.h
@@ -243,7 +243,8 @@ static inline int fsync (int fd)
#define ASIC_PARSE_COMMANDS(DRIVER_ADD_COMMAND) \
DRIVER_ADD_COMMAND(bflsc) \
DRIVER_ADD_COMMAND(bitfury) \
- DRIVER_ADD_COMMAND(avalon)
+ DRIVER_ADD_COMMAND(avalon) \
+ DRIVER_ADD_COMMAND(klondike)
#define DRIVER_PARSE_COMMANDS(DRIVER_ADD_COMMAND) \
DRIVER_ADD_COMMAND(opencl) \
@@ -938,6 +939,9 @@ extern bool opt_worktime;
#ifdef USE_AVALON
extern char *opt_avalon_options;
#endif
+#ifdef USE_KLONDIKE
+extern char *opt_klondike_options;
+#endif
#ifdef USE_USBUTILS
extern char *opt_usb_select;
extern int opt_usbdump;
diff --git a/usbutils.c b/usbutils.c
index 2532b33..2b7482d 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -50,6 +50,7 @@
#define BITFURY_TIMEOUT_MS 999
#define MODMINER_TIMEOUT_MS 999
#define AVALON_TIMEOUT_MS 999
+#define KLONDIKE_TIMEOUT_MS 999
#define ICARUS_TIMEOUT_MS 999
#else
#define BFLSC_TIMEOUT_MS 300
@@ -57,6 +58,7 @@
#define BITFURY_TIMEOUT_MS 100
#define MODMINER_TIMEOUT_MS 100
#define AVALON_TIMEOUT_MS 200
+#define KLONDIKE_TIMEOUT_MS 200
#define ICARUS_TIMEOUT_MS 200
#endif
@@ -139,6 +141,17 @@ static struct usb_intinfo ava_ints[] = {
};
#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
static struct usb_epinfo ica_epinfos[] = {
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0, 0, 0 },
@@ -292,6 +305,18 @@ static struct usb_find_devices find_dev[] = {
.latency = 10,
INTINFO(ava_ints) },
#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
{
.drv = DRIVER_icarus,
@@ -3148,6 +3173,7 @@ void usb_cleanup()
case DRIVER_modminer:
case DRIVER_icarus:
case DRIVER_avalon:
+ case DRIVER_klondike:
mutex_lock(cgpu->usbinfo.devlock);
release_cgpu(cgpu);
mutex_unlock(cgpu->usbinfo.devlock);
diff --git a/usbutils.h b/usbutils.h
index 011061e..35684f9 100644
--- a/usbutils.h
+++ b/usbutils.h
@@ -148,6 +148,7 @@ enum sub_ident {
IDENT_MMQ,
IDENT_AVA,
IDENT_BTB,
+ IDENT_KLN,
IDENT_ICA,
IDENT_AMU,
IDENT_BLT,