This repository has been archived by the owner on May 31, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
143 additions
and
147 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,4 @@ typedef struct { | |
char name[]; | ||
} kernel_symbol_t; | ||
|
||
extern void (* symbol_find(const char * name))(void); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <kernel/printf.h> | ||
#include <kernel/process.h> | ||
#include <kernel/arch/x86_64/ports.h> | ||
#include <kernel/arch/x86_64/irq.h> | ||
#include <kernel/arch/x86_64/regs.h> | ||
|
||
/* Programmable interval timer */ | ||
#define PIT_A 0x40 | ||
#define PIT_B 0x41 | ||
#define PIT_C 0x42 | ||
#define PIT_CONTROL 0x43 | ||
|
||
#define PIT_MASK 0xFF | ||
#define PIT_SCALE 1193180 | ||
#define PIT_SET 0x34 | ||
|
||
#define TIMER_IRQ 0 | ||
|
||
#define RESYNC_TIME 1 | ||
|
||
static void pit_set_timer_phase(long hz) { | ||
long divisor = PIT_SCALE / hz; | ||
outportb(PIT_CONTROL, PIT_SET); | ||
outportb(PIT_A, divisor & PIT_MASK); | ||
outportb(PIT_A, (divisor >> 8) & PIT_MASK); | ||
} | ||
|
||
extern int cmos_time_stuff(struct regs *r); | ||
|
||
void pit_initialize(void) { | ||
irq_install_handler(TIMER_IRQ, cmos_time_stuff, "pit timer"); | ||
|
||
/* ELCR? */ | ||
uint8_t val = inportb(0x4D1); | ||
outportb(0x4D1, val | (1 << (10-8)) | (1 << (11-8))); | ||
|
||
/* Enable PIT */ | ||
pit_set_timer_phase(100); /* 1000 Hz */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.