Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
Decode frequency for Avalon nano 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
qinfengling committed Jul 28, 2015
1 parent f648706 commit 923837e
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions driver-avalon-miner.c
Expand Up @@ -226,7 +226,10 @@ static int decode_pkg(struct thr_info *thr, struct avalonm_ret *ar)
applog(LOG_DEBUG, "%s-%d: AVAM_P_STATUS_M", avalonm->drv->name, avalonm->device_id);
hexdump(ar->data, 32);
memcpy(&tmp, ar->data, 4);
info->spi_speed = be32toh(tmp);
if (!strncmp(info->ver, "3U", 2))
info->get_frequency[0][0] = be32toh(tmp);
else
info->spi_speed = be32toh(tmp);
memcpy(&tmp, ar->data + 4, 4);
info->led_status = be32toh(tmp);
memcpy(&tmp, ar->data + 8, 4);
Expand Down Expand Up @@ -1182,15 +1185,20 @@ static struct api_data *avalonm_api_stats(struct cgpu_info *cgpu)
sprintf(buf, " TF[%.2f]", convert_temp(info->adc[2]));
strcat(statbuf, buf);

strcat(statbuf, " Freq[");
for (i = 0; i < info->asic_cnts; i++) {
sprintf(buf, "%d %d %d ",
info->get_frequency[i][0],
info->get_frequency[i][1],
info->get_frequency[i][2]);
if (!strncmp(info->ver, "3U", 2)) {
sprintf(buf, " Freq[%d]", info->get_frequency[0][0]);
strcat(statbuf, buf);
} else {
strcat(statbuf, " Freq[");
for (i = 0; i < info->asic_cnts; i++) {
sprintf(buf, "%d %d %d ",
info->get_frequency[i][0],
info->get_frequency[i][1],
info->get_frequency[i][2]);
strcat(statbuf, buf);
}
statbuf[strlen(statbuf) - 1] = ']';
}
statbuf[strlen(statbuf) - 1] = ']';

strcat(statbuf, " HW[");
for (i = 0; i < info->asic_cnts; i++) {
Expand Down Expand Up @@ -1242,10 +1250,9 @@ static void avalonm_statline_before(char *buf, size_t bufsiz, struct cgpu_info *
struct avalonm_info *info = avalonm->device_data;
int frequency;

if (!strncmp(info->ver, "3U", 2)) {
frequency = 100;
tailsprintf(buf, bufsiz, "%4dMhz %.2fV", frequency, (float)info->get_voltage);
} else {
if (!strncmp(info->ver, "3U", 2))
tailsprintf(buf, bufsiz, "%4dMhz %.2fV", info->get_frequency[0][0], (float)info->get_voltage);
else {
frequency = (info->set_frequency[0][0] * 4 + info->set_frequency[0][1] * 4 + info->set_frequency[0][2]) / 9;
tailsprintf(buf, bufsiz, "%4dMhz %.4fV", frequency, (float)info->get_voltage / 10000);
}
Expand Down

0 comments on commit 923837e

Please sign in to comment.