Trying harder to get 1.15y working
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
diff --git a/driver-ztex.c b/driver-ztex.c
index bbfd9b1..89bccec 100644
--- a/driver-ztex.c
+++ b/driver-ztex.c
@@ -41,6 +41,7 @@ static void ztex_selectFpga(struct libztex_device* ztex)
if (ztex->root->numberOfFpgas > 1) {
if (ztex->root->selectedFpga != ztex->fpgaNum)
mutex_lock(&ztex->root->mutex);
+ applog(LOG_DEBUG, "%s:%d: locked", ztex->repr, ztex->fpgaNum);
libztex_selectFpga(ztex);
}
}
@@ -50,6 +51,7 @@ static void ztex_releaseFpga(struct libztex_device* ztex)
if (ztex->root->numberOfFpgas > 1) {
ztex->root->selectedFpga = -1;
mutex_unlock(&ztex->root->mutex);
+ applog(LOG_DEBUG, "%s:%d: unlocked", ztex->repr, ztex->fpgaNum);
}
}
@@ -127,7 +129,7 @@ static bool ztex_updateFreq(struct libztex_device* ztex)
if (bestM != ztex->freqM) {
ztex_selectFpga(ztex);
- libztex_setFreq(ztex, bestM);
+ libztex_setFreq(ztex->root, bestM);
ztex_releaseFpga(ztex);
}
@@ -136,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);
+ libztex_resetFpga(ztex->root);
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);
@@ -204,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, sendbuf);
+ i = libztex_sendHashData(ztex->root, 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, sendbuf);
+ i = libztex_sendHashData(ztex->root, sendbuf);
if (i < 0) {
// And there's nothing we can do about it
ztex_disable(thr);
@@ -247,12 +249,12 @@ static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
break;
}
ztex_selectFpga(ztex);
- i = libztex_readHashData(ztex, &hdata[0]);
+ i = libztex_readHashData(ztex->root, &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, &hdata[0]);
+ i = libztex_readHashData(ztex->root, &hdata[0]);
if (i < 0) {
// And there's nothing we can do about it
ztex_disable(thr);
@@ -361,7 +363,7 @@ static bool ztex_prepare(struct thr_info *thr)
get_datestamp(cgpu->init, &now);
ztex_selectFpga(ztex);
- if (libztex_configureFpga(ztex) != 0)
+ if (libztex_configureFpga(ztex->root) != 0)
return false;
ztex_releaseFpga(ztex);
ztex->freqM = -1;
diff --git a/libztex.c b/libztex.c
index 29a226a..1762a48 100644
--- a/libztex.c
+++ b/libztex.c
@@ -351,19 +351,19 @@ int libztex_numberOfFpgas(struct libztex_device *ztex) {
}
int libztex_selectFpga(struct libztex_device *ztex) {
- int cnt, fpgacnt = libztex_numberOfFpgas(ztex);
+ int cnt, fpgacnt = libztex_numberOfFpgas(ztex->root);
int number = ztex->fpgaNum;
if (number < 0 || number >= fpgacnt) {
applog(LOG_WARNING, "%s: Trying to select wrong fpga (%d in %d)", ztex->repr, number, fpgacnt);
return 1;
}
- if (ztex->selectedFpga != number && libztex_checkCapability(ztex, CAPABILITY_MULTI_FPGA)) {
- cnt = libusb_control_transfer(ztex->hndl, 0x40, 0x51, number, 0, NULL, 0, 500);
+ if (ztex->root->selectedFpga != number && libztex_checkCapability(ztex->root, CAPABILITY_MULTI_FPGA)) {
+ cnt = libusb_control_transfer(ztex->root->hndl, 0x40, 0x51, number, 0, NULL, 0, 500);
if (unlikely(cnt < 0)) {
applog(LOG_ERR, "Ztex check device: Failed to set fpga with err %d", cnt);
return cnt;
}
- ztex->selectedFpga = number;
+ ztex->root->selectedFpga = number;
}
return 0;
}