Code cleanup and improved documentation
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
diff --git a/ASIC-README b/ASIC-README
index 9ac56c7..a56666c 100644
--- a/ASIC-README
+++ b/ASIC-README
@@ -108,7 +108,7 @@ ASIC SPECIFIC COMMANDS
--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
@@ -120,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
@@ -181,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
@@ -202,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/driver-avalon.c b/driver-avalon.c
index dd73316..98897fb 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -797,24 +797,25 @@ static bool avalon_detect_one(libusb_device *dev, struct usb_find_devices *found
info->asic_count = asic_count;
info->timeout = timeout;
info->frequency = frequency;
- } else if (usb_ident(avalon) == IDENT_BTB) {
- info->baud = AVALON_IO_SPEED;
- info->miner_count = BITBURNER_XX_DEFAULT_MINER_NUM;
- info->asic_count = BITBURNER_DEFAULT_ASIC_NUM;
- info->timeout = AVALON_DEFAULT_TIMEOUT;
- info->frequency = AVALON_DEFAULT_FREQUENCY;
- } else if (usb_ident(avalon) == IDENT_BBF) {
- info->baud = AVALON_IO_SPEED;
- info->miner_count = BITBURNER_FURY_DEFAULT_MINER_NUM;
- info->asic_count = BITBURNER_DEFAULT_ASIC_NUM;
- info->timeout = BITBURNER_FURY_DEFAULT_TIMEOUT;
- info->frequency = BITBURNER_FURY_DEFAULT_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_BTB:
+ info->miner_count = BITBURNER_XX_DEFAULT_MINER_NUM;
+ info->timeout = AVALON_DEFAULT_TIMEOUT;
+ info->frequency = AVALON_DEFAULT_FREQUENCY;
+ break;
+ 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 34ea133..1e985db 100644
--- a/driver-avalon.h
+++ b/driver-avalon.h
@@ -55,9 +55,10 @@
#define AVALON_MAX_MINER_NUM 0x100
#define AVALON_DEFAULT_ASIC_NUM 0xA
+/* Default values for *_MINER_NUM are for a full stack of 8 boards, but they
+ will work acceptably for smaller stacks, too */
#define BITBURNER_XX_DEFAULT_MINER_NUM 16
#define BITBURNER_FURY_DEFAULT_MINER_NUM 128
-#define BITBURNER_DEFAULT_ASIC_NUM 10
#define BITBURNER_FURY_DEFAULT_FREQUENCY 256
#define BITBURNER_FURY_DEFAULT_TIMEOUT 50