Browse Source

avalon: display the FPGA controller version on API

nfactor-troky
Xiangfu 11 years ago
parent
commit
088a340342
  1. 16
      driver-avalon.c
  2. 1
      driver-avalon.h

16
driver-avalon.c

@ -273,6 +273,7 @@ static int avalon_reset(struct cgpu_info *avalon, bool initial) @@ -273,6 +273,7 @@ static int avalon_reset(struct cgpu_info *avalon, bool initial)
struct avalon_task at;
uint8_t *buf, *tmp;
struct timespec p;
struct avalon_info *info = avalon->device_data;
/* Send reset, then check for result */
avalon_init_task(&at, 1, 0,
@ -329,9 +330,17 @@ static int avalon_reset(struct cgpu_info *avalon, bool initial) @@ -329,9 +330,17 @@ static int avalon_reset(struct cgpu_info *avalon, bool initial)
" (%d: %02x %02x %02x %02x)", avalon->drv->name, avalon->device_id,
i, buf[0], buf[1], buf[2], buf[3]);
/* FIXME: return 1; */
} else
applog(LOG_WARNING, "%s%d: Reset succeeded",
avalon->drv->name, avalon->device_id);
} else {
/* buf[44]: minor
* buf[45]: day
* buf[46]: year,month, d6: 201306
*/
info->ctlr_ver = ((buf[46] >> 4) + 2000) * 1000000 +
(buf[46] & 0x0f) * 10000 +
buf[45] * 100 + buf[44];
applog(LOG_WARNING, "%s%d: Reset succeeded (Controller version: %d)",
avalon->drv->name, avalon->device_id, info->ctlr_ver);
}
return 0;
}
@ -1522,6 +1531,7 @@ static struct api_data *avalon_api_stats(struct cgpu_info *cgpu) @@ -1522,6 +1531,7 @@ static struct api_data *avalon_api_stats(struct cgpu_info *cgpu)
info->version1, info->version2, info->version3);
root = api_add_string(root, "version", buf, true);
}
root = api_add_int(root, "Controller Version", &(info->ctlr_ver), false);
return root;
}

1
driver-avalon.h

@ -125,6 +125,7 @@ struct avalon_info { @@ -125,6 +125,7 @@ struct avalon_info {
int matching_work[AVALON_DEFAULT_MINER_NUM];
int frequency;
uint32_t ctlr_ver;
struct thr_info *thr;
pthread_t read_thr;

Loading…
Cancel
Save