libbitfury.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef __LIBBITFURY_H__
  2. #define __LIBBITFURY_H__
  3. #include "miner.h"
  4. #define BITFURY_STAT_N 1024
  5. struct bitfury_payload {
  6. unsigned char midstate[32];
  7. unsigned int junk[8];
  8. unsigned m7;
  9. unsigned ntime;
  10. unsigned nbits;
  11. unsigned nnonce;
  12. };
  13. struct bitfury_device {
  14. unsigned char osc6_bits;
  15. unsigned newbuf[17];
  16. unsigned oldbuf[17];
  17. struct work * work;
  18. struct work * owork;
  19. struct work * o2work;
  20. int job_switched;
  21. struct bitfury_payload payload;
  22. struct bitfury_payload opayload;
  23. struct bitfury_payload o2payload;
  24. unsigned int results[16];
  25. int results_n;
  26. time_t stat_ts[BITFURY_STAT_N];
  27. unsigned int stat_counter;
  28. unsigned int future_nonce;
  29. unsigned int old_nonce;
  30. struct timespec timer1;
  31. struct timespec timer2;
  32. struct timespec otimer1;
  33. struct timespec otimer2;
  34. struct timespec predict1;
  35. struct timespec predict2;
  36. unsigned int counter1, counter2;
  37. unsigned int ocounter1, ocounter2;
  38. int rate; //per msec
  39. int osc_slow;
  40. int osc_fast;
  41. int req1_done, req2_done;
  42. double mhz;
  43. double ns;
  44. unsigned slot;
  45. unsigned fasync;
  46. };
  47. int libbitfury_readHashData(unsigned int *res);
  48. int libbitfury_sendHashData(struct bitfury_device *bf, int chip_n);
  49. void work_to_payload(struct bitfury_payload *p, struct work *w);
  50. struct timespec t_diff(struct timespec start, struct timespec end);
  51. int libbitfury_detectChips(struct bitfury_device *devices);
  52. int libbitfury_shutdownChips(struct bitfury_device *devices, int chip_n);
  53. #endif /* __LIBBITFURY_H__ */