FreeNOS
Public Member Functions | Private Types | Private Attributes | Static Private Attributes
IntelPIC Class Reference

Intel 8259 Programmable Interrupt Controller (PIC). More...

#include <IntelPIC.h>

Inheritance diagram for IntelPIC:
IntController

Public Member Functions

 IntelPIC ()
 Constructor. More...
 
Result initialize ()
 Initialize the PIC. More...
 
virtual Result enable (uint irq)
 Enable hardware interrupt (IRQ). More...
 
virtual Result disable (uint irq)
 Disable hardware interrupt (IRQ). More...
 
virtual Result clear (uint irq)
 Clear hardware interrupt (IRQ). More...
 
- Public Member Functions inherited from IntController
 IntController ()
 Constructor. More...
 
uint getBase () const
 Get interrupt number base offset. More...
 
virtual Result nextPending (uint &irq)
 Retrieve the next pending interrupt (IRQ). More...
 
virtual bool isTriggered (uint irq)
 Check if an IRQ vector is set. More...
 
virtual Result send (const uint targetCoreId, const uint irq)
 Send an inter-processor-interrupt (IPI). More...
 

Private Types

enum  Registers { Command = 0x0, Data = 0x1 }
 Hardware registers. More...
 
enum  CommandFlags {
  Init1 = (1 << 4) | (1 << 0), CascadeMode = (0), LevelTriggered = (0), Mode8086 = (1),
  EndOfInterrupt = (0x20)
}
 Command Register Flags. More...
 

Private Attributes

IntelIO m_master
 I/O instance for master. More...
 
IntelIO m_slave
 I/O instance for slave. More...
 

Static Private Attributes

static const uint InterruptBase = 32
 Base offset for interrupt vectors from the PIC. More...
 
static const uint MasterBase = 0x20
 Master PIC I/O port base offset. More...
 
static const uint SlaveBase = 0xa0
 Slave PIC I/O port base offset. More...
 

Additional Inherited Members

- Public Types inherited from IntController
enum  Result {
  Success, InvalidIRQ, InvalidFrequency, IOError,
  NotFound
}
 Result codes. More...
 
- Protected Attributes inherited from IntController
uint m_base
 Interrupt number base offset. More...
 

Detailed Description

Intel 8259 Programmable Interrupt Controller (PIC).

Definition at line 40 of file IntelPIC.h.

Member Enumeration Documentation

◆ CommandFlags

enum IntelPIC::CommandFlags
private

Command Register Flags.

Enumerator
Init1 
CascadeMode 
LevelTriggered 
Mode8086 
EndOfInterrupt 

Definition at line 70 of file IntelPIC.h.

◆ Registers

enum IntelPIC::Registers
private

Hardware registers.

Enumerator
Command 
Data 

Definition at line 61 of file IntelPIC.h.

Constructor & Destructor Documentation

◆ IntelPIC()

IntelPIC::IntelPIC ( )

Constructor.

Definition at line 20 of file IntelPIC.cpp.

References InterruptBase, IntController::m_base, m_master, m_slave, MasterBase, IntelIO::setPortBase(), and SlaveBase.

Member Function Documentation

◆ clear()

IntelPIC::Result IntelPIC::clear ( uint  irq)
virtual

Clear hardware interrupt (IRQ).

Clearing marks the end of an interrupt service routine and causes the PIC to trigger the interrupt vector again on the next trigger moment.

Parameters
irqInterrupt Request number to clear.
Returns
Result code.

Implements IntController.

Definition at line 81 of file IntelPIC.cpp.

References Command, EndOfInterrupt, IntController::InvalidIRQ, m_master, m_slave, IntelIO::outb(), and IntController::Success.

◆ disable()

IntelPIC::Result IntelPIC::disable ( uint  irq)
virtual

Disable hardware interrupt (IRQ).

Parameters
irqInterrupt Request number.
Returns
Result code.

Implements IntController.

Definition at line 68 of file IntelPIC.cpp.

References Data, IntelIO::inb(), IntController::InvalidIRQ, m_master, m_slave, IntelIO::outb(), and IntController::Success.

◆ enable()

IntelPIC::Result IntelPIC::enable ( uint  irq)
virtual

Enable hardware interrupt (IRQ).

Parameters
irqInterrupt Request number.
Returns
Result code.

Implements IntController.

Definition at line 55 of file IntelPIC.cpp.

References Data, IntelIO::inb(), IntController::InvalidIRQ, m_master, m_slave, IntelIO::outb(), and IntController::Success.

Referenced by initialize().

◆ initialize()

IntelPIC::Result IntelPIC::initialize ( )

Initialize the PIC.

Returns
Result code.

Definition at line 28 of file IntelPIC.cpp.

References CascadeMode, Command, Data, enable(), Init1, InterruptBase, LevelTriggered, m_master, m_slave, Mode8086, IntelIO::outb(), and IntController::Success.

Referenced by IntelKernel::IntelKernel().

Field Documentation

◆ InterruptBase

const uint IntelPIC::InterruptBase = 32
staticprivate

Base offset for interrupt vectors from the PIC.

External IRQ numbers 0-15 are remapped to interrupt vectors 32-47, because CPU exceptions on Intel are fixed to vectors 0-17.

Definition at line 50 of file IntelPIC.h.

Referenced by initialize(), and IntelPIC().

◆ m_master

IntelIO IntelPIC::m_master
private

I/O instance for master.

Definition at line 127 of file IntelPIC.h.

Referenced by clear(), disable(), enable(), initialize(), and IntelPIC().

◆ m_slave

IntelIO IntelPIC::m_slave
private

I/O instance for slave.

Definition at line 130 of file IntelPIC.h.

Referenced by clear(), disable(), enable(), initialize(), and IntelPIC().

◆ MasterBase

const uint IntelPIC::MasterBase = 0x20
staticprivate

Master PIC I/O port base offset.

Definition at line 53 of file IntelPIC.h.

Referenced by IntelPIC().

◆ SlaveBase

const uint IntelPIC::SlaveBase = 0xa0
staticprivate

Slave PIC I/O port base offset.

Definition at line 56 of file IntelPIC.h.

Referenced by IntelPIC().


The documentation for this class was generated from the following files: