mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 07:17:58 +00:00
Add atmel init sequence likely to be required on hashfast for windows to work.
This commit is contained in:
parent
75726f6e00
commit
5ee279ca00
@ -38,12 +38,12 @@ static int bitfury_open(struct cgpu_info *bitfury)
|
|||||||
* harmless on linux. */
|
* harmless on linux. */
|
||||||
buf[0] = 0x80250000;
|
buf[0] = 0x80250000;
|
||||||
buf[1] = 0x00000800;
|
buf[1] = 0x00000800;
|
||||||
err = usb_transfer(bitfury, 0, 9, 1, 0, C_BF1_RESET);
|
err = usb_transfer(bitfury, 0, 9, 1, 0, C_ATMEL_RESET);
|
||||||
if (!err)
|
if (!err)
|
||||||
err = usb_transfer(bitfury, 0x21, 0x22, 0, 0, C_BF1_OPEN);
|
err = usb_transfer(bitfury, 0x21, 0x22, 0, 0, C_ATMEL_OPEN);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
err = usb_transfer_data(bitfury, 0x21, 0x20, 0x0000, 0, buf,
|
err = usb_transfer_data(bitfury, 0x21, 0x20, 0x0000, 0, buf,
|
||||||
BF1MSGSIZE, C_BF1_INIT);
|
BF1MSGSIZE, C_ATMEL_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
@ -312,7 +312,6 @@ static bool hfa_detect_common(struct cgpu_info *hashfast)
|
|||||||
if (!info)
|
if (!info)
|
||||||
quit(1, "Failed to calloc hashfast_info in hfa_detect_common");
|
quit(1, "Failed to calloc hashfast_info in hfa_detect_common");
|
||||||
hashfast->device_data = info;
|
hashfast->device_data = info;
|
||||||
hfa_clear_readbuf(hashfast);
|
|
||||||
/* hashfast_reset should fill in details for info */
|
/* hashfast_reset should fill in details for info */
|
||||||
ret = hfa_reset(hashfast, info);
|
ret = hfa_reset(hashfast, info);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
@ -340,12 +339,35 @@ static bool hfa_detect_common(struct cgpu_info *hashfast)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hfa_initialise(struct cgpu_info *hashfast)
|
static bool hfa_initialise(struct cgpu_info *hashfast)
|
||||||
{
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
if (hashfast->usbinfo.nodev)
|
if (hashfast->usbinfo.nodev)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
usb_buffer_enable(hashfast);
|
usb_buffer_enable(hashfast);
|
||||||
// FIXME Do necessary initialising here
|
hfa_clear_readbuf(hashfast);
|
||||||
|
|
||||||
|
err = usb_transfer(hashfast, 0, 9, 1, 0, C_ATMEL_RESET);
|
||||||
|
if (!err)
|
||||||
|
err = usb_transfer(hashfast, 0x21, 0x22, 0, 0, C_ATMEL_OPEN);
|
||||||
|
if (!err) {
|
||||||
|
uint32_t buf[2];
|
||||||
|
|
||||||
|
/* Magic sequence to reset device only really needed for windows
|
||||||
|
* but harmless on linux. */
|
||||||
|
buf[0] = 0x80250000;
|
||||||
|
buf[1] = 0x00000800;
|
||||||
|
err = usb_transfer_data(hashfast, 0x21, 0x20, 0x0000, 0, buf,
|
||||||
|
7, C_ATMEL_INIT);
|
||||||
|
}
|
||||||
|
if (err < 0) {
|
||||||
|
applog(LOG_INFO, "HFA %d: Failed to open with error %s",
|
||||||
|
hashfast->device_id, libusb_error_name(err));
|
||||||
|
}
|
||||||
|
/* Must have transmitted init sequence sized buffer */
|
||||||
|
return (err == 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hfa_detect_one_usb(libusb_device *dev, struct usb_find_devices *found)
|
static bool hfa_detect_one_usb(libusb_device *dev, struct usb_find_devices *found)
|
||||||
@ -363,7 +385,10 @@ static bool hfa_detect_one_usb(libusb_device *dev, struct usb_find_devices *foun
|
|||||||
|
|
||||||
hashfast->usbdev->usb_type = USB_TYPE_STD;
|
hashfast->usbdev->usb_type = USB_TYPE_STD;
|
||||||
|
|
||||||
hfa_initialise(hashfast);
|
if (!hfa_initialise(hashfast)) {
|
||||||
|
hashfast = usb_free_cgpu(hashfast);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
add_cgpu(hashfast);
|
add_cgpu(hashfast);
|
||||||
|
|
||||||
|
@ -331,10 +331,10 @@ struct cg_usb_info {
|
|||||||
USB_ADD_COMMAND(C_ENABLE_UART, "EnableUART") \
|
USB_ADD_COMMAND(C_ENABLE_UART, "EnableUART") \
|
||||||
USB_ADD_COMMAND(C_BB_SET_VOLTAGE, "SetCoreVoltage") \
|
USB_ADD_COMMAND(C_BB_SET_VOLTAGE, "SetCoreVoltage") \
|
||||||
USB_ADD_COMMAND(C_BB_GET_VOLTAGE, "GetCoreVoltage") \
|
USB_ADD_COMMAND(C_BB_GET_VOLTAGE, "GetCoreVoltage") \
|
||||||
USB_ADD_COMMAND(C_BF1_RESET, "BF1Reset") \
|
USB_ADD_COMMAND(C_ATMEL_RESET, "AtmelReset") \
|
||||||
USB_ADD_COMMAND(C_BF1_OPEN, "BF1Open") \
|
USB_ADD_COMMAND(C_ATMEL_OPEN, "AtmelOpen") \
|
||||||
USB_ADD_COMMAND(C_BF1_INIT, "BF1Init") \
|
USB_ADD_COMMAND(C_ATMEL_INIT, "AtmelInit") \
|
||||||
USB_ADD_COMMAND(C_BF1_CLOSE, "BF1Close") \
|
USB_ADD_COMMAND(C_ATMEL_CLOSE, "AtmelClose") \
|
||||||
USB_ADD_COMMAND(C_BF1_REQINFO, "BF1RequestInfo") \
|
USB_ADD_COMMAND(C_BF1_REQINFO, "BF1RequestInfo") \
|
||||||
USB_ADD_COMMAND(C_BF1_GETINFO, "BF1GetInfo") \
|
USB_ADD_COMMAND(C_BF1_GETINFO, "BF1GetInfo") \
|
||||||
USB_ADD_COMMAND(C_BF1_REQRESET, "BF1RequestReset") \
|
USB_ADD_COMMAND(C_BF1_REQRESET, "BF1RequestReset") \
|
||||||
|
Loading…
Reference in New Issue
Block a user