x86: Add Real-Time Clock Driver

This patch adds a driver for Real-Time Clock (RTC). The RTC timer is
suitable to implement some operating system features such as the
system clock. Actually, the RTC will be used to implement the system
clock in galileo platform.

The driver introduced by this patch programs the RTC to generate
interrupt periodically. The interrupt frequency can be configured by the
user. On each RTC interrupt, a callback configured by the user is called.
As expected, that callback is executed in interrupt context so the user
should be aware of what it is not supposed to do (e.g. to call blocking
functions).

This patch also adds the inb() helper function to helpers.h. The helpers
is a wrapper for assembly 'in' instruction.
This commit is contained in:
Andre Guedes 2015-07-02 17:29:02 -03:00 committed by Jesus Sanchez-Palencia
parent 11098501d8
commit 5f47bafc6a
5 changed files with 154 additions and 1 deletions

View file

@ -43,4 +43,7 @@ void halt(void) __attribute__((__noreturn__));
*/
void outb(uint16_t port, uint8_t byte);
/* Wrapper for the assembly 'in' instruction */
uint8_t inb(uint16_t port);
#endif /* HELPERS_H */