forked from luke-jr/bfgminer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libbitfury.h
66 lines (57 loc) · 1.55 KB
/
libbitfury.h
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
#ifndef __LIBBITFURY_H__
#define __LIBBITFURY_H__
#include <stdbool.h>
#include <stdint.h>
#include "miner.h"
#include "spidevc.h"
struct work;
#define BITFURY_STAT_N 1024
struct bitfury_payload {
unsigned char midstate[32];
unsigned int junk[8];
unsigned m7;
unsigned ntime;
unsigned nbits;
unsigned nnonce;
};
struct freq_stat {
double *mh;
double *s;
int osc6_min;
int osc6_max;
double omh;
double os;
int best_osc;
int best_done;
};
struct bitfury_device {
struct spi_port *spi;
unsigned char osc6_bits;
unsigned newbuf[17];
unsigned oldbuf[17];
bool oldjob;
int active;
uint32_t atrvec[20];
struct bitfury_payload payload;
struct freq_stat chip_stat;
struct timeval timer1;
struct timeval tv_stat;
unsigned int counter1, counter2;
double mhz;
unsigned slot;
unsigned fasync;
unsigned strange_counter;
bool force_reinit;
int desync_counter;
int sample_hwe;
int sample_tot;
};
extern void work_to_bitfury_payload(struct bitfury_payload *, struct work *);
extern void bitfury_payload_to_atrvec(uint32_t *atrvec, struct bitfury_payload *);
extern void bitfury_send_reinit(struct spi_port *, int slot, int chip_n, int n);
extern void bitfury_send_shutdown(struct spi_port *, int slot, int chip_n);
extern void bitfury_send_freq(struct spi_port *, int slot, int chip_n, int bits);
extern int libbitfury_detectChips1(struct spi_port *);
extern unsigned bitfury_decnonce(unsigned);
extern bool bitfury_fudge_nonce(const void *midstate, const uint32_t m7, const uint32_t ntime, const uint32_t nbits, uint32_t *nonce_p);
#endif /* __LIBBITFURY_H__ */