]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.c
ARM Packages: Fixed line endings
[mirror_edk2.git] / Omap35xxPkg / Library / DebugAgentTimerLib / DebugAgentTimerLib.c
index 76c13d5527285bbfa961390ee8d68d5d4b8b9359..b3da7366a921e38466d5c358ff081405485990c1 100755 (executable)
 \r
 **/\r
 #include <Base.h>\r
-#include <Library/BaseLib.h>
-#include <Library/IoLib.h>
-#include <Library/OmapLib.h>
+#include <Library/BaseLib.h>\r
+#include <Library/IoLib.h>\r
+#include <Library/OmapLib.h>\r
 #include <Library/ArmLib.h>\r
-#include <Library/PcdLib.h>
+#include <Library/PcdLib.h>\r
 \r
-#include <Omap3530/Omap3530.h>
+#include <Omap3530/Omap3530.h>\r
 \r
 \r
 volatile UINT32 gVector;\r
-
-// Cached registers
-volatile UINT32 gTISR;
-volatile UINT32 gTCLR;
-volatile UINT32 gTLDR;
-volatile UINT32 gTCRR;
-volatile UINT32 gTIER;
+\r
+// Cached registers\r
+volatile UINT32 gTISR;\r
+volatile UINT32 gTCLR;\r
+volatile UINT32 gTLDR;\r
+volatile UINT32 gTCRR;\r
+volatile UINT32 gTIER;\r
 \r
 VOID\r
 EnableInterruptSource (\r
@@ -80,15 +80,15 @@ DebugAgentTimerIntialize (
   UINT32      TimerNumber;\r
 \r
   TimerNumber = PcdGet32(PcdOmap35xxDebugAgentTimer);\r
-  gVector = InterruptVectorForTimer (TimerNumber);
+  gVector = InterruptVectorForTimer (TimerNumber);\r
 \r
-  // Set up the timer registers
-  TimerBaseAddress = TimerBase (TimerNumber);
-  gTISR = TimerBaseAddress + GPTIMER_TISR;
-  gTCLR = TimerBaseAddress + GPTIMER_TCLR;
-  gTLDR = TimerBaseAddress + GPTIMER_TLDR;
-  gTCRR = TimerBaseAddress + GPTIMER_TCRR;
-  gTIER = TimerBaseAddress + GPTIMER_TIER;
+  // Set up the timer registers\r
+  TimerBaseAddress = TimerBase (TimerNumber);\r
+  gTISR = TimerBaseAddress + GPTIMER_TISR;\r
+  gTCLR = TimerBaseAddress + GPTIMER_TCLR;\r
+  gTLDR = TimerBaseAddress + GPTIMER_TLDR;\r
+  gTCRR = TimerBaseAddress + GPTIMER_TCRR;\r
+  gTIER = TimerBaseAddress + GPTIMER_TIER;\r
 \r
   if ((TimerNumber < 2) || (TimerNumber > 9)) {\r
     // This code assumes one the General Purpose timers is used\r
@@ -113,31 +113,31 @@ DebugAgentTimerSetPeriod (
   IN  UINT32  TimerPeriodMilliseconds\r
   )\r
 {\r
-  UINT64      TimerCount;
-  INT32       LoadValue;
-  
-  if (TimerPeriodMilliseconds == 0) {
-    // Turn off GPTIMER3
-    MmioWrite32 (gTCLR, TCLR_ST_OFF);
-    
-    DisableInterruptSource ();
-  } else {  
-    // Calculate required timer count
-    TimerCount = DivU64x32(TimerPeriodMilliseconds * 1000000, PcdGet32(PcdDebugAgentTimerFreqNanoSeconds));
-
-    // Set GPTIMER5 Load register
-    LoadValue = (INT32) -TimerCount;
-    MmioWrite32 (gTLDR, LoadValue);
-    MmioWrite32 (gTCRR, LoadValue);
-
-    // Enable Overflow interrupt
-    MmioWrite32 (gTIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_ENABLE | TIER_MAT_IT_DISABLE);
-
-    // Turn on GPTIMER3, it will reload at overflow
-    MmioWrite32 (gTCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON);
-
-    EnableInterruptSource ();
-  }
+  UINT64      TimerCount;\r
+  INT32       LoadValue;\r
+  \r
+  if (TimerPeriodMilliseconds == 0) {\r
+    // Turn off GPTIMER3\r
+    MmioWrite32 (gTCLR, TCLR_ST_OFF);\r
+    \r
+    DisableInterruptSource ();\r
+  } else {  \r
+    // Calculate required timer count\r
+    TimerCount = DivU64x32(TimerPeriodMilliseconds * 1000000, PcdGet32(PcdDebugAgentTimerFreqNanoSeconds));\r
+\r
+    // Set GPTIMER5 Load register\r
+    LoadValue = (INT32) -TimerCount;\r
+    MmioWrite32 (gTLDR, LoadValue);\r
+    MmioWrite32 (gTCRR, LoadValue);\r
+\r
+    // Enable Overflow interrupt\r
+    MmioWrite32 (gTIER, TIER_TCAR_IT_DISABLE | TIER_OVF_IT_ENABLE | TIER_MAT_IT_DISABLE);\r
+\r
+    // Turn on GPTIMER3, it will reload at overflow\r
+    MmioWrite32 (gTCLR, TCLR_AR_AUTORELOAD | TCLR_ST_ON);\r
+\r
+    EnableInterruptSource ();\r
+  }\r
 }\r
   \r
 \r
@@ -152,10 +152,10 @@ DebugAgentTimerEndOfInterrupt (
   VOID\r
   )\r
 {\r
-   // Clear all timer interrupts
-  MmioWrite32 (gTISR, TISR_CLEAR_ALL);  
-
-  // Poll interrupt status bits to ensure clearing
+   // Clear all timer interrupts\r
+  MmioWrite32 (gTISR, TISR_CLEAR_ALL);  \r
+\r
+  // Poll interrupt status bits to ensure clearing\r
   while ((MmioRead32 (gTISR) & TISR_ALL_INTERRUPT_MASK) != TISR_NO_INTERRUPTS_PENDING);\r
 \r
   MmioWrite32 (INTCPS_CONTROL, INTCPS_CONTROL_NEWFIQAGR);\r
@@ -163,4 +163,4 @@ DebugAgentTimerEndOfInterrupt (
 \r
 }\r
 \r
-  
\ No newline at end of file
+  \r
\ No newline at end of file