POK(kernelpart)
Main Page
Data Structures
Files
File List
Globals
pit.c
Go to the documentation of this file.
1
/*
2
* POK header
3
*
4
* The following file is a part of the POK project. Any modification should
5
* made according to the POK licence. You CANNOT use this file or a part of
6
* this file is this part of a file for your own project
7
*
8
* For more information on the POK licence, please see our LICENCE FILE
9
*
10
* Please follow the coding guidelines described in doc/CODING_GUIDELINES
11
*
12
* Copyright (c) 2007-2009 POK team
13
*
14
* Created by julien on Thu Jan 15 23:34:13 2009
15
*/
16
17
18
#include <
errno.h
>
19
#include <
bsp.h
>
20
#include <
core/time.h
>
21
#include <
core/sched.h
>
22
#include <
arch/x86/ioports.h
>
23
#include <
arch/x86/interrupt.h
>
24
25
#include "
pic.h
"
26
27
#include "
pit.h
"
28
29
#define OSCILLATOR_RATE 1193180
30
#define PIT_BASE 0x40
31
#define PIT_IRQ 0
32
33
INTERRUPT_HANDLER
(pit_interrupt)
34
{
35
(void) frame;
36
pok_pic_eoi
(
PIT_IRQ
);
37
CLOCK_HANDLER
38
}
39
40
pok_ret_t
pok_x86_qemu_timer_init
()
41
{
42
uint16_t
pit_freq;
43
44
pit_freq = POK_TIMER_FREQUENCY;
45
46
outb
(
PIT_BASE
+ 3, 0x34);
/* Channel0, rate generator, Set LSB then MSB */
47
outb
(
PIT_BASE
, (
OSCILLATOR_RATE
/ pit_freq) & 0xff);
48
outb
(
PIT_BASE
, ((
OSCILLATOR_RATE
/ pit_freq) >> 8) & 0xff);
49
50
pok_bsp_irq_register
(
PIT_IRQ
, pit_interrupt);
51
52
return
(
POK_ERRNO_OK
);
53
}
54
55
kernel
arch
x86
x86-qemu
pit.c
Generated on Fri Jun 1 2012 19:07:12 for POK(kernelpart) by
1.8.1