Browse Source

bitfury: Loop over chips once during scanwork

Luke Dashjr 12 years ago
parent
commit
6172bb6447
2 changed files with 9 additions and 20 deletions
  1. 9 5
      driver-bitfury.c
  2. 0 15
      libbitfury.c

+ 9 - 5
driver-bitfury.c

@@ -79,6 +79,7 @@ static int64_t bitfury_scanHash(struct thr_info *thr)
 	int chip_n;
 	int chip;
 	uint64_t hashes = 0;
+	static bool second_run = false;
 
 	chip_n = thr->cgpu->chip_n;
 
@@ -91,11 +92,11 @@ static int64_t bitfury_scanHash(struct thr_info *thr)
 			}
 			work_to_payload(&(devices[chip].payload), devices[chip].work);
 		}
-	}
-
-	libbitfury_sendHashData(devices, chip_n);
-
-	for (chip = 0; chip < chip_n; chip++) {
+		
+		devices[chip].chip = chip;
+		payload_to_atrvec(devices[chip].atrvec, &devices[chip].payload);
+		libbitfury_sendHashData1(&devices[chip], second_run);
+		
 		if (devices[chip].job_switched) {
 			int i,j;
 			unsigned int *res = devices[chip].results;
@@ -115,6 +116,9 @@ static int64_t bitfury_scanHash(struct thr_info *thr)
 			hashes += 0xffffffffull * i;
 		}
 	}
+	
+	second_run = true;
+	
 	return hashes;
 }
 

+ 0 - 15
libbitfury.c

@@ -316,21 +316,6 @@ void libbitfury_sendHashData1(struct bitfury_device *d, bool want_results)
 	cgsleep_ms(BITFURY_REFRESH_DELAY);
 }
 
-void libbitfury_sendHashData(struct bitfury_device *bf, int chip_n) {
-	int chip;
-	static bool second_run = false;
-
-	for (chip = 0; chip < chip_n; chip++) {
-		struct bitfury_device *d = bf + chip;
-		d->chip = chip;
-		payload_to_atrvec(d->atrvec, &d->payload);
-		libbitfury_sendHashData1(d, second_run);
-	}
-	second_run = true;
-
-	return;
-}
-
 int libbitfury_readHashData(unsigned int *res) {
 	return 0;
 }