Rev 534 | Rev 1477 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 534 | Rev 576 | ||
---|---|---|---|
Line 37... | Line 37... | ||
37 | #include <arch/pm.h> |
37 | #include <arch/pm.h> |
38 | #include <arch/asm.h> |
38 | #include <arch/asm.h> |
39 | #include <arch/cpuid.h> |
39 | #include <arch/cpuid.h> |
40 | #include <arch.h> |
40 | #include <arch.h> |
41 | #include <time/delay.h> |
41 | #include <time/delay.h> |
- | 42 | #include <interrupt.h> |
|
42 | 43 | ||
43 | /* |
44 | /* |
44 | * i8254 chip driver. |
45 | * i8254 chip driver. |
45 | * Low level time functions. |
46 | * Low level time functions. |
46 | */ |
47 | */ |
Line 50... | Line 51... | ||
50 | 51 | ||
51 | 52 | ||
52 | #define CLK_CONST 1193180 |
53 | #define CLK_CONST 1193180 |
53 | #define MAGIC_NUMBER 1194 |
54 | #define MAGIC_NUMBER 1194 |
54 | 55 | ||
- | 56 | static void i8254_interrupt(int n, void *stack); |
|
- | 57 | ||
55 | void i8254_init(void) |
58 | void i8254_init(void) |
56 | { |
59 | { |
57 | i8254_normal_operation(); |
60 | i8254_normal_operation(); |
58 | } |
61 | } |
59 | 62 | ||
Line 62... | Line 65... | ||
62 | outb(CLK_PORT4, 0x36); |
65 | outb(CLK_PORT4, 0x36); |
63 | pic_disable_irqs(1<<IRQ_CLK); |
66 | pic_disable_irqs(1<<IRQ_CLK); |
64 | outb(CLK_PORT1, (CLK_CONST/HZ) & 0xf); |
67 | outb(CLK_PORT1, (CLK_CONST/HZ) & 0xf); |
65 | outb(CLK_PORT1, (CLK_CONST/HZ) >> 8); |
68 | outb(CLK_PORT1, (CLK_CONST/HZ) >> 8); |
66 | pic_enable_irqs(1<<IRQ_CLK); |
69 | pic_enable_irqs(1<<IRQ_CLK); |
67 | trap_register(VECTOR_CLK, i8254_interrupt); |
70 | exc_register(VECTOR_CLK, "i8254_clock", i8254_interrupt); |
68 | } |
71 | } |
69 | 72 | ||
70 | #define LOOPS 150000 |
73 | #define LOOPS 150000 |
71 | #define SHIFT 11 |
74 | #define SHIFT 11 |
72 | void i8254_calibrate_delay_loop(void) |
75 | void i8254_calibrate_delay_loop(void) |
Line 120... | Line 123... | ||
120 | CPU->frequency_mhz = (clk2-clk1)>>SHIFT; |
123 | CPU->frequency_mhz = (clk2-clk1)>>SHIFT; |
121 | 124 | ||
122 | return; |
125 | return; |
123 | } |
126 | } |
124 | 127 | ||
125 | void i8254_interrupt(__u8 n, __native stack[]) |
128 | void i8254_interrupt(int n, void *stack) |
126 | { |
129 | { |
127 | trap_virtual_eoi(); |
130 | trap_virtual_eoi(); |
128 | clock(); |
131 | clock(); |
129 | } |
132 | } |