deviceapi.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef __DEVICEAPI_H__
  2. #define __DEVICEAPI_H__
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #include <sys/time.h>
  6. #include "miner.h"
  7. extern void request_work(struct thr_info *);
  8. extern struct work *get_work(struct thr_info *);
  9. extern bool hashes_done(struct thr_info *, int64_t hashes, struct timeval *tvp_hashes, uint32_t *max_nonce);
  10. extern bool hashes_done2(struct thr_info *, int64_t hashes, uint32_t *max_nonce);
  11. extern void mt_disable_start(struct thr_info *);
  12. extern void mt_disable_finish(struct thr_info *);
  13. extern void mt_disable(struct thr_info *); // blocks until reenabled
  14. extern int restart_wait(struct thr_info *, unsigned int ms);
  15. extern void minerloop_scanhash(struct thr_info *);
  16. extern bool do_job_prepare(struct thr_info *, struct timeval *tvp_now);
  17. extern void job_prepare_complete(struct thr_info *);
  18. extern void do_get_results(struct thr_info *, bool proceed_with_new_job);
  19. extern void job_results_fetched(struct thr_info *);
  20. extern void do_job_start(struct thr_info *);
  21. extern void mt_job_transition(struct thr_info *);
  22. extern void job_start_complete(struct thr_info *);
  23. extern void job_start_abort(struct thr_info *, bool failure);
  24. extern bool do_process_results(struct thr_info *, struct timeval *tvp_now, struct work *, bool stopping);
  25. extern void minerloop_async(struct thr_info *);
  26. extern void minerloop_queue(struct thr_info *);
  27. extern void *miner_thread(void *);
  28. extern void add_cgpu_live(void*);
  29. extern bool add_cgpu_slave(struct cgpu_info *, struct cgpu_info *master);
  30. typedef bool(*detectone_func_t)(const char*);
  31. typedef int(*autoscan_func_t)();
  32. extern int _serial_detect(struct device_drv *api, detectone_func_t, autoscan_func_t, int flags);
  33. #define serial_detect_fauto(api, detectone, autoscan) \
  34. _serial_detect(api, detectone, autoscan, 1)
  35. #define serial_detect_auto(api, detectone, autoscan) \
  36. _serial_detect(api, detectone, autoscan, 0)
  37. #define serial_detect_auto_byname(api, detectone, autoscan) \
  38. _serial_detect(api, detectone, autoscan, 2)
  39. #define serial_detect(api, detectone) \
  40. _serial_detect(api, detectone, NULL, 0)
  41. #define serial_detect_byname(api, detectone) \
  42. _serial_detect(api, detectone, NULL, 2)
  43. #define noserial_detect(api, autoscan) \
  44. _serial_detect(api, NULL , autoscan, 0)
  45. #define noserial_detect_manual(api, autoscan) \
  46. _serial_detect(api, NULL , autoscan, 4)
  47. extern FILE *open_bitstream(const char *dname, const char *filename);
  48. #endif