Browse Source

Moving space indentation to tabs

For consistency with cgminer sources
nfactor-troky
nelisky 13 years ago
parent
commit
c280dd0dae
  1. 757
      libztex.c
  2. 68
      libztex.h
  3. 426
      ztex.c

757
libztex.c

@ -45,428 +45,425 @@
static bool libztex_checkDevice (struct libusb_device *dev) { static bool libztex_checkDevice (struct libusb_device *dev) {
int err; int err;
struct libusb_device_descriptor desc; struct libusb_device_descriptor desc;
err = libusb_get_device_descriptor(dev, &desc); err = libusb_get_device_descriptor(dev, &desc);
if (unlikely(err != 0)) { if (unlikely(err != 0)) {
applog(LOG_ERR, "Ztex check device: Failed to open read descriptor with error %d", err); applog(LOG_ERR, "Ztex check device: Failed to open read descriptor with error %d", err);
return false; return false;
} }
if (!(desc.idVendor == LIBZTEX_IDVENDOR && desc.idProduct == LIBZTEX_IDPRODUCT)) { if (!(desc.idVendor == LIBZTEX_IDVENDOR && desc.idProduct == LIBZTEX_IDPRODUCT)) {
return false; return false;
} }
return true; return true;
} }
static bool libztex_checkCapability (struct libztex_device *ztex, int i, int j) { static bool libztex_checkCapability (struct libztex_device *ztex, int i, int j) {
if (!((i>=0) && (i<=5) && (j>=0) && (j<8) && if (!((i>=0) && (i<=5) && (j>=0) && (j<8) &&
(((ztex->interfaceCapabilities[i] & 255) & (1 << j)) != 0))) { (((ztex->interfaceCapabilities[i] & 255) & (1 << j)) != 0))) {
applog(LOG_ERR, "%s: capability missing: %d %d", ztex->repr, i, i); applog(LOG_ERR, "%s: capability missing: %d %d", ztex->repr, i, i);
} }
return true; return true;
} }
static int libztex_detectBitstreamBitOrder (const unsigned char *buf, int size) { static int libztex_detectBitstreamBitOrder (const unsigned char *buf, int size) {
int i; int i;
size -= 4; size -= 4;
for (i=0; i<size; i++) { for (i=0; i<size; i++) {
if ( ((buf[i] & 255)==0xaa) && ((buf[i+1] & 255)==0x99) && ((buf[i+2] & 255)==0x55) && ((buf[i+3] & 255)==0x66) ) if ( ((buf[i] & 255)==0xaa) && ((buf[i+1] & 255)==0x99) && ((buf[i+2] & 255)==0x55) && ((buf[i+3] & 255)==0x66) )
return 1; return 1;
if ( ((buf[i] & 255)==0x55) && ((buf[i+1] & 255)==0x99) && ((buf[i+2] & 255)==0xaa) && ((buf[i+3] & 255)==0x66) ) if ( ((buf[i] & 255)==0x55) && ((buf[i+1] & 255)==0x99) && ((buf[i+2] & 255)==0xaa) && ((buf[i+3] & 255)==0x66) )
return 0; return 0;
} }
applog(LOG_WARNING, "Unable to determine bitstream bit order: no signature found"); applog(LOG_WARNING, "Unable to determine bitstream bit order: no signature found");
return 0; return 0;
} }
static void libztex_swapBits (unsigned char *buf, int size) { static void libztex_swapBits (unsigned char *buf, int size) {
int i; int i;
unsigned char c; unsigned char c;
for (i=0; i<size; i++) { for (i=0; i<size; i++) {
c = buf[i]; c = buf[i];
buf[i] = ((c & 128) >> 7) | buf[i] = ((c & 128) >> 7) |
((c & 64) >> 5) | ((c & 64) >> 5) |
((c & 32) >> 3) | ((c & 32) >> 3) |
((c & 16) >> 1) | ((c & 16) >> 1) |
((c & 8) << 1) | ((c & 8) << 1) |
((c & 4) << 3) | ((c & 4) << 3) |
((c & 2) << 5) | ((c & 2) << 5) |
((c & 1) << 7); ((c & 1) << 7);
} }
} }
static int libztex_getFpgaState (struct libztex_device *ztex, struct libztex_fpgastate *state) { static int libztex_getFpgaState (struct libztex_device *ztex, struct libztex_fpgastate *state) {
int cnt; int cnt;
unsigned char buf[9]; unsigned char buf[9];
if (!libztex_checkCapability(ztex, CAPABILITY_FPGA)) { if (!libztex_checkCapability(ztex, CAPABILITY_FPGA)) {
return -1; return -1;
} }
cnt = libusb_control_transfer(ztex->hndl, 0xc0, 0x30, 0, 0, buf, 9, 1000); cnt = libusb_control_transfer(ztex->hndl, 0xc0, 0x30, 0, 0, buf, 9, 1000);
if (unlikely(cnt < 0)) { if (unlikely(cnt < 0)) {
applog(LOG_ERR, "%s: Failed getFpgaState with err %d", ztex->repr, cnt); applog(LOG_ERR, "%s: Failed getFpgaState with err %d", ztex->repr, cnt);
return cnt; return cnt;
} }
state->fpgaConfigured = buf[0] == 0; state->fpgaConfigured = buf[0] == 0;
state->fpgaChecksum = buf[1] & 0xff; state->fpgaChecksum = buf[1] & 0xff;
state->fpgaBytes = ((buf[5] & 0xff)<<24) | ((buf[4] & 0xff)<<16) | ((buf[3] & 0xff)<<8) | (buf[2] & 0xff); state->fpgaBytes = ((buf[5] & 0xff)<<24) | ((buf[4] & 0xff)<<16) | ((buf[3] & 0xff)<<8) | (buf[2] & 0xff);
state->fpgaInitB = buf[6] & 0xff; state->fpgaInitB = buf[6] & 0xff;
state->fpgaFlashResult = buf[7]; state->fpgaFlashResult = buf[7];
state->fpgaFlashBitSwap = buf[8] != 0; state->fpgaFlashBitSwap = buf[8] != 0;
return 0; return 0;
} }
static int libztex_configureFpgaLS (struct libztex_device *ztex, const char* firmware, bool force, char bs) { static int libztex_configureFpgaLS (struct libztex_device *ztex, const char* firmware, bool force, char bs) {
struct libztex_fpgastate state; struct libztex_fpgastate state;
ssize_t pos=0; ssize_t pos=0;
int transactionBytes = 2048; int transactionBytes = 2048;
unsigned char buf[transactionBytes], cs; unsigned char buf[transactionBytes], cs;
int tries, cnt, buf_p, i; int tries, cnt, buf_p, i;
FILE *fp; FILE *fp;
if (!libztex_checkCapability(ztex, CAPABILITY_FPGA)) { if (!libztex_checkCapability(ztex, CAPABILITY_FPGA)) {
return -1; return -1;
} }
libztex_getFpgaState(ztex, &state); libztex_getFpgaState(ztex, &state);
if (!force) { if (!force) {
if (state.fpgaConfigured) { if (state.fpgaConfigured) {
return 1; return 1;
} }
} }
for (tries=10; tries>0; tries--) { for (tries=10; tries>0; tries--) {
fp = fopen(firmware, "rb"); fp = fopen(firmware, "rb");
if (!fp) { if (!fp) {
applog(LOG_ERR, "%s: failed to read firmware '%s'", ztex->repr, firmware); applog(LOG_ERR, "%s: failed to read firmware '%s'", ztex->repr, firmware);
return -2; return -2;
} }
cs = 0; cs = 0;
while (pos < transactionBytes && !feof(fp)) { while (pos < transactionBytes && !feof(fp)) {
buf[pos] = getc(fp); buf[pos] = getc(fp);
cs += buf[pos++]; cs += buf[pos++];
}; };
if (feof(fp)) if (feof(fp))
pos--; pos--;
if ( bs<0 || bs>1 ) if ( bs<0 || bs>1 )
bs = libztex_detectBitstreamBitOrder(buf, transactionBytes<pos ? transactionBytes : pos); bs = libztex_detectBitstreamBitOrder(buf, transactionBytes<pos ? transactionBytes : pos);
//* Reset fpga //* Reset fpga
cnt = libztex_resetFpga(ztex); cnt = libztex_resetFpga(ztex);
if (unlikely(cnt < 0)) { if (unlikely(cnt < 0)) {
applog(LOG_ERR, "%s: Failed reset fpga with err %d", ztex->repr, cnt); applog(LOG_ERR, "%s: Failed reset fpga with err %d", ztex->repr, cnt);
continue; continue;
} }
if ( bs == 1 ) if ( bs == 1 )
libztex_swapBits(buf, pos); libztex_swapBits(buf, pos);
buf_p = pos; buf_p = pos;
while (1) { while (1) {
i = 0; i = 0;
while (i < buf_p) { while (i < buf_p) {
cnt = libusb_control_transfer(ztex->hndl, 0x40, 0x32, 0, 0, &buf[i], buf_p-i, 5000); cnt = libusb_control_transfer(ztex->hndl, 0x40, 0x32, 0, 0, &buf[i], buf_p-i, 5000);
if (unlikely(cnt < 0)) { if (unlikely(cnt < 0)) {
applog(LOG_ERR, "%s: Failed send fpga data with err %d", ztex->repr, cnt); applog(LOG_ERR, "%s: Failed send fpga data with err %d", ztex->repr, cnt);
break; break;
} }
i += cnt; i += cnt;
} }
if (i < buf_p || buf_p < transactionBytes) if (i < buf_p || buf_p < transactionBytes)
break; break;
buf_p = 0; buf_p = 0;
while (buf_p < transactionBytes && !feof(fp)) { while (buf_p < transactionBytes && !feof(fp)) {
buf[buf_p] = getc(fp); buf[buf_p] = getc(fp);
cs += buf[buf_p++]; cs += buf[buf_p++];
}; };
if (feof(fp)) if (feof(fp))
buf_p--; buf_p--;
pos += buf_p; pos += buf_p;
if (buf_p == 0) if (buf_p == 0)
break; break;
if ( bs == 1 ) if ( bs == 1 )
libztex_swapBits(buf, buf_p); libztex_swapBits(buf, buf_p);
} }
if (cnt >= 0) if (cnt >= 0)
tries = 0; tries = 0;
fclose(fp); fclose(fp);
} }
libztex_getFpgaState(ztex, &state); libztex_getFpgaState(ztex, &state);
if (!state.fpgaConfigured) { if (!state.fpgaConfigured) {
applog(LOG_ERR, "%s: FPGA configuration failed: DONE pin does not go high", ztex->repr); applog(LOG_ERR, "%s: FPGA configuration failed: DONE pin does not go high", ztex->repr);
return 3; return 3;
} }
usleep(200000); usleep(200000);
applog(LOG_ERR, "%s: FPGA configuration done", ztex->repr); applog(LOG_ERR, "%s: FPGA configuration done", ztex->repr);
return 0; return 0;
} }
int libztex_configureFpga (struct libztex_device *ztex) { int libztex_configureFpga (struct libztex_device *ztex) {
int rv; int rv;
char buf[256] = "bitstreams/"; char buf[256] = "bitstreams/";
memset(&buf[11], 0, 245); memset(&buf[11], 0, 245);
strcpy(&buf[11], ztex->bitFileName); strcpy(&buf[11], ztex->bitFileName);
strcpy(&buf[strlen(buf)], ".bit"); strcpy(&buf[strlen(buf)], ".bit");
rv = libztex_configureFpgaLS(ztex, buf, true, 2); rv = libztex_configureFpgaLS(ztex, buf, true, 2);
//if (rv == 0) { return rv;
// libztex_setFreq(ztex, ztex->freqMDefault);
//}
return rv;
} }
int libztex_setFreq (struct libztex_device *ztex, uint16_t freq) { int libztex_setFreq (struct libztex_device *ztex, uint16_t freq) {
int cnt; int cnt;
if (freq > ztex->freqMaxM) { if (freq > ztex->freqMaxM) {
freq = ztex->freqMaxM; freq = ztex->freqMaxM;
} }
cnt = libusb_control_transfer(ztex->hndl, 0x40, 0x83, freq, 0, NULL, 0, 500); cnt = libusb_control_transfer(ztex->hndl, 0x40, 0x83, freq, 0, NULL, 0, 500);
if (unlikely(cnt < 0)) { if (unlikely(cnt < 0)) {
applog(LOG_ERR, "Ztex check device: Failed to set frequency with err %d", cnt); applog(LOG_ERR, "Ztex check device: Failed to set frequency with err %d", cnt);
return cnt; return cnt;
} }
ztex->freqM = freq; ztex->freqM = freq;
applog(LOG_WARNING, "%s: Frequency change to %0.2f Mhz", ztex->repr, ztex->freqM1 * (ztex->freqM + 1)); applog(LOG_WARNING, "%s: Frequency change to %0.2f Mhz", ztex->repr, ztex->freqM1 * (ztex->freqM + 1));
return 0; return 0;
} }
int libztex_resetFpga (struct libztex_device *ztex) { int libztex_resetFpga (struct libztex_device *ztex) {
return libusb_control_transfer(ztex->hndl, 0x40, 0x31, 0, 0, NULL, 0, 1000); return libusb_control_transfer(ztex->hndl, 0x40, 0x31, 0, 0, NULL, 0, 1000);
} }
int libztex_prepare_device (struct libusb_device *dev, struct libztex_device** ztex) { int libztex_prepare_device (struct libusb_device *dev, struct libztex_device** ztex) {
struct libztex_device *newdev; struct libztex_device *newdev;
int cnt, err; int cnt, err;
unsigned char buf[64]; unsigned char buf[64];
newdev = malloc(sizeof(struct libztex_device)); newdev = malloc(sizeof(struct libztex_device));
newdev->valid = false; newdev->valid = false;
newdev->hndl = NULL; newdev->hndl = NULL;
newdev->bitFileName = NULL; newdev->bitFileName = NULL;
*ztex = newdev; *ztex = newdev;
err = libusb_get_device_descriptor(dev, &newdev->descriptor); err = libusb_get_device_descriptor(dev, &newdev->descriptor);
if (unlikely(err != 0)) { if (unlikely(err != 0)) {
applog(LOG_ERR, "Ztex check device: Failed to open read descriptor with error %d", err); applog(LOG_ERR, "Ztex check device: Failed to open read descriptor with error %d", err);
return err; return err;
} }
// Check vendorId and productId // Check vendorId and productId
if (!(newdev->descriptor.idVendor == LIBZTEX_IDVENDOR && if (!(newdev->descriptor.idVendor == LIBZTEX_IDVENDOR &&
newdev->descriptor.idProduct == LIBZTEX_IDPRODUCT)) { newdev->descriptor.idProduct == LIBZTEX_IDPRODUCT)) {
applog(LOG_ERR, "Not a ztex device? %0.4X, %0.4X", newdev->descriptor.idVendor, newdev->descriptor.idProduct); applog(LOG_ERR, "Not a ztex device? %0.4X, %0.4X", newdev->descriptor.idVendor, newdev->descriptor.idProduct);
return 1; return 1;
} }
err = libusb_open(dev, &newdev->hndl); err = libusb_open(dev, &newdev->hndl);
if (unlikely(err != 0)) { if (unlikely(err != 0)) {
applog(LOG_ERR, "Ztex check device: Failed to open handle with error %d", err); applog(LOG_ERR, "Ztex check device: Failed to open handle with error %d", err);
return err; return err;
} }
cnt = libusb_get_string_descriptor_ascii (newdev->hndl, newdev->descriptor.iSerialNumber, newdev->snString, cnt = libusb_get_string_descriptor_ascii (newdev->hndl, newdev->descriptor.iSerialNumber, newdev->snString,
LIBZTEX_SNSTRING_LEN+1); LIBZTEX_SNSTRING_LEN+1);
if (unlikely(cnt < 0)) { if (unlikely(cnt < 0)) {
applog(LOG_ERR, "Ztex check device: Failed to read device snString with err %d", cnt); applog(LOG_ERR, "Ztex check device: Failed to read device snString with err %d", cnt);
return cnt; return cnt;
} }
cnt = libusb_control_transfer(newdev->hndl, 0xc0, 0x22, 0, 0, buf, 40, 500); cnt = libusb_control_transfer(newdev->hndl, 0xc0, 0x22, 0, 0, buf, 40, 500);
if (unlikely(cnt < 0)) { if (unlikely(cnt < 0)) {
applog(LOG_ERR, "Ztex check device: Failed to read ztex descriptor with err %d", cnt); applog(LOG_ERR, "Ztex check device: Failed to read ztex descriptor with err %d", cnt);
return cnt; return cnt;
} }
if ( buf[0]!=40 || buf[1]!=1 || buf[2]!='Z' || buf[3]!='T' || buf[4]!='E' || buf[5]!='X' ) { if ( buf[0]!=40 || buf[1]!=1 || buf[2]!='Z' || buf[3]!='T' || buf[4]!='E' || buf[5]!='X' ) {
applog(LOG_ERR, "Ztex check device: Error reading ztex descriptor"); applog(LOG_ERR, "Ztex check device: Error reading ztex descriptor");
return 2; return 2;
} }
newdev->productId[0] = buf[6]; newdev->productId[0] = buf[6];
newdev->productId[1] = buf[7]; newdev->productId[1] = buf[7];
newdev->productId[2] = buf[8]; newdev->productId[2] = buf[8];
newdev->productId[3] = buf[9]; newdev->productId[3] = buf[9];
newdev->fwVersion = buf[10]; newdev->fwVersion = buf[10];
newdev->interfaceVersion = buf[11]; newdev->interfaceVersion = buf[11];
newdev->interfaceCapabilities[0] = buf[12]; newdev->interfaceCapabilities[0] = buf[12];
newdev->interfaceCapabilities[1] = buf[13]; newdev->interfaceCapabilities[1] = buf[13];
newdev->interfaceCapabilities[2] = buf[14]; newdev->interfaceCapabilities[2] = buf[14];
newdev->interfaceCapabilities[3] = buf[15]; newdev->interfaceCapabilities[3] = buf[15];
newdev->interfaceCapabilities[4] = buf[16]; newdev->interfaceCapabilities[4] = buf[16];
newdev->interfaceCapabilities[5] = buf[17]; newdev->interfaceCapabilities[5] = buf[17];
newdev->moduleReserved[0] = buf[18]; newdev->moduleReserved[0] = buf[18];
newdev->moduleReserved[1] = buf[19]; newdev->moduleReserved[1] = buf[19];
newdev->moduleReserved[2] = buf[20]; newdev->moduleReserved[2] = buf[20];
newdev->moduleReserved[3] = buf[21]; newdev->moduleReserved[3] = buf[21];
newdev->moduleReserved[4] = buf[22]; newdev->moduleReserved[4] = buf[22];
newdev->moduleReserved[5] = buf[23]; newdev->moduleReserved[5] = buf[23];
newdev->moduleReserved[6] = buf[24]; newdev->moduleReserved[6] = buf[24];
newdev->moduleReserved[7] = buf[25]; newdev->moduleReserved[7] = buf[25];
newdev->moduleReserved[8] = buf[26]; newdev->moduleReserved[8] = buf[26];
newdev->moduleReserved[9] = buf[27]; newdev->moduleReserved[9] = buf[27];
newdev->moduleReserved[10] = buf[28]; newdev->moduleReserved[10] = buf[28];
newdev->moduleReserved[11] = buf[29]; newdev->moduleReserved[11] = buf[29];
cnt = libusb_control_transfer(newdev->hndl, 0xc0, 0x82, 0, 0, buf, 64, 500); cnt = libusb_control_transfer(newdev->hndl, 0xc0, 0x82, 0, 0, buf, 64, 500);
if (unlikely(cnt < 0)) { if (unlikely(cnt < 0)) {
applog(LOG_ERR, "Ztex check device: Failed to read ztex descriptor with err %d", cnt); applog(LOG_ERR, "Ztex check device: Failed to read ztex descriptor with err %d", cnt);
return cnt; return cnt;
} }
if (unlikely(!(buf[0]) == 4)) { if (unlikely(!(buf[0]) == 4)) {
if (unlikely(buf[0]) != 2) { if (unlikely(buf[0]) != 2) {
applog(LOG_ERR, "Invalid BTCMiner descriptor version. Firmware must be updated (%d).", buf[0]); applog(LOG_ERR, "Invalid BTCMiner descriptor version. Firmware must be updated (%d).", buf[0]);
return 3; return 3;
} }
applog(LOG_WARNING, "Firmware out of date"); applog(LOG_WARNING, "Firmware out of date");
} }
newdev->numNonces = buf[1] + 1; newdev->numNonces = buf[1] + 1;
newdev->offsNonces = ((buf[2] & 255) | ((buf[3] & 255) << 8)) - 10000; newdev->offsNonces = ((buf[2] & 255) | ((buf[3] & 255) << 8)) - 10000;
newdev->freqM1 = ( (buf[4] & 255) | ((buf[5] & 255) << 8) ) * 0.01; newdev->freqM1 = ( (buf[4] & 255) | ((buf[5] & 255) << 8) ) * 0.01;
newdev->freqMaxM = (buf[7] & 255); newdev->freqMaxM = (buf[7] & 255);
newdev->freqM = (buf[6] & 255); newdev->freqM = (buf[6] & 255);
newdev->freqMDefault = newdev->freqM; newdev->freqMDefault = newdev->freqM;
for (cnt=0; cnt<255; cnt++) { for (cnt=0; cnt<255; cnt++) {
newdev->errorCount[cnt] = 0; newdev->errorCount[cnt] = 0;
newdev->errorWeight[cnt] = 0; newdev->errorWeight[cnt] = 0;
newdev->errorRate[cnt] = 0; newdev->errorRate[cnt] = 0;
newdev->maxErrorRate[cnt] = 0; newdev->maxErrorRate[cnt] = 0;
} }
cnt = strlen((char *)&buf[buf[0]==4?10:8]); cnt = strlen((char *)&buf[buf[0]==4?10:8]);
newdev->bitFileName = malloc(sizeof(char)*(cnt+1)); newdev->bitFileName = malloc(sizeof(char)*(cnt+1));
memcpy(newdev->bitFileName, &buf[buf[0]==4?10:8], cnt+1); memcpy(newdev->bitFileName, &buf[buf[0]==4?10:8], cnt+1);
newdev->usbbus = libusb_get_bus_number(dev); newdev->usbbus = libusb_get_bus_number(dev);
newdev->usbaddress = libusb_get_device_address(dev); newdev->usbaddress = libusb_get_device_address(dev);
sprintf(newdev->repr, "ZTEX %.3d:%.3d-%s", newdev->usbbus, newdev->usbaddress, newdev->snString); sprintf(newdev->repr, "ZTEX %.3d:%.3d-%s", newdev->usbbus, newdev->usbaddress, newdev->snString);
newdev->valid = true; newdev->valid = true;
return 0; return 0;
} }
void libztex_destroy_device (struct libztex_device* ztex) { void libztex_destroy_device (struct libztex_device* ztex) {
if (ztex->hndl != NULL) { if (ztex->hndl != NULL) {
libusb_close(ztex->hndl); libusb_close(ztex->hndl);
ztex->hndl = NULL; ztex->hndl = NULL;
} }
if (ztex->bitFileName != NULL) { if (ztex->bitFileName != NULL) {
free(ztex->bitFileName); free(ztex->bitFileName);
ztex->bitFileName = NULL; ztex->bitFileName = NULL;
} }
free(ztex); free(ztex);
} }
int libztex_scanDevices (struct libztex_dev_list*** devs_p) { int libztex_scanDevices (struct libztex_dev_list*** devs_p) {
libusb_device **list; libusb_device **list;
struct libztex_device *ztex; struct libztex_device *ztex;
ssize_t cnt = libusb_get_device_list(NULL, &list); ssize_t cnt = libusb_get_device_list(NULL, &list);
ssize_t i = 0; ssize_t i = 0;
int found = 0, pos = 0, err; int found = 0, pos = 0, err;
if (unlikely(cnt < 0)) { if (unlikely(cnt < 0)) {
applog(LOG_ERR, "Ztex scan devices: Failed to list usb devices with err %d", cnt); applog(LOG_ERR, "Ztex scan devices: Failed to list usb devices with err %d", cnt);
return 0; return 0;
} }
int usbdevices[LIBZTEX_MAX_DESCRIPTORS]; int usbdevices[LIBZTEX_MAX_DESCRIPTORS];
for (i = 0; i < cnt; i++) { for (i = 0; i < cnt; i++) {
if (libztex_checkDevice(list[i])) { if (libztex_checkDevice(list[i])) {
// Got one! // Got one!
usbdevices[found] = i; usbdevices[found] = i;
found++; found++;
} }
} }
struct libztex_dev_list **devs; struct libztex_dev_list **devs;
devs = malloc(sizeof(struct libztex_dev_list *) * found); devs = malloc(sizeof(struct libztex_dev_list *) * found);
if (devs == NULL) { if (devs == NULL) {
applog(LOG_ERR, "Ztex scan devices: Failed to allocate memory"); applog(LOG_ERR, "Ztex scan devices: Failed to allocate memory");
return 0; return 0;
} }
for (i = 0; i < found; i++) { for (i = 0; i < found; i++) {
err = libztex_prepare_device(list[usbdevices[i]], &ztex); err = libztex_prepare_device(list[usbdevices[i]], &ztex);
if (unlikely(err != 0)) { if (unlikely(err != 0)) {
applog(LOG_ERR, "prepare device: %d", err); applog(LOG_ERR, "prepare device: %d", err);
} }
// check if valid // check if valid
if (!ztex->valid) { if (!ztex->valid) {
libztex_destroy_device(ztex); libztex_destroy_device(ztex);
continue; continue;
} }
devs[pos] = malloc(sizeof(struct libztex_dev_list)); devs[pos] = malloc(sizeof(struct libztex_dev_list));
devs[pos]->dev = ztex; devs[pos]->dev = ztex;
devs[pos]->next = NULL; devs[pos]->next = NULL;
if (pos > 0) { if (pos > 0) {
devs[pos-1]->next = devs[pos]; devs[pos-1]->next = devs[pos];
} }
pos++; pos++;
} }
libusb_free_device_list(list, 1); libusb_free_device_list(list, 1);
*devs_p = devs; *devs_p = devs;
return pos; return pos;
} }
int libztex_sendHashData (struct libztex_device *ztex, unsigned char *sendbuf) { int libztex_sendHashData (struct libztex_device *ztex, unsigned char *sendbuf) {
int cnt; int cnt;
if (ztex == NULL || ztex->hndl == NULL) { if (ztex == NULL || ztex->hndl == NULL) {
return 0; return 0;
} }
cnt = libusb_control_transfer(ztex->hndl, 0x40, 0x80, 0, 0, sendbuf, 44, 1000); cnt = libusb_control_transfer(ztex->hndl, 0x40, 0x80, 0, 0, sendbuf, 44, 1000);
if (unlikely(cnt < 0)) { if (unlikely(cnt < 0)) {
applog(LOG_ERR, "%s: Failed sendHashData with err %d", ztex->repr, cnt); applog(LOG_ERR, "%s: Failed sendHashData with err %d", ztex->repr, cnt);
} }
return cnt; return cnt;
} }
int libztex_readHashData (struct libztex_device *ztex, struct libztex_hash_data nonces[]) { int libztex_readHashData (struct libztex_device *ztex, struct libztex_hash_data nonces[]) {
// length of buf must be 8 * (numNonces + 1) // length of buf must be 8 * (numNonces + 1)
unsigned char rbuf[12*8]; unsigned char rbuf[12*8];
int cnt, i; int cnt, i;
if (ztex->hndl == NULL) { if (ztex->hndl == NULL) {
return 0; return 0;
} }
cnt = libusb_control_transfer(ztex->hndl, 0xc0, 0x81, 0, 0, rbuf, 12*ztex->numNonces, 1000); cnt = libusb_control_transfer(ztex->hndl, 0xc0, 0x81, 0, 0, rbuf, 12*ztex->numNonces, 1000);
if (unlikely(cnt < 0)) { if (unlikely(cnt < 0)) {
applog(LOG_ERR, "%s: Failed readHashData with err %d", ztex->repr, cnt); applog(LOG_ERR, "%s: Failed readHashData with err %d", ztex->repr, cnt);
return cnt; return cnt;
} }
for (i=0; i<ztex->numNonces; i++) { for (i=0; i<ztex->numNonces; i++) {
memcpy((char*)&nonces[i].goldenNonce, &rbuf[i*12], 4); memcpy((char*)&nonces[i].goldenNonce, &rbuf[i*12], 4);
nonces[i].goldenNonce -= ztex->offsNonces; nonces[i].goldenNonce -= ztex->offsNonces;
memcpy((char*)&nonces[i].nonce, &rbuf[(i*12)+4], 4); memcpy((char*)&nonces[i].nonce, &rbuf[(i*12)+4], 4);
nonces[i].nonce -= ztex->offsNonces; nonces[i].nonce -= ztex->offsNonces;
memcpy((char*)&nonces[i].hash7, &rbuf[(i*12)+8], 4); memcpy((char*)&nonces[i].hash7, &rbuf[(i*12)+8], 4);
} }
return cnt; return cnt;
} }
void libztex_freeDevList (struct libztex_dev_list **devs) { void libztex_freeDevList (struct libztex_dev_list **devs) {
ssize_t cnt = 0; ssize_t cnt = 0;
bool done = false; bool done = false;
while (!done) { while (!done) {
if (devs[cnt]->next == NULL) { if (devs[cnt]->next == NULL) {
done = true; done = true;
} }
free(devs[cnt++]); free(devs[cnt++]);
} }
free(devs); free(devs);
} }

68
libztex.h

@ -35,51 +35,51 @@
#define LIBZTEX_OVERHEATTHRESHOLD 0.5 #define LIBZTEX_OVERHEATTHRESHOLD 0.5
struct libztex_fpgastate { struct libztex_fpgastate {
bool fpgaConfigured; bool fpgaConfigured;
unsigned char fpgaChecksum; unsigned char fpgaChecksum;
uint16_t fpgaBytes; uint16_t fpgaBytes;
unsigned char fpgaInitB; unsigned char fpgaInitB;
unsigned char fpgaFlashResult; unsigned char fpgaFlashResult;
bool fpgaFlashBitSwap; bool fpgaFlashBitSwap;
}; };
struct libztex_device { struct libztex_device {
bool valid; bool valid;
struct libusb_device_descriptor descriptor; struct libusb_device_descriptor descriptor;
libusb_device_handle *hndl; libusb_device_handle *hndl;
unsigned char usbbus; unsigned char usbbus;
unsigned char usbaddress; unsigned char usbaddress;
unsigned char snString[LIBZTEX_SNSTRING_LEN+1]; unsigned char snString[LIBZTEX_SNSTRING_LEN+1];
unsigned char productId[4]; unsigned char productId[4];
unsigned char fwVersion; unsigned char fwVersion;
unsigned char interfaceVersion; unsigned char interfaceVersion;
unsigned char interfaceCapabilities[6]; unsigned char interfaceCapabilities[6];
unsigned char moduleReserved[12]; unsigned char moduleReserved[12];
uint8_t numNonces; uint8_t numNonces;
uint16_t offsNonces; uint16_t offsNonces;
double freqM1; double freqM1;
uint8_t freqM; uint8_t freqM;
uint8_t freqMaxM; uint8_t freqMaxM;
uint8_t freqMDefault; uint8_t freqMDefault;
char* bitFileName; char* bitFileName;
double errorCount[256]; double errorCount[256];
double errorWeight[256]; double errorWeight[256];
double errorRate[256]; double errorRate[256];
double maxErrorRate[256]; double maxErrorRate[256];
char repr[64]; char repr[64];
}; };
struct libztex_dev_list { struct libztex_dev_list {
struct libztex_device *dev; struct libztex_device *dev;
struct libztex_dev_list *next; struct libztex_dev_list *next;
}; };
struct libztex_hash_data { struct libztex_hash_data {
uint32_t goldenNonce; uint32_t goldenNonce;
uint32_t nonce; uint32_t nonce;
uint32_t hash7; uint32_t hash7;
}; };
extern int libztex_scanDevices (struct libztex_dev_list ***devs); extern int libztex_scanDevices (struct libztex_dev_list ***devs);

426
ztex.c

@ -38,72 +38,72 @@ static bool ztex_prepare(struct thr_info *thr);
static void ztex_detect() static void ztex_detect()
{ {
int cnt; int cnt;
int i; int i;
struct libztex_dev_list **ztex_devices; struct libztex_dev_list **ztex_devices;
cnt = libztex_scanDevices(&ztex_devices); cnt = libztex_scanDevices(&ztex_devices);
applog(LOG_WARNING, "Found %d ztex board(s)", cnt); applog(LOG_WARNING, "Found %d ztex board(s)", cnt);
for (i=0; i<cnt; i++) { for (i=0; i<cnt; i++) {
if (total_devices == MAX_DEVICES) if (total_devices == MAX_DEVICES)
break; break;
struct cgpu_info *ztex; struct cgpu_info *ztex;
ztex = calloc(1, sizeof(struct cgpu_info)); ztex = calloc(1, sizeof(struct cgpu_info));
ztex->api = &ztex_api; ztex->api = &ztex_api;
ztex->device_id = total_devices; ztex->device_id = total_devices;
ztex->device = ztex_devices[i]->dev; ztex->device = ztex_devices[i]->dev;
ztex->threads = 1; ztex->threads = 1;
devices[total_devices++] = ztex; devices[total_devices++] = ztex;
applog(LOG_WARNING,"%s: Found Ztex, mark as %d", ztex->device->repr, ztex->device_id); applog(LOG_WARNING,"%s: Found Ztex, mark as %d", ztex->device->repr, ztex->device_id);
} }
if (cnt > 0) { if (cnt > 0) {
libztex_freeDevList(ztex_devices); libztex_freeDevList(ztex_devices);
} }
} }
static bool ztex_updateFreq (struct libztex_device* ztex) static bool ztex_updateFreq (struct libztex_device* ztex)
{ {
int i, maxM, bestM; int i, maxM, bestM;
double bestR, r; double bestR, r;
for (i=0; i<ztex->freqMaxM; i++) { for (i=0; i<ztex->freqMaxM; i++) {
if (ztex->maxErrorRate[i+1]*i < ztex->maxErrorRate[i]*(i+20)) if (ztex->maxErrorRate[i+1]*i < ztex->maxErrorRate[i]*(i+20))
ztex->maxErrorRate[i+1] = ztex->maxErrorRate[i]*(1.0+20.0/i); ztex->maxErrorRate[i+1] = ztex->maxErrorRate[i]*(1.0+20.0/i);
} }
maxM = 0; maxM = 0;
while (maxM<ztex->freqMDefault && ztex->maxErrorRate[maxM+1]<LIBZTEX_MAXMAXERRORRATE) while (maxM<ztex->freqMDefault && ztex->maxErrorRate[maxM+1]<LIBZTEX_MAXMAXERRORRATE)
maxM++; maxM++;
while (maxM<ztex->freqMaxM && ztex->errorWeight[maxM]>150 && ztex->maxErrorRate[maxM+1]<LIBZTEX_MAXMAXERRORRATE) while (maxM<ztex->freqMaxM && ztex->errorWeight[maxM]>150 && ztex->maxErrorRate[maxM+1]<LIBZTEX_MAXMAXERRORRATE)
maxM++; maxM++;
bestM = 0; bestM = 0;
bestR = 0; bestR = 0;
for (i=0; i<=maxM; i++) { for (i=0; i<=maxM; i++) {
r = (i + 1 + ( i == ztex->freqM ? LIBZTEX_ERRORHYSTERESIS : 0))*(1-ztex->maxErrorRate[i]); r = (i + 1 + ( i == ztex->freqM ? LIBZTEX_ERRORHYSTERESIS : 0))*(1-ztex->maxErrorRate[i]);
if (r > bestR) { if (r > bestR) {
bestM = i; bestM = i;
bestR = r; bestR = r;
} }
} }
if (bestM != ztex->freqM) { if (bestM != ztex->freqM) {
libztex_setFreq(ztex, bestM); libztex_setFreq(ztex, bestM);
} }
maxM = ztex->freqMDefault; maxM = ztex->freqMDefault;
while (maxM<ztex->freqMaxM && ztex->errorWeight[maxM+1] > 100) while (maxM<ztex->freqMaxM && ztex->errorWeight[maxM+1] > 100)
maxM++; maxM++;
if ((bestM < (1.0-LIBZTEX_OVERHEATTHRESHOLD) * maxM) && bestM < maxM - 1) { if ((bestM < (1.0-LIBZTEX_OVERHEATTHRESHOLD) * maxM) && bestM < maxM - 1) {
libztex_resetFpga(ztex); libztex_resetFpga(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); 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);
return false; return false;
} }
return true; return true;
} }
@ -111,198 +111,198 @@ static bool ztex_checkNonce (struct libztex_device *ztex,
struct work *work, struct work *work,
struct libztex_hash_data *hdata) struct libztex_hash_data *hdata)
{ {
uint32_t *data32 = (uint32_t *)(work->data); uint32_t *data32 = (uint32_t *)(work->data);
unsigned char swap[128]; unsigned char swap[128];
uint32_t *swap32 = (uint32_t *)swap; uint32_t *swap32 = (uint32_t *)swap;
unsigned char hash1[32]; unsigned char hash1[32];
unsigned char hash2[32]; unsigned char hash2[32];
uint32_t *hash2_32 = (uint32_t *)hash2; uint32_t *hash2_32 = (uint32_t *)hash2;
int i; int i;
#if defined(__BIGENDIAN__) || defined(MIPSEB) #if defined(__BIGENDIAN__) || defined(MIPSEB)
hdata->nonce = swab32(hdata->nonce); hdata->nonce = swab32(hdata->nonce);
hdata->hash7 = swab32(hdata->hash7); hdata->hash7 = swab32(hdata->hash7);
#endif #endif
work->data[64 + 12 + 0] = (hdata->nonce >> 0) & 0xff; work->data[64 + 12 + 0] = (hdata->nonce >> 0) & 0xff;
work->data[64 + 12 + 1] = (hdata->nonce >> 8) & 0xff; work->data[64 + 12 + 1] = (hdata->nonce >> 8) & 0xff;
work->data[64 + 12 + 2] = (hdata->nonce >> 16) & 0xff; work->data[64 + 12 + 2] = (hdata->nonce >> 16) & 0xff;
work->data[64 + 12 + 3] = (hdata->nonce >> 24) & 0xff; work->data[64 + 12 + 3] = (hdata->nonce >> 24) & 0xff;
for (i = 0; i < 80 / 4; i++) for (i = 0; i < 80 / 4; i++)
swap32[i] = swab32(data32[i]); swap32[i] = swab32(data32[i]);
sha2(swap, 80, hash1, false); sha2(swap, 80, hash1, false);
sha2(hash1, 32, hash2, false); sha2(hash1, 32, hash2, false);
#if defined(__BIGENDIAN__) || defined(MIPSEB) #if defined(__BIGENDIAN__) || defined(MIPSEB)
if (hash2_32[7] != ((hdata->hash7 + 0x5be0cd19) & 0xFFFFFFFF)) { if (hash2_32[7] != ((hdata->hash7 + 0x5be0cd19) & 0xFFFFFFFF)) {
#else #else
if (swab32(hash2_32[7]) != ((hdata->hash7 + 0x5be0cd19) & 0xFFFFFFFF)) { if (swab32(hash2_32[7]) != ((hdata->hash7 + 0x5be0cd19) & 0xFFFFFFFF)) {
#endif #endif
ztex->errorCount[ztex->freqM] += 1.0/ztex->numNonces; ztex->errorCount[ztex->freqM] += 1.0/ztex->numNonces;
applog(LOG_DEBUG, "%s: checkNonce failed for %0.8X", ztex->repr, hdata->nonce); applog(LOG_DEBUG, "%s: checkNonce failed for %0.8X", ztex->repr, hdata->nonce);
return false; return false;
} }
return true; return true;
} }
static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work, static uint64_t ztex_scanhash(struct thr_info *thr, struct work *work,
__maybe_unused uint64_t max_nonce) __maybe_unused uint64_t max_nonce)
{ {
struct libztex_device *ztex; struct libztex_device *ztex;
unsigned char sendbuf[44]; unsigned char sendbuf[44];
int i, j; int i, j;
uint32_t backlog[GOLDEN_BACKLOG]; uint32_t backlog[GOLDEN_BACKLOG];
int backlog_p = 0; int backlog_p = 0;
uint32_t lastnonce[GOLDEN_BACKLOG], nonce, noncecnt = 0; uint32_t lastnonce[GOLDEN_BACKLOG], nonce, noncecnt = 0;
bool overflow, found, rv; bool overflow, found, rv;
struct libztex_hash_data hdata[GOLDEN_BACKLOG]; struct libztex_hash_data hdata[GOLDEN_BACKLOG];
ztex = thr->cgpu->device; ztex = thr->cgpu->device;
memcpy(sendbuf, work->data + 64, 12); memcpy(sendbuf, work->data + 64, 12);
memcpy(sendbuf+12, work->midstate, 32); memcpy(sendbuf+12, work->midstate, 32);
memset(backlog, 0, sizeof(backlog)); memset(backlog, 0, sizeof(backlog));
i = libztex_sendHashData(ztex, 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", ztex->repr, i); applog(LOG_ERR, "%s: Failed to send hash data with err %d", ztex->repr, i);
usleep(500000); usleep(500000);
i = libztex_sendHashData(ztex, 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);
return 0; return 0;
} }
} }
applog(LOG_DEBUG, "sent hashdata"); applog(LOG_DEBUG, "sent hashdata");
for (i=0; i<ztex->numNonces; i++) { for (i=0; i<ztex->numNonces; i++) {
lastnonce[i] = 0; lastnonce[i] = 0;
} }
overflow = false; overflow = false;
while (!(overflow || work_restart[thr->id].restart)) { while (!(overflow || work_restart[thr->id].restart)) {
usleep(250000); usleep(250000);
if (work_restart[thr->id].restart) { if (work_restart[thr->id].restart) {
break; break;
} }
i = libztex_readHashData(ztex, &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", ztex->repr, i); applog(LOG_ERR, "%s: Failed to read hash data with err %d", ztex->repr, i);
usleep(500000); usleep(500000);
i = libztex_readHashData(ztex, &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);
return 0; return 0;
} }
} }
if (work_restart[thr->id].restart) { if (work_restart[thr->id].restart) {
break; break;
} }
ztex->errorCount[ztex->freqM] *= 0.995; ztex->errorCount[ztex->freqM] *= 0.995;
ztex->errorWeight[ztex->freqM] = ztex->errorWeight[ztex->freqM] * 0.995 + 1.0; ztex->errorWeight[ztex->freqM] = ztex->errorWeight[ztex->freqM] * 0.995 + 1.0;
for (i=0; i<ztex->numNonces; i++) { for (i=0; i<ztex->numNonces; i++) {
nonce = swab32(hdata[i].nonce); nonce = swab32(hdata[i].nonce);
if (nonce > noncecnt) if (nonce > noncecnt)
noncecnt = nonce; noncecnt = nonce;
if ((nonce >> 4) < (lastnonce[i] >> 4)) { if ((nonce >> 4) < (lastnonce[i] >> 4)) {
overflow = true; overflow = true;
} else { } else {
lastnonce[i] = nonce; lastnonce[i] = nonce;
} }
if (!ztex_checkNonce(ztex, work, &hdata[i])) { if (!ztex_checkNonce(ztex, work, &hdata[i])) {
thr->cgpu->hw_errors++; thr->cgpu->hw_errors++;
continue; continue;
} }
nonce = hdata[i].goldenNonce; nonce = hdata[i].goldenNonce;
if (nonce > 0) { if (nonce > 0) {
found = false; found = false;
for (j=0; j<GOLDEN_BACKLOG; j++) { for (j=0; j<GOLDEN_BACKLOG; j++) {
if (backlog[j] == nonce) { if (backlog[j] == nonce) {
found = true; found = true;
break; break;
} }
} }
if (!found) { if (!found) {
// new nonce found! // new nonce found!
backlog[backlog_p++] = nonce; backlog[backlog_p++] = nonce;
if (backlog_p >= GOLDEN_BACKLOG) { if (backlog_p >= GOLDEN_BACKLOG) {
backlog_p = 0; backlog_p = 0;
} }
#if defined(__BIGENDIAN__) || defined(MIPSEB) #if defined(__BIGENDIAN__) || defined(MIPSEB)
nonce = swab32(nonce); nonce = swab32(nonce);
#endif #endif
work->blk.nonce = 0xffffffff; work->blk.nonce = 0xffffffff;
rv = submit_nonce(thr, work, nonce); rv = submit_nonce(thr, work, nonce);
applog(LOG_DEBUG, "submitted %0.8X %d", nonce, rv); applog(LOG_DEBUG, "submitted %0.8X %d", nonce, rv);
} }
} }
} }
} }
ztex->errorRate[ztex->freqM] = ztex->errorCount[ztex->freqM] / ztex->errorWeight[ztex->freqM] * (ztex->errorWeight[ztex->freqM]<100 ? ztex->errorWeight[ztex->freqM]*0.01 : 1.0); ztex->errorRate[ztex->freqM] = ztex->errorCount[ztex->freqM] / ztex->errorWeight[ztex->freqM] * (ztex->errorWeight[ztex->freqM]<100 ? ztex->errorWeight[ztex->freqM]*0.01 : 1.0);
if (ztex->errorRate[ztex->freqM] > ztex->maxErrorRate[ztex->freqM]) { if (ztex->errorRate[ztex->freqM] > ztex->maxErrorRate[ztex->freqM]) {
ztex->maxErrorRate[ztex->freqM] = ztex->errorRate[ztex->freqM]; ztex->maxErrorRate[ztex->freqM] = ztex->errorRate[ztex->freqM];
} }
if (!ztex_updateFreq(ztex)) { if (!ztex_updateFreq(ztex)) {
// Something really serious happened, so mark this thread as dead! // Something really serious happened, so mark this thread as dead!
return 0; return 0;
} }
applog(LOG_DEBUG, "exit %1.8X", noncecnt); applog(LOG_DEBUG, "exit %1.8X", noncecnt);
work->blk.nonce = 0xffffffff; work->blk.nonce = 0xffffffff;
return noncecnt > 0 ? noncecnt : 1; return noncecnt > 0 ? noncecnt : 1;
} }
static void ztex_statline_before(char *buf, struct cgpu_info *cgpu) static void ztex_statline_before(char *buf, struct cgpu_info *cgpu)
{ {
if (cgpu->deven == DEV_ENABLED) { if (cgpu->deven == DEV_ENABLED) {
tailsprintf(buf, "%s | ", cgpu->device->snString); tailsprintf(buf, "%s | ", cgpu->device->snString);
tailsprintf(buf, "%0.2fMhz | ", cgpu->device->freqM1 * (cgpu->device->freqM + 1)); tailsprintf(buf, "%0.2fMhz | ", cgpu->device->freqM1 * (cgpu->device->freqM + 1));
} }
} }
static bool ztex_prepare(struct thr_info *thr) static bool ztex_prepare(struct thr_info *thr)
{ {
struct timeval now; struct timeval now;
struct cgpu_info *ztex = thr->cgpu; struct cgpu_info *ztex = thr->cgpu;
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
get_datestamp(ztex->init, &now); get_datestamp(ztex->init, &now);
if (libztex_configureFpga(ztex->device) != 0) { if (libztex_configureFpga(ztex->device) != 0) {
return false; return false;
} }
ztex->device->freqM = -1; ztex->device->freqM = -1;
ztex_updateFreq(ztex->device); ztex_updateFreq(ztex->device);
return true; return true;
} }
static void ztex_shutdown(struct thr_info *thr) static void ztex_shutdown(struct thr_info *thr)
{ {
if (thr->cgpu->device != NULL) { if (thr->cgpu->device != NULL) {
libztex_destroy_device(thr->cgpu->device); libztex_destroy_device(thr->cgpu->device);
thr->cgpu->device = NULL; thr->cgpu->device = NULL;
} }
} }
static void ztex_disable (struct thr_info *thr) static void ztex_disable (struct thr_info *thr)
{ {
applog(LOG_ERR, "%s: Disabling!", thr->cgpu->device->repr); applog(LOG_ERR, "%s: Disabling!", thr->cgpu->device->repr);
devices[thr->cgpu->device_id]->deven = DEV_DISABLED; devices[thr->cgpu->device_id]->deven = DEV_DISABLED;
ztex_shutdown(thr); ztex_shutdown(thr);
} }
struct device_api ztex_api = { struct device_api ztex_api = {

Loading…
Cancel
Save