Browse Source

ztex updateFreq was always reporting on fpga 0

nfactor-troky
nelisky 13 years ago
parent
commit
0eda541560
  1. 14
      driver-ztex.c

14
driver-ztex.c

@ -129,7 +129,7 @@ static bool ztex_updateFreq(struct libztex_device* ztex)
if (bestM != ztex->freqM) { if (bestM != ztex->freqM) {
ztex_selectFpga(ztex); ztex_selectFpga(ztex);
libztex_setFreq(ztex->root, bestM); libztex_setFreq(ztex, bestM);
ztex_releaseFpga(ztex); ztex_releaseFpga(ztex);
} }
@ -138,7 +138,7 @@ static bool ztex_updateFreq(struct libztex_device* ztex)
maxM++; maxM++;
if ((bestM < (1.0 - LIBZTEX_OVERHEATTHRESHOLD) * maxM) && bestM < maxM - 1) { if ((bestM < (1.0 - LIBZTEX_OVERHEATTHRESHOLD) * maxM) && bestM < maxM - 1) {
ztex_selectFpga(ztex); ztex_selectFpga(ztex);
libztex_resetFpga(ztex->root); libztex_resetFpga(ztex);
ztex_releaseFpga(ztex); ztex_releaseFpga(ztex);
applog(LOG_ERR, "%s: frequency drop of %.1f%% detect. This may be caused by overheating. FPGA is shut down to prevent damage.", applog(LOG_ERR, "%s: frequency drop of %.1f%% detect. This may be caused by overheating. FPGA is shut down to prevent damage.",
ztex->repr, (1.0 - 1.0 * bestM / maxM) * 100); ztex->repr, (1.0 - 1.0 * bestM / maxM) * 100);
@ -206,12 +206,12 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
memcpy(sendbuf + 12, work->midstate, 32); memcpy(sendbuf + 12, work->midstate, 32);
ztex_selectFpga(ztex); ztex_selectFpga(ztex);
i = libztex_sendHashData(ztex->root, sendbuf); i = libztex_sendHashData(ztex, sendbuf);
if (i < 0) { if (i < 0) {
// Something wrong happened in send // Something wrong happened in send
applog(LOG_ERR, "%s: Failed to send hash data with err %d, retrying", ztex->repr, i); applog(LOG_ERR, "%s: Failed to send hash data with err %d, retrying", ztex->repr, i);
usleep(500000); usleep(500000);
i = libztex_sendHashData(ztex->root, sendbuf); i = libztex_sendHashData(ztex, sendbuf);
if (i < 0) { if (i < 0) {
// And there's nothing we can do about it // And there's nothing we can do about it
ztex_disable(thr); ztex_disable(thr);
@ -249,12 +249,12 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
break; break;
} }
ztex_selectFpga(ztex); ztex_selectFpga(ztex);
i = libztex_readHashData(ztex->root, &hdata[0]); i = libztex_readHashData(ztex, &hdata[0]);
if (i < 0) { if (i < 0) {
// Something wrong happened in read // Something wrong happened in read
applog(LOG_ERR, "%s: Failed to read hash data with err %d, retrying", ztex->repr, i); applog(LOG_ERR, "%s: Failed to read hash data with err %d, retrying", ztex->repr, i);
usleep(500000); usleep(500000);
i = libztex_readHashData(ztex->root, &hdata[0]); i = libztex_readHashData(ztex, &hdata[0]);
if (i < 0) { if (i < 0) {
// And there's nothing we can do about it // And there's nothing we can do about it
ztex_disable(thr); ztex_disable(thr);
@ -363,7 +363,7 @@ static bool ztex_prepare(struct thr_info *thr)
get_datestamp(cgpu->init, &now); get_datestamp(cgpu->init, &now);
ztex_selectFpga(ztex); ztex_selectFpga(ztex);
if (libztex_configureFpga(ztex->root) != 0) if (libztex_configureFpga(ztex) != 0)
return false; return false;
ztex_releaseFpga(ztex); ztex_releaseFpga(ztex);
ztex->freqM = -1; ztex->freqM = -1;

Loading…
Cancel
Save