FreeNOS
IntelPIC.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __LIBARCH_INTEL_PIC_H
19#define __LIBARCH_INTEL_PIC_H
20
21#include <Types.h>
22#include <BitOperations.h>
23#include <IntController.h>
24#include "IntelIO.h"
25
40class IntelPIC : public IntController
41{
42 private:
43
50 static const uint InterruptBase = 32;
51
53 static const uint MasterBase = 0x20;
54
56 static const uint SlaveBase = 0xa0;
57
62 {
63 Command = 0x0,
64 Data = 0x1
65 };
66
71 {
72 Init1 = (1 << 4) | (1 << 0),
75 Mode8086 = (1),
76 EndOfInterrupt = (0x20)
77 };
78
79 public:
80
84 IntelPIC();
85
92
100 virtual Result enable(uint irq);
101
109 virtual Result disable(uint irq);
110
122 virtual Result clear(uint irq);
123
124 private:
125
128
131};
132
139#endif /* __LIBARCH_INTEL_PIC_H */
Interrupt controller interface.
Result
Result codes.
Intel I/O functions.
Definition IntelIO.h:39
Intel 8259 Programmable Interrupt Controller (PIC).
Definition IntelPIC.h:41
IntelPIC()
Constructor.
Definition IntelPIC.cpp:20
virtual Result disable(uint irq)
Disable hardware interrupt (IRQ).
Definition IntelPIC.cpp:68
static const uint SlaveBase
Slave PIC I/O port base offset.
Definition IntelPIC.h:56
static const uint MasterBase
Master PIC I/O port base offset.
Definition IntelPIC.h:53
IntelIO m_slave
I/O instance for slave.
Definition IntelPIC.h:130
Result initialize()
Initialize the PIC.
Definition IntelPIC.cpp:28
virtual Result enable(uint irq)
Enable hardware interrupt (IRQ).
Definition IntelPIC.cpp:55
Registers
Hardware registers.
Definition IntelPIC.h:62
@ Command
Definition IntelPIC.h:63
CommandFlags
Command Register Flags.
Definition IntelPIC.h:71
@ EndOfInterrupt
Definition IntelPIC.h:76
@ LevelTriggered
Definition IntelPIC.h:74
@ Mode8086
Definition IntelPIC.h:75
@ CascadeMode
Definition IntelPIC.h:73
virtual Result clear(uint irq)
Clear hardware interrupt (IRQ).
Definition IntelPIC.cpp:81
static const uint InterruptBase
Base offset for interrupt vectors from the PIC.
Definition IntelPIC.h:50
IntelIO m_master
I/O instance for master.
Definition IntelPIC.h:127
unsigned int uint
Unsigned integer number.
Definition Types.h:44