Browse Source

Correct formatting in FPGA drivers

Luke Dashjr 13 years ago
parent
commit
f77dad650e
5 changed files with 13 additions and 13 deletions
  1. 6 6
      driver-bitforce.c
  2. 2 2
      driver-x6500.c
  3. 3 3
      driver-ztex.c
  4. 1 1
      fpgautils.c
  5. 1 1
      libztex.c

+ 6 - 6
driver-bitforce.c

@@ -30,7 +30,7 @@
 #define BITFORCE_CHECK_INTERVAL_MS 10
 #define WORK_CHECK_INTERVAL_MS 50
 #define MAX_START_DELAY_US 100000
-#define tv_to_ms(tval) (tval.tv_sec * 1000 + tval.tv_usec / 1000)
+#define tv_to_ms(tval) ((unsigned long)(tval.tv_sec * 1000 + tval.tv_usec / 1000))
 #define TIME_AVG_CONSTANT 8
 
 #define KNAME_WORK  "full work"
@@ -447,8 +447,8 @@ static int64_t bitforce_get_result(struct thr_info *thr, struct work *work)
 		timersub(&now, &bitforce->work_start_tv, &elapsed);
 
 		if (elapsed.tv_sec >= BITFORCE_LONG_TIMEOUT_S) {
-			applog(LOG_ERR, "BFL%i: took %dms - longer than %dms", bitforce->device_id,
-				tv_to_ms(elapsed), BITFORCE_LONG_TIMEOUT_MS);
+			applog(LOG_ERR, "BFL%i: took %lums - longer than %lums", bitforce->device_id,
+				tv_to_ms(elapsed), (unsigned long)BITFORCE_LONG_TIMEOUT_MS);
 			return 0;
 		}
 
@@ -463,8 +463,8 @@ static int64_t bitforce_get_result(struct thr_info *thr, struct work *work)
 	}
 
 	if (elapsed.tv_sec > BITFORCE_TIMEOUT_S) {
-		applog(LOG_ERR, "BFL%i: took %dms - longer than %dms", bitforce->device_id,
-			tv_to_ms(elapsed), BITFORCE_TIMEOUT_MS);
+		applog(LOG_ERR, "BFL%i: took %lums - longer than %lums", bitforce->device_id,
+			tv_to_ms(elapsed), (unsigned long)BITFORCE_TIMEOUT_MS);
 		bitforce->device_last_not_well = time(NULL);
 		bitforce->device_not_well_reason = REASON_DEV_OVER_HEAT;
 		bitforce->dev_over_heat_count++;
@@ -585,7 +585,7 @@ commerr:
 		BFclose(bitforce->device_fd);
 		int fd = bitforce->device_fd = BFopen(bitforce->device_path);
 		if (fd == -1) {
-			applog(LOG_ERR, "BFL%i: Error reopening");
+			applog(LOG_ERR, "BFL%i: Error reopening", bitforce->device_id);
 			return -1;
 		}
 		/* empty read buffer */

+ 2 - 2
driver-x6500.c

@@ -240,7 +240,7 @@ x6500_fpga_upload_bitstream(struct cgpu_info *x6500, struct jtag_port *jp1)
 	sleep(1);
 	
 	if (fread(buf, 32, 1, f) != 1)
-		bailout2(LOG_ERR, "%s %u: File underrun programming %s (%d bytes left)", x6500->api->name, x6500->device_id, x6500->device_path, len);
+		bailout2(LOG_ERR, "%s %u: File underrun programming %s (%lu bytes left)", x6500->api->name, x6500->device_id, x6500->device_path, len);
 	jtag_swrite(jp, JTAG_REG_DR, buf, 256);
 	len -= 32;
 	
@@ -258,7 +258,7 @@ x6500_fpga_upload_bitstream(struct cgpu_info *x6500, struct jtag_port *jp1)
 	while (len) {
 		buflen = len < 32 ? len : 32;
 		if (fread(buf, buflen, 1, f) != 1)
-			bailout2(LOG_ERR, "%s %u: File underrun programming %s (%d bytes left)", x6500->api->name, x6500->device_id, x6500->device_path, len);
+			bailout2(LOG_ERR, "%s %u: File underrun programming %s (%lu bytes left)", x6500->api->name, x6500->device_id, x6500->device_path, len);
 		jtag_swrite_more(jp, buf, buflen * 8, len == (unsigned long)buflen);
 		*pdone = 100 - ((len * 100) / flen);
 		if (*pdone >= nextstatus)

+ 3 - 3
driver-ztex.c

@@ -170,7 +170,7 @@ static bool ztex_checkNonce(struct libztex_device *ztex,
 	sha2(hash1, 32, hash2, false);
 	if (htobe32(hash2_32[7]) != ((hdata->hash7 + 0x5be0cd19) & 0xFFFFFFFF)) {
 		dclk_errorCount(&ztex->dclk, 1.0 / ztex->numNonces);
-		applog(LOG_DEBUG, "%s: checkNonce failed for %0.8X", ztex->repr, hdata->nonce);
+		applog(LOG_DEBUG, "%s: checkNonce failed for %08x", ztex->repr, hdata->nonce);
 		return false;
 	}
 	return true;
@@ -271,7 +271,7 @@ static int64_t ztex_scanhash(struct thr_info *thr, struct work *work,
 			if (nonce > noncecnt)
 				noncecnt = nonce;
 			if (((nonce & 0x7fffffff) >> 4) < ((lastnonce[i] & 0x7fffffff) >> 4)) {
-				applog(LOG_DEBUG, "%s: overflow nonce=%0.8x lastnonce=%0.8x", ztex->repr, nonce, lastnonce[i]);
+				applog(LOG_DEBUG, "%s: overflow nonce=%08x lastnonce=%08x", ztex->repr, nonce, lastnonce[i]);
 				overflow = true;
 			} else
 				lastnonce[i] = nonce;
@@ -299,7 +299,7 @@ static int64_t ztex_scanhash(struct thr_info *thr, struct work *work,
 						work->blk.nonce = 0xffffffff;
 						if ( (rv = test_nonce(work, nonce, false)) )
 						rv = submit_nonce(thr, work, nonce);
-						applog(LOG_DEBUG, "%s: submitted %0.8x (from N%dE%d) %d", ztex->repr, nonce, i, j, rv);
+						applog(LOG_DEBUG, "%s: submitted %08x (from N%dE%d) %d", ztex->repr, nonce, i, j, rv);
 					}
 				}
 			}

+ 1 - 1
fpgautils.c

@@ -713,7 +713,7 @@ FILE *open_xilinx_bitstream(struct cgpu_info *cgpu, const char *fwfile, unsigned
 	if (fwusercode == 0xffffffff)
 		bailout(LOG_ERR, "%s %u: Firmware doesn't support user code",
 		        cgpu->api->name, cgpu->device_id);
-	applog(LOG_DEBUG, "  Version: %u, build %u", (fwusercode >> 8) & 0xff, fwusercode & 0xff);
+	applog(LOG_DEBUG, "  Version: %u, build %u", (unsigned)((fwusercode >> 8) & 0xff), (unsigned)(fwusercode & 0xff));
 	check_magic('b');
 	read_str("part number");
 	applog(LOG_DEBUG, "  Part number: %s", buf);

+ 1 - 1
libztex.c

@@ -59,7 +59,7 @@ static bool libztex_checkDevice(struct libusb_device *dev)
 		return false;
 	}
 	if (!(desc.idVendor == LIBZTEX_IDVENDOR && desc.idProduct == LIBZTEX_IDPRODUCT)) {
-		applog(LOG_DEBUG, "Not a ZTEX device %0.4x:%0.4x", desc.idVendor, desc.idProduct);
+		applog(LOG_DEBUG, "Not a ZTEX device %04x:%04x", desc.idVendor, desc.idProduct);
 		return false;
 	}
 	return true;