Add basic nf1_scan function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/driver-bitfury.c b/driver-bitfury.c
index 0384be1..9085e6f 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -973,6 +973,39 @@ static int64_t bxf_scan(struct cgpu_info *bitfury, struct bitfury_info *info)
return ret;
}
+static int64_t nf1_scan(struct thr_info *thr, struct cgpu_info *bitfury,
+ struct bitfury_info *info)
+{
+ struct work *work;
+ int64_t ret = 0;
+
+ work = get_queue_work(thr, bitfury, thr->id);
+ if (unlikely(thr->work_restart)) {
+ work_completed(bitfury, work);
+ return 0;
+ }
+ info->work = work;
+ bitfury_work_to_payload(&info->payload, work);
+ libbitfury_sendHashData(bitfury);
+ if (info->job_switched) {
+ int i, j;
+ int *res = info->results;
+ struct work *owork = info->owork;
+
+ i = info->results_n;
+ for (j = i - 1; j >= 0; j--) {
+ if (owork)
+ submit_nonce(thr, owork, bswap_32(res[j]));
+ }
+ if (owork)
+ work_completed(bitfury, owork);
+ info->owork = info->work;
+ info->work = NULL;
+ ret += 0xffffffffull * i;
+ }
+ return ret;
+}
+
static int64_t bitfury_scanwork(struct thr_info *thr)
{
struct cgpu_info *bitfury = thr->cgpu;
@@ -981,10 +1014,10 @@ static int64_t bitfury_scanwork(struct thr_info *thr)
switch(info->ident) {
case IDENT_BF1:
return bf1_scan(thr, bitfury, info);
- break;
case IDENT_BXF:
return bxf_scan(bitfury, info);
- break;
+ case IDENT_NF1:
+ return nf1_scan(thr, bitfury, info);
default:
return 0;
}
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 7fc8a2f..9c1fa86 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -85,8 +85,10 @@ struct bitfury_info {
unsigned newbuf[20];
unsigned oldbuf[20];
int job_switched;
- unsigned int results[16];
+ int results[16];
int results_n;
+ struct work *work;
+ struct work *owork;
};
#endif /* BITFURY_H */
diff --git a/libbitfury.h b/libbitfury.h
index 377b3dd..69adcae 100644
--- a/libbitfury.h
+++ b/libbitfury.h
@@ -14,11 +14,13 @@
void ms3steps(uint32_t *p);
uint32_t decnonce(uint32_t in);
+void bitfury_work_to_payload(struct bitfury_payload *p, struct work *w);
void spi_clear_buf(struct bitfury_info *info);
void spi_add_buf(struct bitfury_info *info, const void *buf, const int sz);
void spi_add_break(struct bitfury_info *info);
void spi_add_data(struct bitfury_info *info, uint16_t addr, const void *buf, int len);
bool spi_reset(struct cgpu_info *bitfury, struct bitfury_info *info);
bool spi_txrx(struct cgpu_info *bitfury, struct bitfury_info *info);
+void libbitfury_sendHashData(struct cgpu_info *bf);
#endif /* LIBBITFURY_H */