Commit 6ff2b7bd2c5c7684518fe7b1f67d42aca19eb85b

Con Kolivas 2014-02-05T22:22:04

Add ability to enter ANU frequency as a multiple of 25 from 150-500.

diff --git a/cgminer.c b/cgminer.c
index fd700b6..c843e7b 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -161,6 +161,7 @@ static bool no_work;
 #ifdef USE_ICARUS
 char *opt_icarus_options = NULL;
 char *opt_icarus_timing = NULL;
+int opt_anu_freq = 200;
 #endif
 bool opt_worktime;
 #ifdef USE_AVALON
@@ -1035,6 +1036,20 @@ static char *set_icarus_timing(const char *arg)
 
 	return NULL;
 }
+
+static char *set_int_150_to_500(const char *arg, int *i)
+{
+	char *err = set_int_range(arg, i, 150, 500);
+	int mult;
+
+	if (err)
+		return err;
+	mult = *i / 25;
+	mult *= 25;
+	if (mult != *i)
+		return "Frequency must be a multiple of 25";
+	return NULL;
+}
 #endif
 
 #ifdef USE_AVALON
@@ -1096,6 +1111,11 @@ static char *set_null(const char __maybe_unused *arg)
 
 /* These options are available from config file or commandline */
 static struct opt_table opt_config_table[] = {
+#ifdef USE_ICARUS
+	OPT_WITH_ARG("--anu-freq",
+		     set_int_150_to_500, &opt_show_intval, &opt_anu_freq,
+		     "Set AntminerU1 frequency in hex, range 150-500"),
+#endif
 	OPT_WITH_ARG("--api-allow",
 		     set_api_allow, NULL, NULL,
 		     "Allow API access only to the given list of [G:]IP[/Prefix] addresses[/subnets]"),
diff --git a/miner.h b/miner.h
index 8d1d733..9d89f9a 100644
--- a/miner.h
+++ b/miner.h
@@ -951,8 +951,11 @@ extern bool opt_api_network;
 extern bool opt_delaynet;
 extern time_t last_getwork;
 extern bool opt_restart;
+#ifdef USE_ICARUS
 extern char *opt_icarus_options;
 extern char *opt_icarus_timing;
+extern int opt_anu_freq;
+#endif
 extern bool opt_worktime;
 #ifdef USE_AVALON
 extern char *opt_avalon_options;