xref: /openbmc/phosphor-pid-control/pid/pidloop.hpp (revision f8b6e55147148c3cfb42327ff267197a460b411c)
1 #pragma once
2 
3 #include "pid/zone_interface.hpp"
4 
5 #include <boost/asio/steady_timer.hpp>
6 
7 #include <cstdint>
8 #include <memory>
9 
10 namespace pid_control
11 {
12 
13 /**
14  * Main pid control loop for a given zone.
15  * This function calls itself indefinitely in an async loop to calculate
16  * fan outputs based on thermal inputs.
17  *
18  * @param[in] zone - ptr to the ZoneInterface implementation for this loop.
19  * @param[in] timer - boost timer used for async callback.
20  * @param[in] isCanceling - bool ptr to indicate whether pidControlLoop is being
21  * canceled.
22  * @param[in] first - boolean to denote if initialization needs to be run.
23  * @param[in] cycleCnt - loop timer counter.
24  */
25 void pidControlLoop(const std::shared_ptr<ZoneInterface>& zone,
26                     const std::shared_ptr<boost::asio::steady_timer>& timer,
27                     const bool* isCanceling, bool first = true,
28                     uint64_t cycleCnt = 0);
29 
30 } // namespace pid_control
31