pintos/src/devices/timer.c File Reference

#include "devices/timer.h"
#include <debug.h>
#include <inttypes.h>
#include <round.h>
#include <stdio.h>
#include "devices/pit.h"
#include "threads/interrupt.h"
#include "threads/synch.h"
#include "threads/thread.h"

Go to the source code of this file.

Functions

static bool too_many_loops (unsigned loops)
static void busy_wait (int64_t loops)
static void real_time_sleep (int64_t num, int32_t denom)
static void real_time_delay (int64_t num, int32_t denom)
void timer_init (void)
void timer_calibrate (void)
int64_t timer_ticks (void)
int64_t timer_elapsed (int64_t then)
void timer_sleep (int64_t ticks)
void timer_msleep (int64_t ms)
void timer_usleep (int64_t us)
void timer_nsleep (int64_t ns)
void timer_mdelay (int64_t ms)
void timer_udelay (int64_t us)
void timer_ndelay (int64_t ns)
void timer_print_stats (void)
static void timer_interrupt (struct intr_frame *args UNUSED)

Variables

static int64_t ticks
static unsigned loops_per_tick
static intr_handler_func timer_interrupt


Function Documentation

static void NO_INLINE busy_wait ( int64_t  loops  )  [static]

Definition at line 206 of file timer.c.

References barrier.

Referenced by real_time_delay(), and too_many_loops().

static void real_time_delay ( int64_t  num,
int32_t  denom 
) [static]

Definition at line 242 of file timer.c.

References ASSERT, busy_wait(), loops_per_tick, and TIMER_FREQ.

Referenced by real_time_sleep(), timer_mdelay(), timer_ndelay(), and timer_udelay().

static void real_time_sleep ( int64_t  num,
int32_t  denom 
) [static]

Definition at line 214 of file timer.c.

References ASSERT, intr_get_level(), INTR_ON, real_time_delay(), ticks, TIMER_FREQ, and timer_sleep().

Referenced by timer_msleep(), timer_nsleep(), and timer_usleep().

void timer_calibrate ( void   ) 

Definition at line 45 of file timer.c.

References ASSERT, intr_get_level(), INTR_ON, loops_per_tick, printf(), PRIu64, TIMER_FREQ, and too_many_loops().

Referenced by main().

int64_t timer_elapsed ( int64_t  then  ) 

void timer_init ( void   ) 

Definition at line 37 of file timer.c.

References intr_register_ext(), pit_configure_channel(), TIMER_FREQ, and timer_interrupt.

Referenced by main().

static void timer_interrupt ( struct intr_frame *args  UNUSED  )  [static]

Definition at line 173 of file timer.c.

References thread_tick(), and ticks.

void timer_mdelay ( int64_t  ms  ) 

Definition at line 133 of file timer.c.

References real_time_delay().

void timer_msleep ( int64_t  ms  ) 

void timer_ndelay ( int64_t  ns  ) 

Definition at line 159 of file timer.c.

References real_time_delay().

void timer_nsleep ( int64_t  ns  ) 

Definition at line 120 of file timer.c.

References real_time_sleep().

Referenced by select_device().

void timer_print_stats ( void   ) 

Definition at line 166 of file timer.c.

References PRId64, printf(), and timer_ticks().

Referenced by print_stats().

void timer_sleep ( int64_t  ticks  ) 

int64_t timer_ticks ( void   ) 

void timer_udelay ( int64_t  us  ) 

Definition at line 146 of file timer.c.

References real_time_delay().

Referenced by reboot().

void timer_usleep ( int64_t  us  ) 

Definition at line 112 of file timer.c.

References real_time_sleep().

Referenced by reset_channel(), uhci_enable_port(), uhci_init(), and wait_until_idle().

static bool too_many_loops ( unsigned  loops  )  [static]

Definition at line 182 of file timer.c.

References barrier, busy_wait(), start, and ticks.

Referenced by timer_calibrate().


Variable Documentation

unsigned loops_per_tick [static]

Definition at line 26 of file timer.c.

Referenced by real_time_delay(), and timer_calibrate().

int64_t ticks [static]

Definition at line 22 of file timer.c.

Referenced by real_time_sleep(), timer_interrupt(), timer_ticks(), and too_many_loops().

intr_handler_func timer_interrupt [static]

Definition at line 28 of file timer.c.

Referenced by timer_init().


Generated on Mon Jan 10 16:43:58 2011 for Pintos by  doxygen 1.5.6