Browse Source

aan: Enable configuring nonce diff with (eg) --set jtn:diff=32

Luke Dashjr 11 years ago
parent
commit
ecaa3f1eb2
3 changed files with 23 additions and 0 deletions
  1. 19 0
      driver-aan.c
  2. 3 0
      driver-aan.h
  3. 1 0
      driver-jingtian.c

+ 19 - 0
driver-aan.c

@@ -477,3 +477,22 @@ void aan_poll(struct thr_info * const master_thr)
 		// Avoid polling when we have queues to fill
 		timer_unset(&master_thr->tv_poll);
 }
+
+const char *aan_set_diff(struct cgpu_info * const proc, const char * const optname, const char * const newvalue, char * const replybuf, enum bfg_set_device_replytype * const success)
+{
+	struct thr_info * const thr = proc->thr[0];
+	struct aan_chip_data * const chip = thr->cgpu_data;
+	
+	const double nv = atof(newvalue);
+	if (nv <= 0)
+		return "Invalid difficulty";
+	
+	chip->desired_nonce_pdiff = nv;
+	
+	return NULL;
+}
+
+const struct bfg_set_device_definition aan_set_device_funcs[] = {
+	{"diff", aan_set_diff, "desired nonce difficulty"},
+	{NULL},
+};

+ 3 - 0
driver-aan.h

@@ -37,4 +37,7 @@ extern bool aan_queue_append(struct thr_info *, struct work *);
 extern void aan_queue_flush(struct thr_info *);
 extern void aan_poll(struct thr_info *);
 
+extern const char *aan_set_diff(struct cgpu_info *, const char *optname, const char *newvalue, char *replybuf, enum bfg_set_device_replytype *);
+extern const struct bfg_set_device_definition aan_set_device_funcs[];
+
 #endif

+ 1 - 0
driver-jingtian.c

@@ -148,6 +148,7 @@ bool jingtian_detect_one(const char * const devpath)
 			.threads = prev_cgpu ? 0 : 1,
 			.device_data = spi_a[i],
 			.device_path = strdup(devpath),
+			.set_device_funcs = aan_set_device_funcs,
 		};
 		add_cgpu_slave(cgpu, prev_cgpu);
 		prev_cgpu = cgpu;