Browse Source

Klondike update code to current git

nfactor-troky
Kano 11 years ago committed by Con Kolivas
parent
commit
51418f79e5
  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 @@ -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

24
cgminer.c

@ -166,6 +166,9 @@ bool opt_worktime; @@ -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) @@ -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)
{
@ -1231,6 +1243,11 @@ static struct opt_table opt_config_table[] = { @@ -1231,6 +1243,11 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--bitburner-voltage",
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,
@ -1572,6 +1589,9 @@ static char *opt_verusage_and_exit(const char *extra) @@ -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) @@ -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));

23
configure.ac

@ -275,6 +275,17 @@ if test "x$avalon" = xyes; then @@ -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 @@ -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 @@ -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 @@ -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

7
driver-klondike.c

@ -29,7 +29,6 @@ @@ -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 @@ -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) @@ -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,

6
miner.h

@ -243,7 +243,8 @@ static inline int fsync (int fd) @@ -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; @@ -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;

26
usbutils.c

@ -50,6 +50,7 @@ @@ -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 @@ @@ -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[] = { @@ -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[] = { @@ -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() @@ -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);

1
usbutils.h

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

Loading…
Cancel
Save