Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
Tamas Ban | d097318 | 2024-02-21 12:42:00 +0100 | [diff] [blame] | 8 | #ifndef __RSE_COMMS_PROTOCOL_EMBED_H__ |
| 9 | #define __RSE_COMMS_PROTOCOL_EMBED_H__ |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 10 | |
| 11 | #include <cdefs.h> |
| 12 | |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 13 | #include <psa/client.h> |
| 14 | |
| 15 | #include <platform_def.h> |
| 16 | |
Tamas Ban | ff0aa68 | 2022-09-08 17:04:49 +0200 | [diff] [blame] | 17 | |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 18 | |
Tamas Ban | d097318 | 2024-02-21 12:42:00 +0100 | [diff] [blame] | 19 | struct __packed rse_embed_msg_t { |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 20 | psa_handle_t handle; |
| 21 | uint32_t ctrl_param; /* type, in_len, out_len */ |
| 22 | uint16_t io_size[PSA_MAX_IOVEC]; |
Tamas Ban | d097318 | 2024-02-21 12:42:00 +0100 | [diff] [blame] | 23 | uint8_t trailer[PLAT_RSE_COMMS_PAYLOAD_MAX_SIZE]; |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 24 | }; |
| 25 | |
Tamas Ban | d097318 | 2024-02-21 12:42:00 +0100 | [diff] [blame] | 26 | struct __packed rse_embed_reply_t { |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 27 | int32_t return_val; |
| 28 | uint16_t out_size[PSA_MAX_IOVEC]; |
Tamas Ban | d097318 | 2024-02-21 12:42:00 +0100 | [diff] [blame] | 29 | uint8_t trailer[PLAT_RSE_COMMS_PAYLOAD_MAX_SIZE]; |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 30 | }; |
| 31 | |
Tamas Ban | d097318 | 2024-02-21 12:42:00 +0100 | [diff] [blame] | 32 | psa_status_t rse_protocol_embed_serialize_msg(psa_handle_t handle, |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 33 | int16_t type, |
| 34 | const psa_invec *in_vec, |
| 35 | uint8_t in_len, |
| 36 | const psa_outvec *out_vec, |
| 37 | uint8_t out_len, |
Tamas Ban | d097318 | 2024-02-21 12:42:00 +0100 | [diff] [blame] | 38 | struct rse_embed_msg_t *msg, |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 39 | size_t *msg_len); |
| 40 | |
Tamas Ban | d097318 | 2024-02-21 12:42:00 +0100 | [diff] [blame] | 41 | psa_status_t rse_protocol_embed_deserialize_reply(psa_outvec *out_vec, |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 42 | uint8_t out_len, |
| 43 | psa_status_t *return_val, |
Tamas Ban | d097318 | 2024-02-21 12:42:00 +0100 | [diff] [blame] | 44 | const struct rse_embed_reply_t *reply, |
Raef Coles | 734aaac | 2022-06-15 14:37:22 +0100 | [diff] [blame] | 45 | size_t reply_size); |
| 46 | |
Tamas Ban | d097318 | 2024-02-21 12:42:00 +0100 | [diff] [blame] | 47 | #endif /* __RSE_COMMS_PROTOCOL_EMBED_H__ */ |