blob: d173aebbd6e13f113973a208c80fd11ac656c97f [file] [log] [blame]
Sampa Misra032bd502019-03-06 05:03:22 -06001#ifndef BIOS_H
2#define BIOS_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <asm/byteorder.h>
9#include <stddef.h>
10#include <stdint.h>
11
12#include "base.h"
13
14/* Response lengths are inclusive of completion code */
15#define PLDM_GET_DATE_TIME_RESP_BYTES 8
16
17enum pldm_bios_commands { PLDM_GET_DATE_TIME = 0x0c };
18
19/* Requester */
20
21/* GetDateTime */
22
23/** @brief Create a PLDM request message for GetDateTime
24 *
25 * @param[in] instance_id - Message's instance id
26 * @param[out] msg - Message will be written to this
27 * @return pldm_completion_codes
28 * @note Caller is responsible for memory alloc and dealloc of param
29 * 'msg.body.payload'
30 */
31
32int encode_get_date_time_req(uint8_t instance_id, struct pldm_msg *msg);
33
34/** @brief Decode a GetDateTime response message
35 *
36 * @param[in] msg - Response message payload
37 * @param[out] completion_code - Pointer to response msg's PLDM completion code
38 * @param[out] seconds - Seconds in BCD format
39 * @param[out] minutes - minutes in BCD format
40 * @param[out] hours - hours in BCD format
41 * @param[out] day - day of month in BCD format
42 * @param[out] month - number of month in BCD format
43 * @param[out] year - year in BCD format
44 * @return pldm_completion_codes
45 */
46int decode_get_date_time_resp(const struct pldm_msg_payload *msg,
47 uint8_t *completion_code, uint8_t *seconds,
48 uint8_t *minutes, uint8_t *hours, uint8_t *day,
49 uint8_t *month, uint16_t *year);
50
51/* Responder */
52
53/* GetDateTime */
54
55/** @brief Create a PLDM response message for GetDateTime
56 *
57 * @param[in] instance_id - Message's instance id
58 * @param[in] completion_code - PLDM completion code
59 * @param[in] seconds - seconds in BCD format
60 * @param[in] minutes - minutes in BCD format
61 * @param[in] hours - hours in BCD format
62 * @param[in] day - day of the month in BCD format
63 * @param[in] month - number of month in BCD format
64 * @param[in] year - year in BCD format
65 * @param[out] msg - Message will be written to this
66 * @return pldm_completion_codes
67 * @note Caller is responsible for memory alloc and dealloc of param
68 * 'msg.body.payload'
69 */
70
71int encode_get_date_time_resp(uint8_t instance_id, uint8_t completion_code,
72 uint8_t seconds, uint8_t minutes, uint8_t hours,
73 uint8_t day, uint8_t month, uint16_t year,
74 struct pldm_msg *msg);
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif /* BIOS_H */