Browse Source

icarus: Support for custom driver job start function

Luke Dashjr 12 years ago
parent
commit
424cc16b68
2 changed files with 8 additions and 4 deletions
  1. 5 3
      driver-icarus.c
  2. 3 1
      icarus-common.h

+ 5 - 3
driver-icarus.c

@@ -650,6 +650,8 @@ static bool icarus_init(struct thr_info *thr)
 	struct ICARUS_INFO *info = icarus->device_data;
 	int fd = icarus->device_fd;
 	
+	BFGINIT(info->job_start_func, icarus_job_start);
+	
 	if (!info->work_division)
 	{
 		struct timeval tv_finish;
@@ -744,7 +746,7 @@ bool icarus_job_prepare(struct thr_info *thr, struct work *work, __maybe_unused
 	return true;
 }
 
-static bool icarus_job_start(struct thr_info *thr)
+bool icarus_job_start(struct thr_info *thr)
 {
 	struct cgpu_info *icarus = thr->cgpu;
 	struct ICARUS_INFO *info = icarus->device_data;
@@ -853,7 +855,7 @@ void handle_identify(struct thr_info * const thr, int ret, const bool was_first_
 	if (!state->firstrun)
 	{
 		applog(LOG_DEBUG, "%"PRIpreprv": Identify: Starting next job", icarus->proc_repr);
-		if (!icarus_job_start(thr))
+		if (!info->job_start_func(thr))
 no_job_start:
 			state->firstrun = true;
 	}
@@ -1020,7 +1022,7 @@ keepwaiting:
 		// Delay job start until later...
 	}
 	else
-	if (unlikely(icarus->deven != DEV_ENABLED || !icarus_job_start(thr)))
+	if (unlikely(icarus->deven != DEV_ENABLED || !info->job_start_func(thr)))
 		state->firstrun = true;
 
 	if (info->reopen_mode == IRM_CYCLE && !icarus_reopen(icarus, state, &fd))

+ 3 - 1
icarus-common.h

@@ -114,8 +114,9 @@ struct ICARUS_INFO {
 	const char *golden_nonce;
 	bool nonce_littleendian;
 	
-	// Custom driver function
+	// Custom driver functions
 	bool (*detect_init_func)(const char *devpath, int fd, struct ICARUS_INFO *);
+	bool (*job_start_func)(struct thr_info *);
 };
 
 struct icarus_state {
@@ -134,5 +135,6 @@ bool icarus_detect_custom(const char *devpath, struct device_drv *, struct ICARU
 extern int icarus_gets(unsigned char *, int fd, struct timeval *tv_finish, struct thr_info *, int read_count, int read_size);
 extern int icarus_write(int fd, const void *buf, size_t bufLen);
 extern void do_icarus_close(struct thr_info *thr);
+extern bool icarus_job_start(struct thr_info *);
 
 #endif