mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Reading actual bitfilename
This commit is contained in:
parent
98d6664185
commit
dc6e2f4e18
19
libztex.c
19
libztex.c
@ -192,7 +192,12 @@ static int libztex_configureFpgaLS (struct libztex_device *ztex, const char* fir
|
|||||||
|
|
||||||
int libztex_configureFpga (struct libztex_device *ztex) {
|
int libztex_configureFpga (struct libztex_device *ztex) {
|
||||||
int rv;
|
int rv;
|
||||||
rv = libztex_configureFpgaLS(ztex, "bitstreams/ztex_ufm1_15d3.bit", true, 2);
|
char buf[256] = "bitstreams/";
|
||||||
|
memset(&buf[11], 0, 245);
|
||||||
|
strcpy(&buf[11], ztex->bitFileName);
|
||||||
|
strcpy(&buf[strlen(buf)], ".bit");
|
||||||
|
|
||||||
|
rv = libztex_configureFpgaLS(ztex, buf, true, 2);
|
||||||
//if (rv == 0) {
|
//if (rv == 0) {
|
||||||
// libztex_setFreq(ztex, ztex->freqMDefault);
|
// libztex_setFreq(ztex, ztex->freqMDefault);
|
||||||
//}
|
//}
|
||||||
@ -228,6 +233,7 @@ int libztex_prepare_device (struct libusb_device *dev, struct libztex_device** z
|
|||||||
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;
|
||||||
*ztex = newdev;
|
*ztex = newdev;
|
||||||
|
|
||||||
err = libusb_get_device_descriptor(dev, &newdev->descriptor);
|
err = libusb_get_device_descriptor(dev, &newdev->descriptor);
|
||||||
@ -295,9 +301,9 @@ int libztex_prepare_device (struct libusb_device *dev, struct libztex_device** z
|
|||||||
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.");
|
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");
|
||||||
@ -317,6 +323,10 @@ int libztex_prepare_device (struct libusb_device *dev, struct libztex_device** z
|
|||||||
newdev->maxErrorRate[cnt] = 0;
|
newdev->maxErrorRate[cnt] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cnt = strlen(&buf[buf[0]==4?10:8]);
|
||||||
|
newdev->bitFileName = malloc(sizeof(char)*(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);
|
||||||
@ -328,6 +338,9 @@ void libztex_destroy_device (struct libztex_device* ztex) {
|
|||||||
if (ztex->hndl != NULL) {
|
if (ztex->hndl != NULL) {
|
||||||
libusb_close(ztex->hndl);
|
libusb_close(ztex->hndl);
|
||||||
}
|
}
|
||||||
|
if (ztex->bitFileName != NULL) {
|
||||||
|
free(ztex->bitFileName);
|
||||||
|
}
|
||||||
free(ztex);
|
free(ztex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ struct libztex_device {
|
|||||||
uint8_t freqM;
|
uint8_t freqM;
|
||||||
uint8_t freqMaxM;
|
uint8_t freqMaxM;
|
||||||
uint8_t freqMDefault;
|
uint8_t freqMDefault;
|
||||||
|
char* bitFileName;
|
||||||
|
|
||||||
double errorCount[256];
|
double errorCount[256];
|
||||||
double errorWeight[256];
|
double errorWeight[256];
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
- verify setting cgpu.status=DEAD does in fact stop the thread
|
- verify setting cgpu.status=DEAD does in fact stop the thread
|
||||||
- make it compile on osx / windows
|
- make it compile on osx / windows
|
||||||
- read actual bitstream
|
- read actual bitstream
|
||||||
|
- allow configuring bitstream directory
|
||||||
- HS fpga config
|
- HS fpga config
|
||||||
- allow configuring LIBZTEX_OVERHEATTHRESHOLD
|
- allow configuring LIBZTEX_OVERHEATTHRESHOLD
|
||||||
- hotplug support?
|
- hotplug support?
|
||||||
|
Loading…
Reference in New Issue
Block a user