POK(kernelpart)
pit.c File Reference
#include <errno.h>
#include <bsp.h>
#include <core/time.h>
#include <core/sched.h>
#include <arch/x86/ioports.h>
#include <arch/x86/interrupt.h>
#include "pic.h"
#include "pit.h"

Go to the source code of this file.

Macros

#define OSCILLATOR_RATE   1193180 /** The oscillation rate of x86 clock */
#define PIT_BASE   0x40
#define PIT_IRQ   0

Functions

 INTERRUPT_HANDLER (pit_interrupt)
pok_ret_t pok_x86_qemu_timer_init ()

Macro Definition Documentation

#define OSCILLATOR_RATE   1193180 /** The oscillation rate of x86 clock */

Definition at line 29 of file pit.c.

#define PIT_BASE   0x40

Definition at line 30 of file pit.c.

#define PIT_IRQ   0

Definition at line 31 of file pit.c.


Function Documentation

INTERRUPT_HANDLER ( pit_interrupt  )

Definition at line 33 of file pit.c.

{
(void) frame;
CLOCK_HANDLER
}
pok_ret_t pok_x86_qemu_timer_init ( )

Definition at line 40 of file pit.c.

{
uint16_t pit_freq;
pit_freq = POK_TIMER_FREQUENCY;
outb (PIT_BASE + 3, 0x34); /* Channel0, rate generator, Set LSB then MSB */
outb (PIT_BASE, (OSCILLATOR_RATE / pit_freq) & 0xff);
outb (PIT_BASE, ((OSCILLATOR_RATE / pit_freq) >> 8) & 0xff);
pok_bsp_irq_register (PIT_IRQ, pit_interrupt);
return (POK_ERRNO_OK);
}