CS318 - Pintos
Pintos source browser for JHU CS318 course
timer.h
Go to the documentation of this file.
1 #ifndef DEVICES_TIMER_H
2 #define DEVICES_TIMER_H
3 
4 #include <round.h>
5 #include <stdint.h>
6 
7 /** Number of timer interrupts per second. */
8 #define TIMER_FREQ 100
9 
10 void timer_init (void);
11 void timer_calibrate (void);
12 
13 int64_t timer_ticks (void);
15 
16 /** Sleep and yield the CPU to other threads. */
18 void timer_msleep (int64_t milliseconds);
19 void timer_usleep (int64_t microseconds);
20 void timer_nsleep (int64_t nanoseconds);
21 
22 /** Busy waits. */
23 void timer_mdelay (int64_t milliseconds);
24 void timer_udelay (int64_t microseconds);
25 void timer_ndelay (int64_t nanoseconds);
26 
27 void timer_print_stats (void);
28 
29 #endif /**< devices/timer.h */
timer_init
void timer_init(void)
Sets up the timer to interrupt TIMER_FREQ times per second, and registers the corresponding interrupt...
Definition: timer.c:36
ticks
static int64_t ticks
See [8254] for hardware details of the 8254 timer chip.
Definition: timer.c:21
timer_usleep
void timer_usleep(int64_t microseconds)
Sleeps for approximately US microseconds.
Definition: timer.c:110
timer_nsleep
void timer_nsleep(int64_t nanoseconds)
Sleeps for approximately NS nanoseconds.
Definition: timer.c:118
timer_udelay
void timer_udelay(int64_t microseconds)
Sleeps for approximately US microseconds.
Definition: timer.c:144
int64_t
signed long long int int64_t
Definition: stdint.h:16
timer_elapsed
int64_t timer_elapsed(int64_t)
Returns the number of timer ticks elapsed since THEN, which should be a value once returned by timer_...
Definition: timer.c:82
timer_ticks
int64_t timer_ticks(void)
Returns the number of timer ticks since the OS booted.
Definition: timer.c:71
round.h
stdint.h
timer_msleep
void timer_msleep(int64_t milliseconds)
Sleeps for approximately MS milliseconds.
Definition: timer.c:102
timer_ndelay
void timer_ndelay(int64_t nanoseconds)
Sleeps execution for approximately NS nanoseconds.
Definition: timer.c:157
timer_calibrate
void timer_calibrate(void)
Calibrates loops_per_tick, used to implement brief delays.
Definition: timer.c:44
timer_print_stats
void timer_print_stats(void)
devices/timer.h
Definition: timer.c:164
timer_mdelay
void timer_mdelay(int64_t milliseconds)
Busy waits.
Definition: timer.c:131
timer_sleep
void timer_sleep(int64_t ticks)
Sleep and yield the CPU to other threads.
Definition: timer.c:90