mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-09 06:18:06 +00:00
Unify drivers as driver-*.c and add driver name to API
This commit is contained in:
parent
97ab111ec9
commit
e131dfab31
@ -37,7 +37,7 @@ cgminer_SOURCES += logging.c
|
||||
|
||||
# GPU sources, TODO: make them selectable
|
||||
# the GPU portion extracted from original main.c
|
||||
cgminer_SOURCES += device-gpu.h device-gpu.c
|
||||
cgminer_SOURCES += driver-opencl.h driver-opencl.c
|
||||
|
||||
# the original GPU related sources, unchanged
|
||||
cgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h
|
||||
@ -53,7 +53,7 @@ cgminer_SOURCES += \
|
||||
sha256_altivec_4way.c
|
||||
|
||||
# the CPU portion extracted from original main.c
|
||||
cgminer_SOURCES += device-cpu.h device-cpu.c
|
||||
cgminer_SOURCES += driver-cpu.h driver-cpu.c
|
||||
|
||||
if HAS_YASM
|
||||
AM_CFLAGS = -DHAS_YASM
|
||||
@ -68,9 +68,9 @@ endif # HAS_YASM
|
||||
endif # HAS_CPUMINE
|
||||
|
||||
if HAS_BITFORCE
|
||||
cgminer_SOURCES += bitforce.c
|
||||
cgminer_SOURCES += driver-bitforce.c
|
||||
endif
|
||||
|
||||
if HAS_ICARUS
|
||||
cgminer_SOURCES += icarus.c
|
||||
cgminer_SOURCES += driver-icarus.c
|
||||
endif
|
||||
|
2
api.c
2
api.c
@ -21,7 +21,7 @@
|
||||
|
||||
#include "compat.h"
|
||||
#include "miner.h"
|
||||
#include "device-cpu.h" /* for algo_names[], TODO: re-factor dependency */
|
||||
#include "driver-cpu.h" /* for algo_names[], TODO: re-factor dependency */
|
||||
|
||||
#if defined(unix) || defined(__APPLE__)
|
||||
#include <errno.h>
|
||||
|
@ -42,8 +42,8 @@
|
||||
#include "miner.h"
|
||||
#include "findnonce.h"
|
||||
#include "adl.h"
|
||||
#include "device-cpu.h"
|
||||
#include "device-gpu.h"
|
||||
#include "driver-cpu.h"
|
||||
#include "driver-opencl.h"
|
||||
#include "bench_block.h"
|
||||
|
||||
#if defined(unix)
|
||||
@ -4430,7 +4430,7 @@ int main (int argc, char *argv[])
|
||||
if (devices_enabled == -1) {
|
||||
applog(LOG_ERR, "Devices detected:");
|
||||
for (i = 0; i < total_devices; ++i) {
|
||||
applog(LOG_ERR, " %2d. %s%d", i, devices[i]->api->name, devices[i]->device_id);
|
||||
applog(LOG_ERR, " %2d. %s%d (driver: %s)", i, devices[i]->api->name, devices[i]->device_id, devices[i]->api->dname);
|
||||
}
|
||||
quit(0, "%d devices listed", total_devices);
|
||||
}
|
||||
|
@ -350,7 +350,8 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6
|
||||
}
|
||||
|
||||
struct device_api bitforce_api = {
|
||||
.name = "BFL",
|
||||
.dname = "bitforce",
|
||||
.name = "PGA",
|
||||
.api_detect = bitforce_detect,
|
||||
.get_statline_before = get_bitforce_statline_before,
|
||||
.thread_prepare = bitforce_thread_prepare,
|
@ -32,7 +32,7 @@
|
||||
#include "compat.h"
|
||||
#include "miner.h"
|
||||
#include "bench_block.h"
|
||||
#include "device-cpu.h"
|
||||
#include "driver-cpu.h"
|
||||
|
||||
#if defined(unix)
|
||||
#include <errno.h>
|
||||
@ -827,6 +827,7 @@ CPUSearch:
|
||||
}
|
||||
|
||||
struct device_api cpu_api = {
|
||||
.dname = "cpu",
|
||||
.name = "CPU",
|
||||
.api_detect = cpu_detect,
|
||||
.reinit_device = reinit_cpu_device,
|
@ -326,7 +326,8 @@ static void icarus_shutdown(struct thr_info *thr)
|
||||
}
|
||||
|
||||
struct device_api icarus_api = {
|
||||
.name = "ICA",
|
||||
.dname = "icarus",
|
||||
.name = "PGA",
|
||||
.api_detect = icarus_detect,
|
||||
.thread_prepare = icarus_prepare,
|
||||
.scanhash = icarus_scanhash,
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "compat.h"
|
||||
#include "miner.h"
|
||||
#include "device-gpu.h"
|
||||
#include "driver-opencl.h"
|
||||
#include "findnonce.h"
|
||||
#include "ocl.h"
|
||||
#include "adl.h"
|
||||
@ -1373,6 +1373,7 @@ static void opencl_thread_shutdown(struct thr_info *thr)
|
||||
}
|
||||
|
||||
struct device_api opencl_api = {
|
||||
.dname = "opencl",
|
||||
.name = "GPU",
|
||||
.api_detect = opencl_detect,
|
||||
.reinit_device = reinit_opencl_device,
|
1
miner.h
1
miner.h
@ -187,6 +187,7 @@ struct thr_info;
|
||||
struct work;
|
||||
|
||||
struct device_api {
|
||||
char*dname;
|
||||
char*name;
|
||||
|
||||
// API-global functions
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
// tcatm's 4-way 128-bit SSE2 SHA-256
|
||||
|
||||
#include "device-cpu.h"
|
||||
#include "driver-cpu.h"
|
||||
|
||||
#ifdef WANT_SSE2_4WAY
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
//
|
||||
|
||||
|
||||
#include "device-cpu.h"
|
||||
#include "driver-cpu.h"
|
||||
|
||||
#ifdef WANT_ALTIVEC_4WAY
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "device-cpu.h"
|
||||
#include "driver-cpu.h"
|
||||
|
||||
#ifdef WANT_X8664_SSE2
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "device-cpu.h"
|
||||
#include "driver-cpu.h"
|
||||
|
||||
#ifdef WANT_X8632_SSE2
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "device-cpu.h"
|
||||
#include "driver-cpu.h"
|
||||
|
||||
#ifdef WANT_X8664_SSE4
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#include "device-cpu.h"
|
||||
#include "driver-cpu.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
Loading…
Reference in New Issue
Block a user