blob: 3ee5aae83bdebbb775b2754c1e74455175d21e68 [file] [log] [blame]
Imre Kisc674b5b2021-02-09 19:05:27 +01001/* SPDX-License-Identifier: BSD-3-Clause */
2/*
3 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
4 */
5
6#ifndef LIBSP_INCLUDE_SP_MESSAGING_H_
7#define LIBSP_INCLUDE_SP_MESSAGING_H_
8
9#include "sp_api_defines.h"
10#include "sp_api_types.h"
11
12#include <stdint.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#define SP_MSG_ARG_COUNT (4)
19
20/**
21 * @brief SP message type
22 */
23struct sp_msg {
24 uint16_t source_id;
25 uint16_t destination_id;
26 uint32_t args[SP_MSG_ARG_COUNT];
27};
28
29/**
30 * @brief Wait for a message and returns it.
31 * @param[out] msg The received message
32 *
33 * @return The SP API result
34 */
35sp_result sp_msg_wait(struct sp_msg *msg);
36
37/**
38 * @brief Sends a request message and waits for the response message
39 * which it returns then.
40 *
41 * @param[in] req The request message
42 * @param[out] resp The response message
43 *
44 * @return The SP API result
45 */
46sp_result sp_msg_send_direct_req(const struct sp_msg *req, struct sp_msg *resp);
47
48/**
49 * @brief Sends a response message and waits for a new request which it
50 * returns then.
51 *
52 * @param[in] resp The response message
53 * @param[out] req The request message
54 *
55 * @return The SP API result
56 */
57sp_result sp_msg_send_direct_resp(const struct sp_msg *resp,
58 struct sp_msg *req);
59
60#ifdef __cplusplus
61}
62#endif
63
64#endif /* LIBSP_INCLUDE_SP_MESSAGING_H_ */