blob: f5c69c1f1a4f3e5fb1827664be9083c21a2cd91c [file] [log] [blame]
Patrick Venture46470a32018-09-07 19:26:25 -07001#pragma once
Tom Josephbe5eaa12017-07-12 19:54:44 +05302
Patrick Venture0b02be92018-08-31 11:55:55 -07003#include "nlohmann/json.hpp"
4
Patrick Venture0b02be92018-08-31 11:55:55 -07005#include <sdbusplus/bus.hpp>
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -05006
7#include <map>
Tom Josephbe5eaa12017-07-12 19:54:44 +05308#include <string>
9#include <vector>
10
Tom Josephbe5eaa12017-07-12 19:54:44 +053011namespace dcmi
12{
13
Deepak Kodihalli0b459552018-02-06 06:25:12 -060014using NumInstances = size_t;
15using Json = nlohmann::json;
16
Ratan Gupta11ddbd22017-08-05 11:59:39 +053017enum Commands
18{
19 // Get capability bits
Dhruvaraj Subhashchandrane29be412018-01-16 05:11:56 -060020 GET_CAPABILITIES = 0x01,
Marri Devender Rao66c5fda2018-01-18 10:48:37 -060021 GET_POWER_READING = 0x02,
Ratan Gupta11ddbd22017-08-05 11:59:39 +053022 GET_ASSET_TAG = 0x06,
Deepak Kodihalli0b459552018-02-06 06:25:12 -060023 GET_SENSOR_INFO = 0x07,
Ratan Gupta11ddbd22017-08-05 11:59:39 +053024 SET_ASSET_TAG = 0x08,
Vladislav Vovchenko8f7a6f62017-08-17 00:31:14 +030025 GET_MGMNT_CTRL_ID_STR = 0x09,
26 SET_MGMNT_CTRL_ID_STR = 0x0A,
Deepak Kodihalliee717d72018-01-24 04:53:09 -060027 GET_TEMP_READINGS = 0x10,
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -060028 SET_CONF_PARAMS = 0x12,
29 GET_CONF_PARAMS = 0x13,
Ratan Gupta11ddbd22017-08-05 11:59:39 +053030};
31
Tom Josephbe5eaa12017-07-12 19:54:44 +053032static constexpr auto propIntf = "org.freedesktop.DBus.Properties";
33static constexpr auto assetTagIntf =
Patrick Venture0b02be92018-08-31 11:55:55 -070034 "xyz.openbmc_project.Inventory.Decorator.AssetTag";
Tom Josephbe5eaa12017-07-12 19:54:44 +053035static constexpr auto assetTagProp = "AssetTag";
Vladislav Vovchenko8f7a6f62017-08-17 00:31:14 +030036static constexpr auto networkServiceName = "xyz.openbmc_project.Network";
Patrick Venture0b02be92018-08-31 11:55:55 -070037static constexpr auto networkConfigObj = "/xyz/openbmc_project/network/config";
Vladislav Vovchenko8f7a6f62017-08-17 00:31:14 +030038static constexpr auto networkConfigIntf =
Patrick Venture0b02be92018-08-31 11:55:55 -070039 "xyz.openbmc_project.Network.SystemConfiguration";
Vladislav Vovchenko8f7a6f62017-08-17 00:31:14 +030040static constexpr auto hostNameProp = "HostName";
Deepak Kodihalliee717d72018-01-24 04:53:09 -060041static constexpr auto temperatureSensorType = 0x01;
Deepak Kodihalli0b459552018-02-06 06:25:12 -060042static constexpr auto maxInstances = 255;
Kirill Pakhomova2573622018-11-02 19:00:18 +030043static constexpr auto gDCMISensorsConfig =
Deepak Kodihalli0b459552018-02-06 06:25:12 -060044 "/usr/share/ipmi-providers/dcmi_sensors.json";
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -060045static constexpr auto ethernetIntf =
Patrick Venture0b02be92018-08-31 11:55:55 -070046 "xyz.openbmc_project.Network.EthernetInterface";
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -060047static constexpr auto ethernetDefaultChannelNum = 0x1;
48static constexpr auto networkRoot = "/xyz/openbmc_project/network";
Jian Zhang958806d2022-12-13 13:37:09 +080049static constexpr auto dhcpObj = "/xyz/openbmc_project/network/dhcp";
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -060050static constexpr auto dhcpIntf =
Patrick Venture0b02be92018-08-31 11:55:55 -070051 "xyz.openbmc_project.Network.DHCPConfiguration";
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -060052static constexpr auto systemBusName = "org.freedesktop.systemd1";
53static constexpr auto systemPath = "/org/freedesktop/systemd1";
54static constexpr auto systemIntf = "org.freedesktop.systemd1.Manager";
Kirill Pakhomova2573622018-11-02 19:00:18 +030055static constexpr auto gDCMICapabilitiesConfig =
56 "/usr/share/ipmi-providers/dcmi_cap.json";
Kirill Pakhomov2c2af2c2018-11-06 16:06:10 +030057static constexpr auto gDCMIPowerMgmtCapability = "PowerManagement";
58static constexpr auto gDCMIPowerMgmtSupported = 0x1;
Kirill Pakhomovdb5d9b02018-11-06 19:17:51 +030059static constexpr auto gMaxSELEntriesMask = 0xFFF;
60static constexpr auto gByteBitSize = 8;
Tom Josephbe5eaa12017-07-12 19:54:44 +053061
62namespace assettag
63{
64
Patrick Venture0b02be92018-08-31 11:55:55 -070065using ObjectPath = std::string;
66using Service = std::string;
67using Interfaces = std::vector<std::string>;
68using ObjectTree = std::map<ObjectPath, std::map<Service, Interfaces>>;
Tom Josephbe5eaa12017-07-12 19:54:44 +053069
Patrick Venture0b02be92018-08-31 11:55:55 -070070} // namespace assettag
Tom Josephbe5eaa12017-07-12 19:54:44 +053071
Deepak Kodihalliee717d72018-01-24 04:53:09 -060072namespace temp_readings
73{
Patrick Venture0b02be92018-08-31 11:55:55 -070074static constexpr auto maxDataSets = 8;
75static constexpr auto maxTemp = 127; // degrees C
Deepak Kodihalliee717d72018-01-24 04:53:09 -060076
Patrick Venture0b02be92018-08-31 11:55:55 -070077/** @struct Response
78 *
79 * DCMI payload for Get Temperature Readings response
80 */
81struct Response
82{
Deepak Kodihalliee717d72018-01-24 04:53:09 -060083#if BYTE_ORDER == LITTLE_ENDIAN
Patrick Venture0b02be92018-08-31 11:55:55 -070084 uint8_t temperature : 7; //!< Temperature reading in Celsius
85 uint8_t sign : 1; //!< Sign bit
Deepak Kodihalliee717d72018-01-24 04:53:09 -060086#endif
87#if BYTE_ORDER == BIG_ENDIAN
Patrick Venture0b02be92018-08-31 11:55:55 -070088 uint8_t sign : 1; //!< Sign bit
89 uint8_t temperature : 7; //!< Temperature reading in Celsius
Deepak Kodihalliee717d72018-01-24 04:53:09 -060090#endif
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -050091 uint8_t instance; //!< Entity instance number
Patrick Venture0b02be92018-08-31 11:55:55 -070092} __attribute__((packed));
Deepak Kodihalliee717d72018-01-24 04:53:09 -060093
Patrick Venture0b02be92018-08-31 11:55:55 -070094using ResponseList = std::vector<Response>;
95using Value = uint8_t;
96using Sign = bool;
97using Temperature = std::tuple<Value, Sign>;
98} // namespace temp_readings
Deepak Kodihalliee717d72018-01-24 04:53:09 -060099
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600100namespace sensor_info
101{
Patrick Venture0b02be92018-08-31 11:55:55 -0700102static constexpr auto maxRecords = 8;
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600103
Patrick Venture0b02be92018-08-31 11:55:55 -0700104/** @struct Response
105 *
106 * DCMI payload for Get Sensor Info response
107 */
108struct Response
109{
110 uint8_t recordIdLsb; //!< SDR record id LS byte
111 uint8_t recordIdMsb; //!< SDR record id MS byte
112} __attribute__((packed));
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600113
Patrick Venture0b02be92018-08-31 11:55:55 -0700114using ResponseList = std::vector<Response>;
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600115} // namespace sensor_info
116
Tom Joseph6f6dd4d2017-07-12 20:07:11 +0530117static constexpr auto groupExtId = 0xDC;
118
119static constexpr auto assetTagMaxOffset = 62;
120static constexpr auto assetTagMaxSize = 63;
121static constexpr auto maxBytes = 16;
Vladislav Vovchenko8f7a6f62017-08-17 00:31:14 +0300122static constexpr size_t maxCtrlIdStrLen = 63;
Tom Joseph6f6dd4d2017-07-12 20:07:11 +0530123
124/** @struct GetAssetTagRequest
125 *
126 * DCMI payload for Get Asset Tag command request.
127 */
128struct GetAssetTagRequest
129{
William A. Kennington III5d06cc62019-04-25 02:10:55 -0700130 uint8_t offset; //!< Offset to read.
131 uint8_t bytes; //!< Number of bytes to read.
Tom Joseph6f6dd4d2017-07-12 20:07:11 +0530132} __attribute__((packed));
133
134/** @struct GetAssetTagResponse
135 *
136 * DCMI payload for Get Asset Tag command response.
137 */
138struct GetAssetTagResponse
139{
Patrick Venture0b02be92018-08-31 11:55:55 -0700140 uint8_t tagLength; //!< Total asset tag length.
Tom Joseph6f6dd4d2017-07-12 20:07:11 +0530141} __attribute__((packed));
142
Tom Joseph545dd232017-07-12 20:20:49 +0530143/** @struct SetAssetTagRequest
144 *
145 * DCMI payload for Set Asset Tag command request.
146 */
147struct SetAssetTagRequest
148{
William A. Kennington III5d06cc62019-04-25 02:10:55 -0700149 uint8_t offset; //!< Offset to write.
150 uint8_t bytes; //!< Number of bytes to write.
Tom Joseph545dd232017-07-12 20:20:49 +0530151} __attribute__((packed));
152
153/** @struct SetAssetTagResponse
154 *
155 * DCMI payload for Set Asset Tag command response.
156 */
157struct SetAssetTagResponse
158{
Patrick Venture0b02be92018-08-31 11:55:55 -0700159 uint8_t tagLength; //!< Total asset tag length.
Tom Joseph545dd232017-07-12 20:20:49 +0530160} __attribute__((packed));
161
Kirill Pakhomov2c2af2c2018-11-06 16:06:10 +0300162/** @brief Check whether DCMI power management is supported
163 * in the DCMI Capabilities config file.
164 *
165 * @return True if DCMI power management is supported
166 */
167bool isDCMIPowerMgmtSupported();
168
Tom Josephbe5eaa12017-07-12 19:54:44 +0530169/** @brief Read the object tree to fetch the object path that implemented the
170 * Asset tag interface.
171 *
172 * @param[in,out] objectTree - object tree
173 *
174 * @return On success return the object tree with the object path that
175 * implemented the AssetTag interface.
176 */
177void readAssetTagObjectTree(dcmi::assettag::ObjectTree& objectTree);
178
179/** @brief Read the asset tag of the server
180 *
181 * @return On success return the asset tag.
182 */
183std::string readAssetTag();
184
Tom Josephbe5b9892017-07-15 00:55:23 +0530185/** @brief Write the asset tag to the asset tag DBUS property
186 *
187 * @param[in] assetTag - Asset Tag to be written to the property.
188 */
189void writeAssetTag(const std::string& assetTag);
190
Vladislav Vovchenko8f7a6f62017-08-17 00:31:14 +0300191/** @struct GetMgmntCtrlIdStrRequest
192 *
193 * DCMI payload for Get Management Controller Identifier String cmd request.
194 */
195struct GetMgmntCtrlIdStrRequest
196{
William A. Kennington III5d06cc62019-04-25 02:10:55 -0700197 uint8_t offset; //!< Offset to read.
198 uint8_t bytes; //!< Number of bytes to read.
Vladislav Vovchenko8f7a6f62017-08-17 00:31:14 +0300199} __attribute__((packed));
200
201/** @struct GetMgmntCtrlIdStrResponse
202 *
203 * DCMI payload for Get Management Controller Identifier String cmd response.
204 */
205struct GetMgmntCtrlIdStrResponse
206{
William A. Kennington III5d06cc62019-04-25 02:10:55 -0700207 uint8_t strLen; //!< ID string length.
208 char data[]; //!< ID string
Vladislav Vovchenko8f7a6f62017-08-17 00:31:14 +0300209} __attribute__((packed));
210
211/** @struct SetMgmntCtrlIdStrRequest
212 *
213 * DCMI payload for Set Management Controller Identifier String cmd request.
214 */
215struct SetMgmntCtrlIdStrRequest
216{
William A. Kennington III5d06cc62019-04-25 02:10:55 -0700217 uint8_t offset; //!< Offset to write.
218 uint8_t bytes; //!< Number of bytes to read.
219 char data[]; //!< ID string
Vladislav Vovchenko8f7a6f62017-08-17 00:31:14 +0300220} __attribute__((packed));
221
222/** @struct GetMgmntCtrlIdStrResponse
223 *
224 * DCMI payload for Get Management Controller Identifier String cmd response.
225 */
226struct SetMgmntCtrlIdStrResponse
227{
William A. Kennington III5d06cc62019-04-25 02:10:55 -0700228 uint8_t offset; //!< Last Offset Written.
Vladislav Vovchenko8f7a6f62017-08-17 00:31:14 +0300229} __attribute__((packed));
230
Dhruvaraj Subhashchandrane29be412018-01-16 05:11:56 -0600231/** @enum DCMICapParameters
232 *
233 * DCMI Capability parameters
234 */
235enum class DCMICapParameters
236{
237 SUPPORTED_DCMI_CAPS = 0x01, //!< Supported DCMI Capabilities
238 MANDATORY_PLAT_ATTRIBUTES = 0x02, //!< Mandatory Platform Attributes
239 OPTIONAL_PLAT_ATTRIBUTES = 0x03, //!< Optional Platform Attributes
240 MANAGEABILITY_ACCESS_ATTRIBUTES = 0x04, //!< Manageability Access Attributes
241};
242
243/** @struct GetDCMICapRequest
244 *
245 * DCMI payload for Get capabilities cmd request.
246 */
247struct GetDCMICapRequest
248{
William A. Kennington III5d06cc62019-04-25 02:10:55 -0700249 uint8_t param; //!< Capability parameter selector.
Dhruvaraj Subhashchandrane29be412018-01-16 05:11:56 -0600250} __attribute__((packed));
251
252/** @struct GetDCMICapRequest
253 *
254 * DCMI payload for Get capabilities cmd response.
255 */
256struct GetDCMICapResponse
257{
Patrick Venture0b02be92018-08-31 11:55:55 -0700258 uint8_t major; //!< DCMI Specification Conformance - major ver
259 uint8_t minor; //!< DCMI Specification Conformance - minor ver
260 uint8_t paramRevision; //!< Parameter Revision = 02h
261 uint8_t data[]; //!< Capability array
Dhruvaraj Subhashchandrane29be412018-01-16 05:11:56 -0600262} __attribute__((packed));
263
264/** @struct DCMICap
265 *
266 * DCMI capabilities protocol info.
267 */
268struct DCMICap
269{
Patrick Venture0b02be92018-08-31 11:55:55 -0700270 std::string name; //!< Name of DCMI capability.
271 uint8_t bytePosition; //!< Starting byte number from DCMI spec.
272 uint8_t position; //!< bit position from the DCMI spec.
273 uint8_t length; //!< Length of the value from DCMI spec.
Dhruvaraj Subhashchandrane29be412018-01-16 05:11:56 -0600274};
275
276using DCMICapList = std::vector<DCMICap>;
277
278/** @struct DCMICapEntry
279 *
280 * DCMI capabilities list and size for each parameter.
281 */
282struct DCMICapEntry
283{
Patrick Venture0b02be92018-08-31 11:55:55 -0700284 uint8_t size; //!< Size of capability array in bytes.
285 DCMICapList capList; //!< List of capabilities for a parameter.
Dhruvaraj Subhashchandrane29be412018-01-16 05:11:56 -0600286};
287
288using DCMICaps = std::map<DCMICapParameters, DCMICapEntry>;
289
Deepak Kodihalliee717d72018-01-24 04:53:09 -0600290/** @struct GetTempReadingsRequest
291 *
292 * DCMI payload for Get Temperature Readings request
293 */
294struct GetTempReadingsRequest
295{
Patrick Venture0b02be92018-08-31 11:55:55 -0700296 uint8_t sensorType; //!< Type of the sensor
297 uint8_t entityId; //!< Entity ID
298 uint8_t entityInstance; //!< Entity Instance (0 means all instances)
299 uint8_t instanceStart; //!< Instance start (used if instance is 0)
Deepak Kodihalliee717d72018-01-24 04:53:09 -0600300} __attribute__((packed));
301
302/** @struct GetTempReadingsResponse
303 *
304 * DCMI header for Get Temperature Readings response
305 */
306struct GetTempReadingsResponseHdr
307{
Patrick Venture0b02be92018-08-31 11:55:55 -0700308 uint8_t numInstances; //!< No. of instances for requested id
309 uint8_t numDataSets; //!< No. of sets of temperature data
Deepak Kodihalliee717d72018-01-24 04:53:09 -0600310} __attribute__((packed));
311
Kirill Pakhomova2573622018-11-02 19:00:18 +0300312/** @brief Parse out JSON config file.
313 *
314 * @param[in] configFile - JSON config file name
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600315 *
316 * @return A json object
317 */
Kirill Pakhomova2573622018-11-02 19:00:18 +0300318Json parseJSONConfig(const std::string& configFile);
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600319
Deepak Kodihalliee717d72018-01-24 04:53:09 -0600320namespace temp_readings
321{
Patrick Venture0b02be92018-08-31 11:55:55 -0700322/** @brief Read temperature from a d-bus object, scale it as per dcmi
323 * get temperature reading requirements.
324 *
325 * @param[in] dbusService - the D-Bus service
326 * @param[in] dbusPath - the D-Bus path
327 *
328 * @return A temperature reading
329 */
330Temperature readTemp(const std::string& dbusService,
331 const std::string& dbusPath);
Deepak Kodihallib1e8fba2018-01-24 04:57:10 -0600332
Patrick Venture0b02be92018-08-31 11:55:55 -0700333/** @brief Read temperatures and fill up DCMI response for the Get
334 * Temperature Readings command. This looks at a specific
335 * instance.
336 *
337 * @param[in] type - one of "inlet", "cpu", "baseboard"
338 * @param[in] instance - A non-zero Entity instance number
339 *
340 * @return A tuple, containing a temperature reading and the
341 * number of instances.
342 */
343std::tuple<Response, NumInstances> read(const std::string& type,
344 uint8_t instance);
Deepak Kodihalliee717d72018-01-24 04:53:09 -0600345
Patrick Venture0b02be92018-08-31 11:55:55 -0700346/** @brief Read temperatures and fill up DCMI response for the Get
347 * Temperature Readings command. This looks at a range of
348 * instances.
349 *
350 * @param[in] type - one of "inlet", "cpu", "baseboard"
351 * @param[in] instanceStart - Entity instance start index
352 *
353 * @return A tuple, containing a list of temperature readings and the
354 * number of instances.
355 */
356std::tuple<ResponseList, NumInstances> readAll(const std::string& type,
357 uint8_t instanceStart);
358} // namespace temp_readings
Deepak Kodihalliee717d72018-01-24 04:53:09 -0600359
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600360namespace sensor_info
361{
Patrick Venture0b02be92018-08-31 11:55:55 -0700362/** @brief Create response from JSON config.
363 *
364 * @param[in] config - JSON config info about DCMI sensors
365 *
366 * @return Sensor info response
367 */
368Response createFromJson(const Json& config);
Deepak Kodihallidd4cff12018-02-06 06:48:29 -0600369
Patrick Venture0b02be92018-08-31 11:55:55 -0700370/** @brief Read sensor info and fill up DCMI response for the Get
371 * Sensor Info command. This looks at a specific
372 * instance.
373 *
374 * @param[in] type - one of "inlet", "cpu", "baseboard"
375 * @param[in] instance - A non-zero Entity instance number
376 * @param[in] config - JSON config info about DCMI sensors
377 *
378 * @return A tuple, containing a sensor info response and
379 * number of instances.
380 */
381std::tuple<Response, NumInstances> read(const std::string& type,
382 uint8_t instance, const Json& config);
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600383
Patrick Venture0b02be92018-08-31 11:55:55 -0700384/** @brief Read sensor info and fill up DCMI response for the Get
385 * Sensor Info command. This looks at a range of
386 * instances.
387 *
388 * @param[in] type - one of "inlet", "cpu", "baseboard"
389 * @param[in] instanceStart - Entity instance start index
390 * @param[in] config - JSON config info about DCMI sensors
391 *
392 * @return A tuple, containing a list of sensor info responses and the
393 * number of instances.
394 */
395std::tuple<ResponseList, NumInstances>
396 readAll(const std::string& type, uint8_t instanceStart, const Json& config);
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600397} // namespace sensor_info
398
Marri Devender Rao66c5fda2018-01-18 10:48:37 -0600399/** @brief Read power reading from power reading sensor object
400 *
401 * @param[in] bus - dbus connection
402 *
403 * @return total power reading
404 */
Patrick Williams5d82f472022-07-22 19:26:53 -0500405int64_t getPowerReading(sdbusplus::bus_t& bus);
Marri Devender Rao66c5fda2018-01-18 10:48:37 -0600406
407/** @struct GetPowerReadingRequest
408 *
409 * DCMI Get Power Reading command request.
410 * Refer DCMI specification Version 1.1 Section 6.6.1
411 */
412struct GetPowerReadingRequest
413{
Patrick Venture0b02be92018-08-31 11:55:55 -0700414 uint8_t mode; //!< Mode
415 uint8_t modeAttribute; //!< Mode Attributes
Marri Devender Rao66c5fda2018-01-18 10:48:37 -0600416} __attribute__((packed));
417
418/** @struct GetPowerReadingResponse
419 *
420 * DCMI Get Power Reading command response.
421 * Refer DCMI specification Version 1.1 Section 6.6.1
422 */
423struct GetPowerReadingResponse
424{
Patrick Venture0b02be92018-08-31 11:55:55 -0700425 uint16_t currentPower; //!< Current power in watts
426 uint16_t minimumPower; //!< Minimum power over sampling duration
427 //!< in watts
428 uint16_t maximumPower; //!< Maximum power over sampling duration
429 //!< in watts
430 uint16_t averagePower; //!< Average power over sampling duration
431 //!< in watts
432 uint32_t timeStamp; //!< IPMI specification based time stamp
433 uint32_t timeFrame; //!< Statistics reporting time period in milli
434 //!< seconds.
435 uint8_t powerReadingState; //!< Power Reading State
Marri Devender Rao66c5fda2018-01-18 10:48:37 -0600436} __attribute__((packed));
437
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600438/** @struct GetSensorInfoRequest
439 *
440 * DCMI payload for Get Sensor Info request
441 */
442struct GetSensorInfoRequest
443{
Patrick Venture0b02be92018-08-31 11:55:55 -0700444 uint8_t sensorType; //!< Type of the sensor
445 uint8_t entityId; //!< Entity ID
446 uint8_t entityInstance; //!< Entity Instance (0 means all instances)
447 uint8_t instanceStart; //!< Instance start (used if instance is 0)
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600448} __attribute__((packed));
449
450/** @struct GetSensorInfoResponseHdr
451 *
452 * DCMI header for Get Sensor Info response
453 */
454struct GetSensorInfoResponseHdr
455{
Patrick Venture0b02be92018-08-31 11:55:55 -0700456 uint8_t numInstances; //!< No. of instances for requested id
457 uint8_t numRecords; //!< No. of record ids in the response
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600458} __attribute__((packed));
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -0600459/**
460 * @brief Parameters for DCMI Configuration Parameters
461 */
Patrick Venture0b02be92018-08-31 11:55:55 -0700462enum class DCMIConfigParameters : uint8_t
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -0600463{
464 ActivateDHCP = 1,
465 DiscoveryConfig,
466 DHCPTiming1,
467 DHCPTiming2,
468 DHCPTiming3,
469};
470
471/** @struct SetConfParamsRequest
472 *
473 * DCMI Set DCMI Configuration Parameters Command.
474 * Refer DCMI specification Version 1.1 Section 6.1.2
475 */
476struct SetConfParamsRequest
477{
Patrick Venture0b02be92018-08-31 11:55:55 -0700478 uint8_t paramSelect; //!< Parameter selector.
479 uint8_t setSelect; //!< Set Selector (use 00h for parameters that only
480 //!< have one set).
481 uint8_t data[]; //!< Configuration parameter data.
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -0600482} __attribute__((packed));
483
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -0600484/** @struct GetConfParamsRequest
485 *
486 * DCMI Get DCMI Configuration Parameters Command.
487 * Refer DCMI specification Version 1.1 Section 6.1.3
488 */
489struct GetConfParamsRequest
490{
Patrick Venture0b02be92018-08-31 11:55:55 -0700491 uint8_t paramSelect; //!< Parameter selector.
492 uint8_t setSelect; //!< Set Selector. Selects a given set of parameters
493 //!< under a given Parameter selector value. 00h if
494 //!< parameter doesn't use a Set Selector.
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -0600495} __attribute__((packed));
496
497/** @struct GetConfParamsResponse
498 *
499 * DCMI Get DCMI Configuration Parameters Command response.
500 * Refer DCMI specification Version 1.1 Section 6.1.3
501 */
502struct GetConfParamsResponse
503{
Patrick Venture0b02be92018-08-31 11:55:55 -0700504 uint8_t major; //!< DCMI Spec Conformance - major ver = 01h.
505 uint8_t minor; //!< DCMI Spec Conformance - minor ver = 05h.
506 uint8_t paramRevision; //!< Parameter Revision = 01h.
507 uint8_t data[]; //!< Parameter data.
Nagaraju Goruganti22be97b2018-02-07 01:19:59 -0600508} __attribute__((packed));
Deepak Kodihalli0b459552018-02-06 06:25:12 -0600509
Tom Josephbe5eaa12017-07-12 19:54:44 +0530510} // namespace dcmi