Patrick Venture | e620656 | 2018-03-08 15:36:53 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Patrick Venture | 39199b4 | 2020-10-08 14:40:29 -0700 | [diff] [blame] | 3 | #include "conf.hpp" |
James Feist | 0c8223b | 2019-05-08 15:33:33 -0700 | [diff] [blame] | 4 | #include "pid/ec/pid.hpp" |
| 5 | |
James Feist | 5ec2027 | 2019-07-10 11:59:57 -0700 | [diff] [blame] | 6 | #include <phosphor-logging/log.hpp> |
James Feist | 0c8223b | 2019-05-08 15:33:33 -0700 | [diff] [blame] | 7 | #include <sdbusplus/bus.hpp> |
Patrick Venture | a83a3ec | 2020-08-04 09:52:05 -0700 | [diff] [blame] | 8 | |
Patrick Venture | 39199b4 | 2020-10-08 14:40:29 -0700 | [diff] [blame] | 9 | #include <cstdint> |
Patrick Venture | a83a3ec | 2020-08-04 09:52:05 -0700 | [diff] [blame] | 10 | #include <limits> |
Patrick Venture | 39199b4 | 2020-10-08 14:40:29 -0700 | [diff] [blame] | 11 | #include <map> |
Patrick Venture | da06428 | 2018-06-12 19:33:47 -0700 | [diff] [blame] | 12 | #include <string> |
| 13 | |
Patrick Venture | a076487 | 2020-08-08 07:48:43 -0700 | [diff] [blame] | 14 | namespace pid_control |
| 15 | { |
| 16 | |
Hao Jiang | b228cea | 2021-02-20 11:53:09 -0800 | [diff] [blame] | 17 | void tryRestartControlLoops(bool first = true); |
James Feist | 1fe0895 | 2019-05-07 09:17:16 -0700 | [diff] [blame] | 18 | |
James Feist | 0c8223b | 2019-05-08 15:33:33 -0700 | [diff] [blame] | 19 | /* |
| 20 | * Given a configuration structure, fill out the information we use within the |
| 21 | * PID loop. |
| 22 | */ |
| 23 | void initializePIDStruct(ec::pid_info_t* info, const ec::pidinfo& initial); |
| 24 | |
| 25 | void dumpPIDStruct(ec::pid_info_t* info); |
| 26 | |
James Feist | 0c8223b | 2019-05-08 15:33:33 -0700 | [diff] [blame] | 27 | struct SensorThresholds |
| 28 | { |
| 29 | double lowerThreshold = std::numeric_limits<double>::quiet_NaN(); |
| 30 | double upperThreshold = std::numeric_limits<double>::quiet_NaN(); |
| 31 | }; |
| 32 | |
| 33 | const std::string sensorintf = "xyz.openbmc_project.Sensor.Value"; |
| 34 | const std::string criticalThreshInf = |
| 35 | "xyz.openbmc_project.Sensor.Threshold.Critical"; |
| 36 | const std::string propertiesintf = "org.freedesktop.DBus.Properties"; |
| 37 | |
James Feist | 0c8223b | 2019-05-08 15:33:33 -0700 | [diff] [blame] | 38 | /* |
| 39 | * Given a path that optionally has a glob portion, fill it out. |
| 40 | */ |
| 41 | std::string FixupPath(std::string original); |
Patrick Venture | a076487 | 2020-08-08 07:48:43 -0700 | [diff] [blame] | 42 | |
Patrick Venture | 39199b4 | 2020-10-08 14:40:29 -0700 | [diff] [blame] | 43 | /* |
| 44 | * Dump active configuration. |
| 45 | */ |
| 46 | void debugPrint(const std::map<std::string, conf::SensorConfig>& sensorConfig, |
| 47 | const std::map<int64_t, conf::PIDConf>& zoneConfig, |
| 48 | const std::map<int64_t, conf::ZoneConfig>& zoneDetailsConfig); |
| 49 | |
Patrick Venture | a076487 | 2020-08-08 07:48:43 -0700 | [diff] [blame] | 50 | } // namespace pid_control |