Jayanth Othayoth | ed7fb7a | 2022-09-09 00:07:41 -0500 | [diff] [blame] | 1 | /** |
| 2 | * Copyright © 2022 IBM Corporation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | #pragma once |
| 17 | |
| 18 | #include "extensions/phal/create_pel.hpp" |
| 19 | |
| 20 | #include <fmt/format.h> |
| 21 | |
| 22 | #include <sdeventplus/utility/timer.hpp> |
| 23 | |
| 24 | #include <chrono> |
| 25 | |
| 26 | namespace openpower::phal::clock |
| 27 | { |
| 28 | |
| 29 | /* Dbus event timer */ |
| 30 | using Timer = sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>; |
| 31 | |
| 32 | /** |
| 33 | * @class Manager - Represents the clock daily management functions |
| 34 | * |
| 35 | */ |
| 36 | class Manager |
| 37 | { |
| 38 | public: |
| 39 | Manager() = delete; |
| 40 | Manager(const Manager&) = delete; |
| 41 | Manager(Manager&&) = delete; |
| 42 | Manager& operator=(const Manager&) = delete; |
| 43 | Manager& operator=(Manager&&) = delete; |
| 44 | ~Manager() = default; |
| 45 | |
| 46 | /** |
| 47 | * Constructor |
| 48 | * Starts the functions required to capture clock daily logger data. |
| 49 | * |
| 50 | * @param[in] event - sdeventplus event loop |
| 51 | */ |
| 52 | Manager(const sdeventplus::Event& event); |
| 53 | |
| 54 | /** |
| 55 | * @brief Add a dbus timer |
| 56 | */ |
| 57 | void addTimer(); |
| 58 | |
| 59 | /** |
| 60 | * @brief Callback when a timer expires |
| 61 | */ |
| 62 | void timerExpired(); |
| 63 | |
| 64 | /** |
| 65 | * @brief utility function to create clock data log |
| 66 | */ |
| 67 | void createClockDataLog(); |
| 68 | |
Jayanth Othayoth | 91bf93e | 2022-09-09 04:30:17 -0500 | [diff] [blame^] | 69 | /** |
| 70 | * @brief Add processor specific CFAM data to daily logger. |
| 71 | * |
| 72 | * @param[in] proc - pdbg processor target |
| 73 | * @param[out] ffdcData - reference to clock data log |
| 74 | */ |
| 75 | void addCFAMData(struct pdbg_target* proc, |
| 76 | openpower::pel::FFDCData& clockDataLog); |
| 77 | |
Jayanth Othayoth | ed7fb7a | 2022-09-09 00:07:41 -0500 | [diff] [blame] | 78 | private: |
| 79 | /* The sdeventplus even loop to use */ |
| 80 | sdeventplus::Event _event; |
| 81 | |
| 82 | /** @brief Timer used for LEDs lamp test period */ |
| 83 | sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> timer; |
| 84 | }; |
| 85 | |
| 86 | } // namespace openpower::phal::clock |