The Pedigree Project  0.1
malta/Pic.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_MIPS_COMMON_PIC_H
21 #define KERNEL_MACHINE_MIPS_COMMON_PIC_H
22 
23 #include "pedigree/kernel/machine/IrqManager.h"
24 #include "pedigree/kernel/processor/InterruptManager.h"
25 #include "pedigree/kernel/processor/IoPort.h"
26 
31 class Pic : public IrqManager, private InterruptHandler
32 {
33  public:
36  inline static Pic &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 ~Pic()
59  {
60  }
63  Pic(const Pic &);
66  Pic &operator=(const Pic &);
67 
68  //
69  // InterruptHandler interface
70  //
71  virtual void interrupt(size_t interruptNumber, InterruptState &state);
72 
73  void eoi(uint8_t irq);
74  void enable(uint8_t irq, bool enable);
75  void enableAll(bool enable);
76 
78  // IoPort m_SlavePort;
80  // IoPort m_MasterPort;
81 
84 
86  static Pic m_Instance;
87 };
88 
91 #endif
virtual irq_id_t registerPciIrqHandler(IrqHandler *handler, Device *pDevice)
Definition: mach_pc/Pic.cc:86
virtual void acknowledgeIrq(irq_id_t Id)
Definition: mach_pc/Pic.cc:103
static Pic & instance()
Definition: malta/Pic.h:36
Pic & operator=(const Pic &)
virtual void unregisterHandler(irq_id_t Id, IrqHandler *handler)
Definition: mach_pc/Pic.cc:111
List< IrqHandler * > m_Handler[16]
Definition: mach_pc/Pic.h:104
virtual ~Pic()
Definition: malta/Pic.h:58
static Pic m_Instance
Definition: mach_pc/Pic.h:120
Pic() INITIALISATION_ONLY
Definition: mach_pc/Pic.cc:171
virtual void interrupt(size_t interruptNumber, InterruptState &state)
Definition: mach_pc/Pic.cc:204
Abstract base class for interrupt-handlers.
virtual irq_id_t registerIsaIrqHandler(uint8_t irq, IrqHandler *handler, bool bEdge=false)
Definition: mach_pc/Pic.cc:72
bool initialise() INITIALISATION_ONLY
Definition: mach_pc/Pic.cc:131