The Pedigree Project  0.1
kernel/machine/hosted/IrqManager.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef KERNEL_MACHINE_HOSTED_IRQMANAGER_H
21 #define KERNEL_MACHINE_HOSTED_IRQMANAGER_H
22 
23 #include "pedigree/kernel/machine/IrqManager.h"
24 #include "pedigree/kernel/processor/InterruptManager.h"
25 #include "pedigree/kernel/processor/IoPort.h"
26 #include "pedigree/kernel/utilities/List.h"
27 
32 {
33  public:
36  inline static HostedIrqManager &instance()
37  {
38  return m_Instance;
39  }
40 
41  //
42  // IrqManager interface
43  //
44  virtual irq_id_t
45  registerIsaIrqHandler(uint8_t irq, IrqHandler *handler, bool bEdge = false);
46  virtual irq_id_t
47  registerPciIrqHandler(IrqHandler *handler, Device *pDevice);
48  virtual void acknowledgeIrq(irq_id_t Id);
49  virtual void unregisterHandler(irq_id_t Id, IrqHandler *handler);
50 
55 
57  virtual void tick();
58 
60  virtual bool control(uint8_t irq, ControlCode code, size_t argument);
61 
62  virtual void enable(uint8_t irq, bool enable)
63  {
64  }
65 
66  private:
70  inline virtual ~HostedIrqManager()
71  {
72  }
79 
80  //
81  // InterruptHandler interface
82  //
83  virtual void interrupt(size_t interruptNumber, InterruptState &state);
84 
87 
90 
93 };
94 
97 #endif
HostedIrqManager() INITIALISATION_ONLY
static HostedIrqManager m_Instance
virtual irq_id_t registerPciIrqHandler(IrqHandler *handler, Device *pDevice)
Definition: Device.h:43
virtual void interrupt(size_t interruptNumber, InterruptState &state)
bool initialise() INITIALISATION_ONLY
static HostedIrqManager & instance()
virtual void unregisterHandler(irq_id_t Id, IrqHandler *handler)
virtual void tick()
virtual bool control(uint8_t irq, ControlCode code, size_t argument)
HostedIrqManager & operator=(const HostedIrqManager &)
List< IrqHandler * > m_Handler[2]
Abstract base class for interrupt-handlers.
virtual void acknowledgeIrq(irq_id_t Id)
virtual irq_id_t registerIsaIrqHandler(uint8_t irq, IrqHandler *handler, bool bEdge=false)