bios_timer.c File Reference

BIOS timer. More...

#include <gpxe/timer.h>
#include <realmode.h>
#include <bios.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
static unsigned long bios_currticks (void)
 Get current system time in ticks.
 PROVIDE_TIMER_INLINE (pcbios, udelay)
 PROVIDE_TIMER (pcbios, currticks, bios_currticks)
 PROVIDE_TIMER_INLINE (pcbios, ticks_per_sec)


Detailed Description

BIOS timer.

Definition in file bios_timer.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

static unsigned long bios_currticks ( void   )  [static]

Get current system time in ticks.

Return values:
ticks Current time, in ticks
Use direct memory access to BIOS variables, longword 0040:006C (ticks today) and byte 0040:0070 (midnight crossover flag) instead of calling timeofday BIOS interrupt.

Definition at line 40 of file bios_timer.c.

References __asm__(), BDA_SEG, get_real, put_real, and REAL_CODE.

00040                                              {
00041         static int days = 0;
00042         uint32_t ticks;
00043         uint8_t midnight;
00044 
00045         /* Re-enable interrupts so that the timer interrupt can occur */
00046         __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
00047                                            "nop\n\t"
00048                                            "nop\n\t"
00049                                            "cli\n\t" ) : : );
00050 
00051         get_real ( ticks, BDA_SEG, 0x006c );
00052         get_real ( midnight, BDA_SEG, 0x0070 );
00053 
00054         if ( midnight ) {
00055                 midnight = 0;
00056                 put_real ( midnight, BDA_SEG, 0x0070 );
00057                 days += 0x1800b0;
00058         }
00059 
00060         return ( days + ticks );
00061 }

PROVIDE_TIMER_INLINE ( pcbios  ,
udelay   
)

PROVIDE_TIMER ( pcbios  ,
currticks  ,
bios_currticks   
)

PROVIDE_TIMER_INLINE ( pcbios  ,
ticks_per_sec   
)


Generated on Tue Apr 6 20:01:13 2010 for gPXE by  doxygen 1.5.7.1