ia32: Add HPET timer initialization abstraction

Initializes the HPET timer if it is configured into the system.

Change-Id: Ia9474e868101abe88e031266b956c6a559745d75
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
Peter Mitsis 2015-08-06 12:37:11 -04:00 committed by Anas Nashif
commit bbb57b5f80
2 changed files with 13 additions and 0 deletions

View file

@ -110,6 +110,7 @@ the 'ia32' platform.
#define HPET_TIMER0_VEC (HPET_TIMER0_IRQ + INT_VEC_IRQ0)
#define HPET_TIMER0_INT_PRI (4)
#define HPET_TIMER0_IRQ (2)
#define HPET_IOAPIC_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
/* serial port (aka COM port) information */

View file

@ -81,6 +81,17 @@ static inline void ioapic_init(void)
} while ((0))
#endif /* CONFIG_IOAPIC */
#ifdef CONFIG_HPET_TIMER
static inline void hpet_irq_set(void)
{
_ioapic_irq_set(HPET_TIMER0_IRQ, HPET_TIMER0_VEC, HPET_IOAPIC_FLAGS);
}
#else
#define hpet_irq_set() \
do { /* nothing */ \
} while ((0))
#endif
#if defined(CONFIG_PRINTK) || defined(CONFIG_STDOUT_CONSOLE)
/**
@ -160,6 +171,7 @@ static int ia32_init(struct device *arg)
loapic_init(); /* NOP if not needed */
ioapic_init(); /* NOP if not needed */
hpet_irq_set(); /* NOP if not needed */
console_init(); /* NOP if not needed */
bluetooth_init(); /* NOP if not needed */
return 0;