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