The Pedigree Project  0.1
Heathrow.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_PPC_COMMON_HEATHROW_H
21 #define KERNEL_MACHINE_PPC_COMMON_HEATHROW_H
22 
23 #include "pedigree/kernel/machine/IrqManager.h"
24 #include "pedigree/kernel/processor/InterruptManager.h"
25 #include "pedigree/kernel/processor/MemoryMappedIo.h"
26 
31 class Heathrow : public IrqManager, private InterruptHandler
32 {
33  public:
36  inline static Heathrow &instance()
37  {
38  return m_Instance;
39  }
40 
41  //
42  // IrqManager interface
43  //
44  virtual irq_id_t registerIsaIrqHandler(uint8_t irq, IrqHandler *handler);
45  virtual irq_id_t registerPciIrqHandler(IrqHandler *handler);
46  virtual void acknowledgeIrq(irq_id_t Id);
47  virtual void unregisterHandler(irq_id_t Id, IrqHandler *handler);
48 
53 
54  private:
58  inline virtual ~Heathrow()
59  {
60  }
63  Heathrow(const Heathrow &);
66  Heathrow &operator=(const Heathrow &);
67 
68  void searchNode(class Device *pDev);
69 
70  //
71  // InterruptHandler interface
72  //
73  virtual void interrupt(size_t interruptNumber, InterruptState &state);
74 
75  void eoi(uint8_t irq);
76  void enable(uint8_t irq, bool enable);
77  void enableAll(bool enable);
78 
81 
84 
86  size_t m_nIrqs;
87 
90 
91  uint32_t m_LowMask;
92  uint32_t m_HighMask;
93 };
94 
97 #endif
Heathrow() INITIALISATION_ONLY
Definition: Heathrow.cc:137
Heathrow & operator=(const Heathrow &)
virtual void interrupt(size_t interruptNumber, InterruptState &state)
Definition: Heathrow.cc:143
Abstrace base class for hardware I/O capabilities.
Definition: IoBase.h:31
Definition: Device.h:43
virtual void unregisterHandler(irq_id_t Id, IrqHandler *handler)
Definition: Heathrow.cc:55
virtual ~Heathrow()
Definition: Heathrow.h:58
virtual void acknowledgeIrq(irq_id_t Id)
Definition: Heathrow.cc:47
IoBase * m_pPort
Definition: Heathrow.h:80
IrqHandler * m_Handler[64]
Definition: Heathrow.h:83
Abstract base class for interrupt-handlers.
size_t m_nIrqs
Definition: Heathrow.h:86
bool initialise() INITIALISATION_ONLY
Definition: Heathrow.cc:110
static Heathrow m_Instance
Definition: Heathrow.h:89
static Heathrow & instance()
Definition: Heathrow.h:36