titan-asic.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef __TITAN_ASIC_H
  2. #define __TITAN_ASIC_H
  3. #define BLOCK_HEADER_BYTES 80
  4. #define BLOCK_HEADER_BYTES_WITHOUT_NONCE (BLOCK_HEADER_BYTES - 4)
  5. #define KNC_TITAN_MAX_ASICS 6
  6. #define KNC_TITAN_DIES_PER_ASIC 4
  7. #define KNC_TITAN_CORES_PER_DIE 571
  8. #define KNC_TITAN_CORES_PER_ASIC (KNC_TITAN_CORES_PER_DIE * KNC_TITAN_DIES_PER_ASIC)
  9. #define KNC_TITAN_THREADS_PER_CORE 8
  10. #define KNC_TITAN_NONCES_PER_REPORT 5
  11. #define KNC_TITAN_ASIC_REVISION 0xA102
  12. struct titan_info_response {
  13. uint64_t pll_state;
  14. uint16_t cores;
  15. bool want_work[KNC_TITAN_CORES_PER_DIE];
  16. bool have_report[KNC_TITAN_CORES_PER_DIE];
  17. };
  18. struct titan_report {
  19. uint8_t flags;
  20. uint8_t core_counter;
  21. uint8_t slot_core;
  22. struct nonce_report {
  23. uint32_t nonce;
  24. uint8_t slot;
  25. } nonces[KNC_TITAN_NONCES_PER_REPORT];
  26. };
  27. struct titan_setup_core_params {
  28. uint16_t bad_address_mask[2];
  29. uint16_t bad_address_match[2];
  30. uint8_t difficulty;
  31. uint8_t thread_enable;
  32. uint16_t thread_base_address[KNC_TITAN_THREADS_PER_CORE];
  33. uint16_t lookup_gap_mask[KNC_TITAN_THREADS_PER_CORE];
  34. uint16_t N_mask[KNC_TITAN_THREADS_PER_CORE];
  35. uint8_t N_shift[KNC_TITAN_THREADS_PER_CORE];
  36. uint32_t nonce_top;
  37. uint32_t nonce_bottom;
  38. };
  39. bool knc_titan_spi_get_info(const char *repr, struct spi_port * const spi, struct titan_info_response *resp, int die, int core_hint);
  40. bool knc_titan_get_report(const char *repr, struct spi_port * const spi, struct titan_report *report, int die, int core);
  41. bool knc_titan_set_work(const char *repr, struct spi_port * const spi, struct titan_report *report, int die, int core, int slot, struct work *work, bool urgent, bool *work_accepted);
  42. bool knc_titan_setup_core(const char *repr, struct spi_port * const spi, struct titan_setup_core_params *params, int die, int core);
  43. #endif /* __TITAN_ASIC_H */