titan-asic.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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_WORKSLOTS_PER_CORE 2
  10. #define KNC_TITAN_THREADS_PER_CORE 8
  11. #define KNC_TITAN_NONCES_PER_REPORT 5
  12. #define KNC_TITAN_ASIC_REVISION 0xA102
  13. struct nonce_report {
  14. uint32_t nonce;
  15. uint8_t slot;
  16. };
  17. struct titan_info_response {
  18. uint64_t pll_state;
  19. uint16_t cores;
  20. bool want_work[KNC_TITAN_CORES_PER_DIE];
  21. bool have_report[KNC_TITAN_CORES_PER_DIE];
  22. };
  23. struct titan_report {
  24. uint8_t flags;
  25. uint8_t core_counter;
  26. uint8_t slot_core;
  27. struct nonce_report nonces[KNC_TITAN_NONCES_PER_REPORT];
  28. };
  29. struct titan_setup_core_params {
  30. uint16_t bad_address_mask[2];
  31. uint16_t bad_address_match[2];
  32. uint8_t difficulty;
  33. uint8_t thread_enable;
  34. uint16_t thread_base_address[KNC_TITAN_THREADS_PER_CORE];
  35. uint16_t lookup_gap_mask[KNC_TITAN_THREADS_PER_CORE];
  36. uint16_t N_mask[KNC_TITAN_THREADS_PER_CORE];
  37. uint8_t N_shift[KNC_TITAN_THREADS_PER_CORE];
  38. uint32_t nonce_top;
  39. uint32_t nonce_bottom;
  40. };
  41. bool knc_titan_spi_get_info(const char *repr, struct spi_port * const spi, struct titan_info_response *resp, int die, int core_hint);
  42. bool knc_titan_get_report(const char *repr, struct spi_port * const spi, struct titan_report *report, int die, int core);
  43. 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);
  44. bool knc_titan_setup_core(const char *repr, struct spi_port * const spi, struct titan_setup_core_params *params, int die, int core);
  45. #endif /* __TITAN_ASIC_H */