]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.c
Update the copyright notice format
[mirror_edk2.git] / Omap35xxPkg / Library / DebugAgentTimerLib / DebugAgentTimerLib.c
index 72b860361bd335f8eba86a0b8d30161fb393115d..76c13d5527285bbfa961390ee8d68d5d4b8b9359 100755 (executable)
@@ -1,9 +1,9 @@
 /** @file\r
   Debug Agent timer lib for OMAP 35xx.\r
 \r
-  Copyright (c) 2008-2010, Apple Inc. All rights reserved.\r
+  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
   \r
-  All rights reserved. This program and the accompanying materials\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
@@ -77,19 +77,27 @@ DebugAgentTimerIntialize (
   )\r
 {\r
   UINT32      TimerBaseAddress;\r
+  UINT32      TimerNumber;\r
 \r
-\r
-  gVector = InterruptVectorForTimer (PcdGet32(PcdOmap35xxDebugAgentTimer));
+  TimerNumber = PcdGet32(PcdOmap35xxDebugAgentTimer);\r
+  gVector = InterruptVectorForTimer (TimerNumber);
 \r
   // Set up the timer registers
-  TimerBaseAddress = TimerBase (PcdGet32(PcdOmap35xxDebugAgentTimer));
+  TimerBaseAddress = TimerBase (TimerNumber);
   gTISR = TimerBaseAddress + GPTIMER_TISR;
   gTCLR = TimerBaseAddress + GPTIMER_TCLR;
   gTLDR = TimerBaseAddress + GPTIMER_TLDR;
   gTCRR = TimerBaseAddress + GPTIMER_TCRR;
   gTIER = TimerBaseAddress + GPTIMER_TIER;
 \r
-  DisableInterruptSource ();\r
+  if ((TimerNumber < 2) || (TimerNumber > 9)) {\r
+    // This code assumes one the General Purpose timers is used\r
+    // GPT2 - GPT9\r
+    CpuDeadLoop ();\r
+  }\r
+  // Set source clock for GPT2 - GPT9 to SYS_CLK\r
+  MmioOr32 (CM_CLKSEL_PER, 1 << (TimerNumber - 2)); \r
+\r
 }\r
   \r
   \r
@@ -154,5 +162,5 @@ DebugAgentTimerEndOfInterrupt (
   ArmDataSyncronizationBarrier ();\r
 \r
 }\r
-  \r
+\r
   
\ No newline at end of file