changes to bitburner driver for bitburner fury 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
diff --git a/driver-avalon.c b/driver-avalon.c
index 341a635..82657e5 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -209,6 +209,52 @@ static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *aval
return ret;
}
+static int bitburner_send_task(const struct avalon_task *at, struct cgpu_info *avalon)
+
+{
+ uint8_t buf[AVALON_WRITE_SIZE + 4 * AVALON_DEFAULT_ASIC_NUM];
+ int ret, ep = C_AVALON_TASK;
+ size_t nr_len;
+
+ if (at->nonce_elf)
+ nr_len = AVALON_WRITE_SIZE + 4 * at->asic_num;
+ else
+ nr_len = AVALON_WRITE_SIZE;
+
+ memset(buf, 0, nr_len);
+ memcpy(buf, at, AVALON_WRITE_SIZE);
+
+#if defined(__BIG_ENDIAN__) || defined(MIPSEB)
+ uint8_t tt = 0;
+
+ tt = (buf[0] & 0x0f) << 4;
+ tt |= ((buf[0] & 0x10) ? (1 << 3) : 0);
+ tt |= ((buf[0] & 0x20) ? (1 << 2) : 0);
+ tt |= ((buf[0] & 0x40) ? (1 << 1) : 0);
+ tt |= ((buf[0] & 0x80) ? (1 << 0) : 0);
+ buf[0] = tt;
+
+ tt = (buf[4] & 0x0f) << 4;
+ tt |= ((buf[4] & 0x10) ? (1 << 3) : 0);
+ tt |= ((buf[4] & 0x20) ? (1 << 2) : 0);
+ tt |= ((buf[4] & 0x40) ? (1 << 1) : 0);
+ tt |= ((buf[4] & 0x80) ? (1 << 0) : 0);
+ buf[4] = tt;
+#endif
+
+ if (at->reset) {
+ ep = C_AVALON_RESET;
+ nr_len = 1;
+ }
+ if (opt_debug) {
+ applog(LOG_DEBUG, "Avalon: Sent(%u):", (unsigned int)nr_len);
+ hexdump(buf, nr_len);
+ }
+ ret = avalon_write(avalon, (char *)buf, nr_len, ep);
+
+ return ret;
+}
+
static bool avalon_decode_nonce(struct thr_info *thr, struct cgpu_info *avalon,
struct avalon_info *info, struct avalon_result *ar,
struct work *work)
@@ -414,7 +460,7 @@ static bool get_options(int this_option_offset, int *baud, int *miner_count,
if (*colon) {
tmp = atoi(colon);
- if (tmp > 0 && tmp <= AVALON_DEFAULT_MINER_NUM) {
+ if (tmp > 0 && tmp <= AVALON_MAX_MINER_NUM) {
*miner_count = tmp;
} else {
quit(1, "Invalid avalon-options for "
@@ -1181,7 +1227,7 @@ static void *bitburner_send_tasks(void *userdata)
avalon_reset_auto(info);
}
- ret = avalon_send_task(&at, avalon);
+ ret = bitburner_send_task(&at, avalon);
if (unlikely(ret == AVA_SEND_ERROR)) {
applog(LOG_ERR, "%s%i: Comms error(buffer)",
diff --git a/driver-avalon.h b/driver-avalon.h
index 54dc5e2..ae32353 100644
--- a/driver-avalon.h
+++ b/driver-avalon.h
@@ -36,7 +36,7 @@
#define BITBURNER_DEFAULT_CORE_VOLTAGE 1200 /* in millivolts */
#define BITBURNER_MIN_COREMV 1000
/* change here if you want to risk killing it :) */
-#define BITBURNER_MAX_COREMV 1400
+#define BITBURNER_MAX_COREMV 1500
#define AVALON_DEFAULT_TIMEOUT 0x2D
@@ -45,6 +45,7 @@
#define AVALON_TIMEOUT_FACTOR 12690
#define AVALON_DEFAULT_FREQUENCY 282
#define AVALON_DEFAULT_MINER_NUM 0x20
+#define AVALON_MAX_MINER_NUM 0x100
#define AVALON_DEFAULT_ASIC_NUM 0xA
#define AVALON_AUTO_CYCLE 1024