iPXE
Macros | Functions
pic8259.h File Reference
#include <ipxe/io.h>

Go to the source code of this file.

Macros

#define PIC8259_H
 
#define IRQ_PIC_CUTOFF   8
 
#define PIC1_ICW1   0x20
 
#define PIC1_OCW2   0x20
 
#define PIC1_OCW3   0x20
 
#define PIC1_ICR   0x20
 
#define PIC1_IRR   0x20
 
#define PIC1_ISR   0x20
 
#define PIC1_ICW2   0x21
 
#define PIC1_ICW3   0x21
 
#define PIC1_ICW4   0x21
 
#define PIC1_IMR   0x21
 
#define PIC2_ICW1   0xa0
 
#define PIC2_OCW2   0xa0
 
#define PIC2_OCW3   0xa0
 
#define PIC2_ICR   0xa0
 
#define PIC2_IRR   0xa0
 
#define PIC2_ISR   0xa0
 
#define PIC2_ICW2   0xa1
 
#define PIC2_ICW3   0xa1
 
#define PIC2_ICW4   0xa1
 
#define PIC2_IMR   0xa1
 
#define OCW3_ID   0x08
 
#define OCW3_READ_IRR   0x02
 
#define OCW3_READ_ISR   0x03
 
#define ICR_EOI_NON_SPECIFIC   0x20
 
#define ICR_EOI_NOP   0x40
 
#define ICR_EOI_SPECIFIC   0x60
 
#define ICR_EOI_SET_PRIORITY   0xc0
 
#define IMR_REG(x)   ( (x) < IRQ_PIC_CUTOFF ? PIC1_IMR : PIC2_IMR )
 
#define IMR_BIT(x)   ( 1 << ( (x) % IRQ_PIC_CUTOFF ) )
 
#define ICR_REG(irq)   ( (irq) < IRQ_PIC_CUTOFF ? PIC1_ICR : PIC2_ICR )
 
#define ICR_VALUE(irq)   ( (irq) % IRQ_PIC_CUTOFF )
 
#define CHAINED_IRQ   2
 
#define IRQ_INT(irq)   ( ( ( (irq) - IRQ_PIC_CUTOFF ) ^ 0x70 ) & 0x7f )
 
#define IRQ_MAX   15
 
#define IRQ_NONE   -1U
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static __attribute__ ((always_inline)) int irq_enabled(unsigned int irq)
 Check if interrupt is enabled. More...
 
void send_eoi (unsigned int irq)
 Send End-Of-Interrupt to the PIC. More...
 

Macro Definition Documentation

◆ PIC8259_H

#define PIC8259_H

Definition at line 10 of file pic8259.h.

◆ IRQ_PIC_CUTOFF

#define IRQ_PIC_CUTOFF   8

Definition at line 14 of file pic8259.h.

◆ PIC1_ICW1

#define PIC1_ICW1   0x20

Definition at line 17 of file pic8259.h.

◆ PIC1_OCW2

#define PIC1_OCW2   0x20

Definition at line 18 of file pic8259.h.

◆ PIC1_OCW3

#define PIC1_OCW3   0x20

Definition at line 19 of file pic8259.h.

◆ PIC1_ICR

#define PIC1_ICR   0x20

Definition at line 20 of file pic8259.h.

◆ PIC1_IRR

#define PIC1_IRR   0x20

Definition at line 21 of file pic8259.h.

◆ PIC1_ISR

#define PIC1_ISR   0x20

Definition at line 22 of file pic8259.h.

◆ PIC1_ICW2

#define PIC1_ICW2   0x21

Definition at line 23 of file pic8259.h.

◆ PIC1_ICW3

#define PIC1_ICW3   0x21

Definition at line 24 of file pic8259.h.

◆ PIC1_ICW4

#define PIC1_ICW4   0x21

Definition at line 25 of file pic8259.h.

◆ PIC1_IMR

#define PIC1_IMR   0x21

Definition at line 26 of file pic8259.h.

◆ PIC2_ICW1

#define PIC2_ICW1   0xa0

Definition at line 27 of file pic8259.h.

◆ PIC2_OCW2

#define PIC2_OCW2   0xa0

Definition at line 28 of file pic8259.h.

◆ PIC2_OCW3

#define PIC2_OCW3   0xa0

Definition at line 29 of file pic8259.h.

◆ PIC2_ICR

#define PIC2_ICR   0xa0

Definition at line 30 of file pic8259.h.

◆ PIC2_IRR

#define PIC2_IRR   0xa0

Definition at line 31 of file pic8259.h.

◆ PIC2_ISR

#define PIC2_ISR   0xa0

Definition at line 32 of file pic8259.h.

◆ PIC2_ICW2

#define PIC2_ICW2   0xa1

Definition at line 33 of file pic8259.h.

◆ PIC2_ICW3

#define PIC2_ICW3   0xa1

Definition at line 34 of file pic8259.h.

◆ PIC2_ICW4

#define PIC2_ICW4   0xa1

Definition at line 35 of file pic8259.h.

◆ PIC2_IMR

#define PIC2_IMR   0xa1

Definition at line 36 of file pic8259.h.

◆ OCW3_ID

#define OCW3_ID   0x08

Definition at line 39 of file pic8259.h.

◆ OCW3_READ_IRR

#define OCW3_READ_IRR   0x02

Definition at line 40 of file pic8259.h.

◆ OCW3_READ_ISR

#define OCW3_READ_ISR   0x03

Definition at line 41 of file pic8259.h.

◆ ICR_EOI_NON_SPECIFIC

#define ICR_EOI_NON_SPECIFIC   0x20

Definition at line 42 of file pic8259.h.

◆ ICR_EOI_NOP

#define ICR_EOI_NOP   0x40

Definition at line 43 of file pic8259.h.

◆ ICR_EOI_SPECIFIC

#define ICR_EOI_SPECIFIC   0x60

Definition at line 44 of file pic8259.h.

◆ ICR_EOI_SET_PRIORITY

#define ICR_EOI_SET_PRIORITY   0xc0

Definition at line 45 of file pic8259.h.

◆ IMR_REG

#define IMR_REG (   x)    ( (x) < IRQ_PIC_CUTOFF ? PIC1_IMR : PIC2_IMR )

Definition at line 48 of file pic8259.h.

◆ IMR_BIT

#define IMR_BIT (   x)    ( 1 << ( (x) % IRQ_PIC_CUTOFF ) )

Definition at line 49 of file pic8259.h.

◆ ICR_REG

#define ICR_REG (   irq)    ( (irq) < IRQ_PIC_CUTOFF ? PIC1_ICR : PIC2_ICR )

Definition at line 52 of file pic8259.h.

◆ ICR_VALUE

#define ICR_VALUE (   irq)    ( (irq) % IRQ_PIC_CUTOFF )

Definition at line 53 of file pic8259.h.

◆ CHAINED_IRQ

#define CHAINED_IRQ   2

Definition at line 54 of file pic8259.h.

◆ IRQ_INT

#define IRQ_INT (   irq)    ( ( ( (irq) - IRQ_PIC_CUTOFF ) ^ 0x70 ) & 0x7f )

Definition at line 57 of file pic8259.h.

◆ IRQ_MAX

#define IRQ_MAX   15

Definition at line 60 of file pic8259.h.

◆ IRQ_NONE

#define IRQ_NONE   -1U

Definition at line 61 of file pic8259.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ __attribute__()

static __attribute__ ( (always_inline)  )
inlinestatic

Check if interrupt is enabled.

Disable interrupt.

Enable interrupt.

Parameters
irqInterrupt number
Return values
enabledInterrupt is currently enabled
Parameters
irqInterrupt number
Return values
enabledInterrupt was previously enabled

Definition at line 69 of file pic8259.h.

70  {
71  int imr = inb ( IMR_REG ( irq ) );
72  int mask = IMR_BIT ( irq );
73 
74  return ( ( imr & mask ) == 0 );
75 }
#define IMR_BIT(x)
Definition: pic8259.h:49
Definition: sis900.h:27
uint8_t inb(volatile uint8_t *io_addr)
Read byte from I/O-mapped device.
#define IMR_REG(x)
Definition: pic8259.h:48

References imr, IMR_BIT, IMR_REG, and inb().

◆ send_eoi()

void send_eoi ( unsigned int  irq)

Send End-Of-Interrupt to the PIC.

Parameters
irqIRQ number

Definition at line 65 of file pic8259.c.

65  {
66  send_specific_eoi ( irq );
67 }
static void send_specific_eoi(unsigned int irq)
Send specific EOI(s)
Definition: pic8259.c:51

References send_specific_eoi().

Referenced by undinet_open().