Merge pull request #509 from roybadami/master Improvements to support for BitBurner boards
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
diff --git a/ASIC-README b/ASIC-README
index 55b76d8..a56666c 100644
--- a/ASIC-README
+++ b/ASIC-README
@@ -102,11 +102,13 @@ ASIC SPECIFIC COMMANDS
--avalon-options <arg> Set avalon options baud:miners:asic:timeout:freq
--avalon-temp <arg> Set avalon target temperature (default: 50)
--bflsc-overheat <arg> Set overheat temperature where BFLSC devices throttle, 0 to disable (default: 90)
---bitburner-voltage <arg> Set BitBurner core voltage, in millivolts
+--bitburner-fury-options <arg> Override avalon-options for BitBurner Fury boards baud:miners:asic:timeout:freq
+--bitburner-fury-voltage <arg> Set BitBurner Fury core voltage, in millivolts
+--bitburner-voltage <arg> Set BitBurner (Avalon) core voltage, in millivolts
--klondike-options <arg> Set klondike options clock:temp1:temp2:fan
-AVALON DEVICES
+AVALON AND BITBURNER DEVICES
Currently all known Avalon devices come with their own operating system and
a preinstalled version of cgminer as part of the flash firmware, based on the
@@ -118,6 +120,9 @@ command, and adjust its fan control-temperature relationship with avalon-temp.
By default the avalon will also cut off when its temperature reaches 60
degrees.
+All current BitBurner devices (BitBurner X, BitBurner XX and BitBurner Fury)
+emulate Avalon devices, whether or not they use Avalon chips.
+
Avalon commands:
--avalon-auto Adjust avalon overclock frequency dynamically for best hashrate
@@ -126,7 +131,9 @@ Avalon commands:
--avalon-freq <arg> Set frequency range for avalon-auto, single value or range
--avalon-options <arg> Set avalon options baud:miners:asic:timeout:freq
--avalon-temp <arg> Set avalon target temperature (default: 50)
---bitburner-voltage <arg> Set BitBurner core voltage, in millivolts
+--bitburner-fury-options <arg> Override avalon-options for BitBurner Fury boards baud:miners:asic:timeout:freq
+--bitburner-fury-voltage <arg> Set BitBurner Fury core voltage, in millivolts
+--bitburner-voltage <arg> Set BitBurner (Avalon) core voltage, in millivolts
Avalon auto will enable dynamic overclocking gradually increasing and
@@ -177,8 +184,15 @@ Miners:
Most Avalons are 3 module devices, which come to 24 miners. 4 module devices
would use 32 here.
+For BitBurner X and BitBurner XX devices you should use twice the number of
+boards in the stack. e.g. for a two-board stack you would use 4. For
+BitBurner Fury devices you should use the total number of BitFury chips in the
+stack (i.e. 16 times the number of boards). e.g. for a two-board stack you
+would use 32.
+
Asic count:
-Virtually all have 10, so don't change this.
+Virtually all have 10, so don't change this. BitBurner devices use 10 here
+even if the boards have some other number of ASICs.
Timeout:
This is how long the device will work on a work item before accepting new work
@@ -198,16 +212,61 @@ Sample settings for valid different frequencies (last 2 values):
50:256
Frequency:
-This is the clock speed of the devices. Only specific values work, 256, 270,
-282 (default), 300, 325, 350 and 375.
+This is the clock speed of the devices. For Avalon devices, only specific
+values work, 256, 270, 282 (default), 300, 325, 350 and 375. For BitBurner
+devices, other values can be used.
Note that setting a value with an asterisk next to it will be using your
avalon outside its spec and you do so at your own risk.
+The default frequency for BitBurner X and BitBurner XX boards is 282. The
+default frequency for BitBurner Fury boards is 256. Overclocking is
+possible - please consult the product documentation and/or manufacturer for
+information on safe values. Values outside this range are used at your own
+risk. Underclocking is also possible, at least with the X and XX boards.
+
+eg:
+--bitburner-fury-options <arg> Override avalon-options for BitBurner Fury boards baud:miners:asic:timeout:freq
+
+This option takes the same format as --avalon-options. When specified, it
+will be used for BitBurner Fury boards in preference to the values specified
+in --avalon-options. (If not specified, BitBurner Fury boards will be
+controlled by the values used in --avalon options.) See --avalon-options for
+a detailed description of the fields.
+
+This option is particularly useful when using a mixture of different BitBurner
+devices as BitBurner Fury devices generally require significantly different
+clock frequencies from Avalon-based devices. This option is only available
+for boards with recent firmware that are recognized by cgminer as BBF.
+
eg:
---bitburner-voltage <arg> Set BitBurner core voltage, in millivolts
+--bitburner-fury-voltage <arg> Set BitBurner Fury core voltage, in millivolts
+
+Sets the core voltage for the BitBurner Fury boards. The default value is
+900. Overvolting is possible - please consult the product documentation
+and/or manufaturer about the safe range of values. Values outside this range
+are used at your own risk.
+
+This option is only available for boards with recent firmware that are
+recognized by cgminer as BBF. For boards recognized as BTB, see
+--bitburner-voltage
+
+eg:
+--bitburner-voltage <arg> Set BitBurner (Avalon) core voltage, in millivolts
+
+Sets the core voltage for the Avalon-based BitBurner X and BitBurner XX
+boards. The default value is 1200. Overvolting and undervolting is
+possible - please consult the product documentation and/or the manufacturer
+for information about the safe range. Values outside this range are used at
+your own risk.
+
+Older BitBurner Fury firmware emulates a BitBurner XX board and is identified
+by cgminer as BTB. On these devices, --bitburner-voltage is used to control
+the voltage of the BitBurner Fury board. The actual core voltage will be
+300mV less than the requested voltage, so to run a BitBurner Fury board at
+950mV use --bitburner-voltage 1250. The default value of 1200 therefore
+corresponds to the default core voltage of 900mV.
-Self evident.
If you use the full curses based interface with Avalons you will get this
information:
diff --git a/README b/README
index 5c73991..832d424 100644
--- a/README
+++ b/README
@@ -220,7 +220,9 @@ ASIC only options:
--avalon-options <arg> Set avalon options baud:miners:asic:timeout:freq
--avalon-temp <arg> Set avalon target temperature (default: 50)
--bflsc-overheat <arg> Set overheat temperature where BFLSC devices throttle, 0 to disable (default: 90)
---bitburner-voltage <arg> Set BitBurner core voltage, in millivolts
+--bitburner-fury-options <arg> Override avalon-options for BitBurner Fury boards baud:miners:asic:timeout:freq
+--bitburner-fury-voltage <arg> Set BitBurner Fury core voltage, in millivolts
+--bitburner-voltage <arg> Set BitBurner (Avalon) core voltage, in millivolts
See ASIC-README for more information regarding these.
diff --git a/cgminer.c b/cgminer.c
index 99dbaa7..f6f5cce 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -167,6 +167,7 @@ char *opt_icarus_timing = NULL;
bool opt_worktime;
#ifdef USE_AVALON
char *opt_avalon_options = NULL;
+char *opt_bitburner_fury_options = NULL;
#endif
#ifdef USE_KLONDIKE
char *opt_klondike_options = NULL;
@@ -1036,6 +1037,13 @@ static char *set_avalon_options(const char *arg)
return NULL;
}
+
+static char *set_bitburner_fury_options(const char *arg)
+{
+ opt_set_charp(arg, &opt_bitburner_fury_options);
+
+ return NULL;
+}
#endif
#ifdef USE_KLONDIKE
@@ -1255,6 +1263,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--bitburner-fury-voltage",
opt_set_intval, NULL, &opt_bitburner_fury_core_voltage,
"Set BitBurner Fury core voltage, in millivolts"),
+ OPT_WITH_ARG("--bitburner-fury-options",
+ set_bitburner_fury_options, NULL, NULL,
+ "Override avalon-options for BitBurner Fury boards baud:miners:asic:timeout:freq"),
#endif
#ifdef USE_KLONDIKE
OPT_WITH_ARG("--klondike-options",
diff --git a/driver-avalon.c b/driver-avalon.c
index 09e6dfa..75cd06e 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -53,6 +53,7 @@ int opt_bitburner_fury_core_voltage = BITBURNER_FURY_DEFAULT_CORE_VOLTAGE;
bool opt_avalon_auto;
static int option_offset = -1;
+static int bbf_option_offset = -1;
static int avalon_init_task(struct avalon_task *at,
uint8_t reset, uint8_t ff, uint8_t fan,
@@ -400,7 +401,7 @@ static int avalon_calc_timeout(int frequency)
}
static bool get_options(int this_option_offset, int *baud, int *miner_count,
- int *asic_count, int *timeout, int *frequency)
+ int *asic_count, int *timeout, int *frequency, char *options)
{
char buf[BUFSIZ+1];
char *ptr, *comma, *colon, *colon2, *colon3, *colon4;
@@ -408,10 +409,10 @@ static bool get_options(int this_option_offset, int *baud, int *miner_count,
size_t max;
int i, tmp;
- if (opt_avalon_options == NULL)
+ if (options == NULL)
buf[0] = '\0';
else {
- ptr = opt_avalon_options;
+ ptr = options;
for (i = 0; i < this_option_offset; i++) {
comma = strchr(ptr, ',');
if (comma == NULL)
@@ -754,7 +755,7 @@ static void bitburner_get_version(struct cgpu_info *avalon)
static bool avalon_detect_one(libusb_device *dev, struct usb_find_devices *found)
{
int baud, miner_count, asic_count, timeout, frequency;
- int this_option_offset = ++option_offset;
+ int this_option_offset;
struct avalon_info *info;
struct cgpu_info *avalon;
bool configured;
@@ -768,12 +769,14 @@ static bool avalon_detect_one(libusb_device *dev, struct usb_find_devices *found
timeout = AVALON_DEFAULT_TIMEOUT;
frequency = AVALON_DEFAULT_FREQUENCY;
- configured = get_options(this_option_offset, &baud, &miner_count,
- &asic_count, &timeout, &frequency);
-
if (!usb_init(avalon, dev, found))
goto shin;
+ this_option_offset = usb_ident(avalon) == IDENT_BBF ? ++bbf_option_offset : ++option_offset;
+ configured = get_options(this_option_offset, &baud, &miner_count,
+ &asic_count, &timeout, &frequency,
+ (usb_ident(avalon) == IDENT_BBF && opt_bitburner_fury_options != NULL) ? opt_bitburner_fury_options : opt_avalon_options);
+
/* Even though this is an FTDI type chip, we want to do the parsing
* all ourselves so set it to std usb type */
avalon->usbdev->usb_type = USB_TYPE_STD;
@@ -796,10 +799,18 @@ static bool avalon_detect_one(libusb_device *dev, struct usb_find_devices *found
info->frequency = frequency;
} else {
info->baud = AVALON_IO_SPEED;
- info->miner_count = AVALON_DEFAULT_MINER_NUM;
info->asic_count = AVALON_DEFAULT_ASIC_NUM;
- info->timeout = AVALON_DEFAULT_TIMEOUT;
- info->frequency = AVALON_DEFAULT_FREQUENCY;
+ switch (usb_ident(avalon)) {
+ case IDENT_BBF:
+ info->miner_count = BITBURNER_FURY_DEFAULT_MINER_NUM;
+ info->timeout = BITBURNER_FURY_DEFAULT_TIMEOUT;
+ info->frequency = BITBURNER_FURY_DEFAULT_FREQUENCY;
+ break;
+ default:
+ info->miner_count = AVALON_DEFAULT_MINER_NUM;
+ info->timeout = AVALON_DEFAULT_TIMEOUT;
+ info->frequency = AVALON_DEFAULT_FREQUENCY;
+ }
}
info->fan_pwm = AVALON_DEFAULT_FAN_MIN_PWM;
diff --git a/driver-avalon.h b/driver-avalon.h
index e506388..063fb68 100644
--- a/driver-avalon.h
+++ b/driver-avalon.h
@@ -55,6 +55,12 @@
#define AVALON_MAX_MINER_NUM 0x100
#define AVALON_DEFAULT_ASIC_NUM 0xA
+/* Default number of miners for Bitburner Fury is for a stack of 8 boards,
+ but it will work acceptably for smaller stacks, too */
+#define BITBURNER_FURY_DEFAULT_MINER_NUM 128
+#define BITBURNER_FURY_DEFAULT_FREQUENCY 256
+#define BITBURNER_FURY_DEFAULT_TIMEOUT 50
+
#define AVALON_AUTO_CYCLE 1024
#define AVALON_FTDI_READSIZE 510
diff --git a/miner.h b/miner.h
index 874f172..bd80883 100644
--- a/miner.h
+++ b/miner.h
@@ -1022,6 +1022,7 @@ extern char *opt_icarus_timing;
extern bool opt_worktime;
#ifdef USE_AVALON
extern char *opt_avalon_options;
+extern char *opt_bitburner_fury_options;
#endif
#ifdef USE_KLONDIKE
extern char *opt_klondike_options;