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