mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-28 23:44:30 +00:00
Deprecate preferred packet size functions in usbutils since they're unhelpful.
This commit is contained in:
parent
ea12210032
commit
fc80e2feb6
@ -780,7 +780,6 @@ static bool avalon_detect_one(libusb_device *dev, struct usb_find_devices *found
|
||||
/* Even though this is an FTDI type chip, we want to do the parsing
|
||||
* all ourselves so set it to std usb type */
|
||||
avalon->usbdev->usb_type = USB_TYPE_STD;
|
||||
usb_set_pps(avalon, AVALON_USB_PACKETSIZE);
|
||||
usb_buffer_enable(avalon);
|
||||
|
||||
/* We have a real Avalon! */
|
||||
|
@ -64,7 +64,6 @@
|
||||
#define AVALON_AUTO_CYCLE 1024
|
||||
|
||||
#define AVALON_FTDI_READSIZE 510
|
||||
#define AVALON_USB_PACKETSIZE 512
|
||||
#define AVALON_READBUF_SIZE 8192
|
||||
#define AVALON_RESET_TIMEOUT 100
|
||||
#define AVALON_READ_TIMEOUT 18 /* Enough to only half fill the buffer */
|
||||
|
@ -55,10 +55,6 @@
|
||||
// The size of a successful nonce read
|
||||
#define ICARUS_READ_SIZE 4
|
||||
|
||||
#define AMU_PREF_PACKET 256
|
||||
#define BLT_PREF_PACKET 512
|
||||
#define ICA_PREF_PACKET 256
|
||||
|
||||
// Ensure the sizes are correct for the Serial read
|
||||
#if (ICARUS_READ_SIZE != 4)
|
||||
#error ICARUS_READ_SIZE must be 4
|
||||
@ -329,8 +325,6 @@ static void icarus_initialise(struct cgpu_info *icarus, int baud)
|
||||
case IDENT_LLT:
|
||||
case IDENT_CMR1:
|
||||
case IDENT_CMR2:
|
||||
usb_set_pps(icarus, BLT_PREF_PACKET);
|
||||
|
||||
// Reset
|
||||
transfer(icarus, FTDI_TYPE_OUT, FTDI_REQUEST_RESET, FTDI_VALUE_RESET,
|
||||
interface, C_RESET);
|
||||
@ -404,8 +398,6 @@ static void icarus_initialise(struct cgpu_info *icarus, int baud)
|
||||
interface, C_PURGERX);
|
||||
break;
|
||||
case IDENT_ICA:
|
||||
usb_set_pps(icarus, ICA_PREF_PACKET);
|
||||
|
||||
// Set Data Control
|
||||
transfer(icarus, PL2303_CTRL_OUT, PL2303_REQUEST_CTRL, PL2303_VALUE_CTRL,
|
||||
interface, C_SETDATA);
|
||||
@ -426,8 +418,6 @@ static void icarus_initialise(struct cgpu_info *icarus, int baud)
|
||||
interface, C_VENDOR);
|
||||
break;
|
||||
case IDENT_AMU:
|
||||
usb_set_pps(icarus, AMU_PREF_PACKET);
|
||||
|
||||
// Enable the UART
|
||||
transfer(icarus, CP210X_TYPE_OUT, CP210X_REQUEST_IFC_ENABLE,
|
||||
CP210X_VALUE_UART_ENABLE,
|
||||
|
98
usbutils.c
98
usbutils.c
@ -103,8 +103,8 @@ static struct list_head ut_list;
|
||||
#ifdef USE_BFLSC
|
||||
// N.B. transfer size is 512 with USB2.0, but only 64 with USB1.1
|
||||
static struct usb_epinfo bas_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_intinfo bas_ints[] = {
|
||||
@ -115,8 +115,8 @@ static struct usb_intinfo bas_ints[] = {
|
||||
#ifdef USE_BITFORCE
|
||||
// N.B. transfer size is 512 with USB2.0, but only 64 with USB1.1
|
||||
static struct usb_epinfo bfl_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_intinfo bfl_ints[] = {
|
||||
@ -126,12 +126,12 @@ static struct usb_intinfo bfl_ints[] = {
|
||||
|
||||
#ifdef USE_BITFURY
|
||||
static struct usb_epinfo bfu0_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_INTERRUPT, 8, EPI(2), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_INTERRUPT, 8, EPI(2), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_epinfo bfu1_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 16, EPI(3), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 16, EPO(4), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 16, EPI(3), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 16, EPO(4), 0, 0 }
|
||||
};
|
||||
|
||||
/* Default to interface 1 */
|
||||
@ -145,12 +145,12 @@ static struct usb_intinfo bfu_ints[] = {
|
||||
#include "driver-hashfast.h"
|
||||
|
||||
static struct usb_epinfo hfa0_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_INTERRUPT, 8, EPI(3), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_INTERRUPT, 8, EPI(3), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_epinfo hfa1_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0 }
|
||||
};
|
||||
|
||||
/* Default to interface 1 */
|
||||
@ -162,8 +162,8 @@ static struct usb_intinfo hfa_ints[] = {
|
||||
|
||||
#ifdef USE_MODMINER
|
||||
static struct usb_epinfo mmq_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(3), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(3), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_intinfo mmq_ints[] = {
|
||||
@ -173,8 +173,8 @@ static struct usb_intinfo mmq_ints[] = {
|
||||
|
||||
#ifdef USE_AVALON
|
||||
static struct usb_epinfo ava_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_intinfo ava_ints[] = {
|
||||
@ -184,8 +184,8 @@ static struct usb_intinfo ava_ints[] = {
|
||||
|
||||
#ifdef USE_KLONDIKE
|
||||
static struct usb_epinfo kln_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(1), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(1), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_intinfo kln_ints[] = {
|
||||
@ -195,8 +195,8 @@ static struct usb_intinfo kln_ints[] = {
|
||||
|
||||
#ifdef USE_ICARUS
|
||||
static struct usb_epinfo ica_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_intinfo ica_ints[] = {
|
||||
@ -204,8 +204,8 @@ static struct usb_intinfo ica_ints[] = {
|
||||
};
|
||||
|
||||
static struct usb_epinfo amu_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(1), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(1), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_intinfo amu_ints[] = {
|
||||
@ -213,8 +213,8 @@ static struct usb_intinfo amu_ints[] = {
|
||||
};
|
||||
|
||||
static struct usb_epinfo llt_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_intinfo llt_ints[] = {
|
||||
@ -222,8 +222,8 @@ static struct usb_intinfo llt_ints[] = {
|
||||
};
|
||||
|
||||
static struct usb_epinfo cmr1_epinfos[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_intinfo cmr1_ints[] = {
|
||||
@ -231,20 +231,20 @@ static struct usb_intinfo cmr1_ints[] = {
|
||||
};
|
||||
|
||||
static struct usb_epinfo cmr2_epinfos0[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(1), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(2), 0, 0 }
|
||||
};
|
||||
static struct usb_epinfo cmr2_epinfos1[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(4), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(3), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(4), 0, 0 },
|
||||
};
|
||||
static struct usb_epinfo cmr2_epinfos2[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(5), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(6), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(5), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(6), 0, 0 },
|
||||
};
|
||||
static struct usb_epinfo cmr2_epinfos3[] = {
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(7), 0, 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(8), 0, 0, 0 }
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPI(7), 0, 0 },
|
||||
{ LIBUSB_TRANSFER_TYPE_BULK, 64, EPO(8), 0, 0 }
|
||||
};
|
||||
|
||||
static struct usb_intinfo cmr2_ints[] = {
|
||||
@ -3171,40 +3171,6 @@ enum sub_ident usb_ident(struct cgpu_info *cgpu)
|
||||
return ident;
|
||||
}
|
||||
|
||||
/*
|
||||
* If you pass both intinfo and epinfo as <0 then it will set all
|
||||
* endpoints to PrefPacketSize
|
||||
* If intinfo >=0 but epinfo <0 then it will set all endpoints
|
||||
* for the given one intinfo to PrefPacketSize
|
||||
* If both are >=0 then it will set only the specified single
|
||||
* endpoint (intinfo,epinfo) to PrefPacketSize
|
||||
*/
|
||||
void _usb_set_pps(struct cgpu_info *cgpu, int intinfo, int epinfo, uint16_t PrefPacketSize)
|
||||
{
|
||||
struct usb_find_devices *found;
|
||||
int pstate;
|
||||
|
||||
DEVWLOCK(cgpu, pstate);
|
||||
|
||||
if (cgpu->usbdev) {
|
||||
found = cgpu->usbdev->found;
|
||||
if (intinfo >= 0 && epinfo >= 0)
|
||||
found->intinfos[intinfo].epinfos[epinfo].PrefPacketSize = PrefPacketSize;
|
||||
else {
|
||||
if (intinfo >= 0) {
|
||||
for (epinfo = 0; epinfo < found->intinfos[intinfo].epinfo_count; epinfo++)
|
||||
found->intinfos[intinfo].epinfos[epinfo].PrefPacketSize = PrefPacketSize;
|
||||
} else {
|
||||
for (intinfo = 0; intinfo < found->intinfo_count ; intinfo++)
|
||||
for (epinfo = 0; epinfo < found->intinfos[intinfo].epinfo_count; epinfo++)
|
||||
found->intinfos[intinfo].epinfos[epinfo].PrefPacketSize = PrefPacketSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEVWUNLOCK(cgpu, pstate);
|
||||
}
|
||||
|
||||
// Need to set all devices with matching usbdev
|
||||
void usb_set_dev_start(struct cgpu_info *cgpu)
|
||||
{
|
||||
|
@ -122,7 +122,6 @@ struct usb_epinfo {
|
||||
uint16_t size;
|
||||
unsigned char ep;
|
||||
uint16_t wMaxPacketSize;
|
||||
uint16_t PrefPacketSize;
|
||||
bool found;
|
||||
};
|
||||
|
||||
@ -405,8 +404,6 @@ void usb_disable_cps(struct cgpu_info *cgpu);
|
||||
int _usb_interface(struct cgpu_info *cgpu, int intinfo);
|
||||
#define usb_interface(_cgpu) _usb_interface(_cgpu, DEFAULT_INTINFO)
|
||||
enum sub_ident usb_ident(struct cgpu_info *cgpu);
|
||||
void _usb_set_pps(struct cgpu_info *cgpu, int intinfo, int epinfo, uint16_t PrefPacketSize);
|
||||
#define usb_set_pps(_cgpu, _pps) _usb_set_pps(_cgpu, -1, -1, _pps)
|
||||
void usb_set_dev_start(struct cgpu_info *cgpu);
|
||||
void usb_cleanup();
|
||||
void usb_initialise();
|
||||
|
Loading…
x
Reference in New Issue
Block a user