Browse Source

changes to bitburner driver for bitburner fury boards

nfactor-troky
Chris Chua 11 years ago
parent
commit
521e746b80
  1. 50
      driver-avalon.c
  2. 3
      driver-avalon.h

50
driver-avalon.c

@ -209,6 +209,52 @@ static int avalon_send_task(const struct avalon_task *at, struct cgpu_info *aval
return ret; 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, static bool avalon_decode_nonce(struct thr_info *thr, struct cgpu_info *avalon,
struct avalon_info *info, struct avalon_result *ar, struct avalon_info *info, struct avalon_result *ar,
struct work *work) struct work *work)
@ -414,7 +460,7 @@ static bool get_options(int this_option_offset, int *baud, int *miner_count,
if (*colon) { if (*colon) {
tmp = atoi(colon); tmp = atoi(colon);
if (tmp > 0 && tmp <= AVALON_DEFAULT_MINER_NUM) { if (tmp > 0 && tmp <= AVALON_MAX_MINER_NUM) {
*miner_count = tmp; *miner_count = tmp;
} else { } else {
quit(1, "Invalid avalon-options for " quit(1, "Invalid avalon-options for "
@ -1181,7 +1227,7 @@ static void *bitburner_send_tasks(void *userdata)
avalon_reset_auto(info); avalon_reset_auto(info);
} }
ret = avalon_send_task(&at, avalon); ret = bitburner_send_task(&at, avalon);
if (unlikely(ret == AVA_SEND_ERROR)) { if (unlikely(ret == AVA_SEND_ERROR)) {
applog(LOG_ERR, "%s%i: Comms error(buffer)", applog(LOG_ERR, "%s%i: Comms error(buffer)",

3
driver-avalon.h

@ -36,7 +36,7 @@
#define BITBURNER_DEFAULT_CORE_VOLTAGE 1200 /* in millivolts */ #define BITBURNER_DEFAULT_CORE_VOLTAGE 1200 /* in millivolts */
#define BITBURNER_MIN_COREMV 1000 #define BITBURNER_MIN_COREMV 1000
/* change here if you want to risk killing it :) */ /* change here if you want to risk killing it :) */
#define BITBURNER_MAX_COREMV 1400 #define BITBURNER_MAX_COREMV 1500
#define AVALON_DEFAULT_TIMEOUT 0x2D #define AVALON_DEFAULT_TIMEOUT 0x2D
@ -45,6 +45,7 @@
#define AVALON_TIMEOUT_FACTOR 12690 #define AVALON_TIMEOUT_FACTOR 12690
#define AVALON_DEFAULT_FREQUENCY 282 #define AVALON_DEFAULT_FREQUENCY 282
#define AVALON_DEFAULT_MINER_NUM 0x20 #define AVALON_DEFAULT_MINER_NUM 0x20
#define AVALON_MAX_MINER_NUM 0x100
#define AVALON_DEFAULT_ASIC_NUM 0xA #define AVALON_DEFAULT_ASIC_NUM 0xA
#define AVALON_AUTO_CYCLE 1024 #define AVALON_AUTO_CYCLE 1024

Loading…
Cancel
Save