driver-aan.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef BFG_DRIVER_AAN
  2. #define BFG_DRIVER_AAN
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #include "lowl-spi.h"
  6. #include "miner.h"
  7. #define AAN_ALL_CHIPS 0
  8. #define AAN_MAX_JOBID 4
  9. struct aan_hooks {
  10. void (*precmd)(struct spi_port *);
  11. bool (*read_reg)(struct spi_port *, uint8_t chip, void *out_buf, const struct timeval *tvp_timeout);
  12. };
  13. struct aan_board_data {
  14. struct spi_port *spi;
  15. struct timeval tv_next_poll;
  16. struct cgpu_info *master_dev;
  17. // Master board only
  18. int queues_empty;
  19. };
  20. struct aan_chip_data {
  21. uint8_t chipid;
  22. int8_t last_jobid;
  23. struct work *works[AAN_MAX_JOBID];
  24. float desired_nonce_pdiff;
  25. float current_nonce_pdiff;
  26. };
  27. extern int aan_detect_spi(int *out_chipcount, struct spi_port * const *spi_a, int spi_n);
  28. extern bool aan_read_reg_direct(struct spi_port *, uint8_t chip, void *out_buf, const struct timeval *tvp_timeout);
  29. extern bool aan_init(struct thr_info *);
  30. extern bool aan_queue_append(struct thr_info *, struct work *);
  31. extern void aan_queue_flush(struct thr_info *);
  32. extern void aan_poll(struct thr_info *);
  33. extern const char *aan_set_diff(struct cgpu_info *, const char *optname, const char *newvalue, char *replybuf, enum bfg_set_device_replytype *);
  34. extern const struct bfg_set_device_definition aan_set_device_funcs[];
  35. #endif