Class PIC

Class PIC

Placement in the overall structure

Module
machine
Base classes
None
Derived classes
None
Time of creation
Task 2
Files
pic.h pic.cc

Description

By using the Programmable Interrupt Controller (PIC), hardware interrupts can be enabled or suppressed individually. This way we can control whether interrupts of a specific device are forwarded to the CPU at all. Even then, the interrupt handler gets only activated if the CPU is ready to react to interrupts. This can be controlled by using class CPU. Thanks to the Automatic-End-Of-Interrupt mode set in the startup code, interrupts do not have to be acknowledged manually.

Public constants

The following constants (as enumeration) are defined for the numbers of the devices connected to the PIC:

enum {
    timer    = 0,
    keyboard = 1
};

Public methods

void allow (int interrupt_device)
Configure the PIC so that it forwards interrupts for the device with the number interrupt_device to the CPU.
void forbid (int interrupt_device)
Configure the PIC so that it suppresses a specific hardware interrupt of the device number interrupt_device.
bool is_masked (int interrupt_device)
Determine the current state of the masking bit of a specific hardware interrupt with interrupt number interrupt_device. If interrupts of this device are not forwarded to the CPU, return true, otherwise return false.