Browse Source

bitforce: Flush job and result queues at startup to avoid unnecessary warnings

Luke Dashjr 12 years ago
parent
commit
28a1862114
1 changed files with 10 additions and 0 deletions
  1. 10 0
      driver-bitforce.c

+ 10 - 0
driver-bitforce.c

@@ -1222,6 +1222,8 @@ static bool bitforce_thread_init(struct thr_info *thr)
 	bool sc = initdata->sc;
 	bool sc = initdata->sc;
 	int xlink_id = 0, boardno = 0;
 	int xlink_id = 0, boardno = 0;
 	struct bitforce_proc_data *first_on_this_board;
 	struct bitforce_proc_data *first_on_this_board;
+	char buf[100];
+	int fd = bitforce->device_fd;
 	
 	
 	for ( ; bitforce; bitforce = bitforce->next_proc)
 	for ( ; bitforce; bitforce = bitforce->next_proc)
 	{
 	{
@@ -1282,6 +1284,9 @@ static bool bitforce_thread_init(struct thr_info *thr)
 				bitforce_change_mode(bitforce, BFP_RANGE);
 				bitforce_change_mode(bitforce, BFP_RANGE);
 		}
 		}
 		
 		
+		// Clear job queue to start fresh; ignore response
+		bitforce_cmd1(fd, data->xlink_id, buf, sizeof(buf), "ZQX");
+		
 		first_on_this_board = procdata;
 		first_on_this_board = procdata;
 		for (int proc = 1; proc < data->parallel; ++proc)
 		for (int proc = 1; proc < data->parallel; ++proc)
 		{
 		{
@@ -1302,6 +1307,7 @@ static bool bitforce_thread_init(struct thr_info *thr)
 		{}
 		{}
 	}
 	}
 	
 	
+	// NOTE: This doesn't restore the first processor, but it does get us the last one; this is sufficient for the delay debug and start of the next loop below
 	bitforce = thr->cgpu;
 	bitforce = thr->cgpu;
 
 
 	free(initdata->parallels);
 	free(initdata->parallels);
@@ -1313,6 +1319,10 @@ static bool bitforce_thread_init(struct thr_info *thr)
 	applog(LOG_DEBUG, "%s: Delaying start by %dms", bitforce->dev_repr, wait / 1000);
 	applog(LOG_DEBUG, "%s: Delaying start by %dms", bitforce->dev_repr, wait / 1000);
 	nmsleep(wait);
 	nmsleep(wait);
 
 
+	// Clear results queue last, to start fresh; ignore response
+	for (bitforce = bitforce->device; bitforce; bitforce = bitforce->next_proc)
+		bitforce_zox(thr, "ZOX");
+	
 	return true;
 	return true;
 }
 }