Barrelfish
Functions
pic.h File Reference

Header file for classic 8259A PIC. More...

Functions

void pic_init (void)
 Initialize 8259A. More...
 
bool pic_have_interrupt (int irq)
 returns true iff the PIC has an interrupt pending
 
int pic_pending_interrupt (void)
 Queries the PIC for pending interrupts. More...
 
void pic_eoi (int irq)
 Send end of interrupt.
 
void pic_toggle_irq (int irq, bool enable)
 Enable/Disable interrupt 'irq'. More...
 

Detailed Description

Header file for classic 8259A PIC.

Function Documentation

void pic_init ( void  )

Initialize 8259A.

Initializes both master and slave 8259A in the standard cascaded way (slave attached to IR line 2 of master). Sets off interrupts by 32, leaving the lower 32 IRQs reserved for processor exceptions, as required by protected mode. Sets all interrupts to edge triggered. Finally, masks out all interrupts. If an interrupt is expected by the OS, it has to be unmasked individually.

int pic_pending_interrupt ( void  )

Queries the PIC for pending interrupts.

Returns
IRQ number of pending interrupt, or -1 if nothing is pending
void pic_toggle_irq ( int  irq,
bool  enable 
)

Enable/Disable interrupt 'irq'.

Be careful to serialize calls to this function on a multiprocessor. In general, the classic 8259A should not be used on a multiprocessor.