-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathirq0.c
58 lines (52 loc) · 1.05 KB
/
irq0.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "irq0.h"
#include "lib.h"
#include "i8259.h"
//NoBcd,leastfirst then msn, cntr counter0
#define timer_ctrl_port 0x43
#define timer_port 0x40
#define INTR_ON_TERMNAL_COUNT 0x30
#define HARD_RE_TRIG_ONE_SHOT 0x32
#define RATE_GENERATOR 0x34
#define SQUARE_WAVE_MODE 0x36
#define SOFTWARE_STROBE 0x38
#define HZ 20
#define DIVISOR 1193180/HZ
/* open_IRQ0
* Description: start up the IRQ0
* Input: N/A
* Output: N/A
* Return value: N/A
* Side effect: enable irq0
*/
void
open_IRQ0(void)
{
outb(RATE_GENERATOR, timer_ctrl_port);
/* Write the divisor to the time chip port*/
outb(DIVISOR&0xFF, timer_port);
outb(DIVISOR>>8, timer_port);
enable_irq(0);
//printf("IRQ0 ENABLED");
}
/* open_IRQ12
* Description: start up the IRQ12
* Input: N/A
* Output: N/A
* Return value: N/A
* Side effect: enable irq12
*/
void
open_IRQ12(void)
{
printf("enter mouse");
/*
frequency approximate 18hz
*/
//set up the registers.
outb(0xFF, 0x60);
outb(0xF6, 0x60);
outb(0xE6, 0x60);
// enable the mouse.
enable_irq(12);
printf("mouse ENABLED");
}