Author: hpoussin
Date: Sat Apr 25 00:35:11 2009
New Revision: 40686
URL:
http://svn.reactos.org/svn/reactos?rev=40686&view=rev
Log:
Implement ArcGetTime() and ArcGetRelativeTime()
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/amd64/mach.c
trunk/reactos/boot/freeldr/freeldr/arch/amd64/pcrtc.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/pcrtc.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxrtc.c
trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
trunk/reactos/boot/freeldr/freeldr/custom.c
trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/machpc.h
trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machpc.h
trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h
trunk/reactos/boot/freeldr/freeldr/include/machine.h
trunk/reactos/boot/freeldr/freeldr/machine.c
trunk/reactos/boot/freeldr/freeldr/ui/tui.c
trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c
trunk/reactos/include/reactos/arc/arc.h
Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/mach.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/mach.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/mach.c [iso-8859-1] Sat Apr 25 00:35:11
2009
@@ -54,7 +54,7 @@
MachVtbl.DiskGetPartitionEntry = DiskGetPartitionEntry;
MachVtbl.DiskGetDriveGeometry = PcDiskGetDriveGeometry;
MachVtbl.DiskGetCacheableBlockCount = PcDiskGetCacheableBlockCount;
- MachVtbl.RTCGetCurrentDateTime = PcRTCGetCurrentDateTime;
+ MachVtbl.GetTime = PcGetTime;
MachVtbl.HwDetect = PcHwDetect;
}
Modified: trunk/reactos/boot/freeldr/freeldr/arch/amd64/pcrtc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/amd64/pcrtc.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/amd64/pcrtc.c [iso-8859-1] Sat Apr 25 00:35:11
2009
@@ -1,104 +1,5 @@
-/* $Id: pcrtc.c 21339 2006-03-18 22:09:16Z peterw $
- *
- * FreeLoader
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
+/* No need to duplicate code ; import the i386 version */
-#include <freeldr.h>
-
-#define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
-
-VOID
-PcRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG
Minute, PULONG Second)
-{
- REGS Regs;
-
- if (NULL != Year || NULL != Month || NULL != Day)
- {
- /* Some BIOSes, such es the 1998/07/25 system ROM
- * in the Compaq Deskpro EP/SB, leave CF unchanged
- * if successful, so CF should be cleared before
- * calling this function. */
- __asm__ ("clc");
-
- /* Int 1Ah AH=04h
- * TIME - GET REAL-TIME CLOCK DATE (AT,XT286,PS)
- *
- * AH = 04h
- * CF clear to avoid bug
- * Return:
- * CF clear if successful
- * CH = century (BCD)
- * CL = year (BCD)
- * DH = month (BCD)
- * DL = day (BCD)
- * CF set on error
- */
- Regs.b.ah = 0x04;
- Int386(0x1A, &Regs, &Regs);
-
- if (NULL != Year)
- {
- *Year = 100 * BCD_INT(Regs.b.ch) + BCD_INT(Regs.b.cl);
- }
- if (NULL != Month)
- {
- *Month = BCD_INT(Regs.b.dh);
- }
- if (NULL != Day)
- {
- *Day = BCD_INT(Regs.b.dl);
- }
- }
-
- if (NULL != Hour || NULL != Minute || NULL != Second)
- {
- /* Some BIOSes leave CF unchanged if successful,
- * so CF should be cleared before calling this function. */
- __asm__ ("clc");
-
- /* Int 1Ah AH=02h
- * TIME - GET REAL-TIME CLOCK TIME (AT,XT286,PS)
- *
- * AH = 02h
- * CF clear to avoid bug
- * Return:
- * CF clear if successful
- * CH = hour (BCD)
- * CL = minutes (BCD)
- * DH = seconds (BCD)
- * DL = daylight savings flag (00h standard time, 01h daylight time)
- * CF set on error (i.e. clock not running or in middle of update)
- */
- Regs.b.ah = 0x02;
- Int386(0x1A, &Regs, &Regs);
-
- if (NULL != Hour)
- {
- *Hour = BCD_INT(Regs.b.ch);
- }
- if (NULL != Minute)
- {
- *Minute = BCD_INT(Regs.b.cl);
- }
- if (NULL != Second)
- {
- *Second = BCD_INT(Regs.b.dh);
- }
- }
-}
+#include "../i386/pcrtc.c"
/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c [iso-8859-1] Sat Apr 25 00:35:11
2009
@@ -54,7 +54,7 @@
MachVtbl.DiskGetPartitionEntry = DiskGetPartitionEntry;
MachVtbl.DiskGetDriveGeometry = PcDiskGetDriveGeometry;
MachVtbl.DiskGetCacheableBlockCount = PcDiskGetCacheableBlockCount;
- MachVtbl.RTCGetCurrentDateTime = PcRTCGetCurrentDateTime;
+ MachVtbl.GetTime = PcGetTime;
MachVtbl.HwDetect = PcHwDetect;
}
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c [iso-8859-1] Sat Apr 25
00:35:11 2009
@@ -57,7 +57,7 @@
MachVtbl.DiskGetPartitionEntry = XboxDiskGetPartitionEntry;
MachVtbl.DiskGetDriveGeometry = XboxDiskGetDriveGeometry;
MachVtbl.DiskGetCacheableBlockCount = XboxDiskGetCacheableBlockCount;
- MachVtbl.RTCGetCurrentDateTime = XboxRTCGetCurrentDateTime;
+ MachVtbl.GetTime = XboxGetTime;
MachVtbl.HwDetect = XboxHwDetect;
/* Set LEDs to orange after init */
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcrtc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcrtc.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcrtc.c [iso-8859-1] Sat Apr 25 00:35:11
2009
@@ -21,84 +21,63 @@
#define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
-VOID
-PcRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG
Minute, PULONG Second)
+TIMEINFO*
+PcGetTime(VOID)
{
- REGS Regs;
+ static TIMEINFO TimeInfo;
+ REGS Regs;
- if (NULL != Year || NULL != Month || NULL != Day)
- {
- /* Some BIOSes, such es the 1998/07/25 system ROM
- * in the Compaq Deskpro EP/SB, leave CF unchanged
- * if successful, so CF should be cleared before
- * calling this function. */
- __asm__ ("clc");
+ /* Some BIOSes, such as the 1998/07/25 system ROM
+ * in the Compaq Deskpro EP/SB, leave CF unchanged
+ * if successful, so CF should be cleared before
+ * calling this function. */
+ __asm__ ("clc");
- /* Int 1Ah AH=04h
- * TIME - GET REAL-TIME CLOCK DATE (AT,XT286,PS)
- *
- * AH = 04h
- * CF clear to avoid bug
- * Return:
- * CF clear if successful
- * CH = century (BCD)
- * CL = year (BCD)
- * DH = month (BCD)
- * DL = day (BCD)
- * CF set on error
- */
- Regs.b.ah = 0x04;
- Int386(0x1A, &Regs, &Regs);
+ /* Int 1Ah AH=04h
+ * TIME - GET REAL-TIME CLOCK DATE (AT,XT286,PS)
+ *
+ * AH = 04h
+ * CF clear to avoid bug
+ * Return:
+ * CF clear if successful
+ * CH = century (BCD)
+ * CL = year (BCD)
+ * DH = month (BCD)
+ * DL = day (BCD)
+ * CF set on error
+ */
+ Regs.b.ah = 0x04;
+ Int386(0x1A, &Regs, &Regs);
- if (NULL != Year)
- {
- *Year = 100 * BCD_INT(Regs.b.ch) + BCD_INT(Regs.b.cl);
- }
- if (NULL != Month)
- {
- *Month = BCD_INT(Regs.b.dh);
- }
- if (NULL != Day)
- {
- *Day = BCD_INT(Regs.b.dl);
- }
- }
+ TimeInfo.Year = 100 * BCD_INT(Regs.b.ch) + BCD_INT(Regs.b.cl);
+ TimeInfo.Month = BCD_INT(Regs.b.dh);
+ TimeInfo.Day = BCD_INT(Regs.b.dl);
- if (NULL != Hour || NULL != Minute || NULL != Second)
- {
- /* Some BIOSes leave CF unchanged if successful,
- * so CF should be cleared before calling this function. */
- __asm__ ("clc");
+ /* Some BIOSes leave CF unchanged if successful,
+ * so CF should be cleared before calling this function. */
+ __asm__ ("clc");
- /* Int 1Ah AH=02h
- * TIME - GET REAL-TIME CLOCK TIME (AT,XT286,PS)
- *
- * AH = 02h
- * CF clear to avoid bug
- * Return:
- * CF clear if successful
- * CH = hour (BCD)
- * CL = minutes (BCD)
- * DH = seconds (BCD)
- * DL = daylight savings flag (00h standard time, 01h daylight time)
- * CF set on error (i.e. clock not running or in middle of update)
- */
- Regs.b.ah = 0x02;
- Int386(0x1A, &Regs, &Regs);
+ /* Int 1Ah AH=02h
+ * TIME - GET REAL-TIME CLOCK TIME (AT,XT286,PS)
+ *
+ * AH = 02h
+ * CF clear to avoid bug
+ * Return:
+ * CF clear if successful
+ * CH = hour (BCD)
+ * CL = minutes (BCD)
+ * DH = seconds (BCD)
+ * DL = daylight savings flag (00h standard time, 01h daylight time)
+ * CF set on error (i.e. clock not running or in middle of update)
+ */
+ Regs.b.ah = 0x02;
+ Int386(0x1A, &Regs, &Regs);
- if (NULL != Hour)
- {
- *Hour = BCD_INT(Regs.b.ch);
- }
- if (NULL != Minute)
- {
- *Minute = BCD_INT(Regs.b.cl);
- }
- if (NULL != Second)
- {
- *Second = BCD_INT(Regs.b.dh);
- }
- }
+ TimeInfo.Hour = BCD_INT(Regs.b.ch);
+ TimeInfo.Minute = BCD_INT(Regs.b.cl);
+ TimeInfo.Second = BCD_INT(Regs.b.dh);
+
+ return &TimeInfo;
}
/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxrtc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxrtc.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxrtc.c [iso-8859-1] Sat Apr 25
00:35:11 2009
@@ -37,46 +37,28 @@
return(Val);
}
-VOID
-XboxRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG
Minute, PULONG Second)
+TIMEINFO*
+XboxGetTime(VOID)
{
- while (HalpQueryCMOS (RTC_REGISTER_A) & RTC_REG_A_UIP)
+ static TIMEINFO TimeInfo;
+
+ while (HalpQueryCMOS (RTC_REGISTER_A) & RTC_REG_A_UIP)
{
- ;
+ ;
}
- if (NULL != Second)
- {
- *Second = BCD_INT(HalpQueryCMOS(0));
- }
- if (NULL != Minute)
- {
- *Minute = BCD_INT(HalpQueryCMOS(2));
- }
- if (NULL != Hour)
- {
- *Hour = BCD_INT(HalpQueryCMOS(4));
- }
- if (NULL != Day)
- {
- *Day = BCD_INT(HalpQueryCMOS(7));
- }
- if (NULL != Month)
- {
- *Month = BCD_INT(HalpQueryCMOS(8));
- }
- if (NULL != Year)
- {
- *Year = BCD_INT(HalpQueryCMOS(9));
- if (*Year > 80)
- {
- *Year += 1900;
- }
- else
- {
- *Year += 2000;
- }
- }
+ TimeInfo.Second = BCD_INT(HalpQueryCMOS(0));
+ TimeInfo.Minute = BCD_INT(HalpQueryCMOS(2));
+ TimeInfo.Hour = BCD_INT(HalpQueryCMOS(4));
+ TimeInfo.Day = BCD_INT(HalpQueryCMOS(7));
+ TimeInfo.Month = BCD_INT(HalpQueryCMOS(8));
+ TimeInfo.Year = BCD_INT(HalpQueryCMOS(9));
+ if (TimeInfo.Year > 80)
+ TimeInfo.Year += 1900;
+ else
+ TimeInfo.Year += 2000;
+
+ return &TimeInfo;
}
/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] Sat Apr 25
00:35:11 2009
@@ -342,9 +342,12 @@
return 1;
}
-VOID PpcRTCGetCurrentDateTime( PULONG Hear, PULONG Month, PULONG Day,
- PULONG Hour, PULONG Minute, PULONG Second ) {
- //printf("RTCGeturrentDateTime\n");
+TIMEINFO*
+PpcGetTime(VOID)
+{
+ static TIMEINFO TimeInfo;
+ //printf("PpcGetTime\n");
+ return &TimeInfo;
}
VOID NarrowToWide(WCHAR *wide_name, char *name)
@@ -534,7 +537,7 @@
MachVtbl.DiskGetDriveGeometry = PpcDiskGetDriveGeometry;
MachVtbl.DiskGetCacheableBlockCount = PpcDiskGetCacheableBlockCount;
- MachVtbl.RTCGetCurrentDateTime = PpcRTCGetCurrentDateTime;
+ MachVtbl.GetTime = PpcGetTime;
MachVtbl.HwDetect = PpcHwDetect;
}
Modified: trunk/reactos/boot/freeldr/freeldr/custom.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/custo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/custom.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/custom.c [iso-8859-1] Sat Apr 25 00:35:11 2009
@@ -79,7 +79,7 @@
CHAR SectionName[100];
CHAR BootDriveString[20];
ULONG SectionId;
- ULONG Year, Month, Day, Hour, Minute, Second;
+ TIMEINFO* TimeInfo;
RtlZeroMemory(SectionName, sizeof(SectionName));
RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
@@ -90,8 +90,8 @@
}
// Generate a unique section name
- MachRTCGetCurrentDateTime(&Year, &Month, &Day, &Hour, &Minute,
&Second);
- sprintf(SectionName, "CustomBootDisk%ld%ld%ld%ld%ld%ld", Year, Day, Month,
Hour, Minute, Second);
+ TimeInfo = ArcGetTime();
+ sprintf(SectionName, "CustomBootDisk%u%u%u%u%u%u", TimeInfo->Year,
TimeInfo->Day, TimeInfo->Month, TimeInfo->Hour, TimeInfo->Minute,
TimeInfo->Second);
// Add the section
if (!IniAddSection(SectionName, &SectionId))
@@ -122,7 +122,7 @@
CHAR BootDriveString[20];
CHAR BootPartitionString[20];
ULONG SectionId;
- ULONG Year, Month, Day, Hour, Minute, Second;
+ TIMEINFO* TimeInfo;
RtlZeroMemory(SectionName, sizeof(SectionName));
RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
@@ -139,8 +139,8 @@
}
// Generate a unique section name
- MachRTCGetCurrentDateTime(&Year, &Month, &Day, &Hour, &Minute,
&Second);
- sprintf(SectionName, "CustomBootPartition%ld%ld%ld%ld%ld%ld", Year, Day,
Month, Hour, Minute, Second);
+ TimeInfo = ArcGetTime();
+ sprintf(SectionName, "CustomBootPartition%u%u%u%u%u%u", TimeInfo->Year,
TimeInfo->Day, TimeInfo->Month, TimeInfo->Hour, TimeInfo->Minute,
TimeInfo->Second);
// Add the section
if (!IniAddSection(SectionName, &SectionId))
@@ -178,7 +178,7 @@
CHAR BootPartitionString[20];
CHAR BootSectorFileString[200];
ULONG SectionId;
- ULONG Year, Month, Day, Hour, Minute, Second;
+ TIMEINFO* TimeInfo;
RtlZeroMemory(SectionName, sizeof(SectionName));
RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
@@ -201,8 +201,8 @@
}
// Generate a unique section name
- MachRTCGetCurrentDateTime(&Year, &Month, &Day, &Hour, &Minute,
&Second);
- sprintf(SectionName, "CustomBootSectorFile%ld%ld%ld%ld%ld%ld", Year, Day,
Month, Hour, Minute, Second);
+ TimeInfo = ArcGetTime();
+ sprintf(SectionName, "CustomBootSectorFile%u%u%u%u%u%u", TimeInfo->Year,
TimeInfo->Day, TimeInfo->Month, TimeInfo->Hour, TimeInfo->Minute,
TimeInfo->Second);
// Add the section
if (!IniAddSection(SectionName, &SectionId))
@@ -248,7 +248,7 @@
CHAR ReactOSARCPath[200];
CHAR ReactOSOptions[200];
ULONG SectionId;
- ULONG Year, Month, Day, Hour, Minute, Second;
+ TIMEINFO* TimeInfo;
RtlZeroMemory(SectionName, sizeof(SectionName));
RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
@@ -277,8 +277,8 @@
}
// Generate a unique section name
- MachRTCGetCurrentDateTime(&Year, &Month, &Day, &Hour, &Minute,
&Second);
- sprintf(SectionName, "CustomReactOS%ld%ld%ld%ld%ld%ld", Year, Day, Month,
Hour, Minute, Second);
+ TimeInfo = ArcGetTime();
+ sprintf(SectionName, "CustomReactOS%u%u%u%u%u%u", TimeInfo->Year,
TimeInfo->Day, TimeInfo->Month, TimeInfo->Hour, TimeInfo->Minute,
TimeInfo->Second);
// Add the section
if (!IniAddSection(SectionName, &SectionId))
@@ -321,7 +321,7 @@
CHAR LinuxInitrdString[200];
CHAR LinuxCommandLineString[200];
ULONG SectionId;
- ULONG Year, Month, Day, Hour, Minute, Second;
+ TIMEINFO* TimeInfo;
RtlZeroMemory(SectionName, sizeof(SectionName));
RtlZeroMemory(BootDriveString, sizeof(BootDriveString));
@@ -356,8 +356,8 @@
}
// Generate a unique section name
- MachRTCGetCurrentDateTime(&Year, &Month, &Day, &Hour, &Minute,
&Second);
- sprintf(SectionName, "CustomLinux%ld%ld%ld%ld%ld%ld", Year, Day, Month, Hour,
Minute, Second);
+ TimeInfo = ArcGetTime();
+ sprintf(SectionName, "CustomLinux%u%u%u%u%u%u", TimeInfo->Year,
TimeInfo->Day, TimeInfo->Month, TimeInfo->Hour, TimeInfo->Minute,
TimeInfo->Second);
// Add the section
if (!IniAddSection(SectionName, &SectionId))
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/machpc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/machpc.h [iso-8859-1]
(original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/amd64/machpc.h [iso-8859-1] Sat Apr 25
00:35:11 2009
@@ -55,7 +55,7 @@
BOOLEAN PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry);
ULONG PcDiskGetCacheableBlockCount(ULONG DriveNumber);
-VOID PcRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG
Minute, PULONG Second);
+TIMEINFO* PcGetTime(VOID);
PCONFIGURATION_COMPONENT_DATA PcHwDetect(VOID);
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machpc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machpc.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machpc.h [iso-8859-1] Sat Apr 25
00:35:11 2009
@@ -54,7 +54,7 @@
BOOLEAN PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry);
ULONG PcDiskGetCacheableBlockCount(ULONG DriveNumber);
-VOID PcRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG
Minute, PULONG Second);
+TIMEINFO* PcGetTime(VOID);
PCONFIGURATION_COMPONENT_DATA PcHwDetect(VOID);
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h [iso-8859-1]
(original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h [iso-8859-1] Sat Apr
25 00:35:11 2009
@@ -57,7 +57,7 @@
BOOLEAN XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry);
ULONG XboxDiskGetCacheableBlockCount(ULONG DriveNumber);
-VOID XboxRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG
Minute, PULONG Second);
+TIMEINFO* XboxGetTime(VOID);
PCONFIGURATION_COMPONENT_DATA XboxHwDetect(VOID);
Modified: trunk/reactos/boot/freeldr/freeldr/include/machine.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] Sat Apr 25 00:35:11
2009
@@ -72,7 +72,8 @@
BOOLEAN (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry);
ULONG (*DiskGetCacheableBlockCount)(ULONG DriveNumber);
- VOID (*RTCGetCurrentDateTime)(PULONG Year, PULONG Month, PULONG Day, PULONG Hour,
PULONG Minute, PULONG Second);
+ TIMEINFO* (*GetTime)(VOID);
+ ULONG (*GetRelativeTime)(VOID);
PCONFIGURATION_COMPONENT_DATA (*HwDetect)(VOID);
} MACHVTBL, *PMACHVTBL;
@@ -115,7 +116,8 @@
BOOLEAN MachDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber,
PPARTITION_TABLE_ENTRY PartitionTableEntry);
BOOLEAN MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry);
ULONG MachDiskGetCacheableBlockCount(ULONG DriveNumber);
-VOID MachRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG
Minute, PULONG Second);
+TIMEINFO* ArcGetTime(VOID);
+ULONG ArcGetRelativeTime(VOID);
VOID MachHwDetect(VOID);
VOID MachPrepareForReactOS(IN BOOLEAN Setup);
@@ -147,7 +149,6 @@
#define MachDiskGetPartitionEntry(Drive, Part,
Entry) MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))
#define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive),
(Geom))
#define MachDiskGetCacheableBlockCount(Drive) MachVtbl.DiskGetCacheableBlockCount(Drive)
-#define MachRTCGetCurrentDateTime(Y, Mo, D, H, Mi, S) MachVtbl.RTCGetCurrentDateTime((Y),
(Mo), (D), (H), (Mi), (S));
#define MachHwDetect() MachVtbl.HwDetect()
#endif /* __MACHINE_H_ */
Modified: trunk/reactos/boot/freeldr/freeldr/machine.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/machi…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/machine.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/machine.c [iso-8859-1] Sat Apr 25 00:35:11 2009
@@ -47,7 +47,6 @@
#undef MachDiskGetPartitionEntry
#undef MachDiskGetDriveGeometry
#undef MachDiskGetCacheableBlockCount
-#undef MachRTCGetCurrentDateTime
#undef MachHwDetect
MACHVTBL MachVtbl;
@@ -228,10 +227,24 @@
return MachVtbl.DiskGetCacheableBlockCount(DriveNumber);
}
-VOID
-MachRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG
Minute, PULONG Second)
-{
- MachVtbl.RTCGetCurrentDateTime(Year, Month, Day, Hour, Minute, Second);
+TIMEINFO*
+ArcGetTime(VOID)
+{
+ return MachVtbl.GetTime();
+}
+
+ULONG
+ArcGetRelativeTime(VOID)
+{
+ TIMEINFO* TimeInfo;
+ ULONG ret;
+
+ if (MachVtbl.GetRelativeTime)
+ return MachVtbl.GetRelativeTime();
+
+ TimeInfo = ArcGetTime();
+ ret = ((TimeInfo->Hour * 24) + TimeInfo->Minute) * 60 + TimeInfo->Second;
+ return ret;
}
VOID
Modified: trunk/reactos/boot/freeldr/freeldr/ui/tui.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/tu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/ui/tui.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/ui/tui.c [iso-8859-1] Sat Apr 25 00:35:11 2009
@@ -442,9 +442,8 @@
VOID TuiUpdateDateTime(VOID)
{
- ULONG Year, Month, Day;
- ULONG Hour, Minute, Second;
- CHAR DateString[40];
+ TIMEINFO* TimeInfo;
+ char DateString[40];
CHAR TimeString[40];
CHAR TempString[20];
BOOLEAN PMHour = FALSE;
@@ -452,27 +451,31 @@
/* Don't draw the time if this has been disabled */
if (!UiDrawTime) return;
- MachRTCGetCurrentDateTime(&Year, &Month, &Day, &Hour, &Minute,
&Second);
- if (Year < 1 || 9999 < Year || Month < 1 || 12 < Month || Day < 1 ||
- 31 < Day || 23 < Hour || 59 < Minute || 59 < Second)
+ TimeInfo = ArcGetTime();
+ if (TimeInfo->Year < 1 || 9999 < TimeInfo->Year ||
+ TimeInfo->Month < 1 || 12 < TimeInfo->Month ||
+ TimeInfo->Day < 1 || 31 < TimeInfo->Day ||
+ 23 < TimeInfo->Hour ||
+ 59 < TimeInfo->Minute ||
+ 59 < TimeInfo->Second)
{
/* This happens on QEmu sometimes. We just skip updating */
return;
}
// Get the month name
- strcpy(DateString, UiMonthNames[Month - 1]);
+ strcpy(DateString, UiMonthNames[TimeInfo->Month - 1]);
// Get the day
- _itoa(Day, TempString, 10);
+ _itoa(TimeInfo->Day, TempString, 10);
// Get the day postfix
- if (1 == Day || 21 == Day || 31 == Day)
+ if (1 == TimeInfo->Day || 21 == TimeInfo->Day || 31 == TimeInfo->Day)
{
strcat(TempString, "st");
}
- else if (2 == Day || 22 == Day)
+ else if (2 == TimeInfo->Day || 22 == TimeInfo->Day)
{
strcat(TempString, "nd");
}
- else if (3 == Day || 23 == Day)
+ else if (3 == TimeInfo->Day || 23 == TimeInfo->Day)
{
strcat(TempString, "rd");
}
@@ -486,35 +489,35 @@
strcat(DateString, " ");
// Get the year and add it to the date
- _itoa(Year, TempString, 10);
+ _itoa(TimeInfo->Year, TempString, 10);
strcat(DateString, TempString);
// Draw the date
TuiDrawText(UiScreenWidth-strlen(DateString)-2, 1, DateString, ATTR(UiTitleBoxFgColor,
UiTitleBoxBgColor));
// Get the hour and change from 24-hour mode to 12-hour
- if (Hour > 12)
- {
- Hour -= 12;
+ if (TimeInfo->Hour > 12)
+ {
+ TimeInfo->Hour -= 12;
PMHour = TRUE;
}
- if (Hour == 0)
- {
- Hour = 12;
- }
- _itoa(Hour, TempString, 10);
+ if (TimeInfo->Hour == 0)
+ {
+ TimeInfo->Hour = 12;
+ }
+ _itoa(TimeInfo->Hour, TempString, 10);
strcpy(TimeString, " ");
strcat(TimeString, TempString);
strcat(TimeString, ":");
- _itoa(Minute, TempString, 10);
- if (Minute < 10)
+ _itoa(TimeInfo->Minute, TempString, 10);
+ if (TimeInfo->Minute < 10)
{
strcat(TimeString, "0");
}
strcat(TimeString, TempString);
strcat(TimeString, ":");
- _itoa(Second, TempString, 10);
- if (Second < 10)
+ _itoa(TimeInfo->Second, TempString, 10);
+ if (TimeInfo->Second < 10)
{
strcat(TimeString, "0");
}
Modified: trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/tu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c [iso-8859-1] Sat Apr 25 00:35:11 2009
@@ -23,6 +23,7 @@
UiMenuKeyPressFilterCallback KeyPressFilter)
{
UI_MENU_INFO MenuInformation;
+ ULONG InitialClockSecond;
ULONG LastClockSecond;
ULONG CurrentClockSecond;
ULONG KeyPress;
@@ -59,7 +60,7 @@
//
// Get the current second of time
//
- MachRTCGetCurrentDateTime(NULL, NULL, NULL, NULL, NULL, &LastClockSecond);
+ InitialClockSecond = LastClockSecond = ArcGetRelativeTime();
//
// Process keys
@@ -87,17 +88,12 @@
//
// Check if there is a countdown
//
- if (MenuInformation.MenuTimeRemaining)
- {
- //
- // Get the updated time, seconds only
- //
- MachRTCGetCurrentDateTime(NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- &CurrentClockSecond);
+ if (MenuInformation.MenuTimeRemaining != -1)
+ {
+ //
+ // Get the updated time
+ //
+ CurrentClockSecond = ArcGetRelativeTime();
//
// Check if more then a second has now elapsed
@@ -108,7 +104,10 @@
// Update the time information
//
LastClockSecond = CurrentClockSecond;
- MenuInformation.MenuTimeRemaining--;
+ MenuInformation.MenuTimeRemaining =
+ InitialClockSecond + MenuTimeOut - LastClockSecond;
+ if (MenuInformation.MenuTimeRemaining < 0)
+ MenuInformation.MenuTimeRemaining = 0;
//
// Update the menu
@@ -117,7 +116,7 @@
VideoCopyOffScreenBufferToVRAM();
}
}
- else
+ else if (MenuInformation.MenuTimeRemaining == 0)
{
//
// A time out occurred, exit this loop and return default OS
Modified: trunk/reactos/include/reactos/arc/arc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/arc/arc.h?…
==============================================================================
--- trunk/reactos/include/reactos/arc/arc.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/arc/arc.h [iso-8859-1] Sat Apr 25 00:35:11 2009
@@ -121,6 +121,16 @@
MemoryMaximum
} MEMORY_TYPE;
+typedef struct _TIMEINFO
+{
+ USHORT Year;
+ USHORT Month;
+ USHORT Day;
+ USHORT Hour;
+ USHORT Minute;
+ USHORT Second;
+} TIMEINFO;
+
typedef struct _MEMORY_DESCRIPTOR
{
MEMORY_TYPE MemoryType;