forked from ckolivas/cgminer
-
Notifications
You must be signed in to change notification settings - Fork 15
/
libbitfury.h
112 lines (98 loc) · 3.11 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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* libbitfury.h - library for Bitfury chip/board
*
* Copyright (c) 2013 bitfury
* Copyright (c) 2013 legkodymov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
**/
#ifndef __LIBBITFURY_H__
#define __LIBBITFURY_H__
#include "bitfury-config.h"
#ifdef BITFURY_METABANK
#define BITFURY_MAXCHIPS 256
#define BITFURY_MAXBANKS 32
#define BITFURY_BANKCHIPS 8
#define BITFURY_SCANHASH_DELAY 60
#endif
#ifdef BITFURY_NEEDBMW_NOMUX
#define BITFURY_MAXCHIPS 100
#define BITFURY_MAXBANKS 1
#define BITFURY_BANKCHIPS 100
#define BITFURY_SCANHASH_DELAY 100
#endif
#include "miner.h"
struct bitfury_payload {
unsigned char midstate[32];
unsigned int junk[8];
unsigned m7;
unsigned ntime;
unsigned nbits;
unsigned nnonce;
};
struct bitfury_device {
unsigned osc6_req;
unsigned osc6_bits;
unsigned osc6_bits_setpoint;
unsigned newbuf[17];
unsigned oldbuf[17];
struct work * work;
struct work * owork;
struct work * o2work;
int job_switched;
struct bitfury_payload payload;
struct bitfury_payload opayload;
struct bitfury_payload o2payload;
unsigned int results[16];
int results_n;
time_t stat_ts[BITFURY_STAT_N];
unsigned int stat_counter;
unsigned int future_nonce;
unsigned int old_nonce;
struct timespec timer1;
struct timespec timer2;
struct timespec otimer1;
struct timespec otimer2;
struct timespec predict1;
struct timespec predict2;
unsigned int counter1, counter2;
unsigned int ocounter1, ocounter2;
int rate; //per msec
int osc_slow;
int osc_fast;
int req1_done, req2_done;
double mhz;
double ns;
unsigned slot;
unsigned fasync;
unsigned hw_errors;
unsigned int matching_work;
unsigned int nonces[32];
int current_nonce;
double gh_stat[8];
int strange_counter;
};
int libbitfury_readHashData(unsigned int *res);
int libbitfury_sendHashData(struct thr_info *thr, struct bitfury_device *bf, int chip_n);
void work_to_payload(struct bitfury_payload *p, struct work *w);
struct timespec t_diff(struct timespec start, struct timespec end);
int libbitfury_detectChips(struct bitfury_device *devices);
int libbitfury_shutdownChips(struct bitfury_device *devices, int chip_n);
#endif /* __LIBBITFURY_H__ */