ReactOS 0.4.16-dev-2208-g6350669
xboxrtc.c File Reference
#include <freeldr.h>
Include dependency graph for xboxrtc.c:

Go to the source code of this file.

Macros

#define RTC_REGISTER_A   0x0A
 
#define RTC_REG_A_UIP   0x80 /* Update In Progress bit */
 

Functions

static UCHAR BCD_INT (_In_ UCHAR Bcd)
 
static UCHAR HalpQueryCMOS (UCHAR Reg)
 
TIMEINFOXboxGetTime (VOID)
 

Macro Definition Documentation

◆ RTC_REG_A_UIP

#define RTC_REG_A_UIP   0x80 /* Update In Progress bit */

Definition at line 22 of file xboxrtc.c.

◆ RTC_REGISTER_A

#define RTC_REGISTER_A   0x0A

Definition at line 21 of file xboxrtc.c.

Function Documentation

◆ BCD_INT()

static UCHAR BCD_INT ( _In_ UCHAR  Bcd)
static

Definition at line 26 of file xboxrtc.c.

28{
29 return ((Bcd & 0xF0) >> 4) * 10 + (Bcd & 0x0F);
30}

Referenced by XboxGetTime().

◆ HalpQueryCMOS()

static UCHAR HalpQueryCMOS ( UCHAR  Reg)
static

Definition at line 33 of file xboxrtc.c.

34{
35 UCHAR Val;
36 Reg |= 0x80;
37
38 WRITE_PORT_UCHAR((PUCHAR)0x70, Reg);
39 Val = READ_PORT_UCHAR((PUCHAR)0x71);
40 WRITE_PORT_UCHAR((PUCHAR)0x70, 0);
41
42 return(Val);
43}
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
unsigned char * PUCHAR
Definition: typedefs.h:53
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by XboxGetTime().

◆ XboxGetTime()

TIMEINFO * XboxGetTime ( VOID  )

Definition at line 46 of file xboxrtc.c.

47{
48 static TIMEINFO TimeInfo;
49
51 {
52 ;
53 }
54
55 TimeInfo.Second = BCD_INT(HalpQueryCMOS(0));
56 TimeInfo.Minute = BCD_INT(HalpQueryCMOS(2));
57 TimeInfo.Hour = BCD_INT(HalpQueryCMOS(4));
58 TimeInfo.Day = BCD_INT(HalpQueryCMOS(7));
59 TimeInfo.Month = BCD_INT(HalpQueryCMOS(8));
60 TimeInfo.Year = BCD_INT(HalpQueryCMOS(9));
61 if (TimeInfo.Year > 80)
62 TimeInfo.Year += 1900;
63 else
64 TimeInfo.Year += 2000;
65
66 return &TimeInfo;
67}
Definition: fw.h:10
USHORT Month
Definition: fw.h:12
USHORT Day
Definition: fw.h:13
USHORT Minute
Definition: fw.h:15
USHORT Hour
Definition: fw.h:14
USHORT Second
Definition: fw.h:16
USHORT Year
Definition: fw.h:11
static UCHAR BCD_INT(_In_ UCHAR Bcd)
Definition: xboxrtc.c:26
static UCHAR HalpQueryCMOS(UCHAR Reg)
Definition: xboxrtc.c:33
#define RTC_REG_A_UIP
Definition: xboxrtc.c:22
#define RTC_REGISTER_A
Definition: xboxrtc.c:21

Referenced by MachInit().