mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Improved ztex device detection
This commit is contained in:
parent
3197ca54e4
commit
8f58d25614
17
ztex.c
17
ztex.c
@ -30,16 +30,24 @@
|
|||||||
|
|
||||||
#define GOLDEN_BACKLOG 5
|
#define GOLDEN_BACKLOG 5
|
||||||
|
|
||||||
struct device_api ztex_api;
|
struct device_api ztex_api, ztex_hotplug_api;
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
static void ztex_disable (struct thr_info* thr);
|
static void ztex_disable (struct thr_info* thr);
|
||||||
|
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;
|
||||||
|
struct cgpu_info *ztex;
|
||||||
|
|
||||||
|
ztex = calloc(1, sizeof(struct cgpu_info));
|
||||||
|
ztex->api = &ztex_hotplug_api;
|
||||||
|
ztex->threads = 1;
|
||||||
|
devices[total_devices++] = ztex;
|
||||||
|
|
||||||
|
|
||||||
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);
|
||||||
@ -47,7 +55,6 @@ static void ztex_detect()
|
|||||||
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;
|
|
||||||
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;
|
||||||
@ -280,13 +287,17 @@ static bool ztex_prepare(struct thr_info *thr)
|
|||||||
|
|
||||||
static void ztex_shutdown(struct thr_info *thr)
|
static void ztex_shutdown(struct thr_info *thr)
|
||||||
{
|
{
|
||||||
libztex_destroy_device(thr->cgpu->device);
|
if (thr->cgpu->device != NULL) {
|
||||||
|
libztex_destroy_device(thr->cgpu->device);
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct device_api ztex_api = {
|
struct device_api ztex_api = {
|
||||||
|
Loading…
Reference in New Issue
Block a user