1 /*
2 * \brief IRQ session interface
3 * \author Christian Helmuth
4 * \author Martin Stein
5 * \date 2007-09-13
6 *
7 * An open IRQ session represents a valid IRQ attachment/association.
8 * Initially, the interrupt is masked and will only occur if enabled. This is
9 * done by calling ack_irq().
10 *
11 * Disassociation from an IRQ is done by closing the session.
12 */
13
14 /*
15 * Copyright (C) 2007-2015 Genode Labs GmbH
16 *
17 * This file is part of the Genode OS framework, which is distributed
18 * under the terms of the GNU General Public License version 2.
19 */
20
21 #ifndef _INCLUDE__IRQ_SESSION__IRQ_SESSION_H_
22 #define _INCLUDE__IRQ_SESSION__IRQ_SESSION_H_
23
24 #include <base/signal.h>
25 #include <base/capability.h>
26 #include <session/session.h>
27
28 namespace Genode {
29 struct Irq_session;
30 }
31
32
33 struct Genode::Irq_session : Session
34 {
35 struct Info {
36 enum Type { INVALID, MSI } type;
37 unsigned long address;
38 unsigned long value;
39 };
40
41 /**
42 * Interrupt trigger
43 */
44 enum Trigger { TRIGGER_UNCHANGED = 0, TRIGGER_LEVEL, TRIGGER_EDGE };
45
46 /**
47 * Interrupt trigger polarity
48 */
49 enum Polarity { POLARITY_UNCHANGED = 0, POLARITY_HIGH, POLARITY_LOW };
50
51 /**
52 * Destructor
53 */
54 virtual ~Irq_session() { }
55
56 /**
57 * Acknowledge handling of last interrupt - re-enables interrupt reception
58 */
59 virtual void ack_irq() = 0;
60
61 /**
62 * Register irq signal handler
63 */
64 virtual void sigh(Genode::Signal_context_capability sigh) = 0;
65
66 /**
67 * Request information about IRQ, e.g. on x86 request MSI address and
68 * MSI value to be programmed to device specific PCI registers.
69 */
70 virtual Info info() = 0;
71
72 /*************
73 ** Session **
74 *************/
75
76 static const char * service_name() { return "IRQ"; }
77
78
79 /*********************
80 ** RPC declaration **
81 *********************/
82
83 GENODE_RPC(Rpc_ack_irq, void, ack_irq);
84 GENODE_RPC(Rpc_sigh, void, sigh, Genode::Signal_context_capability);
85 GENODE_RPC(Rpc_info, Info, info);
86 GENODE_RPC_INTERFACE(Rpc_ack_irq, Rpc_sigh, Rpc_info);
87 };
88
89 #endif /* _INCLUDE__IRQ_SESSION__IRQ_SESSION_H_ */