Browse Source

Merge branch 'compac' into bfgminer

Luke Dashjr 10 years ago
parent
commit
6a6ce3af7d
4 changed files with 56 additions and 7 deletions
  1. 1 0
      70-bfgminer.rules.in
  2. 19 2
      README.ASIC
  3. 34 3
      driver-antminer.c
  4. 2 2
      driver-icarus.c

+ 1 - 0
70-bfgminer.rules.in

@@ -11,6 +11,7 @@ LABEL="bfgminer_start"
 @USE_DRILLBIT_TRUE@ENV{manufacturer}=="*Drillbit*", GOTO="bfgminer_add"
 @USE_DRILLBIT_TRUE@ENV{manufacturer}=="*Drillbit*", GOTO="bfgminer_add"
 @USE_ICARUS_TRUE@ENV{ID_MODEL}=="*Antminer*", GOTO="bfgminer_add"
 @USE_ICARUS_TRUE@ENV{ID_MODEL}=="*Antminer*", GOTO="bfgminer_add"
 @USE_ICARUS_TRUE@ENV{ID_MODEL}=="*Cairnsmore1*", GOTO="bfgminer_add"
 @USE_ICARUS_TRUE@ENV{ID_MODEL}=="*Cairnsmore1*", GOTO="bfgminer_add"
+@USE_ICARUS_TRUE@ENV{ID_MODEL}=="*Compac*Bitcoin*", GOTO="bfgminer_add"
 @USE_ICARUS_TRUE@ENV{ID_MODEL}=="*Block*Erupter*", GOTO="bfgminer_add"
 @USE_ICARUS_TRUE@ENV{ID_MODEL}=="*Block*Erupter*", GOTO="bfgminer_add"
 @USE_HASHBUSTER_TRUE@ENV{ID_MODEL}=="*HashBuster*", GOTO="bfgminer_add"
 @USE_HASHBUSTER_TRUE@ENV{ID_MODEL}=="*HashBuster*", GOTO="bfgminer_add"
 @USE_HASHBUSTERUSB_TRUE@ENV{ID_MODEL}=="*HashBuster*", GOTO="bfgminer_add"
 @USE_HASHBUSTERUSB_TRUE@ENV{ID_MODEL}=="*HashBuster*", GOTO="bfgminer_add"

+ 19 - 2
README.ASIC

@@ -2,8 +2,8 @@ SUPPORTED DEVICES
 
 
 Currently supported ASIC devices include Avalon, Bitfountain's Block Erupter
 Currently supported ASIC devices include Avalon, Bitfountain's Block Erupter
 series (both USB and blades), a large variety of Bitfury-based miners,
 series (both USB and blades), a large variety of Bitfury-based miners,
-Butterfly Labs' SC range of devices, HashBuster boards, Klondike modules, and
-KnCMiner's Mercury, Jupiter and Saturn.
+Butterfly Labs' SC range of devices, HashBuster boards, GekkoScience's Compac
+USB stick, Klondike modules, and KnCMiner's Mercury, Jupiter and Saturn.
 
 
 
 
 ANTMINER U3
 ANTMINER U3
@@ -22,6 +22,12 @@ known-working configuration is:
 
 
 --set antminer:voltage=x800 --set antminer:clock=x1286 --set antminer:timing=0.022421
 --set antminer:voltage=x800 --set antminer:clock=x1286 --set antminer:timing=0.022421
 
 
+Some valid values for clock setting are:
+    x0783 for 100 MHz, x0983 for 125 MHz, x0b83 for 150 MHz, x0d83 for 175 MHz,
+    x0782 for 200 MHz, x0882 for 225 MHz, x0982 for 250 MHz, x0a82 for 275 MHz,
+    x0b82 for 300 MHz, x0c82 for 325 MHz, x0d82 for 350 MHz, x0e82 for 375 MHz,
+    and x08f2 for 400 MHz
+
 
 
 AVALON 1
 AVALON 1
 --------
 --------
@@ -175,6 +181,17 @@ ports. They communicate with the Icarus protocol, which has some additional
 options in README.FPGA
 options in README.FPGA
 
 
 
 
+COMPAC
+------
+
+These USB sticks are based on Bitmain's BM1384 chip, and use the antminer
+driver. You can set the clock frequency with
+
+--set compac:clock=x0782
+
+The same values for Antminer U3 (above) are valid for the BM1384.
+
+
 HEX*FURY
 HEX*FURY
 --------
 --------
 
 

+ 34 - 3
driver-antminer.c

@@ -38,14 +38,13 @@
 #define ANTMINER_COMMAND_OFFSET 32
 #define ANTMINER_COMMAND_OFFSET 32
 
 
 BFG_REGISTER_DRIVER(antminer_drv)
 BFG_REGISTER_DRIVER(antminer_drv)
+BFG_REGISTER_DRIVER(compac_drv)
 static
 static
 const struct bfg_set_device_definition antminer_set_device_funcs[];
 const struct bfg_set_device_definition antminer_set_device_funcs[];
 
 
 static
 static
-bool antminer_detect_one(const char *devpath)
+bool antminer_detect_one_with_drv(const char * const devpath, struct device_drv * const drv)
 {
 {
-	struct device_drv *drv = &antminer_drv;
-	
 	struct ICARUS_INFO *info = calloc(1, sizeof(struct ICARUS_INFO));
 	struct ICARUS_INFO *info = calloc(1, sizeof(struct ICARUS_INFO));
 	if (unlikely(!info))
 	if (unlikely(!info))
 		quit(1, "Failed to malloc ICARUS_INFO");
 		quit(1, "Failed to malloc ICARUS_INFO");
@@ -72,6 +71,11 @@ bool antminer_detect_one(const char *devpath)
 	return true;
 	return true;
 }
 }
 
 
+static bool antminer_detect_one(const char * const devpath)
+{
+	return antminer_detect_one_with_drv(devpath, &antminer_drv);
+}
+
 static
 static
 bool antminer_lowl_match(const struct lowlevel_device_info * const info)
 bool antminer_lowl_match(const struct lowlevel_device_info * const info)
 {
 {
@@ -270,6 +274,23 @@ const struct bfg_set_device_definition antminer_set_device_funcs[] = {
 	{NULL},
 	{NULL},
 };
 };
 
 
+static
+bool compac_lowl_match(const struct lowlevel_device_info * const info)
+{
+	return lowlevel_match_lowlproduct(info, &lowl_vcom, "Compac", "Bitcoin");
+}
+
+static bool compac_detect_one(const char * const devpath)
+{
+	return antminer_detect_one_with_drv(devpath, &compac_drv);
+}
+
+static
+bool compac_lowl_probe(const struct lowlevel_device_info * const info)
+{
+	return vcom_lowl_probe_wrapper(info, compac_detect_one);
+}
+
 static
 static
 void antminer_drv_init()
 void antminer_drv_init()
 {
 {
@@ -280,8 +301,18 @@ void antminer_drv_init()
 	antminer_drv.lowl_probe = antminer_lowl_probe;
 	antminer_drv.lowl_probe = antminer_lowl_probe;
 	antminer_drv.identify_device = antminer_identify;
 	antminer_drv.identify_device = antminer_identify;
 	++antminer_drv.probe_priority;
 	++antminer_drv.probe_priority;
+	
+	compac_drv = antminer_drv;
+	compac_drv.name = "CBM";
+	compac_drv.lowl_match = compac_lowl_match;
+	compac_drv.lowl_probe = compac_lowl_probe;
+	++compac_drv.probe_priority;
 }
 }
 
 
 struct device_drv antminer_drv = {
 struct device_drv antminer_drv = {
 	.drv_init = antminer_drv_init,
 	.drv_init = antminer_drv_init,
 };
 };
+
+struct device_drv compac_drv = {
+	.drv_init = antminer_drv_init,
+};

+ 2 - 2
driver-icarus.c

@@ -487,8 +487,8 @@ int icarus_probe_work_division(const int fd, const char * const repr, struct ICA
 	unsigned char pkt[64] =
 	unsigned char pkt[64] =
 		"\x2e\x4c\x8f\x91\xfd\x59\x5d\x2d\x7e\xa2\x0a\xaa\xcb\x64\xa2\xa0"
 		"\x2e\x4c\x8f\x91\xfd\x59\x5d\x2d\x7e\xa2\x0a\xaa\xcb\x64\xa2\xa0"
 		"\x43\x82\x86\x02\x77\xcf\x26\xb6\xa1\xee\x04\xc5\x6a\x5b\x50\x4a"
 		"\x43\x82\x86\x02\x77\xcf\x26\xb6\xa1\xee\x04\xc5\x6a\x5b\x50\x4a"
-		"WDiv\0\0\0\0BFGMiner"
-		"BFG\0\x64\x61\x01\x1a\xc9\x06\xa9\x51\xfb\x9b\x3c\x73";
+		"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+		"\x64\x61\x01\x1a\xc9\x06\xa9\x51\xfb\x9b\x3c\x73";
 	
 	
 	icarus_write(repr, fd, pkt, sizeof(pkt));
 	icarus_write(repr, fd, pkt, sizeof(pkt));
 	memset(res_bin, 0, sizeof(res_bin));
 	memset(res_bin, 0, sizeof(res_bin));