Browse Source

Unify drivers as driver-*.c and add driver name to API

nfactor-troky
Luke Dashjr 13 years ago
parent
commit
e131dfab31
  1. 8
      Makefile.am
  2. 2
      api.c
  3. 6
      cgminer.c
  4. 3
      driver-bitforce.c
  5. 3
      driver-cpu.c
  6. 0
      driver-cpu.h
  7. 3
      driver-icarus.c
  8. 3
      driver-opencl.c
  9. 0
      driver-opencl.h
  10. 1
      miner.h
  11. 2
      sha256_4way.c
  12. 2
      sha256_altivec_4way.c
  13. 2
      sha256_sse2_amd64.c
  14. 2
      sha256_sse2_i386.c
  15. 2
      sha256_sse4_amd64.c
  16. 2
      sha256_via.c

8
Makefile.am

@ -37,7 +37,7 @@ cgminer_SOURCES += logging.c
# GPU sources, TODO: make them selectable # GPU sources, TODO: make them selectable
# the GPU portion extracted from original main.c # 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 # the original GPU related sources, unchanged
cgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h cgminer_SOURCES += ocl.c ocl.h findnonce.c findnonce.h
@ -53,7 +53,7 @@ cgminer_SOURCES += \
sha256_altivec_4way.c sha256_altivec_4way.c
# the CPU portion extracted from original main.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 if HAS_YASM
AM_CFLAGS = -DHAS_YASM AM_CFLAGS = -DHAS_YASM
@ -68,9 +68,9 @@ endif # HAS_YASM
endif # HAS_CPUMINE endif # HAS_CPUMINE
if HAS_BITFORCE if HAS_BITFORCE
cgminer_SOURCES += bitforce.c cgminer_SOURCES += driver-bitforce.c
endif endif
if HAS_ICARUS if HAS_ICARUS
cgminer_SOURCES += icarus.c cgminer_SOURCES += driver-icarus.c
endif endif

2
api.c

@ -21,7 +21,7 @@
#include "compat.h" #include "compat.h"
#include "miner.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__) #if defined(unix) || defined(__APPLE__)
#include <errno.h> #include <errno.h>

6
cgminer.c

@ -42,8 +42,8 @@
#include "miner.h" #include "miner.h"
#include "findnonce.h" #include "findnonce.h"
#include "adl.h" #include "adl.h"
#include "device-cpu.h" #include "driver-cpu.h"
#include "device-gpu.h" #include "driver-opencl.h"
#include "bench_block.h" #include "bench_block.h"
#if defined(unix) #if defined(unix)
@ -4430,7 +4430,7 @@ int main (int argc, char *argv[])
if (devices_enabled == -1) { if (devices_enabled == -1) {
applog(LOG_ERR, "Devices detected:"); applog(LOG_ERR, "Devices detected:");
for (i = 0; i < total_devices; ++i) { 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); quit(0, "%d devices listed", total_devices);
} }

3
bitforce.c → driver-bitforce.c

@ -350,7 +350,8 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6
} }
struct device_api bitforce_api = { struct device_api bitforce_api = {
.name = "BFL", .dname = "bitforce",
.name = "PGA",
.api_detect = bitforce_detect, .api_detect = bitforce_detect,
.get_statline_before = get_bitforce_statline_before, .get_statline_before = get_bitforce_statline_before,
.thread_prepare = bitforce_thread_prepare, .thread_prepare = bitforce_thread_prepare,

3
device-cpu.c → driver-cpu.c

@ -32,7 +32,7 @@
#include "compat.h" #include "compat.h"
#include "miner.h" #include "miner.h"
#include "bench_block.h" #include "bench_block.h"
#include "device-cpu.h" #include "driver-cpu.h"
#if defined(unix) #if defined(unix)
#include <errno.h> #include <errno.h>
@ -827,6 +827,7 @@ CPUSearch:
} }
struct device_api cpu_api = { struct device_api cpu_api = {
.dname = "cpu",
.name = "CPU", .name = "CPU",
.api_detect = cpu_detect, .api_detect = cpu_detect,
.reinit_device = reinit_cpu_device, .reinit_device = reinit_cpu_device,

0
device-cpu.h → driver-cpu.h

3
icarus.c → driver-icarus.c

@ -326,7 +326,8 @@ static void icarus_shutdown(struct thr_info *thr)
} }
struct device_api icarus_api = { struct device_api icarus_api = {
.name = "ICA", .dname = "icarus",
.name = "PGA",
.api_detect = icarus_detect, .api_detect = icarus_detect,
.thread_prepare = icarus_prepare, .thread_prepare = icarus_prepare,
.scanhash = icarus_scanhash, .scanhash = icarus_scanhash,

3
device-gpu.c → driver-opencl.c

@ -25,7 +25,7 @@
#include "compat.h" #include "compat.h"
#include "miner.h" #include "miner.h"
#include "device-gpu.h" #include "driver-opencl.h"
#include "findnonce.h" #include "findnonce.h"
#include "ocl.h" #include "ocl.h"
#include "adl.h" #include "adl.h"
@ -1373,6 +1373,7 @@ static void opencl_thread_shutdown(struct thr_info *thr)
} }
struct device_api opencl_api = { struct device_api opencl_api = {
.dname = "opencl",
.name = "GPU", .name = "GPU",
.api_detect = opencl_detect, .api_detect = opencl_detect,
.reinit_device = reinit_opencl_device, .reinit_device = reinit_opencl_device,

0
device-gpu.h → driver-opencl.h

1
miner.h

@ -187,6 +187,7 @@ struct thr_info;
struct work; struct work;
struct device_api { struct device_api {
char*dname;
char*name; char*name;
// API-global functions // API-global functions

2
sha256_4way.c

@ -4,7 +4,7 @@
// tcatm's 4-way 128-bit SSE2 SHA-256 // tcatm's 4-way 128-bit SSE2 SHA-256
#include "device-cpu.h" #include "driver-cpu.h"
#ifdef WANT_SSE2_4WAY #ifdef WANT_SSE2_4WAY

2
sha256_altivec_4way.c

@ -9,7 +9,7 @@
// //
#include "device-cpu.h" #include "driver-cpu.h"
#ifdef WANT_ALTIVEC_4WAY #ifdef WANT_ALTIVEC_4WAY

2
sha256_sse2_amd64.c

@ -9,7 +9,7 @@
* *
*/ */
#include "device-cpu.h" #include "driver-cpu.h"
#ifdef WANT_X8664_SSE2 #ifdef WANT_X8664_SSE2

2
sha256_sse2_i386.c

@ -9,7 +9,7 @@
* *
*/ */
#include "device-cpu.h" #include "driver-cpu.h"
#ifdef WANT_X8632_SSE2 #ifdef WANT_X8632_SSE2

2
sha256_sse4_amd64.c

@ -9,7 +9,7 @@
* *
*/ */
#include "device-cpu.h" #include "driver-cpu.h"
#ifdef WANT_X8664_SSE4 #ifdef WANT_X8664_SSE4

2
sha256_via.c

@ -1,5 +1,5 @@
#include "device-cpu.h" #include "driver-cpu.h"
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>

Loading…
Cancel
Save