1 /* 2 * Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 #ifndef OBJECT_IRQ_H 13 #define OBJECT_IRQ_H 14 15 #include <ipc/notification.h> 16 #include <object/object.h> 17 #include <irq_num.h> 18 19 struct irq_notification { 20 u32 intr_vector; 21 u32 status; 22 struct notification notifc; 23 24 /* 25 * Debugging field: Using this field to avoid re-entry of 26 * a user-level interrupt handler thread. 27 */ 28 volatile u32 user_handler_ready; 29 }; 30 31 extern struct irq_notification *irq_notifcs[MAX_IRQ_NUM]; 32 33 int user_handle_irq(int irq); 34 void irq_deinit(void *irq_ptr); 35 36 /* Syscalls */ 37 cap_t sys_irq_register(int irq); 38 int sys_irq_stop(cap_t irq_cap); 39 int sys_irq_wait(cap_t irq_cap, bool is_block); 40 int sys_irq_ack(cap_t irq_cap); 41 int sys_disable_irqno(int irq); 42 int sys_enable_irqno(int irq); 43 int sys_irq_op(int irq, int op, long val); 44 45 #endif /* OBJECT_IRQ_H */