Initialize
| 144 | |
| 145 | // Initialize |
| 146 | void Initialize(uint32_t freq) { |
| 147 | IDT::RegisterInterruptHandler(IRQ0, Handler); |
| 148 | |
| 149 | frequency = freq; |
| 150 | uint32_t divisor = 1193182 / freq; |
| 151 | |
| 152 | // Send the command byte. |
| 153 | outportb(0x43, 0x36); |
| 154 | |
| 155 | // Divisor has to be sent byte-wise, so split here into upper/lower bytes. |
| 156 | uint8_t l = (uint8_t)(divisor & 0xFF); |
| 157 | uint8_t h = (uint8_t)( (divisor>>8) & 0xFF ); |
| 158 | |
| 159 | // Send the frequency divisor. |
| 160 | outportb(0x40, l); |
| 161 | outportb(0x40, h); |
| 162 | } |
| 163 | } |
nothing calls this directly
no test coverage detected