1 /*
2  * Copyright (C) 2018 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 #include <trusty_ipc.h>
18 
19 #include <trusty_syscalls.h>
20 
port_create(const char * path,uint32_t num_recv_bufs,uint32_t recv_buf_size,uint32_t flags)21 handle_t port_create(const char* path,
22                      uint32_t num_recv_bufs,
23                      uint32_t recv_buf_size,
24                      uint32_t flags) {
25     return _trusty_port_create(path, num_recv_bufs, recv_buf_size, flags);
26 }
27 
connect(const char * path,uint32_t flags)28 handle_t connect(const char* path, uint32_t flags) {
29     return _trusty_connect(path, flags);
30 }
31 
accept(handle_t handle,struct uuid * peer_uuid)32 handle_t accept(handle_t handle, struct uuid* peer_uuid) {
33     return _trusty_accept(handle, peer_uuid);
34 }
35 
close(handle_t handle)36 int close(handle_t handle) {
37     return _trusty_close(handle);
38 }
39 
set_cookie(handle_t handle,void * cookie)40 int set_cookie(handle_t handle, void* cookie) {
41     return _trusty_set_cookie(handle, cookie);
42 }
43 
handle_set_create(void)44 handle_t handle_set_create(void) {
45     return _trusty_handle_set_create();
46 }
47 
handle_set_ctrl(handle_t handle,uint32_t cmd,struct uevent * evt)48 int handle_set_ctrl(handle_t handle, uint32_t cmd, struct uevent* evt) {
49     return _trusty_handle_set_ctrl(handle, cmd, evt);
50 }
51 
wait(handle_t handle,struct uevent * event,uint32_t timeout_msecs)52 int wait(handle_t handle, struct uevent* event, uint32_t timeout_msecs) {
53     return _trusty_wait(handle, event, timeout_msecs);
54 }
55 
wait_any(struct uevent * event,uint32_t timeout_msecs)56 int wait_any(struct uevent* event, uint32_t timeout_msecs) {
57     return _trusty_wait_any(event, timeout_msecs);
58 }
59 
get_msg(handle_t handle,struct ipc_msg_info * msg_info)60 int get_msg(handle_t handle, struct ipc_msg_info* msg_info) {
61     return _trusty_get_msg(handle, msg_info);
62 }
63 
read_msg(handle_t handle,uint32_t msg_id,uint32_t offset,struct ipc_msg * msg)64 ssize_t read_msg(handle_t handle,
65                  uint32_t msg_id,
66                  uint32_t offset,
67                  struct ipc_msg* msg) {
68     return _trusty_read_msg(handle, msg_id, offset, msg);
69 }
70 
put_msg(handle_t handle,uint32_t msg_id)71 int put_msg(handle_t handle, uint32_t msg_id) {
72     return _trusty_put_msg(handle, msg_id);
73 }
74 
send_msg(handle_t handle,struct ipc_msg * msg)75 ssize_t send_msg(handle_t handle, struct ipc_msg* msg) {
76     return _trusty_send_msg(handle, msg);
77 }
78 
dup(handle_t handle)79 handle_t dup(handle_t handle) {
80     return _trusty_dup(handle);
81 }
82