|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <syborg_priv.h> |
|
19 |
|
20 //#define DEBUG |
|
21 |
|
22 #ifdef DEBUG |
|
23 #define __DEBUG_PRINT(format...) Kern::Printf(format) |
|
24 #else |
|
25 #define __DEBUG_PRINT(format...) __KTRACE_OPT(KBOOT,Kern::Printf(format)) |
|
26 #endif |
|
27 |
|
28 void TSyborg::Init3() |
|
29 { |
|
30 // SetTimerMode(KHwBaseCounterTimer, ETimerModePeriodic); |
|
31 // EnableTimer(KHwBaseCounterTimer, EEnable); |
|
32 } |
|
33 |
|
34 EXPORT_C TBool TSyborg::IsTimerEnabled(TUint aTimerBase) |
|
35 { |
|
36 __DEBUG_PRINT("TSyborg::IsTimerEnabled"); |
|
37 return ReadReg(aTimerBase, 1); |
|
38 } |
|
39 |
|
40 EXPORT_C void TSyborg::EnableTimerInterrupt(TUint aTimerBase) |
|
41 { |
|
42 __DEBUG_PRINT("TSyborg::EnableTimerInterrupt"); |
|
43 WriteReg(aTimerBase,5,1); |
|
44 } |
|
45 |
|
46 EXPORT_C void TSyborg::DisableTimerInterrupt(TUint aTimerBase) |
|
47 { |
|
48 __DEBUG_PRINT("TSyborg::DisableTimerInterrupt"); |
|
49 WriteReg(aTimerBase,5,0); |
|
50 } |
|
51 |
|
52 EXPORT_C void TSyborg::EnableTimer(TUint aTimerBase, TState aState) |
|
53 { |
|
54 __DEBUG_PRINT("TSyborg::EnableTimer"); |
|
55 // TUint32 mode = ReadReg(aTimerBase, 1); |
|
56 if (aState == EEnable) |
|
57 WriteReg(aTimerBase, 1, 1); |
|
58 else |
|
59 WriteReg(aTimerBase, 1, 0); |
|
60 } |
|
61 |
|
62 EXPORT_C TSyborg::TTimerMode TSyborg::TimerMode(TUint aTimerBase) |
|
63 { |
|
64 __DEBUG_PRINT("TSyborg::TimerMode"); |
|
65 if (ReadReg(aTimerBase, 2)) |
|
66 return ETimerModeOneShot; |
|
67 else |
|
68 return ETimerModePeriodic; |
|
69 } |
|
70 |
|
71 EXPORT_C void TSyborg::SetTimerMode(TUint aTimerBase, TTimerMode aValue) |
|
72 { |
|
73 __DEBUG_PRINT("TSyborg::SetTimerMode"); |
|
74 if (aValue == ETimerModePeriodic) |
|
75 WriteReg(aTimerBase, 2, 0); |
|
76 else |
|
77 WriteReg(aTimerBase, 2, 1); |
|
78 } |
|
79 |
|
80 // Return base address of debug UART |
|
81 // (as selected in obey file or with eshell debugport command) |
|
82 EXPORT_C TUint32 TSyborg::DebugPortAddr() |
|
83 { |
|
84 // Defaults to UART 0 |
|
85 switch (Kern::SuperPage().iDebugPort) |
|
86 { |
|
87 case KNullDebugPort: // debug supressed |
|
88 return (TUint32)KNullDebugPort; |
|
89 case 1: |
|
90 return KHwBaseUart1; |
|
91 case 2: |
|
92 return KHwBaseUart2; |
|
93 case 3: |
|
94 return KHwBaseUart3; |
|
95 case 0: |
|
96 default: |
|
97 return KHwBaseUart0; |
|
98 } |
|
99 } |
|
100 |
|
101 EXPORT_C void TSyborg::MarkDebugPortOff() |
|
102 { |
|
103 TheVariant.iDebugPortBase = 0; |
|
104 } |
|
105 |
|
106 EXPORT_C TInt TSyborg::VideoRamSize() |
|
107 { |
|
108 return 4*640*480; |
|
109 } |
|
110 |
|
111 // !@! |
|
112 EXPORT_C TPhysAddr TSyborg::VideoRamPhys() |
|
113 { |
|
114 #if 0 |
|
115 __KTRACE_OPT(KEXTENSION,Kern::Printf("TSyborg::VideoRamPhys: VideoRamPhys=0x%x", Syborg::VideoRamPhys)); |
|
116 #endif |
|
117 return 0; |
|
118 |
|
119 } |
|
120 |
|
121 EXPORT_C TPhysAddr TSyborg::VideoRamPhysSecure() |
|
122 { |
|
123 #if 0 |
|
124 return Syborg::VideoRamPhysSecure; |
|
125 #endif |
|
126 return 0; |
|
127 } |
|
128 |