Changes in kernel/arch/ia32/src/drivers/i8254.c [24abb85d:a35b458] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/drivers/i8254.c
r24abb85d ra35b458 89 89 i8254_irq.handler = i8254_irq_handler; 90 90 irq_register(&i8254_irq); 91 91 92 92 i8254_normal_operation(); 93 93 } … … 111 111 pio_write_8(CLK_PORT1, 0xff); 112 112 pio_write_8(CLK_PORT1, 0xff); 113 113 114 114 uint8_t not_ok; 115 115 uint32_t t1; 116 116 uint32_t t2; 117 117 118 118 do { 119 119 /* will read both status and count */ … … 123 123 t1 |= pio_read_8(CLK_PORT1) << 8; 124 124 } while (not_ok); 125 125 126 126 asm_delay_loop(LOOPS); 127 127 128 128 pio_write_8(CLK_PORT4, 0xd2); 129 129 t2 = pio_read_8(CLK_PORT1); 130 130 t2 |= pio_read_8(CLK_PORT1) << 8; 131 131 132 132 /* 133 133 * We want to determine the overhead of the calibrating mechanism. … … 136 136 uint32_t o1 = pio_read_8(CLK_PORT1); 137 137 o1 |= pio_read_8(CLK_PORT1) << 8; 138 138 139 139 asm_fake_loop(LOOPS); 140 140 141 141 pio_write_8(CLK_PORT4, 0xd2); 142 142 uint32_t o2 = pio_read_8(CLK_PORT1); 143 143 o2 |= pio_read_8(CLK_PORT1) << 8; 144 144 145 145 CPU->delay_loop_const = 146 146 ((MAGIC_NUMBER * LOOPS) / 1000) / ((t1 - t2) - (o1 - o2)) + 147 147 (((MAGIC_NUMBER * LOOPS) / 1000) % ((t1 - t2) - (o1 - o2)) ? 1 : 0); 148 148 149 149 uint64_t clk1 = get_cycle(); 150 150 delay(1 << SHIFT); 151 151 uint64_t clk2 = get_cycle(); 152 152 153 153 CPU->frequency_mhz = (clk2 - clk1) >> SHIFT; 154 154 155 155 return; 156 156 }
Note:
See TracChangeset
for help on using the changeset viewer.