mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Use the driver add commands macros in api.c to avoid individually listing them.
This commit is contained in:
parent
1ef38f82e8
commit
55f29b8179
72
api.c
72
api.c
@ -1212,25 +1212,18 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_AN_ASIC
|
#ifdef HAVE_AN_ASIC
|
||||||
static int numascs()
|
static int numascs(void)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rd_lock(&devices_lock);
|
rd_lock(&devices_lock);
|
||||||
for (i = 0; i < total_devices; i++) {
|
for (i = 0; i < total_devices; i++) {
|
||||||
#ifdef USE_AVALON
|
#define DRIVER_ADD_COMMAND(X) \
|
||||||
if (devices[i]->drv->drv_id == DRIVER_avalon)
|
if (devices[i]->drv->drv_id == DRIVER_##X) \
|
||||||
count++;
|
count++;
|
||||||
#endif
|
ASIC_PARSE_COMMANDS
|
||||||
#ifdef USE_BFLSC
|
#undef DRIVER_ADD_COMMAND
|
||||||
if (devices[i]->drv->drv_id == DRIVER_bflsc)
|
|
||||||
count++;
|
|
||||||
#endif
|
|
||||||
#ifdef USE_BITFURY
|
|
||||||
if (devices[i]->drv->drv_id == DRIVER_bitfury)
|
|
||||||
count++;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
rd_unlock(&devices_lock);
|
rd_unlock(&devices_lock);
|
||||||
return count;
|
return count;
|
||||||
@ -1243,18 +1236,11 @@ static int ascdevice(int ascid)
|
|||||||
|
|
||||||
rd_lock(&devices_lock);
|
rd_lock(&devices_lock);
|
||||||
for (i = 0; i < total_devices; i++) {
|
for (i = 0; i < total_devices; i++) {
|
||||||
#ifdef USE_AVALON
|
#define DRIVER_ADD_COMMAND(X) \
|
||||||
if (devices[i]->drv->drv_id == DRIVER_avalon)
|
if (devices[i]->drv->drv_id == DRIVER_##X) \
|
||||||
count++;
|
count++;
|
||||||
#endif
|
ASIC_PARSE_COMMANDS
|
||||||
#ifdef USE_BFLSC
|
#undef DRIVER_ADD_COMMAND
|
||||||
if (devices[i]->drv->drv_id == DRIVER_bflsc)
|
|
||||||
count++;
|
|
||||||
#endif
|
|
||||||
#ifdef USE_BITFURY
|
|
||||||
if (devices[i]->drv->drv_id == DRIVER_bitfury)
|
|
||||||
count++;
|
|
||||||
#endif
|
|
||||||
if (count == (ascid + 1))
|
if (count == (ascid + 1))
|
||||||
goto foundit;
|
goto foundit;
|
||||||
}
|
}
|
||||||
@ -1270,29 +1256,18 @@ foundit:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_AN_FPGA
|
#ifdef HAVE_AN_FPGA
|
||||||
static int numpgas()
|
static int numpgas(void)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rd_lock(&devices_lock);
|
rd_lock(&devices_lock);
|
||||||
for (i = 0; i < total_devices; i++) {
|
for (i = 0; i < total_devices; i++) {
|
||||||
#ifdef USE_BITFORCE
|
#define DRIVER_ADD_COMMAND(X) \
|
||||||
if (devices[i]->drv->drv_id == DRIVER_bitforce)
|
if (devices[i]->drv->drv_id == DRIVER_##X) \
|
||||||
count++;
|
count++;
|
||||||
#endif
|
FPGA_PARSE_COMMANDS
|
||||||
#ifdef USE_ICARUS
|
#undef DRIVER_ADD_COMMAND
|
||||||
if (devices[i]->drv->drv_id == DRIVER_icarus)
|
|
||||||
count++;
|
|
||||||
#endif
|
|
||||||
#ifdef USE_ZTEX
|
|
||||||
if (devices[i]->drv->drv_id == DRIVER_ztex)
|
|
||||||
count++;
|
|
||||||
#endif
|
|
||||||
#ifdef USE_MODMINER
|
|
||||||
if (devices[i]->drv->drv_id == DRIVER_modminer)
|
|
||||||
count++;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
rd_unlock(&devices_lock);
|
rd_unlock(&devices_lock);
|
||||||
return count;
|
return count;
|
||||||
@ -1305,22 +1280,11 @@ static int pgadevice(int pgaid)
|
|||||||
|
|
||||||
rd_lock(&devices_lock);
|
rd_lock(&devices_lock);
|
||||||
for (i = 0; i < total_devices; i++) {
|
for (i = 0; i < total_devices; i++) {
|
||||||
#ifdef USE_BITFORCE
|
#define DRIVER_ADD_COMMAND(X) \
|
||||||
if (devices[i]->drv->drv_id == DRIVER_bitforce)
|
if (devices[i]->drv->drv_id == DRIVER_##X) \
|
||||||
count++;
|
count++;
|
||||||
#endif
|
FPGA_PARSE_COMMANDS
|
||||||
#ifdef USE_ICARUS
|
#undef DRIVER_ADD_COMMAND
|
||||||
if (devices[i]->drv->drv_id == DRIVER_icarus)
|
|
||||||
count++;
|
|
||||||
#endif
|
|
||||||
#ifdef USE_ZTEX
|
|
||||||
if (devices[i]->drv->drv_id == DRIVER_ztex)
|
|
||||||
count++;
|
|
||||||
#endif
|
|
||||||
#ifdef USE_MODMINER
|
|
||||||
if (devices[i]->drv->drv_id == DRIVER_modminer)
|
|
||||||
count++;
|
|
||||||
#endif
|
|
||||||
if (count == (pgaid + 1))
|
if (count == (pgaid + 1))
|
||||||
goto foundit;
|
goto foundit;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user