dm_temp_ctrl.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright 2018 Duan Hao
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License as published by the Free
  6. * Software Foundation; either version 3 of the License, or (at your option)
  7. * any later version. See COPYING for more details.
  8. */
  9. #ifndef _DM_TEMP_CTRL_H_
  10. #define _DM_TEMP_CTRL_H_
  11. #include "dragonmint_t1.h"
  12. #define TEMP_INVALID (-1)
  13. #define TEMP_NORMAL (0)
  14. #define TEMP_TOO_LOW (1)
  15. #define TEMP_TOO_HIGH (2)
  16. #define TEMP_WARNING (3)
  17. #define TEMP_SHUTDOWN (4)
  18. #define TEMP_TOLERANCE (5)
  19. typedef struct _c_temp_cfg
  20. {
  21. short tmp_min; // min value of temperature
  22. short tmp_max; // max value of temperature
  23. short tmp_target; // target temperature
  24. short tmp_thr_lo; // low temperature threshold
  25. short tmp_thr_hi; // high temperature threshold
  26. short tmp_thr_warn; // warning threshold
  27. short tmp_thr_pd; // power down threshold
  28. int tmp_exp_time; // temperature expiring time (ms)
  29. } c_temp_cfg;
  30. extern volatile c_temp_cfg g_tmp_cfg; // configs of temperature control
  31. extern volatile c_temp g_chain_tmp[MAX_CHAIN_NUM]; // current temperature for each chain
  32. void dm_tempctrl_get_defcfg(c_temp_cfg *p_cfg);
  33. void dm_tempctrl_set(c_temp_cfg *p_cfg);
  34. void dm_tempctrl_init(c_temp_cfg *p_cfg);
  35. void dm_tempctrl_update_temp(uint8_t chain_mask);
  36. uint32_t dm_tempctrl_update_chain_temp(int chain_id);
  37. #endif // _DM_TEMP_CTRL_H_