POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/arch/x86/x86-qemu/pic.h File Reference

Go to the source code of this file.

Defines

#define PIC_MASTER_BASE   0x20
#define PIC_SLAVE_BASE   0xa0
#define PIC_MASTER_ICW1   0x11
#define PIC_MASTER_ICW2   0x20
#define PIC_MASTER_ICW3   0x04
#define PIC_MASTER_ICW4   0x01
#define PIC_SLAVE_ICW1   0x11
#define PIC_SLAVE_ICW2   0x28
#define PIC_SLAVE_ICW3   0x02
#define PIC_SLAVE_ICW4   0x01

Functions

int pok_pic_init ()
int pok_pic_mask (uint8_t irq)
int pok_pic_unmask (uint8_t irq)
void pok_pic_eoi (uint8_t irq)

Define Documentation

#define PIC_MASTER_BASE   0x20

Definition at line 21 of file pic.h.

#define PIC_MASTER_ICW1   0x11

Definition at line 24 of file pic.h.

#define PIC_MASTER_ICW2   0x20

Definition at line 25 of file pic.h.

#define PIC_MASTER_ICW3   0x04

Definition at line 26 of file pic.h.

#define PIC_MASTER_ICW4   0x01

Definition at line 27 of file pic.h.

#define PIC_SLAVE_BASE   0xa0

Definition at line 22 of file pic.h.

#define PIC_SLAVE_ICW1   0x11

Definition at line 29 of file pic.h.

#define PIC_SLAVE_ICW2   0x28

Definition at line 30 of file pic.h.

#define PIC_SLAVE_ICW3   0x02

Definition at line 31 of file pic.h.

#define PIC_SLAVE_ICW4   0x01

Definition at line 32 of file pic.h.


Function Documentation

void pok_pic_eoi ( uint8_t  irq)

Definition at line 90 of file pic.c.

{
   if (irq >= 8)
   {
      outb (PIC_SLAVE_BASE, 0x20);
   }

   outb (PIC_MASTER_BASE, 0x20);
}
int pok_pic_mask ( uint8_t  irq)

Definition at line 46 of file pic.c.

{
   uint8_t mask;

   if (irq > 15)
   {
      return (POK_ERRNO_EINVAL);
   }

   if (irq < 8)
   {
      mask = inb (PIC_MASTER_BASE + 1);
      outb (PIC_MASTER_BASE + 1, mask | (1 << irq));
   }
   else
   {
      mask = inb (PIC_SLAVE_BASE + 1);
      outb (PIC_SLAVE_BASE + 1, mask | (1 << (irq - 8)));
   }

   return (POK_ERRNO_OK);
}
int pok_pic_unmask ( uint8_t  irq)

Definition at line 69 of file pic.c.

{
   uint8_t mask;

   if (irq > 15)
      return (POK_ERRNO_EINVAL);

   if (irq < 8)
   {
      mask = inb(PIC_MASTER_BASE + 1);
      outb(PIC_MASTER_BASE + 1, mask & ~(1 << irq));
   }
   else
   {
      mask = inb(PIC_SLAVE_BASE + 1);
      outb(PIC_SLAVE_BASE + 1, mask & ~(1 << (irq - 8)));
   }

   return (POK_ERRNO_OK);
}