Browse Source

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

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

+ 4 - 4
Makefile.am

@@ -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

+ 1 - 1
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>

+ 3 - 3
cgminer.c

@@ -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);
 	}

+ 2 - 1
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 = {
-	.name = "BFL",
+	.dname = "bitforce",
+	.name = "PGA",
 	.api_detect = bitforce_detect,
 	.get_statline_before = get_bitforce_statline_before,
 	.thread_prepare = bitforce_thread_prepare,

+ 2 - 1
device-cpu.c → driver-cpu.c

@@ -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,

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


+ 2 - 1
icarus.c → driver-icarus.c

@@ -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,

+ 2 - 1
device-gpu.c → driver-opencl.c

@@ -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,

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


+ 1 - 0
miner.h

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

+ 1 - 1
sha256_4way.c

@@ -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
 

+ 1 - 1
sha256_altivec_4way.c

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

+ 1 - 1
sha256_sse2_amd64.c

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

+ 1 - 1
sha256_sse2_i386.c

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

+ 1 - 1
sha256_sse4_amd64.c

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

+ 1 - 1
sha256_via.c

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