blob: 3b14fbcfb213a7d3da4c96c2ad64e678d4e8a93c [file] [log] [blame]
Xinyu Zhang99b069f2021-04-09 14:36:42 +08001/*
2 * Copyright (c) 2021, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
Ken Liu82e3eac2021-10-14 16:19:13 +08008#ifndef __TFM_PSA_CALL_PACK_H__
9#define __TFM_PSA_CALL_PACK_H__
10
11#include "psa_config.h"
12#include "psa/client.h"
Xinyu Zhang99b069f2021-04-09 14:36:42 +080013
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#define TYPE_OFFSET 16U
19#define TYPE_MASK (0xFFFFUL << TYPE_OFFSET)
20#define IN_LEN_OFFSET 8U
21#define IN_LEN_MASK (0xFFUL << IN_LEN_OFFSET)
22#define OUT_LEN_OFFSET 0U
23#define OUT_LEN_MASK (0xFFUL << OUT_LEN_OFFSET)
24
25#define PARAM_PACK(type, in_len, out_len) \
26 (((((uint32_t)type) << TYPE_OFFSET) & TYPE_MASK) | \
27 ((((uint32_t)in_len) << IN_LEN_OFFSET) & IN_LEN_MASK) | \
28 ((((uint32_t)out_len) << OUT_LEN_OFFSET) & OUT_LEN_MASK))
29
Ken Liu82e3eac2021-10-14 16:19:13 +080030psa_status_t tfm_psa_call_pack(psa_handle_t handle,
31 uint32_t ctrl_param,
32 const psa_invec *in_vec,
33 psa_outvec *out_vec);
34
Xinyu Zhang99b069f2021-04-09 14:36:42 +080035#ifdef __cplusplus
36}
37#endif
38
Ken Liu82e3eac2021-10-14 16:19:13 +080039#endif /* __TFM_PSA_CALL_PACK_H__ */