Sleep fix#7
Open
circutrider21 wants to merge 2 commits intotmathmeyer:masterfrom
circutrider21:sleep-fix
Open
Conversation
Author
|
Fixes #6 |
tmathmeyer
requested changes
Nov 24, 2020
|
|
||
| set_interrupt_handler(0x20, &timer); | ||
| outb(PIC1_DATA, inb(PIC1_DATA)&~0x01); | ||
| set_interrupt_handler(0x20, & timer); |
Owner
There was a problem hiding this comment.
This is a take-reference, not a bitwise and. please remove the space.
| ticks = 0; | ||
| set_timer_phase(); | ||
|
|
||
| set_interrupt_handler(0x20, &timer); |
Owner
There was a problem hiding this comment.
Please do not change file indentation.
Comment on lines
-12
to
-22
| 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); |
Owner
There was a problem hiding this comment.
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 |
Owner
There was a problem hiding this comment.
const int = 20;
// Self-explanatory isn't a valuable comment.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.