Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Sleep fix #7

wants to merge 2 commits into from

Conversation

circutrider21
Copy link

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.

@circutrider21
Copy link
Author

Fixes #6


set_interrupt_handler(0x20, &timer);
outb(PIC1_DATA, inb(PIC1_DATA)&~0x01);
set_interrupt_handler(0x20, & timer);
Copy link
Owner

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);
Copy link
Owner

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.

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);
Copy link
Owner

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants