Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 1 | #ifndef PLATFORM_H |
| 2 | #define PLATFORM_H |
| 3 | |
| 4 | #ifdef __cplusplus |
| 5 | extern "C" { |
| 6 | #endif |
| 7 | |
| 8 | #include <stddef.h> |
| 9 | #include <stdint.h> |
| 10 | |
| 11 | #include "base.h" |
| 12 | |
| 13 | /* Maximum size for request */ |
| 14 | #define PLDM_SET_STATE_EFFECTER_STATES_REQ_BYTES 19 |
| 15 | /* Response lengths are inclusive of completion code */ |
| 16 | #define PLDM_SET_STATE_EFFECTER_STATES_RESP_BYTES 1 |
| 17 | |
| 18 | enum set_request { PLDM_NO_CHANGE = 0x00, PLDM_REQUEST_SET = 0x01 }; |
| 19 | |
| 20 | enum effecter_state { PLDM_INVALID_VALUE = 0xFF }; |
| 21 | |
| 22 | enum pldm_platform_commands { |
| 23 | PLDM_SET_STATE_EFFECTER_STATES = 0x39, |
| 24 | }; |
| 25 | |
| 26 | /** @struct set_effecter_state_field |
| 27 | * |
| 28 | * Structure representing a stateField in SetStateEffecterStates command */ |
| 29 | |
| 30 | typedef struct state_field_for_state_effecter_set { |
| 31 | uint8_t set_request; //!< Whether to change the state |
| 32 | uint8_t effecter_state; //!< Expected state of the effecter |
| 33 | } __attribute__((packed)) set_effecter_state_field; |
| 34 | |
| 35 | /* Responder */ |
| 36 | |
| 37 | /* SetStateEffecterStates */ |
| 38 | |
| 39 | /** @brief Create a PLDM response message for SetStateEffecterStates |
| 40 | * |
| 41 | * @param[in] instance_id - Message's instance id |
| 42 | * @param[in] completion_code - PLDM completion code |
| 43 | * @param[out] msg - Message will be written to this |
| 44 | * @return pldm_completion_codes |
| 45 | * @note Caller is responsible for memory alloc and dealloc of param |
| 46 | * 'msg.body.payload' |
| 47 | */ |
| 48 | |
| 49 | int encode_set_state_effecter_states_resp(uint8_t instance_id, |
| 50 | uint8_t completion_code, |
| 51 | struct pldm_msg *msg); |
| 52 | |
| 53 | /** @brief Decode SetStateEffecterStates request data |
| 54 | * |
| 55 | * @param[in] msg - Request message payload |
| 56 | * @param[out] effecter_id - used to identify and access the effecter |
| 57 | * @param[out] comp_effecter_count - number of individual sets of effecter |
| 58 | * information. Upto eight sets of state effecter info can be accessed |
| 59 | * for a given effecter. |
| 60 | * @param[out] field - each unit is an instance of the stateFileld structure |
| 61 | * that is used to set the requested state for a particular effecter |
| 62 | * within the state effecter. This field holds the starting address of |
| 63 | * the stateField values. The user is responsible to allocate the |
| 64 | * memory prior to calling this command. Since the state field count is |
| 65 | * not known in advance, the user should allocate the maximum size |
| 66 | * always, which is 8 in number. |
| 67 | * @return pldm_completion_codes |
| 68 | */ |
| 69 | int decode_set_state_effecter_states_req(const struct pldm_msg_payload *msg, |
| 70 | uint16_t *effecter_id, |
| 71 | uint8_t *comp_effecter_count, |
| 72 | set_effecter_state_field *field); |
| 73 | |
vkaverap | 98a2c19 | 2019-04-03 05:33:52 -0500 | [diff] [blame^] | 74 | /** @brief Create a PLDM request message for SetStateEffecterStates |
| 75 | * |
| 76 | * @param[in] instance_id - Message's instance id |
| 77 | * @param[in] effecter_id - used to identify and access the effecter |
| 78 | * @param[in] comp_effecter_count - number of individual sets of effecter |
| 79 | * information. Upto eight sets of state effecter info can be accessed |
| 80 | * for a given effecter. |
| 81 | * @param[in] field - each unit is an instance of the stateField structure |
| 82 | * that is used to set the requested state for a particular effecter |
| 83 | * within the state effecter. This field holds the starting address of |
| 84 | * the stateField values. The user is responsible to allocate the |
| 85 | * memory prior to calling this command. The user has to allocate the |
| 86 | * field parameter as sizeof(set_effecter_state_field) * |
| 87 | * comp_effecter_count |
| 88 | * @param[out] msg - Message will be written to this |
| 89 | * @return pldm_completion_codes |
| 90 | * @note Caller is responsible for memory alloc and dealloc of param |
| 91 | * 'msg.body.payload' |
| 92 | */ |
| 93 | |
| 94 | int encode_set_state_effecter_states_req(uint8_t instance_id, |
| 95 | uint16_t effecter_id, |
| 96 | uint8_t comp_effecter_count, |
| 97 | set_effecter_state_field *field, |
| 98 | struct pldm_msg *msg); |
| 99 | |
| 100 | /** @brief Decode SetStateEffecterStates response data |
| 101 | * @param[in] msg - Request message payload |
| 102 | * @param[out] completion_code - PLDM completion code |
| 103 | * @return pldm_completion_codes |
| 104 | */ |
| 105 | int decode_set_state_effecter_states_resp(const struct pldm_msg_payload *msg, |
| 106 | uint8_t *completion_code); |
| 107 | |
Sampa Misra | 0db1dfa | 2019-03-19 00:15:31 -0500 | [diff] [blame] | 108 | #ifdef __cplusplus |
| 109 | } |
| 110 | #endif |
| 111 | |
| 112 | #endif /* PLATFORM_H */ |