-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sleep fix #7
base: master
Are you sure you want to change the base?
Sleep fix #7
Conversation
Fixes #6 |
|
||
set_interrupt_handler(0x20, &timer); | ||
outb(PIC1_DATA, inb(PIC1_DATA)&~0x01); | ||
set_interrupt_handler(0x20, & timer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a take-reference, not a bitwise and. please remove the space.
|
||
set_interrupt_handler(0x20, &timer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not change file indentation.
void set_timer_phase(int hz) { | ||
PIT_8254 cmd; | ||
cmd.BCD = BCD_16_BIT; | ||
cmd.mode = MODE_SQR_WAVE; | ||
cmd.RW = RW_READ | RW_WRITE; | ||
cmd.CNTR = 0; | ||
|
||
outb(PIT_CMD, cmd.cmd); | ||
int divisor = 1193180 / hz; | ||
outb(PIT_CH0, divisor & 0xff); | ||
outb(PIT_CH0, divisor >> 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise, do not change file indentation.
void timer(struct interrupt_frame *frame) { | ||
return; | ||
unsigned long ticks; // The amount of ticks that have passed | ||
int hz; // Self-Explanitory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const int = 20;
// Self-explanatory isn't a valuable comment.
Added a sleep function and a get uptime function. The sleep function will be neccicary if you ever plan to add multithreading. Also, I rewrote some of the timer code to be more precise.