+/**\r
+ Get the state of the local APIC timer.\r
+\r
+ @param DivideValue Return the divide value for the DCR. It is one of 1,2,4,8,16,32,64,128.\r
+ @param PeriodicMode Return the timer mode. If TRUE, timer mode is peridoic. Othewise, timer mode is one-shot.\r
+ @param Vector Return the timer interrupt vector number.\r
+**/\r
+VOID\r
+EFIAPI\r
+GetApicTimerState (\r
+ OUT UINTN *DivideValue OPTIONAL,\r
+ OUT BOOLEAN *PeriodicMode OPTIONAL,\r
+ OUT UINT8 *Vector OPTIONAL\r
+ )\r
+{\r
+ UINT32 Divisor;\r
+ LOCAL_APIC_DCR Dcr;\r
+ LOCAL_APIC_LVT_TIMER LvtTimer;\r
+\r
+ if (DivideValue != NULL) {\r
+ Dcr.Uint32 = ReadLocalApicReg (XAPIC_TIMER_DIVIDE_CONFIGURATION_OFFSET);\r
+ Divisor = Dcr.Bits.DivideValue1 | (Dcr.Bits.DivideValue2 << 2);\r
+ Divisor = (Divisor + 1) & 0x7;\r
+ *DivideValue = ((UINTN)1) << Divisor;\r
+ }\r
+\r
+ if (PeriodicMode != NULL || Vector != NULL) {\r
+ LvtTimer.Uint32 = ReadLocalApicReg (XAPIC_LVT_TIMER_OFFSET);\r
+ if (PeriodicMode != NULL) {\r
+ if (LvtTimer.Bits.TimerMode == 1) {\r
+ *PeriodicMode = TRUE;\r
+ } else {\r
+ *PeriodicMode = FALSE;\r
+ }\r
+ }\r
+ if (Vector != NULL) {\r
+ *Vector = (UINT8) LvtTimer.Bits.Vector;\r
+ }\r
+ }\r
+}\r
+\r