From 24115e44926b33c763f81026690f20efd913daf2 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Fri, 17 Sep 2010 10:42:10 +0000 Subject: RefRefine soma code to make code run safely. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10885 6f19259b-4bc3-4df7-8a09-765794883524 --- PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 32 +++++++++++----------- PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h | 32 +++++++++++----------- 2 files changed, 32 insertions(+), 32 deletions(-) (limited to 'PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe') diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c index 659c01e57a..6c7e0ca6d7 100644 --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c @@ -382,7 +382,7 @@ PcRtcSetTime ( // Read Register B, and inhibit updates of the RTC // RegisterB.Data = RtcRead (RTC_ADDRESS_REGISTER_B); - RegisterB.Bits.SET = 1; + RegisterB.Bits.Set = 1; RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data); ConvertEfiTimeToRtcTime (&RtcTime, RegisterB, &Century); @@ -398,7 +398,7 @@ PcRtcSetTime ( // // Allow updates of the RTC registers // - RegisterB.Bits.SET = 0; + RegisterB.Bits.Set = 0; RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data); // @@ -488,7 +488,7 @@ PcRtcGetWakeupTime ( // // Get the Time/Date/Daylight Savings values. // - *Enabled = RegisterB.Bits.AIE; + *Enabled = RegisterB.Bits.Aie; if (*Enabled) { Time->Second = RtcRead (RTC_ADDRESS_SECONDS_ALARM); Time->Minute = RtcRead (RTC_ADDRESS_MINUTES_ALARM); @@ -531,7 +531,7 @@ PcRtcGetWakeupTime ( return EFI_DEVICE_ERROR; } - *Pending = RegisterC.Bits.AF; + *Pending = RegisterC.Bits.Af; return EFI_SUCCESS; } @@ -614,7 +614,7 @@ PcRtcSetWakeupTime ( // RegisterB.Data = RtcRead (RTC_ADDRESS_REGISTER_B); - RegisterB.Bits.SET = 1; + RegisterB.Bits.Set = 1; RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data); if (Enable) { @@ -627,15 +627,15 @@ PcRtcSetWakeupTime ( RtcWrite (RTC_ADDRESS_MINUTES_ALARM, RtcTime.Minute); RtcWrite (RTC_ADDRESS_HOURS_ALARM, RtcTime.Hour); - RegisterB.Bits.AIE = 1; + RegisterB.Bits.Aie = 1; } else { - RegisterB.Bits.AIE = 0; + RegisterB.Bits.Aie = 0; } // // Allow updates of the RTC registers // - RegisterB.Bits.SET = 0; + RegisterB.Bits.Set = 0; RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data); // @@ -707,7 +707,7 @@ ConvertRtcTimeToEfiTime ( Time->Hour = (UINT8) (Time->Hour & 0x7f); - if (RegisterB.Bits.DM == 0) { + if (RegisterB.Bits.Dm == 0) { Time->Year = CheckAndConvertBcd8ToDecimal8 ((UINT8) Time->Year); Time->Month = CheckAndConvertBcd8ToDecimal8 (Time->Month); Time->Day = CheckAndConvertBcd8ToDecimal8 (Time->Day); @@ -728,7 +728,7 @@ ConvertRtcTimeToEfiTime ( // // If time is in 12 hour format, convert it to 24 hour format // - if (RegisterB.Bits.MIL == 0) { + if (RegisterB.Bits.Mil == 0) { if (IsPM && Time->Hour < 12) { Time->Hour = (UINT8) (Time->Hour + 12); } @@ -764,7 +764,7 @@ RtcWaitToUpdate ( // RegisterD.Data = RtcRead (RTC_ADDRESS_REGISTER_D); - if (RegisterD.Bits.VRT == 0) { + if (RegisterD.Bits.Vrt == 0) { return EFI_DEVICE_ERROR; } // @@ -772,14 +772,14 @@ RtcWaitToUpdate ( // Timeout = (Timeout / 10) + 1; RegisterA.Data = RtcRead (RTC_ADDRESS_REGISTER_A); - while (RegisterA.Bits.UIP == 1 && Timeout > 0) { + while (RegisterA.Bits.Uip == 1 && Timeout > 0) { MicroSecondDelay (10); RegisterA.Data = RtcRead (RTC_ADDRESS_REGISTER_A); Timeout--; } RegisterD.Data = RtcRead (RTC_ADDRESS_REGISTER_D); - if (Timeout == 0 || RegisterD.Bits.VRT == 0) { + if (Timeout == 0 || RegisterD.Bits.Vrt == 0) { return EFI_DEVICE_ERROR; } @@ -914,7 +914,7 @@ ConvertEfiTimeToRtcTime ( // // Adjust hour field if RTC is in 12 hour mode // - if (RegisterB.Bits.MIL == 0) { + if (RegisterB.Bits.Mil == 0) { if (Time->Hour < 12) { IsPM = FALSE; } @@ -932,7 +932,7 @@ ConvertEfiTimeToRtcTime ( Time->Year = (UINT16) (Time->Year % 100); - if (RegisterB.Bits.DM == 0) { + if (RegisterB.Bits.Dm == 0) { Time->Year = DecimalToBcd8 ((UINT8) Time->Year); Time->Month = DecimalToBcd8 (Time->Month); Time->Day = DecimalToBcd8 (Time->Day); @@ -943,7 +943,7 @@ ConvertEfiTimeToRtcTime ( // // If we are in 12 hour mode and PM is set, then set bit 7 of the Hour field. // - if (RegisterB.Bits.MIL == 0 && IsPM) { + if (RegisterB.Bits.Mil == 0 && IsPM) { Time->Hour = (UINT8) (Time->Hour | 0x80); } } diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h index 85492f7b59..d38c8e1464 100644 --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h @@ -84,9 +84,9 @@ typedef struct { // Register A // typedef struct { - UINT8 RS : 4; // Rate Selection Bits - UINT8 DV : 3; // Divisor - UINT8 UIP : 1; // Update in progress + UINT8 Rs : 4; // Rate Selection Bits + UINT8 Dv : 3; // Divisor + UINT8 Uip : 1; // Update in progress } RTC_REGISTER_A_BITS; typedef union { @@ -98,14 +98,14 @@ typedef union { // Register B // typedef struct { - UINT8 DSE : 1; // 0 - Daylight saving disabled 1 - Daylight savings enabled - UINT8 MIL : 1; // 0 - 12 hour mode 1 - 24 hour mode - UINT8 DM : 1; // 0 - BCD Format 1 - Binary Format - UINT8 SQWE : 1; // 0 - Disable SQWE output 1 - Enable SQWE output - UINT8 UIE : 1; // 0 - Update INT disabled 1 - Update INT enabled - UINT8 AIE : 1; // 0 - Alarm INT disabled 1 - Alarm INT Enabled - UINT8 PIE : 1; // 0 - Periodic INT disabled 1 - Periodic INT Enabled - UINT8 SET : 1; // 0 - Normal operation. 1 - Updates inhibited + UINT8 Dse : 1; // 0 - Daylight saving disabled 1 - Daylight savings enabled + UINT8 Mil : 1; // 0 - 12 hour mode 1 - 24 hour mode + UINT8 Dm : 1; // 0 - BCD Format 1 - Binary Format + UINT8 Sqwe : 1; // 0 - Disable SQWE output 1 - Enable SQWE output + UINT8 Uie : 1; // 0 - Update INT disabled 1 - Update INT enabled + UINT8 Aie : 1; // 0 - Alarm INT disabled 1 - Alarm INT Enabled + UINT8 Pie : 1; // 0 - Periodic INT disabled 1 - Periodic INT Enabled + UINT8 Set : 1; // 0 - Normal operation. 1 - Updates inhibited } RTC_REGISTER_B_BITS; typedef union { @@ -118,10 +118,10 @@ typedef union { // typedef struct { UINT8 Reserved : 4; // Read as zero. Can not be written. - UINT8 UF : 1; // Update End Interrupt Flag - UINT8 AF : 1; // Alarm Interrupt Flag - UINT8 PF : 1; // Periodic Interrupt Flag - UINT8 IRQF : 1; // Iterrupt Request Flag = PF & PIE | AF & AIE | UF & UIE + UINT8 Uf : 1; // Update End Interrupt Flag + UINT8 Af : 1; // Alarm Interrupt Flag + UINT8 Pf : 1; // Periodic Interrupt Flag + UINT8 Irqf : 1; // Iterrupt Request Flag = PF & PIE | AF & AIE | UF & UIE } RTC_REGISTER_C_BITS; typedef union { @@ -134,7 +134,7 @@ typedef union { // typedef struct { UINT8 Reserved : 7; // Read as zero. Can not be written. - UINT8 VRT : 1; // Valid RAM and Time + UINT8 Vrt : 1; // Valid RAM and Time } RTC_REGISTER_D_BITS; typedef union { -- cgit v1.2.3