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