driver-lketc.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef INCLUDE_DRIVER_LKETC_H
  2. #define INCLUDE_DRIVER_LKETC_H
  3. #ifdef USE_LKETC
  4. #define LKETC_PROTOCOL_DEBUG 1
  5. #define LKETC_CHIP_GEN 1
  6. #define LKETC_CHIP_GEN1_CORES 8
  7. #define LKETC_CHIP_CORES LKETC_CHIP_GEN1_CORES
  8. #define LKETC_MIN_CHIPS 1
  9. #define LKETC_MAX_CHIPS 6
  10. #define LKETC_IO_SPEED 115200
  11. #define LKETC_READ_FAULT_DECISECONDS 2
  12. #define LKETC_COMMAND_PKT_LEN 84
  13. #define LKETC_EVENT_PKT_LEN 4
  14. #define LKETC_READ_BUFFER LKETC_EVENT_PKT_LEN + 2 // 2 = max value of read_data_offset; allows 2 extra FTDI status bytes
  15. #define LKETC_CLK_MAX 329 // 0xff * 3/2
  16. #define LKETC_CLK_MIN 180
  17. #define LKETC_USB_ID_MODEL_STR1 "CP2103_USB_to_UART_Bridge_Controller"
  18. #define LKETC_USB_ID_MODEL_STR2 "FT232R_USB_UART"
  19. #define PIPE_R 0
  20. #define PIPE_W 1
  21. struct LKETC_INFO {
  22. char device_name[24];
  23. int device_fd;
  24. int using_libusb;
  25. bool serial_reopen;
  26. unsigned int nonce_count[LKETC_MAX_CHIPS][LKETC_CHIP_CORES];
  27. unsigned int error_count[LKETC_MAX_CHIPS][LKETC_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 lketc_drv;
  53. #endif /* USE_LKETC */
  54. #endif /* INCLUDE_DRIVER_LKETC_H */