1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
4  */
5 
6 #ifndef LIBSP_INCLUDE_SP_RXTX_H_
7 #define LIBSP_INCLUDE_SP_RXTX_H_
8 
9 /**
10  * @file  sp_rxtx.h
11  * @brief The functions of this file provide a higher API for the FF-A RXTX
12  *        buffer handling.
13  */
14 
15 #include "sp_api_defines.h"
16 #include "sp_api_types.h"
17 #include <stddef.h>
18 #include <stdint.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /**
25  * @brief      Maps the RX/TX buffer pair in the callee's translation regime.
26  *
27  * @param[in]  tx_buffer  The transmit buffer
28  * @param[in]  rx_buffer  The receive buffer
29  * @param[in]  size       The buffer size
30  *
31  * @return     The SP API result
32  */
33 sp_result sp_rxtx_buffer_map(void *tx_buffer, const void *rx_buffer,
34 			     size_t size);
35 
36 /**
37  * @brief      Unmaps the RX/TX buffer pair in the callee's translation regime.
38  *
39  * @return     The SP API result
40  */
41 sp_result sp_rxtx_buffer_unmap(void);
42 
43 /**
44  * @brief      Queries the required alignment boundary of the RXTX buffers.
45  *
46  * @param[out] alignment  The minimal buffer size and alignment boundary
47  *
48  * @return     The SP API result
49  */
50 sp_result sp_rxtx_buffer_alignment_boundary_get(uintptr_t *alignment);
51 
52 /**
53  * @brief      Queries the RX buffer's address and size.
54  *
55  * @param[out] buffer  The buffer address
56  * @param[out] size    The buffer size
57  *
58  * @return     The SP API result
59  */
60 sp_result sp_rxtx_buffer_rx_get(const void **buffer, size_t *size);
61 
62 /**
63  * @brief      Queries the TX buffer's address and size.
64  *
65  * @param      buffer  The buffer address
66  * @param      size    The buffer size
67  *
68  * @return     The SP API result
69  */
70 sp_result sp_rxtx_buffer_tx_get(void **buffer, size_t *size);
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif /* LIBSP_INCLUDE_SP_RXTX_H_ */
77