Browse Source

Abstract out flushing of interrupt reads in BF1 devices.

nfactor-troky
Con Kolivas 11 years ago
parent
commit
59b33c1a58
  1. 12
      driver-bitfury.c

12
driver-bitfury.c

@ -27,12 +27,17 @@ static void bitfury_empty_buffer(struct cgpu_info *bitfury) @@ -27,12 +27,17 @@ static void bitfury_empty_buffer(struct cgpu_info *bitfury)
} while (amount);
}
static void bitfury_open(struct cgpu_info *bitfury)
static void bitfury_empty_intbuf(struct cgpu_info *bitfury)
{
char buf[8];
int amount;
usb_read_ii(bitfury, 0, buf, 8, &amount, C_BF1_IFLUSH);
}
static void bitfury_open(struct cgpu_info *bitfury)
{
bitfury_empty_intbuf(bitfury);
/* Magic open sequence */
usb_transfer(bitfury, 0x21, 0x22, 0x0003, 0, C_BF1_OPEN);
bitfury_empty_buffer(bitfury);
@ -40,13 +45,10 @@ static void bitfury_open(struct cgpu_info *bitfury) @@ -40,13 +45,10 @@ static void bitfury_open(struct cgpu_info *bitfury)
static void bitfury_close(struct cgpu_info *bitfury)
{
char buf[8];
int amount;
bitfury_empty_buffer(bitfury);
/* Magic close sequence */
usb_transfer(bitfury, 0x21, 0x22, 0, 0, C_BF1_CLOSE);
usb_read_ii(bitfury, 0, buf, 8, &amount, C_BF1_IFLUSH);
bitfury_empty_intbuf(bitfury);
bitfury_empty_buffer(bitfury);
usb_transfer(bitfury, 0x23, 0x08, 0x9053, 1, C_BF1_CLOSE);
bitfury_empty_buffer(bitfury);

Loading…
Cancel
Save