ReactOS 0.4.15-dev-8135-g1bc6c90
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}
#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 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}
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
#define BCD_INT(bcd)
Definition: xboxrtc.c:24
static UCHAR HalpQueryCMOS(UCHAR Reg)
Definition: xboxrtc.c:27
#define RTC_REG_A_UIP
Definition: xboxrtc.c:22
#define RTC_REGISTER_A
Definition: xboxrtc.c:21

Referenced by MachInit().