Browse Source

dualminer: rename various things to be clearer

Nate Woolls 12 years ago
parent
commit
04b8fb056b
3 changed files with 21 additions and 21 deletions
  1. 6 6
      driver-dualminer.c
  2. 13 13
      gc3355.c
  3. 2 2
      gc3355.h

+ 6 - 6
driver-dualminer.c

@@ -35,9 +35,9 @@
 
 #define DUALMINER_IO_SPEED 115200
 
-#define DUALMINER_SCRYPT_HASH_TIME		0.00001428571429
+#define DUALMINER_SCRYPT_SM_HASH_TIME   0.00001428571429
 #define DUALMINER_SCRYPT_DM_HASH_TIME	0.00003333333333
-#define DUALMINER_SHA2_HASH_TIME		0.00000000300000
+#define DUALMINER_SHA2_DM_HASH_TIME     0.00000000300000
 
 #define DUALMINER_SCRYPT_READ_COUNT 48  // 4.8s to read
 #define DUALMINER_SHA2_READ_COUNT	16  // 1.6s to read
@@ -77,7 +77,7 @@ const struct bfg_set_device_definition dualminer_set_device_funcs[];
 static
 void dualminer_bootstrap_device(int fd)
 {
-	gc3355_dual_reset(fd);
+	gc3355_reset_dtr(fd);
 
 	if (opt_scrypt && !opt_dual_mode)
 		gc3355_opt_scrypt_only_init(fd);
@@ -158,7 +158,7 @@ bool dualminer_job_start(struct thr_info * const thr)
 		if (opt_dual_mode)
 			gc3355_dualminer_init(fd);
 		else
-			gc3355_opt_scrypt_init(fd);
+			gc3355_scrypt_only_reset(fd);
 	}
 
 	return icarus_job_start(thr);
@@ -190,13 +190,13 @@ bool dualminer_detect_one(const char *devpath)
 	{
 		info->golden_ob = (char*)scrypt_golden_ob;
 		info->golden_nonce = (char*)scrypt_golden_nonce;
-		info->Hs = DUALMINER_SCRYPT_HASH_TIME;
+		info->Hs = DUALMINER_SCRYPT_SM_HASH_TIME;
 	}
 	else
 	{
 		info->golden_ob = (char*)sha2_golden_ob;
 		info->golden_nonce = (char*)sha2_golden_nonce;
-		info->Hs = DUALMINER_SHA2_HASH_TIME;
+		info->Hs = DUALMINER_SHA2_DM_HASH_TIME;
 	}
 
 	drv_set_defaults(drv, dualminer_set_device_funcs, info, devpath, detectone_meta_info.serial, 1);

+ 13 - 13
gc3355.c

@@ -32,7 +32,7 @@
 #define DEFAULT_1_2V_sha2 "0"
 
 static
-const char *sha2_gating[] =
+const char *sha2_gating_cmd[] =
 {
 	"55AAEF0200000000",
 	"55AAEF0300000000",
@@ -43,7 +43,7 @@ const char *sha2_gating[] =
 };
 
 static
-const char *sha2_single_open[] =
+const char *sha2_open_cmd[] =
 {
 	"55AAEF0200000001",
 	"55AAEF0200000003",
@@ -209,7 +209,7 @@ const char *sha2_single_open[] =
 };
 
 static
-const char *scrypt_only_init[] =
+const char *scrypt_only_init_cmd[] =
 {
 	"55AAEF0200000000",
 	"55AAEF0300000000",
@@ -223,12 +223,12 @@ const char *scrypt_only_init[] =
 };
 
 char *opt_dualminer_sha2_gating = NULL;
-int opt_pll_freq = 0; // default is set in gc3355_pll_freq_init2
+int opt_pll_freq = 0; // default is set in gc3355_set_pll_freq
 int opt_sha2_number = 160;
 bool opt_hubfans = false;
 bool opt_dual_mode = false;
 
-void gc3355_dual_reset(int fd)
+void gc3355_reset_dtr(int fd)
 {
 	set_serial_dtr(fd, BGV_HIGH);
 	cgsleep_ms(1000);
@@ -330,7 +330,7 @@ void gc3355_send_cmds(int fd, const char *cmds[])
 	}
 }
 
-void gc3355_opt_scrypt_init(int fd)
+void gc3355_scrypt_only_reset(int fd)
 {
 	const char *initscrypt_ob[] =
 	{
@@ -343,7 +343,7 @@ void gc3355_opt_scrypt_init(int fd)
 }
 
 static
-void gc3355_pll_freq_init2(int fd, int pll_freq)
+void gc3355_set_pll_freq(int fd, int pll_freq)
 {
 	const uint8_t chipaddr = 0xf;
 	const uint32_t baud = 115200;  // FIXME: Make this configurable
@@ -439,21 +439,21 @@ void gc3355_open_sha2_unit_one_by_one(int fd, char *opt_sha2_gating)
 	{
 		for(i = 0; i <= unit_count; i++)
 		{
-			hex2bin(ob_bin, sha2_single_open[i], sizeof(ob_bin));
+			hex2bin(ob_bin, sha2_open_cmd[i], sizeof(ob_bin));
 			icarus_write(fd, ob_bin, 8);
 			usleep(DEFAULT_DELAY_TIME * 2);
 		}
 		opt_sha2_number = unit_count;
 	}
 	else if (unit_count == 0)
-		gc3355_send_cmds(fd, sha2_gating);
+		gc3355_send_cmds(fd, sha2_gating_cmd);
 }
 
 void gc3355_opt_scrypt_only_init(int fd)
 {
-	gc3355_send_cmds(fd, scrypt_only_init);
+	gc3355_send_cmds(fd, scrypt_only_init_cmd);
 
-	gc3355_pll_freq_init2(fd, opt_pll_freq);
+	gc3355_set_pll_freq(fd, opt_pll_freq);
 }
 
 
@@ -474,7 +474,7 @@ void gc3355_open_scrypt_unit(int fd, int status)
 	if (status == SCRYPT_UNIT_OPEN)
 	{
 		if (opt_dual_mode)
-			gc3355_opt_scrypt_init(fd);
+			gc3355_scrypt_only_reset(fd);
 		else
 			gc3355_opt_scrypt_only_init(fd);
 	}
@@ -516,7 +516,7 @@ void gc3355_dualminer_init(int fd)
 		gc3355_send_cmds(fd, init_ob);
 
 	if (!opt_scrypt)
-		gc3355_pll_freq_init2(fd, opt_pll_freq);
+		gc3355_set_pll_freq(fd, opt_pll_freq);
 }
 
 void gc3355_init(int fd, char *sha2_unit, bool is_scrypt_only)

+ 2 - 2
gc3355.h

@@ -37,7 +37,7 @@ extern
 bool opt_hubfans;
 
 extern
-void gc3355_dual_reset(int fd);
+void gc3355_reset_dtr(int fd);
 
 extern
 void gc3355_opt_scrypt_only_init(int fd);
@@ -46,7 +46,7 @@ extern
 void gc3355_dualminer_init(int fd);
 
 extern
-void gc3355_opt_scrypt_init(int fd);
+void gc3355_scrypt_only_reset(int fd);
 
 extern
 void gc3355_init(int fd, char *sha2_unit, bool is_scrypt_only);