POK(kernelpart)
pic.c File Reference
#include <types.h>
#include <errno.h>
#include <arch/x86/ioports.h>
#include "pic.h"

Go to the source code of this file.

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)

Function Documentation

void pok_pic_eoi ( uint8_t  irq)

Definition at line 90 of file pic.c.

{
if (irq >= 8)
{
}
}
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);
}