1 | /* |
---|
2 | * soclib_pic.c - soclib PIC driver definition. |
---|
3 | * |
---|
4 | * Author Alain Greiner (2016) |
---|
5 | * |
---|
6 | * Copyright (c) UPMC Sorbonne Universites |
---|
7 | * |
---|
8 | * This file is part of ALMOS-MKH. |
---|
9 | * |
---|
10 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
11 | * under the terms of the GNU General Public License as published by |
---|
12 | * the Free Software Foundation; version 2.0 of the License. |
---|
13 | * |
---|
14 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | * General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with ALMOS-kernel; if not, write to the Free Software Foundation, |
---|
21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
22 | */ |
---|
23 | |
---|
24 | #ifndef _SOCLIB_IOPIC_H_ |
---|
25 | #define _SOCLIB_IOPIC_H_ |
---|
26 | |
---|
27 | #include <hal_types.h> |
---|
28 | |
---|
29 | /****************************************************************************************** |
---|
30 | * PIC register offsets (per input IRQ) |
---|
31 | *****************************************************************************************/ |
---|
32 | |
---|
33 | #define IOPIC_ADDRESS 0 |
---|
34 | #define IOPIC_EXTEND 1 |
---|
35 | #define IOPIC_STATUS 2 |
---|
36 | #define IOPIC_MASK 3 |
---|
37 | #define IOPIC_SPAN 4 |
---|
38 | |
---|
39 | /****************************************************************************************** |
---|
40 | * This blocking function desactivates all input IRQs in PIC controler. |
---|
41 | * It must be called by a local thread. |
---|
42 | ****************************************************************************************** |
---|
43 | * @ chdev : pointer on PIC chdev descriptor. |
---|
44 | *****************************************************************************************/ |
---|
45 | void soclib_pic_init( chdev_t * chdev ); |
---|
46 | |
---|
47 | /****************************************************************************************** |
---|
48 | * This blocking function returns the status for a given input IRQ in the remote |
---|
49 | * PIC controler. It can be called by any thread running on any cluster. |
---|
50 | ****************************************************************************************** |
---|
51 | * @ dev_xp : extended pointer on the PIC device descriptor. |
---|
52 | * @ irq_id : input IRQ index. |
---|
53 | * @ status : pointer on local buffer for returned status. |
---|
54 | *****************************************************************************************/ |
---|
55 | void soclib_pic_get_status( xptr_t dev_xp, |
---|
56 | uint32_t irq_id, |
---|
57 | uint32_t * status ); |
---|
58 | |
---|
59 | /****************************************************************************************** |
---|
60 | * This blocking function unmask an input IRQ in a remote PIC controler, and bind it |
---|
61 | * with a WTI mailbox, by registering the WTI mailbox extended pointer. |
---|
62 | * It can be called by any thread running on any cluster. |
---|
63 | ****************************************************************************************** |
---|
64 | * @ dev_xp : extended pointer on the PIC device descriptor. |
---|
65 | * @ irq_id : input IRQ index. |
---|
66 | * @ xp_wti : extended pointer on the WTI mailbox. |
---|
67 | *****************************************************************************************/ |
---|
68 | void soclib_pic_bind_irq( xptr_t dev_xp, |
---|
69 | uint32_t irq_id, |
---|
70 | xptr_t wti_xp ); |
---|
71 | |
---|
72 | /****************************************************************************************** |
---|
73 | * This blocking function mask an input IRQ in a remote PIC controler. |
---|
74 | * It can be called by any thread running on any cluster. |
---|
75 | ****************************************************************************************** |
---|
76 | * @ dev_xp : extended pointer on the PIC device descriptor. |
---|
77 | * @ irq_id : input IRQ index. |
---|
78 | *****************************************************************************************/ |
---|
79 | void soclib_pic_unbind_irq( xptr_t dev_xp, |
---|
80 | uint32_t irq_id ); |
---|
81 | |
---|
82 | |
---|
83 | #endif /* _SOCLIB_IOPIC_H_ */ |
---|