deviceapi.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 void mt_disable_start(struct thr_info *);
  11. extern void mt_disable_finish(struct thr_info *);
  12. extern void mt_disable(struct thr_info *); // blocks until reenabled
  13. extern int restart_wait(struct thr_info *, unsigned int ms);
  14. extern void minerloop_scanhash(struct thr_info *);
  15. extern bool do_job_prepare(struct thr_info *, struct timeval *tvp_now);
  16. extern void job_prepare_complete(struct thr_info *);
  17. extern void do_get_results(struct thr_info *, bool proceed_with_new_job);
  18. extern void job_results_fetched(struct thr_info *);
  19. extern void do_job_start(struct thr_info *);
  20. extern void mt_job_transition(struct thr_info *);
  21. extern void job_start_complete(struct thr_info *);
  22. extern void job_start_abort(struct thr_info *, bool failure);
  23. extern bool do_process_results(struct thr_info *, struct timeval *tvp_now, struct work *, bool stopping);
  24. extern void minerloop_async(struct thr_info *);
  25. extern void minerloop_queue(struct thr_info *);
  26. extern void *miner_thread(void *);
  27. extern void add_cgpu_live(void*);
  28. typedef bool(*detectone_func_t)(const char*);
  29. typedef int(*autoscan_func_t)();
  30. extern int _serial_detect(struct device_drv *api, detectone_func_t, autoscan_func_t, int flags);
  31. #define serial_detect_fauto(api, detectone, autoscan) \
  32. _serial_detect(api, detectone, autoscan, 1)
  33. #define serial_detect_auto(api, detectone, autoscan) \
  34. _serial_detect(api, detectone, autoscan, 0)
  35. #define serial_detect_auto_byname(api, detectone, autoscan) \
  36. _serial_detect(api, detectone, autoscan, 2)
  37. #define serial_detect(api, detectone) \
  38. _serial_detect(api, detectone, NULL, 0)
  39. #define serial_detect_byname(api, detectone) \
  40. _serial_detect(api, detectone, NULL, 2)
  41. #define noserial_detect(api, autoscan) \
  42. _serial_detect(api, NULL , autoscan, 0)
  43. #define noserial_detect_manual(api, autoscan) \
  44. _serial_detect(api, NULL , autoscan, 4)
  45. extern FILE *open_bitstream(const char *dname, const char *filename);
  46. #endif