miner.h 16 KB

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