Interface: Change control param to uint32_t preprocessor
Define a uint32_t preprocessor to pack control params.
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: I0992620af1c39ef6dba182cac88e81cd666be0c6
diff --git a/interface/include/tfm_api.h b/interface/include/tfm_api.h
index fea18cd..9d0df04 100644
--- a/interface/include/tfm_api.h
+++ b/interface/include/tfm_api.h
@@ -112,17 +112,17 @@
* \brief Call a secure function referenced by a connection handle.
*
* \param[in] handle Handle to connection.
- * \param[in] ctrl_param Parameter structure, includes request type,
- * in_num and out_num.
+ * \param[in] ctrl_param Parameters combined in uint32_t,
+ * includes request type, in_num and out_num.
* \param[in] in_vec Array of input \ref psa_invec structures.
* \param[in,out] out_vec Array of output \ref psa_outvec structures.
*
* \return Returns \ref psa_status_t status code.
*/
psa_status_t tfm_psa_call_veneer(psa_handle_t handle,
- const struct tfm_control_parameter_t *ctrl_param,
- const psa_invec *in_vec,
- psa_outvec *out_vec);
+ uint32_t ctrl_param,
+ const psa_invec *in_vec,
+ psa_outvec *out_vec);
/**
* \brief Close connection to secure function referenced by a connection handle.
diff --git a/interface/include/tfm_psa_call_param.h b/interface/include/tfm_psa_call_param.h
new file mode 100644
index 0000000..ed51da7
--- /dev/null
+++ b/interface/include/tfm_psa_call_param.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_PSA_CALL_PARAM_H__
+#define __TFM_PSA_CALL_PARAM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TYPE_OFFSET 16U
+#define TYPE_MASK (0xFFFFUL << TYPE_OFFSET)
+#define IN_LEN_OFFSET 8U
+#define IN_LEN_MASK (0xFFUL << IN_LEN_OFFSET)
+#define OUT_LEN_OFFSET 0U
+#define OUT_LEN_MASK (0xFFUL << OUT_LEN_OFFSET)
+
+#define PARAM_PACK(type, in_len, out_len) \
+ (((((uint32_t)type) << TYPE_OFFSET) & TYPE_MASK) | \
+ ((((uint32_t)in_len) << IN_LEN_OFFSET) & IN_LEN_MASK) | \
+ ((((uint32_t)out_len) << OUT_LEN_OFFSET) & OUT_LEN_MASK))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_PSA_CALL_PARAM_H__ */