Added DebugAgentTimerLib. Cleaned up .h files and other code.
[mirror_edk2.git] / Omap35xxPkg / Library / OmapLib / OmapLib.c
CommitLineData
a3f98646 1/** @file\r
2\r
3 Copyright (c) 2008-2009, Apple Inc. All rights reserved.\r
4 \r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <Base.h>\r
16#include <Library/DebugLib.h>\r
17#include <Library/OmapLib.h>\r
18#include <Omap3530/Omap3530.h>\r
19\r
20UINT32 \r
21GpioBase (\r
22 IN UINTN Port\r
23 )\r
24{\r
25 switch (Port) {\r
26 case 1: return GPIO1_BASE;\r
27 case 2: return GPIO2_BASE;\r
28 case 3: return GPIO3_BASE;\r
29 case 4: return GPIO4_BASE;\r
30 case 5: return GPIO5_BASE;\r
31 case 6: return GPIO6_BASE;\r
32 default: ASSERT(FALSE); return 0;\r
33 }\r
34}\r
35\r
36UINT32\r
37TimerBase (\r
38 IN UINTN Timer\r
39 )\r
40{\r
41 switch (Timer) {\r
42 case 1: return GPTIMER1_BASE;\r
43 case 2: return GPTIMER2_BASE;\r
44 case 3: return GPTIMER3_BASE;\r
45 case 4: return GPTIMER4_BASE;\r
46 case 5: return GPTIMER5_BASE;\r
47 case 6: return GPTIMER6_BASE;\r
48 case 7: return GPTIMER7_BASE;\r
49 case 8: return GPTIMER8_BASE;\r
50 case 9: return GPTIMER9_BASE;\r
51 case 10: return GPTIMER10_BASE;\r
52 case 11: return GPTIMER11_BASE;\r
53 case 12: return GPTIMER12_BASE;\r
54 default: return 0;\r
55 }\r
56}\r
57\r
58UINTN\r
59InterruptVectorForTimer (\r
60 IN UINTN Timer\r
61 )\r
62{\r
63 if ((Timer < 1) || (Timer > 12)) {\r
64 ASSERT(FALSE);\r
65 return 0xFFFFFFFF;\r
66 }\r
67\r
68 return 36 + Timer;\r
69}\r
70\r
71UINT32\r
72UartBase (\r
73 IN UINTN Uart\r
74 )\r
75{\r
76 switch (Uart) {\r
77 case 1: return UART1_BASE;\r
78 case 2: return UART2_BASE;\r
79 case 3: return UART3_BASE;\r
80 default: ASSERT(FALSE); return 0;\r
81 }\r
82}\r
83\r