blob: 9d2a3a1fcf7afd54f808e48c8eeacb7e5489f401 [file]
#pragma once
#include "CLI/CLI.hpp"
#include "include/common_utility.hpp"
#include "include/power_rail/max34451_utility.hpp"
#include "include/power_rail/pmbus_lib.hpp"
#include <filesystem>
#include <fstream>
#include <map>
#include <string>
#include <vector>
namespace max34451
{
/**
* @brief Parses the BBR data array and writes the result to the log file.
*
* @param BBRArray The BBR data array to be parsed.
* @param logFile The output log file to write the parsed result.
*/
void max34451BBRParser(const std::vector<uint8_t>& bbrArray,
std::ofstream& logFile);
/**
* @brief Retrieves the MFR channel configuration value from the Max34451Logger
* object.
*
* @param config The Max34451Logger object to retrieve the MFR channel
* configuration from.
* @return The MFR channel configuration value.
*/
uint16_t getMfrChannelConfig(const Max34451Logger& logger);
/**
* @brief Sets the MFR channel configuration value in the Max34451Logger object.
*
* @param config The Max34451Logger object to set the MFR channel configuration
* in.
* @param value The value to set as the MFR channel configuration.
*/
void setMfrChannelConfig(const Max34451Logger& logger, uint16_t value);
/**
* @brief Retrieves the MFR PSEN configuration from the Max34451Logger object.
*
* @param config The Max34451Logger object to retrieve the MFR PSEN
* configuration from.
* @return The MFR PSEN configuration as a vector of uint8_t.
*/
std::vector<uint8_t> getMfrPsenConfig(const Max34451Logger& logger);
/**
* @brief Retrieves the MFR PWM configuration from the Max34451Logger object.
*
* @param config The Max34451Logger object to retrieve the MFR PWM configuration
* from.
* @return The MFR PWM configuration as a vector of uint8_t.
*/
std::vector<uint8_t> getMfrPwmConfig(const Max34451Logger& logger);
/**
* @brief Retrieves the MFR NV fault log from the Max34451Logger object.
*
* @param config The Max34451Logger object to retrieve the MFR NV fault log
* from.
* @return The MFR NV fault log value.
*/
uint8_t getMfrNvFaultLog(const Max34451Logger& logger);
/**
* @brief Retrieves the status MFR NV log configuration from the Max34451Logger
* object.
*
* @param config The Max34451Logger object to retrieve the status MFR NV log
* configuration from.
* @return The status MFR NV log configuration value.
*/
uint16_t getStatusMfrNvLogConfig(const Max34451Logger& logger);
/**
* @brief Retrieves the status CML Max34451 value from the Max34451Logger
* object.
*
* @param logger The Max34451Logger object to retrieve the status CML Max34451
* value from.
* @return The status CML Max34451 value.
*/
uint8_t getStatusCmlMax34451(const Max34451Logger& logger);
/**
* @brief Parses the status CML Max34451 value and returns a string
* representation.
*
* @param statusCmlMax34451 The status CML Max34451 value to be parsed.
* @return A string representation of the status CML Max34451 value.
*/
std::string parserStatusCmlMax34451(uint8_t statusCmlMax34451);
/**
* @brief Retrieves the status MFR specific value from the Max34451Logger
* object and writes the result to the log file.
*
* @param logger The Max34451Logger object to retrieve the status MFR specific
* value from.
* @param logFile The output log file to write the status MFR specific result.
*/
void getStatusMfrSpecific(const Max34451Logger& logger, std::ofstream& logFile);
/**
* @brief Parses the status MFR specific value and writes the result to the log
* file.
*
* @param statusMfrSpecific The status MFR specific value to be parsed.
* @param logFile The output log file to write the parsed result.
*/
void parseStatusMfrSpecific(uint8_t statusMfrSpecific, std::ofstream& logFile);
/**
* @brief Retrieves the Max34451 status and writes the result to the log file.
*
* @param logger The Max34451Logger object to retrieve the status from.
* @param logFile The output log file to write the status result.
*/
void getMax34451Status(const Max34451Logger& logger, std::ofstream& logFile);
/**
* @brief Retrieves the fault status from the Max34451Logger object.
*
* @param logger The Max34451Logger object to retrieve the fault status from.
* @return The fault status value.
*/
uint16_t getFaultStatus(const Max34451Logger& logger);
/**
* @brief Retrieves the status MFR specific value from the Max34451Logger object
* and returns a string representation.
*
* @param logger The Max34451Logger object to retrieve the status MFR specific
* value from.
* @return A string representation of the status MFR specific value.
*/
std::string getStatusMfrSpecificMax34451Page255(const Max34451Logger& logger);
/**
* @brief Retrieves the configuration from page 255 of the Max34451Logger object
* and returns a string representation.
*
* @param logger The Max34451Logger object to retrieve the configuration from.
* @return A string representation of the configuration from page 255.
*/
std::string getPage255Config(const Max34451Logger& logger);
/**
* @brief Checks the Max34451 status and performs necessary actions.
*
* @param configFilePath The path to the configuration file.
* @param logDirPath The path to the log directory.
* @param logDetails True if detailed logging is enabled, false otherwise.
*/
void runMax34451Logger(const std::filesystem::path& configFilePath,
const std::filesystem::path& logDirPath,
bool logDetails);
} // namespace max34451