mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
function HalQueryRealTimeClock : partial implementation
svn path=/trunk/; revision=234
This commit is contained in:
parent
621baeefa5
commit
fc52fb7648
1 changed files with 53 additions and 0 deletions
53
reactos/ntoskrnl/hal/x86/time.c
Normal file
53
reactos/ntoskrnl/hal/x86/time.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/hal/x86/time.c
|
||||
* PURPOSE: Getting time information
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#include <internal/stddef.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/ke.h>
|
||||
#include <internal/bitops.h>
|
||||
#include <internal/linkage.h>
|
||||
#include <internal/string.h>
|
||||
|
||||
#include <internal/i386/segment.h>
|
||||
#include <internal/halio.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/* macro BCD_INT : convert bcd to int */
|
||||
#define BCD_INT(bcd) ( ((bcd &0xf0)>>4)*10+(bcd &0x0f) )
|
||||
|
||||
void HalQueryRealTimeClock(PTIME_FIELDS pTime)
|
||||
{
|
||||
//FIXME : wait RTC ok?
|
||||
do
|
||||
{
|
||||
outb(0x70,0);
|
||||
pTime->Second=BCD_INT(inb(0x71));
|
||||
} while(pTime->Second>60);
|
||||
outb(0x70,2);
|
||||
pTime->Minute=BCD_INT(inb(0x71));
|
||||
outb(0x70,4);
|
||||
pTime->Hour=BCD_INT(inb(0x71));
|
||||
outb(0x70,6);
|
||||
pTime->Weekday=BCD_INT(inb(0x71));
|
||||
outb(0x70,7);
|
||||
pTime->Day=BCD_INT(inb(0x71));
|
||||
outb(0x70,8);
|
||||
pTime->Month=BCD_INT(inb(0x71));
|
||||
outb_p(0x70,9);
|
||||
pTime->Year=BCD_INT(inb_p(0x71));
|
||||
if(pTime->Year>80) pTime->Year +=1900;
|
||||
else pTime->Year +=2000;
|
||||
//FIXME pTime->MilliSeconds=
|
||||
}
|
||||
|
Loading…
Reference in a new issue