dynclock.h 885 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef DYNCLOCK_H
  2. #define DYNCLOCK_H
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. struct thr_info;
  6. #define DCLK_MAXMAXERRORRATE 0.05
  7. #define DCLK_ERRORHYSTERESIS 0.1
  8. #define DCLK_OVERHEATTHRESHOLD 0.4
  9. struct dclk_data {
  10. uint8_t freqM;
  11. uint8_t freqMaxM;
  12. uint8_t freqMDefault;
  13. double errorCount[256];
  14. double errorWeight[256];
  15. double errorRate[256];
  16. double maxErrorRate[256];
  17. };
  18. typedef bool (*dclk_change_clock_func_t)(struct thr_info *, int multiplier);
  19. extern void dclk_msg_freqchange(const char *, int oldFreq, int newFreq, const char *tail);
  20. extern void dclk_prepare(struct dclk_data *data);
  21. extern void dclk_gotNonces(struct dclk_data *);
  22. extern void dclk_errorCount(struct dclk_data *, double portion);
  23. extern void dclk_preUpdate(struct dclk_data *data);
  24. extern bool dclk_updateFreq(struct dclk_data *, dclk_change_clock_func_t changeclock, struct thr_info *);
  25. #endif