Edward A. James | 636577f | 2017-10-06 10:53:55 -0500 | [diff] [blame] | 1 | #include <iostream> |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 2 | #include "occ_device.hpp" |
Eddie James | 482e31f | 2017-09-14 13:17:17 -0500 | [diff] [blame] | 3 | #include "occ_status.hpp" |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 4 | |
| 5 | namespace open_power |
| 6 | { |
| 7 | namespace occ |
| 8 | { |
| 9 | |
| 10 | fs::path Device::bindPath = fs::path(OCC_HWMON_PATH) / "bind"; |
| 11 | fs::path Device::unBindPath = fs::path(OCC_HWMON_PATH) / "unbind"; |
| 12 | |
Edward A. James | 636577f | 2017-10-06 10:53:55 -0500 | [diff] [blame] | 13 | bool Device::master() const |
| 14 | { |
| 15 | int master; |
| 16 | auto masterFile = fs::path(DEV_PATH) / config / "occ_master"; |
| 17 | std::ifstream file(masterFile, std::ios::in); |
| 18 | |
| 19 | if (!file) |
| 20 | { |
| 21 | return false; |
| 22 | } |
| 23 | |
| 24 | file >> master; |
| 25 | file.close(); |
| 26 | return (master != 0); |
| 27 | } |
| 28 | |
Eddie James | 482e31f | 2017-09-14 13:17:17 -0500 | [diff] [blame] | 29 | void Device::throttleProcTempCallback(bool error) |
| 30 | { |
| 31 | statusObject.throttleProcTemp(error); |
| 32 | } |
| 33 | |
| 34 | void Device::throttleProcPowerCallback(bool error) |
| 35 | { |
| 36 | statusObject.throttleProcPower(error); |
| 37 | } |
| 38 | |
| 39 | void Device::throttleMemTempCallback(bool error) |
| 40 | { |
| 41 | statusObject.throttleMemTemp(error); |
| 42 | } |
| 43 | |
Vishwanatha Subbanna | 32e84e9 | 2017-06-28 19:17:28 +0530 | [diff] [blame] | 44 | } // namespace occ |
| 45 | } // namespace open_power |