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 #include <errno.h>
18 #include <lib/uirq/uirq.h>
19 #include <trusty_uio.h>
20 #include <uapi/trusty_uevent.h>
21 
uirq_open(const char * name,uint32_t flags)22 handle_t uirq_open(const char* name, uint32_t flags) {
23     return connect(name, flags);
24 }
25 
send_ack(handle_t h,uint32_t cmd)26 static int send_ack(handle_t h, uint32_t cmd) {
27     return trusty_write((int)h, &cmd, sizeof(cmd));
28 }
29 
uirq_ack_handled(handle_t h)30 int uirq_ack_handled(handle_t h) {
31     return send_ack(h, EVENT_NOTIFY_CMD_HANDLED);
32 }
33