ReactOS  0.4.14-dev-49-gfb4591c
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 */
 
#define BCD_INT(bcd)   (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
 

Functions

static UCHAR HalpQueryCMOS (UCHAR Reg)
 
TIMEINFOXboxGetTime (VOID)
 

Macro Definition Documentation

◆ BCD_INT

#define BCD_INT (   bcd)    (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))

Definition at line 24 of file xboxrtc.c.

◆ 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

◆ HalpQueryCMOS()

static UCHAR HalpQueryCMOS ( UCHAR  Reg)
static

Definition at line 27 of file xboxrtc.c.

28 {
29  UCHAR Val;
30  Reg |= 0x80;
31 
32  WRITE_PORT_UCHAR((PUCHAR)0x70, Reg);
33  Val = READ_PORT_UCHAR((PUCHAR)0x71);
34  WRITE_PORT_UCHAR((PUCHAR)0x70, 0);
35 
36  return(Val);
37 }
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
unsigned char UCHAR
Definition: xmlstorage.h:181
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by XboxGetTime().

◆ XboxGetTime()

TIMEINFO* XboxGetTime ( VOID  )

Definition at line 40 of file xboxrtc.c.

41 {
42  static TIMEINFO TimeInfo;
43 
45  {
46  ;
47  }
48 
49  TimeInfo.Second = BCD_INT(HalpQueryCMOS(0));
50  TimeInfo.Minute = BCD_INT(HalpQueryCMOS(2));
51  TimeInfo.Hour = BCD_INT(HalpQueryCMOS(4));
52  TimeInfo.Day = BCD_INT(HalpQueryCMOS(7));
53  TimeInfo.Month = BCD_INT(HalpQueryCMOS(8));
54  TimeInfo.Year = BCD_INT(HalpQueryCMOS(9));
55  if (TimeInfo.Year > 80)
56  TimeInfo.Year += 1900;
57  else
58  TimeInfo.Year += 2000;
59 
60  return &TimeInfo;
61 }
static UCHAR HalpQueryCMOS(UCHAR Reg)
Definition: xboxrtc.c:27
USHORT Second
Definition: fw.h:16
USHORT Month
Definition: fw.h:12
USHORT Minute
Definition: fw.h:15
Definition: fw.h:9
USHORT Year
Definition: fw.h:11
#define BCD_INT(bcd)
Definition: xboxrtc.c:24
USHORT Hour
Definition: fw.h:14
#define RTC_REGISTER_A
Definition: xboxrtc.c:21
USHORT Day
Definition: fw.h:13
#define RTC_REG_A_UIP
Definition: xboxrtc.c:22

Referenced by XboxMachInit().