Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenxboxrtc.c
Go to the documentation of this file.
00001 /* $Id: xboxrtc.c 43790 2009-10-27 10:34:16Z dgorbachev $ 00002 * 00003 * FreeLoader 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 00020 #include <freeldr.h> 00021 00022 #define RTC_REGISTER_A 0x0A 00023 #define RTC_REG_A_UIP 0x80 /* Update In Progress bit */ 00024 00025 #define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f)) 00026 00027 static UCHAR 00028 HalpQueryCMOS(UCHAR Reg) 00029 { 00030 UCHAR Val; 00031 Reg |= 0x80; 00032 00033 WRITE_PORT_UCHAR((PUCHAR)0x70, Reg); 00034 Val = READ_PORT_UCHAR((PUCHAR)0x71); 00035 WRITE_PORT_UCHAR((PUCHAR)0x70, 0); 00036 00037 return(Val); 00038 } 00039 00040 TIMEINFO* 00041 XboxGetTime(VOID) 00042 { 00043 static TIMEINFO TimeInfo; 00044 00045 while (HalpQueryCMOS (RTC_REGISTER_A) & RTC_REG_A_UIP) 00046 { 00047 ; 00048 } 00049 00050 TimeInfo.Second = BCD_INT(HalpQueryCMOS(0)); 00051 TimeInfo.Minute = BCD_INT(HalpQueryCMOS(2)); 00052 TimeInfo.Hour = BCD_INT(HalpQueryCMOS(4)); 00053 TimeInfo.Day = BCD_INT(HalpQueryCMOS(7)); 00054 TimeInfo.Month = BCD_INT(HalpQueryCMOS(8)); 00055 TimeInfo.Year = BCD_INT(HalpQueryCMOS(9)); 00056 if (TimeInfo.Year > 80) 00057 TimeInfo.Year += 1900; 00058 else 00059 TimeInfo.Year += 2000; 00060 00061 return &TimeInfo; 00062 } 00063 00064 /* EOF */ Generated on Mon May 28 2012 04:18:41 for ReactOS by
1.7.6.1
|