driver-aan.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. uint16_t desired_pllreg;
  27. uint16_t current_pllreg;
  28. };
  29. extern int aan_detect_spi(int *out_chipcount, struct spi_port * const *spi_a, int spi_n);
  30. extern bool aan_read_reg_direct(struct spi_port *, uint8_t chip, void *out_buf, const struct timeval *tvp_timeout);
  31. extern bool aan_init(struct thr_info *);
  32. extern bool aan_queue_append(struct thr_info *, struct work *);
  33. extern void aan_queue_flush(struct thr_info *);
  34. extern struct cgpu_info *aan_proc_for_chipid(struct cgpu_info *, int chipid);
  35. extern void aan_poll(struct thr_info *);
  36. extern const char *aan_set_diff(struct cgpu_info *, const char *optname, const char *newvalue, char *replybuf, enum bfg_set_device_replytype *);
  37. extern const struct bfg_set_device_definition aan_set_device_funcs[];
  38. extern struct api_data *aan_api_device_status(struct cgpu_info *);
  39. #endif