Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 1 | #ifndef BIOS_H |
| 2 | #define BIOS_H |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "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 | |
| 17 | enum 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 | |
| 32 | int 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 |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 37 | * @param[in] payload_length - Length of response message payload |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 38 | * @param[out] completion_code - Pointer to response msg's PLDM completion code |
| 39 | * @param[out] seconds - Seconds in BCD format |
| 40 | * @param[out] minutes - minutes in BCD format |
| 41 | * @param[out] hours - hours in BCD format |
| 42 | * @param[out] day - day of month in BCD format |
| 43 | * @param[out] month - number of month in BCD format |
| 44 | * @param[out] year - year in BCD format |
| 45 | * @return pldm_completion_codes |
| 46 | */ |
vkaverap | a6575b8 | 2019-04-03 05:33:52 -0500 | [diff] [blame] | 47 | int decode_get_date_time_resp(const uint8_t *msg, size_t payload_length, |
Sampa Misra | 032bd50 | 2019-03-06 05:03:22 -0600 | [diff] [blame] | 48 | uint8_t *completion_code, uint8_t *seconds, |
| 49 | uint8_t *minutes, uint8_t *hours, uint8_t *day, |
| 50 | uint8_t *month, uint16_t *year); |
| 51 | |
| 52 | /* Responder */ |
| 53 | |
| 54 | /* GetDateTime */ |
| 55 | |
| 56 | /** @brief Create a PLDM response message for GetDateTime |
| 57 | * |
| 58 | * @param[in] instance_id - Message's instance id |
| 59 | * @param[in] completion_code - PLDM completion code |
| 60 | * @param[in] seconds - seconds in BCD format |
| 61 | * @param[in] minutes - minutes in BCD format |
| 62 | * @param[in] hours - hours in BCD format |
| 63 | * @param[in] day - day of the month in BCD format |
| 64 | * @param[in] month - number of month in BCD format |
| 65 | * @param[in] year - year in BCD format |
| 66 | * @param[out] msg - Message will be written to this |
| 67 | * @return pldm_completion_codes |
| 68 | * @note Caller is responsible for memory alloc and dealloc of param |
| 69 | * 'msg.body.payload' |
| 70 | */ |
| 71 | |
| 72 | int encode_get_date_time_resp(uint8_t instance_id, uint8_t completion_code, |
| 73 | uint8_t seconds, uint8_t minutes, uint8_t hours, |
| 74 | uint8_t day, uint8_t month, uint16_t year, |
| 75 | struct pldm_msg *msg); |
| 76 | |
| 77 | #ifdef __cplusplus |
| 78 | } |
| 79 | #endif |
| 80 | |
| 81 | #endif /* BIOS_H */ |