| Patrick Venture | 46470a3 | 2018-09-07 19:26:25 -0700 | [diff] [blame] | 1 | #pragma once | 
| Tom Joseph | be5eaa1 | 2017-07-12 19:54:44 +0530 | [diff] [blame] | 2 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 3 | #include "nlohmann/json.hpp" | 
|  | 4 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 5 | #include <sdbusplus/bus.hpp> | 
| Patrick Williams | fbc6c9d | 2023-05-10 07:50:16 -0500 | [diff] [blame] | 6 |  | 
|  | 7 | #include <map> | 
| Tom Joseph | be5eaa1 | 2017-07-12 19:54:44 +0530 | [diff] [blame] | 8 | #include <string> | 
|  | 9 | #include <vector> | 
|  | 10 |  | 
| Tom Joseph | be5eaa1 | 2017-07-12 19:54:44 +0530 | [diff] [blame] | 11 | namespace dcmi | 
|  | 12 | { | 
|  | 13 |  | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 14 | using NumInstances = size_t; | 
|  | 15 | using Json = nlohmann::json; | 
|  | 16 |  | 
| Ratan Gupta | 11ddbd2 | 2017-08-05 11:59:39 +0530 | [diff] [blame] | 17 | enum Commands | 
|  | 18 | { | 
| Marri Devender Rao | 66c5fda | 2018-01-18 10:48:37 -0600 | [diff] [blame] | 19 | GET_POWER_READING = 0x02, | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 20 | GET_SENSOR_INFO = 0x07, | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 21 | GET_TEMP_READINGS = 0x10, | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 22 | SET_CONF_PARAMS = 0x12, | 
|  | 23 | GET_CONF_PARAMS = 0x13, | 
| Ratan Gupta | 11ddbd2 | 2017-08-05 11:59:39 +0530 | [diff] [blame] | 24 | }; | 
|  | 25 |  | 
| Tom Joseph | be5eaa1 | 2017-07-12 19:54:44 +0530 | [diff] [blame] | 26 | static constexpr auto propIntf = "org.freedesktop.DBus.Properties"; | 
|  | 27 | static constexpr auto assetTagIntf = | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 28 | "xyz.openbmc_project.Inventory.Decorator.AssetTag"; | 
| Tom Joseph | be5eaa1 | 2017-07-12 19:54:44 +0530 | [diff] [blame] | 29 | static constexpr auto assetTagProp = "AssetTag"; | 
| Vladislav Vovchenko | 8f7a6f6 | 2017-08-17 00:31:14 +0300 | [diff] [blame] | 30 | static constexpr auto networkServiceName = "xyz.openbmc_project.Network"; | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 31 | static constexpr auto networkConfigObj = "/xyz/openbmc_project/network/config"; | 
| Vladislav Vovchenko | 8f7a6f6 | 2017-08-17 00:31:14 +0300 | [diff] [blame] | 32 | static constexpr auto networkConfigIntf = | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 33 | "xyz.openbmc_project.Network.SystemConfiguration"; | 
| Vladislav Vovchenko | 8f7a6f6 | 2017-08-17 00:31:14 +0300 | [diff] [blame] | 34 | static constexpr auto hostNameProp = "HostName"; | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 35 | static constexpr auto temperatureSensorType = 0x01; | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 36 | static constexpr auto maxInstances = 255; | 
| Kirill Pakhomov | a257362 | 2018-11-02 19:00:18 +0300 | [diff] [blame] | 37 | static constexpr auto gDCMISensorsConfig = | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 38 | "/usr/share/ipmi-providers/dcmi_sensors.json"; | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 39 | static constexpr auto ethernetIntf = | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 40 | "xyz.openbmc_project.Network.EthernetInterface"; | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 41 | static constexpr auto ethernetDefaultChannelNum = 0x1; | 
|  | 42 | static constexpr auto networkRoot = "/xyz/openbmc_project/network"; | 
| Jian Zhang | 958806d | 2022-12-13 13:37:09 +0800 | [diff] [blame] | 43 | static constexpr auto dhcpObj = "/xyz/openbmc_project/network/dhcp"; | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 44 | static constexpr auto dhcpIntf = | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 45 | "xyz.openbmc_project.Network.DHCPConfiguration"; | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 46 | static constexpr auto systemBusName = "org.freedesktop.systemd1"; | 
|  | 47 | static constexpr auto systemPath = "/org/freedesktop/systemd1"; | 
|  | 48 | static constexpr auto systemIntf = "org.freedesktop.systemd1.Manager"; | 
| Kirill Pakhomov | a257362 | 2018-11-02 19:00:18 +0300 | [diff] [blame] | 49 | static constexpr auto gDCMICapabilitiesConfig = | 
|  | 50 | "/usr/share/ipmi-providers/dcmi_cap.json"; | 
| Kirill Pakhomov | 2c2af2c | 2018-11-06 16:06:10 +0300 | [diff] [blame] | 51 | static constexpr auto gDCMIPowerMgmtCapability = "PowerManagement"; | 
|  | 52 | static constexpr auto gDCMIPowerMgmtSupported = 0x1; | 
| Kirill Pakhomov | db5d9b0 | 2018-11-06 19:17:51 +0300 | [diff] [blame] | 53 | static constexpr auto gMaxSELEntriesMask = 0xFFF; | 
|  | 54 | static constexpr auto gByteBitSize = 8; | 
| Tom Joseph | be5eaa1 | 2017-07-12 19:54:44 +0530 | [diff] [blame] | 55 |  | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 56 | namespace temp_readings | 
|  | 57 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 58 | static constexpr auto maxDataSets = 8; | 
|  | 59 | static constexpr auto maxTemp = 127; // degrees C | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 60 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 61 | /** @struct Response | 
|  | 62 | * | 
|  | 63 | *  DCMI payload for Get Temperature Readings response | 
|  | 64 | */ | 
|  | 65 | struct Response | 
|  | 66 | { | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 67 | #if BYTE_ORDER == LITTLE_ENDIAN | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 68 | uint8_t temperature : 7; //!< Temperature reading in Celsius | 
|  | 69 | uint8_t sign : 1;        //!< Sign bit | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 70 | #endif | 
|  | 71 | #if BYTE_ORDER == BIG_ENDIAN | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 72 | uint8_t sign : 1;        //!< Sign bit | 
|  | 73 | uint8_t temperature : 7; //!< Temperature reading in Celsius | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 74 | #endif | 
| Patrick Williams | fbc6c9d | 2023-05-10 07:50:16 -0500 | [diff] [blame] | 75 | uint8_t instance;        //!< Entity instance number | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 76 | } __attribute__((packed)); | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 77 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 78 | using ResponseList = std::vector<Response>; | 
|  | 79 | using Value = uint8_t; | 
|  | 80 | using Sign = bool; | 
|  | 81 | using Temperature = std::tuple<Value, Sign>; | 
|  | 82 | } // namespace temp_readings | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 83 |  | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 84 | namespace sensor_info | 
|  | 85 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 86 | static constexpr auto maxRecords = 8; | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 87 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 88 | /** @struct Response | 
|  | 89 | * | 
|  | 90 | *  DCMI payload for Get Sensor Info response | 
|  | 91 | */ | 
|  | 92 | struct Response | 
|  | 93 | { | 
|  | 94 | uint8_t recordIdLsb; //!< SDR record id LS byte | 
|  | 95 | uint8_t recordIdMsb; //!< SDR record id MS byte | 
|  | 96 | } __attribute__((packed)); | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 97 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 98 | using ResponseList = std::vector<Response>; | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 99 | } // namespace sensor_info | 
|  | 100 |  | 
| Tom Joseph | 6f6dd4d | 2017-07-12 20:07:11 +0530 | [diff] [blame] | 101 | static constexpr auto groupExtId = 0xDC; | 
|  | 102 |  | 
| Kirill Pakhomov | 2c2af2c | 2018-11-06 16:06:10 +0300 | [diff] [blame] | 103 | /** @brief Check whether DCMI power management is supported | 
|  | 104 | *         in the DCMI Capabilities config file. | 
|  | 105 | * | 
|  | 106 | *  @return True if DCMI power management is supported | 
|  | 107 | */ | 
|  | 108 | bool isDCMIPowerMgmtSupported(); | 
|  | 109 |  | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 110 | /** @struct GetTempReadingsRequest | 
|  | 111 | * | 
|  | 112 | *  DCMI payload for Get Temperature Readings request | 
|  | 113 | */ | 
|  | 114 | struct GetTempReadingsRequest | 
|  | 115 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 116 | uint8_t sensorType;     //!< Type of the sensor | 
|  | 117 | uint8_t entityId;       //!< Entity ID | 
|  | 118 | uint8_t entityInstance; //!< Entity Instance (0 means all instances) | 
|  | 119 | uint8_t instanceStart;  //!< Instance start (used if instance is 0) | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 120 | } __attribute__((packed)); | 
|  | 121 |  | 
|  | 122 | /** @struct GetTempReadingsResponse | 
|  | 123 | * | 
|  | 124 | *  DCMI header for Get Temperature Readings response | 
|  | 125 | */ | 
|  | 126 | struct GetTempReadingsResponseHdr | 
|  | 127 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 128 | uint8_t numInstances; //!< No. of instances for requested id | 
|  | 129 | uint8_t numDataSets;  //!< No. of sets of temperature data | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 130 | } __attribute__((packed)); | 
|  | 131 |  | 
| Kirill Pakhomov | a257362 | 2018-11-02 19:00:18 +0300 | [diff] [blame] | 132 | /** @brief Parse out JSON config file. | 
|  | 133 | * | 
|  | 134 | *  @param[in] configFile - JSON config file name | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 135 | * | 
|  | 136 | *  @return A json object | 
|  | 137 | */ | 
| Kirill Pakhomov | a257362 | 2018-11-02 19:00:18 +0300 | [diff] [blame] | 138 | Json parseJSONConfig(const std::string& configFile); | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 139 |  | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 140 | namespace temp_readings | 
|  | 141 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 142 | /** @brief Read temperature from a d-bus object, scale it as per dcmi | 
|  | 143 | *         get temperature reading requirements. | 
|  | 144 | * | 
|  | 145 | *  @param[in] dbusService - the D-Bus service | 
|  | 146 | *  @param[in] dbusPath - the D-Bus path | 
|  | 147 | * | 
|  | 148 | *  @return A temperature reading | 
|  | 149 | */ | 
|  | 150 | Temperature readTemp(const std::string& dbusService, | 
|  | 151 | const std::string& dbusPath); | 
| Deepak Kodihalli | b1e8fba | 2018-01-24 04:57:10 -0600 | [diff] [blame] | 152 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 153 | /** @brief Read temperatures and fill up DCMI response for the Get | 
|  | 154 | *         Temperature Readings command. This looks at a specific | 
|  | 155 | *         instance. | 
|  | 156 | * | 
|  | 157 | *  @param[in] type - one of "inlet", "cpu", "baseboard" | 
|  | 158 | *  @param[in] instance - A non-zero Entity instance number | 
|  | 159 | * | 
|  | 160 | *  @return A tuple, containing a temperature reading and the | 
|  | 161 | *          number of instances. | 
|  | 162 | */ | 
|  | 163 | std::tuple<Response, NumInstances> read(const std::string& type, | 
|  | 164 | uint8_t instance); | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 165 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 166 | /** @brief Read temperatures and fill up DCMI response for the Get | 
|  | 167 | *         Temperature Readings command. This looks at a range of | 
|  | 168 | *         instances. | 
|  | 169 | * | 
|  | 170 | *  @param[in] type - one of "inlet", "cpu", "baseboard" | 
|  | 171 | *  @param[in] instanceStart - Entity instance start index | 
|  | 172 | * | 
|  | 173 | *  @return A tuple, containing a list of temperature readings and the | 
|  | 174 | *          number of instances. | 
|  | 175 | */ | 
|  | 176 | std::tuple<ResponseList, NumInstances> readAll(const std::string& type, | 
|  | 177 | uint8_t instanceStart); | 
|  | 178 | } // namespace temp_readings | 
| Deepak Kodihalli | ee717d7 | 2018-01-24 04:53:09 -0600 | [diff] [blame] | 179 |  | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 180 | namespace sensor_info | 
|  | 181 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 182 | /** @brief Create response from JSON config. | 
|  | 183 | * | 
|  | 184 | *  @param[in] config - JSON config info about DCMI sensors | 
|  | 185 | * | 
|  | 186 | *  @return Sensor info response | 
|  | 187 | */ | 
|  | 188 | Response createFromJson(const Json& config); | 
| Deepak Kodihalli | dd4cff1 | 2018-02-06 06:48:29 -0600 | [diff] [blame] | 189 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 190 | /** @brief Read sensor info and fill up DCMI response for the Get | 
|  | 191 | *         Sensor Info command. This looks at a specific | 
|  | 192 | *         instance. | 
|  | 193 | * | 
|  | 194 | *  @param[in] type - one of "inlet", "cpu", "baseboard" | 
|  | 195 | *  @param[in] instance - A non-zero Entity instance number | 
|  | 196 | *  @param[in] config - JSON config info about DCMI sensors | 
|  | 197 | * | 
|  | 198 | *  @return A tuple, containing a sensor info response and | 
|  | 199 | *          number of instances. | 
|  | 200 | */ | 
|  | 201 | std::tuple<Response, NumInstances> read(const std::string& type, | 
|  | 202 | uint8_t instance, const Json& config); | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 203 |  | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 204 | /** @brief Read sensor info and fill up DCMI response for the Get | 
|  | 205 | *         Sensor Info command. This looks at a range of | 
|  | 206 | *         instances. | 
|  | 207 | * | 
|  | 208 | *  @param[in] type - one of "inlet", "cpu", "baseboard" | 
|  | 209 | *  @param[in] instanceStart - Entity instance start index | 
|  | 210 | *  @param[in] config - JSON config info about DCMI sensors | 
|  | 211 | * | 
|  | 212 | *  @return A tuple, containing a list of sensor info responses and the | 
|  | 213 | *          number of instances. | 
|  | 214 | */ | 
|  | 215 | std::tuple<ResponseList, NumInstances> | 
|  | 216 | readAll(const std::string& type, uint8_t instanceStart, const Json& config); | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 217 | } // namespace sensor_info | 
|  | 218 |  | 
| Marri Devender Rao | 66c5fda | 2018-01-18 10:48:37 -0600 | [diff] [blame] | 219 | /** @brief Read power reading from power reading sensor object | 
|  | 220 | * | 
|  | 221 | *  @param[in] bus - dbus connection | 
|  | 222 | * | 
|  | 223 | *  @return total power reading | 
|  | 224 | */ | 
| Patrick Williams | 5d82f47 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 225 | int64_t getPowerReading(sdbusplus::bus_t& bus); | 
| Marri Devender Rao | 66c5fda | 2018-01-18 10:48:37 -0600 | [diff] [blame] | 226 |  | 
|  | 227 | /** @struct GetPowerReadingRequest | 
|  | 228 | * | 
|  | 229 | *  DCMI Get Power Reading command request. | 
|  | 230 | *  Refer DCMI specification Version 1.1 Section 6.6.1 | 
|  | 231 | */ | 
|  | 232 | struct GetPowerReadingRequest | 
|  | 233 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 234 | uint8_t mode;          //!< Mode | 
|  | 235 | uint8_t modeAttribute; //!< Mode Attributes | 
| Marri Devender Rao | 66c5fda | 2018-01-18 10:48:37 -0600 | [diff] [blame] | 236 | } __attribute__((packed)); | 
|  | 237 |  | 
|  | 238 | /** @struct GetPowerReadingResponse | 
|  | 239 | * | 
|  | 240 | *  DCMI Get Power Reading command response. | 
|  | 241 | *  Refer DCMI specification Version 1.1 Section 6.6.1 | 
|  | 242 | */ | 
|  | 243 | struct GetPowerReadingResponse | 
|  | 244 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 245 | uint16_t currentPower;     //!< Current power in watts | 
|  | 246 | uint16_t minimumPower;     //!< Minimum power over sampling duration | 
|  | 247 | //!< in watts | 
|  | 248 | uint16_t maximumPower;     //!< Maximum power over sampling duration | 
|  | 249 | //!< in watts | 
|  | 250 | uint16_t averagePower;     //!< Average power over sampling duration | 
|  | 251 | //!< in watts | 
|  | 252 | uint32_t timeStamp;        //!< IPMI specification based time stamp | 
|  | 253 | uint32_t timeFrame;        //!< Statistics reporting time period in milli | 
|  | 254 | //!< seconds. | 
|  | 255 | uint8_t powerReadingState; //!< Power Reading State | 
| Marri Devender Rao | 66c5fda | 2018-01-18 10:48:37 -0600 | [diff] [blame] | 256 | } __attribute__((packed)); | 
|  | 257 |  | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 258 | /** @struct GetSensorInfoRequest | 
|  | 259 | * | 
|  | 260 | *  DCMI payload for Get Sensor Info request | 
|  | 261 | */ | 
|  | 262 | struct GetSensorInfoRequest | 
|  | 263 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 264 | uint8_t sensorType;     //!< Type of the sensor | 
|  | 265 | uint8_t entityId;       //!< Entity ID | 
|  | 266 | uint8_t entityInstance; //!< Entity Instance (0 means all instances) | 
|  | 267 | uint8_t instanceStart;  //!< Instance start (used if instance is 0) | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 268 | } __attribute__((packed)); | 
|  | 269 |  | 
|  | 270 | /** @struct GetSensorInfoResponseHdr | 
|  | 271 | * | 
|  | 272 | *  DCMI header for Get Sensor Info response | 
|  | 273 | */ | 
|  | 274 | struct GetSensorInfoResponseHdr | 
|  | 275 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 276 | uint8_t numInstances; //!< No. of instances for requested id | 
|  | 277 | uint8_t numRecords;   //!< No. of record ids in the response | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 278 | } __attribute__((packed)); | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 279 | /** | 
|  | 280 | *  @brief Parameters for DCMI Configuration Parameters | 
|  | 281 | */ | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 282 | enum class DCMIConfigParameters : uint8_t | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 283 | { | 
|  | 284 | ActivateDHCP = 1, | 
|  | 285 | DiscoveryConfig, | 
|  | 286 | DHCPTiming1, | 
|  | 287 | DHCPTiming2, | 
|  | 288 | DHCPTiming3, | 
|  | 289 | }; | 
|  | 290 |  | 
|  | 291 | /** @struct SetConfParamsRequest | 
|  | 292 | * | 
|  | 293 | *  DCMI Set DCMI Configuration Parameters Command. | 
|  | 294 | *  Refer DCMI specification Version 1.1 Section 6.1.2 | 
|  | 295 | */ | 
|  | 296 | struct SetConfParamsRequest | 
|  | 297 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 298 | uint8_t paramSelect; //!< Parameter selector. | 
|  | 299 | uint8_t setSelect;   //!< Set Selector (use 00h for parameters that only | 
|  | 300 | //!< have one set). | 
|  | 301 | uint8_t data[];      //!< Configuration parameter data. | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 302 | } __attribute__((packed)); | 
|  | 303 |  | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 304 | /** @struct GetConfParamsRequest | 
|  | 305 | * | 
|  | 306 | *  DCMI Get DCMI Configuration Parameters Command. | 
|  | 307 | *  Refer DCMI specification Version 1.1 Section 6.1.3 | 
|  | 308 | */ | 
|  | 309 | struct GetConfParamsRequest | 
|  | 310 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 311 | uint8_t paramSelect; //!< Parameter selector. | 
|  | 312 | uint8_t setSelect;   //!< Set Selector. Selects a given set of parameters | 
|  | 313 | //!< under a given Parameter selector value. 00h if | 
|  | 314 | //!< parameter doesn't use a Set Selector. | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 315 | } __attribute__((packed)); | 
|  | 316 |  | 
|  | 317 | /** @struct GetConfParamsResponse | 
|  | 318 | * | 
|  | 319 | *  DCMI Get DCMI Configuration Parameters Command response. | 
|  | 320 | *  Refer DCMI specification Version 1.1 Section 6.1.3 | 
|  | 321 | */ | 
|  | 322 | struct GetConfParamsResponse | 
|  | 323 | { | 
| Patrick Venture | 0b02be9 | 2018-08-31 11:55:55 -0700 | [diff] [blame] | 324 | uint8_t major;         //!< DCMI Spec Conformance - major ver = 01h. | 
|  | 325 | uint8_t minor;         //!< DCMI Spec Conformance - minor ver = 05h. | 
|  | 326 | uint8_t paramRevision; //!< Parameter Revision = 01h. | 
|  | 327 | uint8_t data[];        //!< Parameter data. | 
| Nagaraju Goruganti | 22be97b | 2018-02-07 01:19:59 -0600 | [diff] [blame] | 328 | } __attribute__((packed)); | 
| Deepak Kodihalli | 0b45955 | 2018-02-06 06:25:12 -0600 | [diff] [blame] | 329 |  | 
| Tom Joseph | be5eaa1 | 2017-07-12 19:54:44 +0530 | [diff] [blame] | 330 | } // namespace dcmi |