Browse Source

aan: Implement --set jtn:clock=MHz

Luke Dashjr 11 years ago
parent
commit
f2978b885b
1 changed files with 15 additions and 0 deletions
  1. 15 0
      driver-aan.c

+ 15 - 0
driver-aan.c

@@ -582,6 +582,20 @@ void aan_poll(struct thr_info * const master_thr)
 		timer_unset(&master_thr->tv_poll);
 		timer_unset(&master_thr->tv_poll);
 }
 }
 
 
+const char *aan_set_clock(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 int nv = atoi(newvalue);
+	if (nv <= 0 || nv > AAN_MAX_FREQ)
+		return "Invalid clock frequency";
+	
+	chip->pllreg = aan_freq2pll(nv);
+	
+	return NULL;
+}
+
 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)
 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 thr_info * const thr = proc->thr[0];
@@ -597,6 +611,7 @@ const char *aan_set_diff(struct cgpu_info * const proc, const char * const optna
 }
 }
 
 
 const struct bfg_set_device_definition aan_set_device_funcs[] = {
 const struct bfg_set_device_definition aan_set_device_funcs[] = {
+	{"clock", aan_set_clock, "clock frequency (MHz)"},
 	{"diff", aan_set_diff, "desired nonce difficulty"},
 	{"diff", aan_set_diff, "desired nonce difficulty"},
 	{NULL},
 	{NULL},
 };
 };