Carlos 7797630a24 Lesson 20 step 1, the timer %!s(int64=10) %!d(string=hai) anos
..
cpu 7797630a24 Lesson 20 step 1, the timer %!s(int64=10) %!d(string=hai) anos
drivers 1a98cab56b lesson 20, preliminar %!s(int64=10) %!d(string=hai) anos
kernel 7797630a24 Lesson 20 step 1, the timer %!s(int64=10) %!d(string=hai) anos
Makefile 1a98cab56b lesson 20, preliminar %!s(int64=10) %!d(string=hai) anos
README.md 7797630a24 Lesson 20 step 1, the timer %!s(int64=10) %!d(string=hai) anos
boot 1a98cab56b lesson 20, preliminar %!s(int64=10) %!d(string=hai) anos

README.md

Everything is now ready to test our hardware interrupts.

Timer

The timer is easy to configure. First we'll declare an init_timer() on cpu/timer.h and implement it on cpu/timer.c. It is just a matter of computing the clock frequency and sending the bytes to the appropriate ports.

We will now fix kernel/utils.c int_to_ascii() to print the numbers in the correct order. For that, we need to implement reverse() and strlen().

Finally, go back to the kernel/kernel.c and do two things. Enable interrupts again (very important!) and then initialize the timer interrupt.

Go make run and you'll see the clock ticking!