xref: /openbmc/pldm/libpldmresponder/bios.hpp (revision f666db13)
1 #pragma once
2 
3 #include <stdint.h>
4 
5 #include <vector>
6 
7 #include "libpldm/bios.h"
8 
9 namespace pldm
10 {
11 
12 using Response = std::vector<uint8_t>;
13 
14 namespace responder
15 {
16 
17 namespace bios
18 {
19 /** @brief Register handlers for command from the platform spec
20  */
21 void registerHandlers();
22 } // namespace bios
23 
24 /** @brief Handler for GetDateTime
25  *
26  *  @param[in] request - Request message payload
27  *  @param[return] Response - PLDM Response message
28  */
29 Response getDateTime(const pldm_msg* request, size_t payloadLength);
30 
31 namespace utils
32 {
33 
34 /** @brief Convert epoch time to BCD time
35  *
36  *  @param[in] timeSec - Time got from epoch time in seconds
37  *  @param[out] seconds - number of seconds in BCD
38  *  @param[out] minutes - number of minutes in BCD
39  *  @param[out] hours - number of hours in BCD
40  *  @param[out] day - day of the month in BCD
41  *  @param[out] month - month number in BCD
42  *  @param[out] year - year number in BCD
43  */
44 void epochToBCDTime(uint64_t timeSec, uint8_t& seconds, uint8_t& minutes,
45                     uint8_t& hours, uint8_t& day, uint8_t& month,
46                     uint16_t& year);
47 } // namespace utils
48 
49 } // namespace responder
50 } // namespace pldm
51