1 /* 2 * Copyright (C) 2015-2017 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 <lk/compiler.h> 20 #include <sys/types.h> 21 #include <trusty_ipc.h> 22 23 typedef void (*event_handler_proc_t)(const uevent_t* ev, void* ctx); 24 25 typedef struct tipc_event_handler { 26 event_handler_proc_t proc; 27 void* priv; 28 } tipc_event_handler_t; 29 30 __BEGIN_CDECLS 31 32 /* 33 * tipc helpers 34 */ 35 void tipc_handle_port_errors(const uevent_t* ev); 36 void tipc_handle_chan_errors(const uevent_t* ev); 37 38 int tipc_send_single_buf(handle_t chan, const void* buf, size_t len); 39 int tipc_recv_single_buf(handle_t chan, void* buf, size_t len); 40 41 int tipc_send_two_segments(handle_t chan, 42 const void* hdr, 43 size_t hdr_len, 44 const void* payload, 45 size_t payload_len); 46 47 int tipc_recv_two_segments(handle_t chan, 48 void* hdr, 49 size_t hdr_len, 50 void* payload, 51 size_t payload_len); 52 53 /* 54 * tipc services 55 */ 56 int hwrng_setup_service(void); 57 int hwkey_setup_service(void); 58 59 __END_CDECLS 60