1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

forward processor frequency from Linux to HermitCore

=> in HermitCore is frequency detection not required
This commit is contained in:
Stefan Lankes 2015-05-24 09:51:30 +02:00
parent 18630efa6c
commit ef16996588
2 changed files with 13 additions and 1 deletions

View file

@ -35,7 +35,7 @@
extern void isrsyscall(void);
cpu_info_t cpu_info = { 0, 0, 0, 0};
static uint32_t cpu_freq = 0;
extern uint32_t cpu_freq;
static void default_mb(void)
{

View file

@ -39,6 +39,7 @@
* has been running for
*/
static volatile uint64_t timer_ticks = 0;
extern uint32_t cpu_freq;
uint64_t get_clock_tick(void)
{
@ -54,6 +55,14 @@ static void timer_handler(struct state *s)
{
/* Increment our 'tick counter' */
timer_ticks++;
/*
* Every TIMER_FREQ clocks (approximately 1 second), we will
* display a message on the screen
*/
if (timer_ticks % TIMER_FREQ == 0) {
kputs("One second has passed\n");
}
}
#define LATCH(f) ((CLOCK_TICK_RATE + f/2) / f)
@ -74,6 +83,9 @@ int timer_init(void)
irq_install_handler(32, timer_handler);
irq_install_handler(123, timer_handler);
if (cpu_freq) // do we need to configure the timer?
return 0;
/*
* Port 0x43 is for initializing the PIT:
*