mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-05 03:24:26 +00:00
Remove unneeded function and checks in avalon write code.
This commit is contained in:
parent
33e83eb764
commit
772b354ea9
@ -121,12 +121,6 @@ static inline void avalon_create_task(struct avalon_task *at,
|
||||
memcpy(at->data, work->data + 64, 12);
|
||||
}
|
||||
|
||||
static void avalon_wait_ready(struct cgpu_info *avalon)
|
||||
{
|
||||
while (!avalon_ready(avalon))
|
||||
nmsleep(40);
|
||||
}
|
||||
|
||||
static int avalon_write(struct cgpu_info *avalon, char *buf, ssize_t len)
|
||||
{
|
||||
ssize_t wrote = 0;
|
||||
@ -134,7 +128,6 @@ static int avalon_write(struct cgpu_info *avalon, char *buf, ssize_t len)
|
||||
while (len > 0) {
|
||||
int amount, err;
|
||||
|
||||
avalon_wait_ready(avalon);
|
||||
err = usb_write(avalon, buf + wrote, len, &amount, C_AVALON_TASK);
|
||||
applog(LOG_DEBUG, "%s%i: usb_write got err %d",
|
||||
avalon->drv->name, avalon->device_id, err);
|
||||
@ -1078,7 +1071,6 @@ static int64_t avalon_scanhash(struct thr_info *thr)
|
||||
static void avalon_flush_work(struct cgpu_info *avalon)
|
||||
{
|
||||
struct avalon_info *info = avalon->device_data;
|
||||
struct thr_info *thr = info->thr;
|
||||
|
||||
mutex_lock(&info->qlock);
|
||||
/* Will overwrite any work queued */
|
||||
|
@ -124,7 +124,6 @@ struct avalon_info {
|
||||
#define AVA_SEND_OK 0
|
||||
|
||||
#define avalon_buffer_full(avalon) !usb_ftdi_cts(avalon)
|
||||
#define avalon_ready(avalon) usb_ftdi_ctw(avalon)
|
||||
|
||||
#define AVALON_READ_TIME(baud) ((double)AVALON_READ_SIZE * (double)8.0 / (double)(baud))
|
||||
#define ASSERT1(condition) __maybe_unused static char sizeof_uint32_t_must_be_4[(condition)?1:-1]
|
||||
|
21
usbutils.c
21
usbutils.c
@ -2228,6 +2228,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
|
||||
#define FTDI_RS0_RI (1 << 6)
|
||||
#define FTDI_RS0_RLSD (1 << 7)
|
||||
|
||||
/* Clear to send for FTDI */
|
||||
int usb_ftdi_cts(struct cgpu_info *cgpu)
|
||||
{
|
||||
struct cg_usb_device *usbdev = cgpu->usbdev;
|
||||
@ -2240,26 +2241,6 @@ int usb_ftdi_cts(struct cgpu_info *cgpu)
|
||||
return (ret & FTDI_RS0_CTS);
|
||||
}
|
||||
|
||||
#define FTDI_RS_DR 1
|
||||
#define FTDI_RS_OE (1<<1)
|
||||
#define FTDI_RS_PE (1<<2)
|
||||
#define FTDI_RS_FE (1<<3)
|
||||
#define FTDI_RS_BI (1<<4)
|
||||
#define FTDI_RS_THRE (1<<5)
|
||||
#define FTDI_RS_TEMT (1<<6)
|
||||
#define FTDI_RS_FIFO (1<<7)
|
||||
|
||||
int usb_ftdi_ctw(struct cgpu_info *cgpu)
|
||||
{
|
||||
struct cg_usb_device *usbdev = cgpu->usbdev;
|
||||
unsigned char buf[2];
|
||||
|
||||
libusb_control_transfer(usbdev->handle, (uint8_t)FTDI_TYPE_IN,
|
||||
(uint8_t)5, (uint16_t)0, (uint16_t)0,
|
||||
buf, 2, DEVTIMEOUT);
|
||||
return ((buf[1] & FTDI_RS_THRE) && (buf[1] & FTDI_RS_TEMT));
|
||||
}
|
||||
|
||||
int _usb_write(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *processed, unsigned int timeout, __maybe_unused enum usb_cmds cmd)
|
||||
{
|
||||
struct cg_usb_device *usbdev = cgpu->usbdev;
|
||||
|
Loading…
x
Reference in New Issue
Block a user