1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <interface/smc/smc.h>
20 #include <lk/compiler.h>
21 #include <trusty_ipc.h>
22 
23 __BEGIN_CDECLS
24 
25 /**
26  * smc_send_request() - send message to SMC service
27  * @channel: handle to the channel to send message over
28  * @msg: pointer to the message to be sent
29  *
30  * Return: the total number of bytes sent on success, a negative error code
31  * otherwise.
32  */
33 int smc_send_request(handle_t channel, struct smc_msg* msg);
34 
35 /**
36  * smc_read_response() - read message from SMC service
37  * @channel: handle to the channel to read message from
38  * @msg: pointer to memory where read message is placed
39  *
40  * Return: the number of bytes stored into memory pointed to by @msg parameter
41  * on success, a negative error code otherwise
42  */
43 int smc_read_response(handle_t channel, struct smc_msg* msg);
44 
45 __END_CDECLS
46