driver-zeus.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef INCLUDE_DRIVER_ZEUS_H
  2. #define INCLUDE_DRIVER_ZEUS_H
  3. #ifdef USE_ZEUS
  4. #define ZEUS_PROTOCOL_DEBUG 1
  5. #define ZEUS_CHIP_GEN 1
  6. #define ZEUS_CHIP_GEN1_CORES 8
  7. #define ZEUS_CHIP_CORES ZEUS_CHIP_GEN1_CORES
  8. #define ZEUS_MIN_CHIPS 6
  9. #define ZEUS_MAX_CHIPS 1024
  10. #define ZEUS_IO_SPEED 115200
  11. #define ZEUS_READ_FAULT_DECISECONDS 2
  12. #define ZEUS_COMMAND_PKT_LEN 84
  13. #define ZEUS_EVENT_PKT_LEN 4
  14. #define ZEUS_READ_BUFFER ZEUS_EVENT_PKT_LEN + 2 // 2 = max value of read_data_offset; allows 2 extra FTDI status bytes
  15. #define ZEUS_CLK_MAX 382 // 0xff * 3/2
  16. #define ZEUS_CLK_MIN 328
  17. #define ZEUS_USB_ID_MODEL_STR1 "CP2102_USB_to_UART_Bridge_Controller"
  18. #define ZEUS_USB_ID_MODEL_STR2 "FT232R_USB_UART"
  19. #define PIPE_R 0
  20. #define PIPE_W 1
  21. struct ZEUS_INFO {
  22. char device_name[24];
  23. int device_fd;
  24. int using_libusb;
  25. bool serial_reopen;
  26. unsigned int nonce_count[ZEUS_MAX_CHIPS][ZEUS_CHIP_CORES];
  27. unsigned int error_count[ZEUS_MAX_CHIPS][ZEUS_CHIP_CORES];
  28. unsigned int workdone;
  29. struct timeval workstart;
  30. struct timeval workend;
  31. struct timeval scanwork_time;
  32. struct timeval work_timeout;
  33. double hashes_per_s;
  34. uint64_t golden_speed_per_core; // speed per core per sec
  35. uint32_t read_count;
  36. uint32_t last_nonce;
  37. int next_chip_clk;
  38. unsigned char freqcode;
  39. struct thr_info *thr;
  40. pthread_t sworkpth;
  41. pthread_mutex_t lock;
  42. cgsem_t wusem;
  43. struct work *current_work;
  44. int baud;
  45. int cores_per_chip;
  46. int chips_count_max;
  47. int chips_count;
  48. int chip_clk;
  49. int chips_bit_num; // log2(chips_count_max)
  50. int read_data_offset;
  51. };
  52. extern struct device_drv zeus_drv;
  53. #endif /* USE_ZEUS */
  54. #endif /* INCLUDE_DRIVER_ZEUS_H */