miner.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. #ifndef __MINER_H__
  2. #define __MINER_H__
  3. #include "config.h"
  4. #include <stdbool.h>
  5. #include <stdint.h>
  6. #include <sys/time.h>
  7. #include <pthread.h>
  8. #include <jansson.h>
  9. #include <curl/curl.h>
  10. #include "elist.h"
  11. #include "uthash.h"
  12. #include "logging.h"
  13. #ifdef HAVE_OPENCL
  14. #ifdef __APPLE_CC__
  15. #include <OpenCL/opencl.h>
  16. #else
  17. #include <CL/cl.h>
  18. #endif
  19. #endif /* HAVE_OPENCL */
  20. #ifdef STDC_HEADERS
  21. # include <stdlib.h>
  22. # include <stddef.h>
  23. #else
  24. # ifdef HAVE_STDLIB_H
  25. # include <stdlib.h>
  26. # endif
  27. #endif
  28. #ifdef HAVE_ALLOCA_H
  29. # include <alloca.h>
  30. #elif defined __GNUC__
  31. # ifndef WIN32
  32. # define alloca __builtin_alloca
  33. # else
  34. # include <malloc.h>
  35. # endif
  36. #elif defined _AIX
  37. # define alloca __alloca
  38. #elif defined _MSC_VER
  39. # include <malloc.h>
  40. # define alloca _alloca
  41. #else
  42. # ifndef HAVE_ALLOCA
  43. # ifdef __cplusplus
  44. extern "C"
  45. # endif
  46. void *alloca (size_t);
  47. # endif
  48. #endif
  49. #if defined (__linux)
  50. #ifndef LINUX
  51. #define LINUX
  52. #endif
  53. #endif
  54. #ifdef HAVE_ADL
  55. #include "ADL_SDK/adl_sdk.h"
  56. #endif
  57. #ifdef HAVE_LIBUSB
  58. #include <libusb-1.0/libusb.h>
  59. #endif
  60. #ifdef USE_ZTEX
  61. #include "libztex.h"
  62. #endif
  63. #if !defined(WIN32) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  64. #define bswap_16 __builtin_bswap16
  65. #define bswap_32 __builtin_bswap32
  66. #define bswap_64 __builtin_bswap64
  67. #else
  68. #if HAVE_BYTESWAP_H
  69. #include <byteswap.h>
  70. #elif defined(USE_SYS_ENDIAN_H)
  71. #include <sys/endian.h>
  72. #elif defined(__APPLE__)
  73. #include <libkern/OSByteOrder.h>
  74. #define bswap_16 OSSwapInt16
  75. #define bswap_32 OSSwapInt32
  76. #define bswap_64 OSSwapInt64
  77. #else
  78. #define bswap_16(value) \
  79. ((((value) & 0xff) << 8) | ((value) >> 8))
  80. #define bswap_32(value) \
  81. (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \
  82. (uint32_t)bswap_16((uint16_t)((value) >> 16)))
  83. #define bswap_64(value) \
  84. (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \
  85. << 32) | \
  86. (uint64_t)bswap_32((uint32_t)((value) >> 32)))
  87. #endif
  88. #endif /* !defined(__GLXBYTEORDER_H__) */
  89. /* This assumes htobe32 is a macro in endian.h */
  90. #ifndef htobe32
  91. # if __BYTE_ORDER == __LITTLE_ENDIAN
  92. # define be32toh(x) bswap_32(x)
  93. # define htobe32(x) bswap_32(x)
  94. # elif __BYTE_ORDER == __BIG_ENDIAN
  95. # define be32toh(x) (x)
  96. # define htobe32(x) (x)
  97. #else
  98. #error UNKNOWN BYTE ORDER
  99. #endif
  100. #endif
  101. #undef unlikely
  102. #undef likely
  103. #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
  104. #define unlikely(expr) (__builtin_expect(!!(expr), 0))
  105. #define likely(expr) (__builtin_expect(!!(expr), 1))
  106. #else
  107. #define unlikely(expr) (expr)
  108. #define likely(expr) (expr)
  109. #endif
  110. #define __maybe_unused __attribute__((unused))
  111. #define uninitialised_var(x) x = x
  112. #if defined(__i386__)
  113. #define WANT_CRYPTOPP_ASM32
  114. #endif
  115. #ifndef ARRAY_SIZE
  116. #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
  117. #endif
  118. enum alive {
  119. LIFE_WELL,
  120. LIFE_SICK,
  121. LIFE_DEAD,
  122. LIFE_NOSTART
  123. };
  124. enum pool_strategy {
  125. POOL_FAILOVER,
  126. POOL_ROUNDROBIN,
  127. POOL_ROTATE,
  128. POOL_LOADBALANCE,
  129. };
  130. #define TOP_STRATEGY (POOL_LOADBALANCE)
  131. struct strategies {
  132. const char *s;
  133. };
  134. struct cgpu_info;
  135. #ifdef HAVE_ADL
  136. struct gpu_adl {
  137. ADLTemperature lpTemperature;
  138. int iAdapterIndex;
  139. int lpAdapterID;
  140. int iBusNumber;
  141. char strAdapterName[256];
  142. ADLPMActivity lpActivity;
  143. ADLODParameters lpOdParameters;
  144. ADLODPerformanceLevels *DefPerfLev;
  145. ADLFanSpeedInfo lpFanSpeedInfo;
  146. ADLFanSpeedValue lpFanSpeedValue;
  147. ADLFanSpeedValue DefFanSpeedValue;
  148. int iEngineClock;
  149. int iMemoryClock;
  150. int iVddc;
  151. int iPercentage;
  152. bool autofan;
  153. bool autoengine;
  154. bool managed; /* Were the values ever changed on this card */
  155. int lastengine;
  156. int lasttemp;
  157. int targetfan;
  158. int targettemp;
  159. int overtemp;
  160. int minspeed;
  161. int maxspeed;
  162. int gpu;
  163. bool has_fanspeed;
  164. struct gpu_adl *twin;
  165. };
  166. #endif
  167. struct thr_info;
  168. struct work;
  169. struct device_api {
  170. char*dname;
  171. char*name;
  172. // API-global functions
  173. void (*api_detect)();
  174. // Device-specific functions
  175. void (*reinit_device)(struct cgpu_info*);
  176. void (*get_statline_before)(char*, struct cgpu_info*);
  177. void (*get_statline)(char*, struct cgpu_info*);
  178. void (*get_api_stats)(char*, struct cgpu_info*, bool);
  179. // Thread-specific functions
  180. bool (*thread_prepare)(struct thr_info*);
  181. uint64_t (*can_limit_work)(struct thr_info*);
  182. bool (*thread_init)(struct thr_info*);
  183. void (*free_work)(struct thr_info*, struct work*);
  184. bool (*prepare_work)(struct thr_info*, struct work*);
  185. uint64_t (*scanhash)(struct thr_info*, struct work*, uint64_t);
  186. void (*thread_shutdown)(struct thr_info*);
  187. };
  188. enum dev_enable {
  189. DEV_ENABLED,
  190. DEV_DISABLED,
  191. DEV_RECOVER,
  192. };
  193. enum cl_kernels {
  194. KL_NONE,
  195. KL_POCLBM,
  196. KL_PHATK,
  197. KL_DIAKGCN,
  198. KL_DIABLO,
  199. };
  200. enum dev_reason {
  201. REASON_THREAD_FAIL_INIT,
  202. REASON_THREAD_ZERO_HASH,
  203. REASON_THREAD_FAIL_QUEUE,
  204. REASON_DEV_SICK_IDLE_60,
  205. REASON_DEV_DEAD_IDLE_600,
  206. REASON_DEV_NOSTART,
  207. REASON_DEV_OVER_HEAT,
  208. REASON_DEV_THERMAL_CUTOFF,
  209. };
  210. #define REASON_NONE "None"
  211. #define REASON_THREAD_FAIL_INIT_STR "Thread failed to init"
  212. #define REASON_THREAD_ZERO_HASH_STR "Thread got zero hashes"
  213. #define REASON_THREAD_FAIL_QUEUE_STR "Thread failed to queue work"
  214. #define REASON_DEV_SICK_IDLE_60_STR "Device idle for 60s"
  215. #define REASON_DEV_DEAD_IDLE_600_STR "Device dead - idle for 600s"
  216. #define REASON_DEV_NOSTART_STR "Device failed to start"
  217. #define REASON_DEV_OVER_HEAT_STR "Device over heated"
  218. #define REASON_DEV_THERMAL_CUTOFF_STR "Device reached thermal cutoff"
  219. #define REASON_UNKNOWN_STR "Unknown reason - code bug"
  220. #define MIN_SEC_UNSET 99999999
  221. struct cgminer_stats {
  222. uint32_t getwork_calls;
  223. struct timeval getwork_wait;
  224. struct timeval getwork_wait_max;
  225. struct timeval getwork_wait_min;
  226. };
  227. struct cgpu_info {
  228. int cgminer_id;
  229. struct device_api *api;
  230. int device_id;
  231. char *name;
  232. char *device_path;
  233. FILE *device_file;
  234. union {
  235. #ifdef USE_ZTEX
  236. struct libztex_device *device_ztex;
  237. #endif
  238. int device_fd;
  239. };
  240. enum dev_enable deven;
  241. int accepted;
  242. int rejected;
  243. int hw_errors;
  244. double rolling;
  245. double total_mhashes;
  246. double utility;
  247. enum alive status;
  248. char init[40];
  249. struct timeval last_message_tv;
  250. int threads;
  251. struct thr_info *thread;
  252. unsigned int max_hashes;
  253. bool mapped;
  254. int virtual_gpu;
  255. int virtual_adl;
  256. int intensity;
  257. bool dynamic;
  258. char *kname;
  259. #ifdef HAVE_OPENCL
  260. cl_uint vwidth;
  261. size_t work_size;
  262. enum cl_kernels kernel;
  263. #endif
  264. float temp;
  265. int cutofftemp;
  266. #ifdef HAVE_ADL
  267. bool has_adl;
  268. struct gpu_adl adl;
  269. int gpu_engine;
  270. int min_engine;
  271. int gpu_fan;
  272. int min_fan;
  273. int gpu_memclock;
  274. int gpu_memdiff;
  275. int gpu_powertune;
  276. float gpu_vddc;
  277. #endif
  278. int last_share_pool;
  279. time_t last_share_pool_time;
  280. time_t device_last_well;
  281. time_t device_last_not_well;
  282. enum dev_reason device_not_well_reason;
  283. int thread_fail_init_count;
  284. int thread_zero_hash_count;
  285. int thread_fail_queue_count;
  286. int dev_sick_idle_60_count;
  287. int dev_dead_idle_600_count;
  288. int dev_nostart_count;
  289. int dev_over_heat_count; // It's a warning but worth knowing
  290. int dev_thermal_cutoff_count;
  291. struct cgminer_stats cgminer_stats;
  292. };
  293. extern bool add_cgpu(struct cgpu_info*);
  294. struct thread_q {
  295. struct list_head q;
  296. bool frozen;
  297. pthread_mutex_t mutex;
  298. pthread_cond_t cond;
  299. };
  300. struct thr_info {
  301. int id;
  302. int device_thread;
  303. pthread_t pth;
  304. struct thread_q *q;
  305. struct cgpu_info *cgpu;
  306. void *cgpu_data;
  307. struct timeval last;
  308. struct timeval sick;
  309. bool pause;
  310. bool getwork;
  311. double rolling;
  312. };
  313. extern int thr_info_create(struct thr_info *thr, pthread_attr_t *attr, void *(*start) (void *), void *arg);
  314. extern void thr_info_cancel(struct thr_info *thr);
  315. extern void thr_info_freeze(struct thr_info *thr);
  316. struct string_elist {
  317. char *string;
  318. bool free_me;
  319. struct list_head list;
  320. };
  321. static inline void string_elist_add(const char *s, struct list_head *head)
  322. {
  323. struct string_elist *n;
  324. n = calloc(1, sizeof(*n));
  325. n->string = strdup(s);
  326. n->free_me = true;
  327. list_add_tail(&n->list, head);
  328. }
  329. static inline void string_elist_del(struct string_elist *item)
  330. {
  331. if (item->free_me)
  332. free(item->string);
  333. list_del(&item->list);
  334. }
  335. static inline uint32_t swab32(uint32_t v)
  336. {
  337. return bswap_32(v);
  338. }
  339. static inline void swap256(void *dest_p, const void *src_p)
  340. {
  341. uint32_t *dest = dest_p;
  342. const uint32_t *src = src_p;
  343. dest[0] = src[7];
  344. dest[1] = src[6];
  345. dest[2] = src[5];
  346. dest[3] = src[4];
  347. dest[4] = src[3];
  348. dest[5] = src[2];
  349. dest[6] = src[1];
  350. dest[7] = src[0];
  351. }
  352. extern void quit(int status, const char *format, ...);
  353. static inline void mutex_lock(pthread_mutex_t *lock)
  354. {
  355. if (unlikely(pthread_mutex_lock(lock)))
  356. quit(1, "WTF MUTEX ERROR ON LOCK!");
  357. }
  358. static inline void mutex_unlock(pthread_mutex_t *lock)
  359. {
  360. if (unlikely(pthread_mutex_unlock(lock)))
  361. quit(1, "WTF MUTEX ERROR ON UNLOCK!");
  362. }
  363. static inline void wr_lock(pthread_rwlock_t *lock)
  364. {
  365. if (unlikely(pthread_rwlock_wrlock(lock)))
  366. quit(1, "WTF WRLOCK ERROR ON LOCK!");
  367. }
  368. static inline void rd_lock(pthread_rwlock_t *lock)
  369. {
  370. if (unlikely(pthread_rwlock_rdlock(lock)))
  371. quit(1, "WTF RDLOCK ERROR ON LOCK!");
  372. }
  373. static inline void rw_unlock(pthread_rwlock_t *lock)
  374. {
  375. if (unlikely(pthread_rwlock_unlock(lock)))
  376. quit(1, "WTF RWLOCK ERROR ON UNLOCK!");
  377. }
  378. static inline void rd_unlock(pthread_rwlock_t *lock)
  379. {
  380. rw_unlock(lock);
  381. }
  382. static inline void wr_unlock(pthread_rwlock_t *lock)
  383. {
  384. rw_unlock(lock);
  385. }
  386. static inline void mutex_init(pthread_mutex_t *lock)
  387. {
  388. if (unlikely(pthread_mutex_init(lock, NULL)))
  389. quit(1, "Failed to pthread_mutex_init");
  390. }
  391. static inline void rwlock_init(pthread_rwlock_t *lock)
  392. {
  393. if (unlikely(pthread_rwlock_init(lock, NULL)))
  394. quit(1, "Failed to pthread_rwlock_init");
  395. }
  396. struct pool;
  397. extern bool opt_protocol;
  398. extern char *opt_kernel_path;
  399. extern char *opt_socks_proxy;
  400. extern char *cgminer_path;
  401. extern bool opt_autofan;
  402. extern bool opt_autoengine;
  403. extern bool use_curses;
  404. extern char *opt_api_allow;
  405. extern char *opt_api_description;
  406. extern int opt_api_port;
  407. extern bool opt_api_listen;
  408. extern bool opt_api_network;
  409. extern bool opt_delaynet;
  410. extern bool opt_restart;
  411. extern pthread_rwlock_t netacc_lock;
  412. extern const uint32_t sha256_init_state[];
  413. extern json_t *json_rpc_call(CURL *curl, const char *url, const char *userpass,
  414. const char *rpc_req, bool, bool, bool *,
  415. struct pool *pool, bool);
  416. extern char *bin2hex(const unsigned char *p, size_t len);
  417. extern bool hex2bin(unsigned char *p, const char *hexstr, size_t len);
  418. typedef bool (*sha256_func)(int thr_id, const unsigned char *pmidstate,
  419. unsigned char *pdata,
  420. unsigned char *phash1, unsigned char *phash,
  421. const unsigned char *ptarget,
  422. uint32_t max_nonce,
  423. uint32_t *last_nonce,
  424. uint32_t nonce);
  425. extern int
  426. timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y);
  427. extern bool fulltest(const unsigned char *hash, const unsigned char *target);
  428. extern int opt_scantime;
  429. struct work_restart {
  430. volatile unsigned long restart;
  431. char padding[128 - sizeof(unsigned long)];
  432. };
  433. extern void thread_reportin(struct thr_info *thr);
  434. extern void kill_work(void);
  435. extern void reinit_device(struct cgpu_info *cgpu);
  436. #ifdef HAVE_ADL
  437. extern bool gpu_stats(int gpu, float *temp, int *engineclock, int *memclock, float *vddc, int *activity, int *fanspeed, int *fanpercent, int *powertune);
  438. extern int set_fanspeed(int gpu, int iFanSpeed);
  439. extern int set_vddc(int gpu, float fVddc);
  440. extern int set_engineclock(int gpu, int iEngineClock);
  441. extern int set_memoryclock(int gpu, int iMemoryClock);
  442. #endif
  443. extern void api(int thr_id);
  444. extern struct pool *current_pool(void);
  445. extern int active_pools(void);
  446. extern int add_pool_details(bool live, char *url, char *user, char *pass);
  447. #define ADD_POOL_MAXIMUM 1
  448. #define ADD_POOL_OK 0
  449. #define MAX_GPUDEVICES 16
  450. #define MAX_DEVICES 64
  451. #define MAX_POOLS (32)
  452. #define MIN_INTENSITY -10
  453. #define _MIN_INTENSITY_STR "-10"
  454. #define MAX_INTENSITY 14
  455. #define _MAX_INTENSITY_STR "14"
  456. extern struct list_head scan_devices;
  457. extern int nDevs;
  458. extern int opt_n_threads;
  459. extern int num_processors;
  460. extern int hw_errors;
  461. extern bool use_syslog;
  462. extern struct thr_info *thr_info;
  463. extern struct work_restart *work_restart;
  464. extern struct cgpu_info gpus[MAX_GPUDEVICES];
  465. extern int gpu_threads;
  466. extern double total_secs;
  467. extern int mining_threads;
  468. extern struct cgpu_info *cpus;
  469. extern int total_devices;
  470. extern struct cgpu_info *devices[];
  471. extern int total_pools;
  472. extern struct pool *pools[MAX_POOLS];
  473. extern const char *algo_names[];
  474. extern enum sha256_algos opt_algo;
  475. extern struct strategies strategies[];
  476. extern enum pool_strategy pool_strategy;
  477. extern int opt_rotate_period;
  478. extern double total_mhashes_done;
  479. extern unsigned int new_blocks;
  480. extern unsigned int found_blocks;
  481. extern int total_accepted, total_rejected;
  482. extern int total_getworks, total_stale, total_discarded;
  483. extern unsigned int local_work;
  484. extern unsigned int total_go, total_ro;
  485. extern const int opt_cutofftemp;
  486. extern int opt_log_interval;
  487. #ifdef HAVE_OPENCL
  488. typedef struct {
  489. cl_uint ctx_a; cl_uint ctx_b; cl_uint ctx_c; cl_uint ctx_d;
  490. cl_uint ctx_e; cl_uint ctx_f; cl_uint ctx_g; cl_uint ctx_h;
  491. cl_uint cty_a; cl_uint cty_b; cl_uint cty_c; cl_uint cty_d;
  492. cl_uint cty_e; cl_uint cty_f; cl_uint cty_g; cl_uint cty_h;
  493. cl_uint merkle; cl_uint ntime; cl_uint nbits; cl_uint nonce;
  494. cl_uint fW0; cl_uint fW1; cl_uint fW2; cl_uint fW3; cl_uint fW15;
  495. cl_uint fW01r; cl_uint fcty_e; cl_uint fcty_e2;
  496. cl_uint W16; cl_uint W17; cl_uint W2;
  497. cl_uint PreVal4; cl_uint T1;
  498. cl_uint C1addK5; cl_uint D1A; cl_uint W2A; cl_uint W17_2;
  499. cl_uint PreVal4addT1; cl_uint T1substate0;
  500. cl_uint PreVal4_2;
  501. cl_uint PreVal0;
  502. cl_uint PreW18;
  503. cl_uint PreW19;
  504. cl_uint PreW31;
  505. cl_uint PreW32;
  506. /* For diakgcn */
  507. cl_uint B1addK6, PreVal0addK7, W16addK16, W17addK17;
  508. cl_uint zeroA, zeroB;
  509. cl_uint oneA, twoA, threeA, fourA, fiveA, sixA, sevenA;
  510. } dev_blk_ctx;
  511. #else
  512. typedef struct {
  513. uint32_t nonce;
  514. } dev_blk_ctx;
  515. #endif
  516. struct curl_ent {
  517. CURL *curl;
  518. struct list_head node;
  519. struct timeval tv;
  520. };
  521. enum pool_enable {
  522. POOL_ENABLED,
  523. POOL_DISABLED,
  524. POOL_REJECTING,
  525. };
  526. struct pool {
  527. int pool_no;
  528. int prio;
  529. int accepted, rejected;
  530. int seq_rejects;
  531. bool submit_fail;
  532. bool idle;
  533. bool lagging;
  534. bool probed;
  535. enum pool_enable enabled;
  536. bool submit_old;
  537. bool removed;
  538. bool lp_started;
  539. char *hdr_path;
  540. char *lp_url;
  541. unsigned int getwork_requested;
  542. unsigned int stale_shares;
  543. unsigned int discarded_work;
  544. unsigned int getfail_occasions;
  545. unsigned int remotefail_occasions;
  546. struct timeval tv_idle;
  547. char *rpc_url;
  548. char *rpc_userpass;
  549. char *rpc_user, *rpc_pass;
  550. pthread_mutex_t pool_lock;
  551. struct thread_q *submit_q;
  552. struct thread_q *getwork_q;
  553. pthread_t longpoll_thread;
  554. pthread_t submit_thread;
  555. pthread_t getwork_thread;
  556. int curls;
  557. pthread_cond_t cr_cond;
  558. struct list_head curlring;
  559. time_t last_share_time;
  560. struct cgminer_stats cgminer_stats;
  561. };
  562. struct work {
  563. unsigned char data[128];
  564. unsigned char hash1[64];
  565. unsigned char midstate[32];
  566. unsigned char target[32];
  567. unsigned char hash[32];
  568. int rolls;
  569. uint32_t output[1];
  570. uint32_t valid;
  571. dev_blk_ctx blk;
  572. struct thr_info *thr;
  573. int thr_id;
  574. struct pool *pool;
  575. struct timeval tv_staged;
  576. bool mined;
  577. bool clone;
  578. bool cloned;
  579. bool rolltime;
  580. bool longpoll;
  581. unsigned int work_block;
  582. int id;
  583. UT_hash_handle hh;
  584. time_t share_found_time;
  585. };
  586. extern void get_datestamp(char *, struct timeval *);
  587. bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
  588. extern void tailsprintf(char *f, const char *fmt, ...);
  589. extern void wlogprint(const char *f, ...);
  590. extern int curses_int(const char *query);
  591. extern char *curses_input(const char *query);
  592. extern void kill_work(void);
  593. extern void switch_pools(struct pool *selected);
  594. extern void remove_pool(struct pool *pool);
  595. extern void write_config(FILE *fcfg);
  596. extern void log_curses(int prio, const char *f, va_list ap);
  597. extern void clear_logwin(void);
  598. extern bool pool_tclear(struct pool *pool, bool *var);
  599. extern struct thread_q *tq_new(void);
  600. extern void tq_free(struct thread_q *tq);
  601. extern bool tq_push(struct thread_q *tq, void *data);
  602. extern void *tq_pop(struct thread_q *tq, const struct timespec *abstime);
  603. extern void tq_freeze(struct thread_q *tq);
  604. extern void tq_thaw(struct thread_q *tq);
  605. extern bool successful_connect;
  606. extern void adl(void);
  607. extern void app_restart(void);
  608. #endif /* __MINER_H__ */