Added encode API for SetTID cmd
Added encode API for SetTID command(0x01) which is defined in
DSP0240 Version 1.1.0 sec:8.1.1.
Signed-off-by: Gilbert Chen <gilbertc@nvidia.com>
Change-Id: Ia2d5c76e8ad545e794c72f5963556f1f0e6357fc
diff --git a/src/base.c b/src/base.c
index 9a5ae09..86bacea 100644
--- a/src/base.c
+++ b/src/base.c
@@ -398,6 +398,33 @@
return PLDM_SUCCESS;
}
+int encode_set_tid_req(uint8_t instance_id, uint8_t tid, struct pldm_msg *msg)
+{
+ if (msg == NULL) {
+ return PLDM_ERROR_INVALID_DATA;
+ }
+
+ if (tid == 0x0 || tid == 0xff) {
+ return PLDM_ERROR_INVALID_DATA;
+ }
+
+ struct pldm_header_info header = {0};
+ header.instance = instance_id;
+ header.msg_type = PLDM_REQUEST;
+ header.command = PLDM_SET_TID;
+
+ uint8_t rc = pack_pldm_header(&header, &(msg->hdr));
+ if (rc != PLDM_SUCCESS) {
+ return rc;
+ }
+
+ struct pldm_set_tid_req *request =
+ (struct pldm_set_tid_req *)msg->payload;
+ request->tid = tid;
+
+ return PLDM_SUCCESS;
+}
+
int decode_multipart_receive_req(
const struct pldm_msg *msg, size_t payload_length, uint8_t *pldm_type,
uint8_t *transfer_opflag, uint32_t *transfer_ctx, uint32_t *transfer_handle,