DebugAgentTimerLib cleanup
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 14 Apr 2010 18:05:19 +0000 (18:05 +0000)
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 14 Apr 2010 18:05:19 +0000 (18:05 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10372 6f19259b-4bc3-4df7-8a09-765794883524

Omap35xxPkg/Library/DebugAgentTimerLib/DebugAgentTimerLib.c
Omap35xxPkg/Omap35xxPkg.dec

index 72b860361bd335f8eba86a0b8d30161fb393115d..1abdb63c7c86a8d82240b1682b0d0847684204d5 100755 (executable)
@@ -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
index 7e35e26e12ef259435693b3c145da607ec6b1734..09b098c1e5a7a210f122662353fa930c109106ae 100644 (file)
@@ -44,5 +44,5 @@
   gOmap35xxTokenSpaceGuid.PcdOmap35xxArchTimer|3|UINT32|0x00000205
   gOmap35xxTokenSpaceGuid.PcdOmap35xxFreeTimer|4|UINT32|0x00000206
   gOmap35xxTokenSpaceGuid.PcdOmap35xxDebugAgentTimer|5|UINT32|0x00000207
-  gOmap35xxTokenSpaceGuid.PcdDebugAgentTimerFreqNanoSeconds|1|UINT32|0x00000208
+  gOmap35xxTokenSpaceGuid.PcdDebugAgentTimerFreqNanoSeconds|77|UINT32|0x00000208