aboutsummaryrefslogtreecommitdiff
path: root/components/messaging/ffa/libsp/include/sp_messaging.h
blob: 3ee5aae83bdebbb775b2754c1e74455175d21e68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* SPDX-License-Identifier: BSD-3-Clause */
/*
 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
 */

#ifndef LIBSP_INCLUDE_SP_MESSAGING_H_
#define LIBSP_INCLUDE_SP_MESSAGING_H_

#include "sp_api_defines.h"
#include "sp_api_types.h"

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#define SP_MSG_ARG_COUNT (4)

/**
 * @brief      SP message type
 */
struct sp_msg {
	uint16_t source_id;
	uint16_t destination_id;
	uint32_t args[SP_MSG_ARG_COUNT];
};

/**
 * @brief      Wait for a message and returns it.
 * @param[out] msg   The received message
 *
 * @return     The SP API result
 */
sp_result sp_msg_wait(struct sp_msg *msg);

/**
 * @brief      Sends a request message and waits for the response message
 *             which it returns then.
 *
 * @param[in]  req   The request message
 * @param[out] resp  The response message
 *
 * @return     The SP API result
 */
sp_result sp_msg_send_direct_req(const struct sp_msg *req, struct sp_msg *resp);

/**
 * @brief      Sends a response message and waits for a new request which it
 *             returns then.
 *
 * @param[in]  resp  The response message
 * @param[out] req   The request message
 *
 * @return     The SP API result
 */
sp_result sp_msg_send_direct_resp(const struct sp_msg *resp,
				  struct sp_msg *req);

#ifdef __cplusplus
}
#endif

#endif /* LIBSP_INCLUDE_SP_MESSAGING_H_ */