Browse Source

Merge pull request #345 from denis2342/ztex

libztex: fixed some warnings and removed some whitespaces
nfactor-troky
Con Kolivas 12 years ago
parent
commit
0aefc9b516
  1. 15
      libztex.c

15
libztex.c

@ -25,13 +25,12 @@ @@ -25,13 +25,12 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <config.h>
#include "miner.h"
#include "fpgautils.h"
#include "libztex.h"
#define BUFSIZE 256
//* Capability index for EEPROM support.
#define CAPABILITY_EEPROM 0,0
//* Capability index for FPGA configuration support.
@ -103,9 +102,10 @@ static enum check_result libztex_checkDevice(struct libusb_device *dev) @@ -103,9 +102,10 @@ static enum check_result libztex_checkDevice(struct libusb_device *dev)
FILE *fp = NULL;
libusb_device_handle *hndl = NULL;
struct libusb_device_descriptor desc;
int i, ret = CHECK_ERROR, err, cnt;
int ret = CHECK_ERROR, err, cnt;
size_t got_bytes, length;
unsigned char buf[64], *fw_buf;
unsigned int i;
err = libusb_get_device_descriptor(dev, &desc);
if (unlikely(err != 0)) {
@ -292,7 +292,7 @@ static bool libztex_checkCapability(struct libztex_device *ztex, int i, int j) @@ -292,7 +292,7 @@ static bool libztex_checkCapability(struct libztex_device *ztex, int i, int j)
return true;
}
static int libztex_detectBitstreamBitOrder(const unsigned char *buf, int size)
static char libztex_detectBitstreamBitOrder(const unsigned char *buf, int size)
{
int i;
@ -407,7 +407,6 @@ static int libztex_configureFpgaHS(struct libztex_device *ztex, const char* firm @@ -407,7 +407,6 @@ static int libztex_configureFpgaHS(struct libztex_device *ztex, const char* firm
applog(LOG_ERR, "%s: HS FPGA configuration failed: DONE pin does not go high", ztex->repr);
return -3;
}
}
libusb_release_interface(ztex->hndl, settings[1]);
@ -415,7 +414,6 @@ static int libztex_configureFpgaHS(struct libztex_device *ztex, const char* firm @@ -415,7 +414,6 @@ static int libztex_configureFpgaHS(struct libztex_device *ztex, const char* firm
nmsleep(200);
applog(LOG_INFO, "%s: HS FPGA configuration done", ztex->repr);
return 0;
}
static int libztex_configureFpgaLS(struct libztex_device *ztex, const char* firmware, bool force, char bs)
@ -520,7 +518,7 @@ int libztex_numberOfFpgas(struct libztex_device *ztex) { @@ -520,7 +518,7 @@ int libztex_numberOfFpgas(struct libztex_device *ztex) {
int libztex_selectFpga(struct libztex_device *ztex) {
int cnt, fpgacnt = libztex_numberOfFpgas(ztex->root);
int number = ztex->fpgaNum;
uint16_t number = ztex->fpgaNum;
if (number < 0 || number >= fpgacnt) {
applog(LOG_WARNING, "%s: Trying to select wrong fpga (%d in %d)", ztex->repr, number, fpgacnt);
return 1;
@ -631,7 +629,6 @@ int libztex_prepare_device(struct libusb_device *dev, struct libztex_device** zt @@ -631,7 +629,6 @@ int libztex_prepare_device(struct libusb_device *dev, struct libztex_device** zt
newdev->moduleReserved[10] = buf[28];
newdev->moduleReserved[11] = buf[29];
cnt = libusb_control_transfer(newdev->hndl, 0xc0, 0x82, 0, 0, buf, 64, 500);
if (unlikely(cnt < 0)) {
applog(LOG_ERR, "Ztex check device: Failed to read ztex descriptor with err %d", cnt);
@ -810,7 +807,7 @@ done: @@ -810,7 +807,7 @@ done:
int libztex_sendHashData(struct libztex_device *ztex, unsigned char *sendbuf)
{
int cnt, ret, len;
int cnt = 0, ret, len;
if (ztex == NULL || ztex->hndl == NULL)
return 0;

Loading…
Cancel
Save