icarus-common.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef ICARUS_COMMON_H
  2. #define ICARUS_COMMON_H
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #include <sys/time.h>
  6. #include "miner.h"
  7. // Fraction of a second, USB timeout is measured in
  8. // i.e. 10 means 1/10 of a second
  9. // Right now, it MUST be 10 due to other assumptions.
  10. #define TIME_FACTOR 10
  11. // It's 10 per second, thus value = 10/TIME_FACTOR =
  12. #define ICARUS_READ_FAULT_DECISECONDS 1
  13. #define NANOSEC 1000000000.0
  14. // Store the last INFO_HISTORY data sets
  15. // [0] = current data, not yet ready to be included as an estimate
  16. // Each new data set throws the last old set off the end thus
  17. // keeping a ongoing average of recent data
  18. #define INFO_HISTORY 10
  19. struct ICARUS_HISTORY {
  20. struct timeval finish;
  21. double sumXiTi;
  22. double sumXi;
  23. double sumTi;
  24. double sumXi2;
  25. uint32_t values;
  26. uint32_t hash_count_min;
  27. uint32_t hash_count_max;
  28. };
  29. enum timing_mode { MODE_DEFAULT, MODE_SHORT, MODE_LONG, MODE_VALUE };
  30. struct ICARUS_INFO {
  31. // time to calculate the golden_ob
  32. uint64_t golden_hashes;
  33. struct timeval golden_tv;
  34. struct ICARUS_HISTORY history[INFO_HISTORY+1];
  35. uint32_t min_data_count;
  36. // seconds per Hash
  37. double Hs;
  38. int read_count;
  39. enum timing_mode timing_mode;
  40. bool do_icarus_timing;
  41. int do_default_detection;
  42. double fullnonce;
  43. int count;
  44. double W;
  45. uint32_t values;
  46. uint64_t hash_count_range;
  47. // Determine the cost of history processing
  48. // (which will only affect W)
  49. uint64_t history_count;
  50. struct timeval history_time;
  51. // icarus-options
  52. int baud;
  53. int work_division;
  54. int fpga_count;
  55. uint32_t nonce_mask;
  56. bool quirk_reopen;
  57. };
  58. bool icarus_detect_custom(const char *devpath, struct device_api *, struct ICARUS_INFO *);
  59. #endif