driver-hashfast.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2013 Con Kolivas <kernel@kolivas.org>
  3. * Copyright 2013 Hashfast
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the Free
  7. * Software Foundation; either version 3 of the License, or (at your option)
  8. * any later version. See COPYING for more details.
  9. */
  10. #ifndef HASHFAST_H
  11. #define HASHFAST_H
  12. #ifdef USE_HASHFAST
  13. #include "miner.h"
  14. #include "elist.h"
  15. #include "hf_protocol.h"
  16. #define HASHFAST_MINER_THREADS 1
  17. #define HF_NUM_SEQUENCE 256
  18. // Matching fields for hf_statistics, but large #'s for local accumulation, per-die
  19. struct hf_long_statistics {
  20. uint64_t rx_header_crc; // Header CRC's
  21. uint64_t rx_body_crc; // Data CRC's
  22. uint64_t rx_header_timeouts; // Header timeouts
  23. uint64_t rx_body_timeouts; // Data timeouts
  24. uint64_t core_nonce_fifo_full; // Core nonce Q overrun events
  25. uint64_t array_nonce_fifo_full; // System nonce Q overrun events
  26. uint64_t stats_overrun; // Overrun in statistics reporting
  27. } __attribute__((packed,aligned(4)));
  28. struct hashfast_info {
  29. int asic_count; // # of chips in the chain
  30. int core_count; // # of cores per chip
  31. int device_type; // What sort of device this is
  32. int ref_frequency; // Reference clock rate
  33. uint16_t hash_sequence; // The next hash sequence # to be sent
  34. struct hf_g1_die_data *die_status; // Array of per-die voltage, current, temperature sensor data
  35. struct hf_long_statistics *die_statistics; // Array of per-die error counters
  36. int hash_clock_rate; // Hash clock rate to use, in Mhz
  37. struct hf_usb_init_base usb_init_base; // USB Base information from USB_INIT
  38. struct hf_config_data config_data; // Configuration data used from USB_INIT
  39. int core_bitmap_size; // in bytes
  40. uint32_t *core_bitmap; // Core OK bitmap test results, run with PLL Bypassed
  41. struct work **works;
  42. uint16_t device_sequence_head; // The most recent sequence number the device dispatched
  43. uint16_t device_sequence_tail; // The most recently completed job in the device
  44. uint16_t hash_sequence_tail; // Follows device_sequence_tail around to free work
  45. };
  46. #endif /* USE_HASHFAST */
  47. #endif /* HASHFAST_H */