|
1 /* |
|
2 * tiwlanhpa.h |
|
3 * |
|
4 * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. |
|
5 * All rights reserved. |
|
6 * |
|
7 * This program and the accompanying materials are made available under the |
|
8 * terms of the Eclipse Public License v1.0 or BSD License which accompanies |
|
9 * this distribution. The Eclipse Public License is available at |
|
10 * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below. |
|
11 * |
|
12 * Redistribution and use in source and binary forms, with or without |
|
13 * modification, are permitted provided that the following conditions |
|
14 * are met: |
|
15 * |
|
16 * * Redistributions of source code must retain the above copyright |
|
17 * notice, this list of conditions and the following disclaimer. |
|
18 * * Redistributions in binary form must reproduce the above copyright |
|
19 * notice, this list of conditions and the following disclaimer in |
|
20 * the documentation and/or other materials provided with the |
|
21 * distribution. |
|
22 * * Neither the name Texas Instruments nor the names of its |
|
23 * contributors may be used to endorse or promote products derived |
|
24 * from this software without specific prior written permission. |
|
25 * |
|
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
30 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
37 */ |
|
38 |
|
39 |
|
40 |
|
41 /** \file TIWlanHpa.h |
|
42 * \brief Interface between the sandbox to the BSP of Omap3430 |
|
43 * |
|
44 * \see |
|
45 */ |
|
46 |
|
47 #ifndef _TIWLANHPA_ |
|
48 #define _TIWLANHPA_ |
|
49 |
|
50 #include <silicon_assp.h> |
|
51 #include <gpio.h> |
|
52 #include <assp.h> |
|
53 |
|
54 #include "wlanhpa.h" |
|
55 |
|
56 #ifdef WLAN_SDIO |
|
57 #define RST_GPIO_NUM 101 |
|
58 #define IRQ_GPIO_NUM 162 |
|
59 #else //WLAN_SPI |
|
60 #define RST_GPIO_NUM 3 |
|
61 #define IRQ_GPIO_NUM 61 |
|
62 #endif //WLAN_SDIO |
|
63 |
|
64 #define RST_MOD_NUM 0 |
|
65 #define IRQ_MOD_NUM 0 |
|
66 |
|
67 #define ASIC_CLASS TOmap |
|
68 #define ASIC_CLASS_PLAT TOmapPlat |
|
69 |
|
70 #define PIN_TO_HANDLE OMAPGPIO_GPINID_TO_PHANDLE |
|
71 #define INVALID_HANDLE KOmapGpioInvalidHandle |
|
72 |
|
73 |
|
74 class TIWlanHpa : public WlanHpa |
|
75 { |
|
76 public: |
|
77 |
|
78 /** |
|
79 * Costructor. |
|
80 */ |
|
81 TIWlanHpa(MWlanOsaExt& aOsaExt, MWlanOsa& aOsa); |
|
82 |
|
83 /** |
|
84 * Destructor |
|
85 */ |
|
86 virtual ~TIWlanHpa(); |
|
87 |
|
88 /** |
|
89 * Turns WLAN devices power on |
|
90 */ |
|
91 virtual void PowerOnDevice(); |
|
92 |
|
93 /** |
|
94 * Turns WLAN devices power off |
|
95 */ |
|
96 virtual void PowerOffDevice(); |
|
97 |
|
98 /** |
|
99 * Called by hpa layer object client when peripheral interrupt |
|
100 * informed by OnInterrupt method has been serviced. |
|
101 * NOTE: on systems implementing level sensitive interrupt handling |
|
102 * host interrupt is enabled at this state |
|
103 */ |
|
104 virtual void InterruptServiced(); |
|
105 |
|
106 /** |
|
107 * Configures the HPA layer |
|
108 */ |
|
109 virtual void Configure( const WlanHpa::TConfig& aConfig ); |
|
110 |
|
111 /** |
|
112 * Enables Irq |
|
113 * |
|
114 * NOTE: usage limited to bootup sequence only. |
|
115 * Untill this call the host side interrupts are disabled |
|
116 * |
|
117 */ |
|
118 virtual void EnableIrq(); |
|
119 |
|
120 /** |
|
121 * Toggles debug GPIO |
|
122 * Usage limited to R&D (debug) purpose only |
|
123 */ |
|
124 virtual TBool DebugGpioToggle( TBool aHigh ); |
|
125 |
|
126 private: |
|
127 |
|
128 /* |
|
129 * DFC - function called by a DFC to handle the interrupt |
|
130 * call another function to get in the correct class and |
|
131 * therefore don't need me-> all the time |
|
132 * Doesn't always work having me-> for the C software |
|
133 */ |
|
134 static void InterruptHandlerDfc(TAny *aPtr); |
|
135 |
|
136 /** |
|
137 * Start the DFC queue |
|
138 */ |
|
139 void InterruptHandlerStartDfc(); |
|
140 |
|
141 |
|
142 /* |
|
143 * Call the actual interrupt handling routine and |
|
144 * re-enable the interrupts. |
|
145 * |
|
146 * The interrupt handler is in the third party software |
|
147 * block and performs the necessary functions |
|
148 */ |
|
149 void InterruptHandler(); |
|
150 |
|
151 |
|
152 /** |
|
153 * Disables interrupts and |
|
154 * unbinds the interrupt service routine. |
|
155 */ |
|
156 void KillInterrupts(); |
|
157 |
|
158 /** |
|
159 * Sets GPIO as input line, binds it to an interrupt. Static function |
|
160 * Isr() is bound to the interrupt service routine. |
|
161 * |
|
162 * Uses following defines: |
|
163 * |
|
164 * #define IRQ_GPIO_NUM 9 |
|
165 * #define IRQ_MOD_NUM 1 |
|
166 * |
|
167 * of which IRQ_GPIO_NUM is the GPIO number and |
|
168 * IRQ_MOD_NUM is the module number where the corresponding |
|
169 * GPIO belongs to. |
|
170 */ |
|
171 void SetupIrqHw( WlanHpa::TIsrPolarity aPolarity); |
|
172 |
|
173 /** |
|
174 * Sets GPIO as output line. Used for controlling the PMEN signal of the WLAN chip. |
|
175 #define RST_GPIO_NUM 10 |
|
176 #define RST_MOD_NUM 1 |
|
177 |
|
178 * of which RST_GPIO_NUM is the GPIO number and |
|
179 * RST_MOD_NUM is the module number where the corresponding |
|
180 * GPIO belongs to. |
|
181 |
|
182 */ |
|
183 |
|
184 void SetupRstHw (); |
|
185 |
|
186 |
|
187 /** |
|
188 * Interrupt handler function. |
|
189 * Is bound to the ISR and handles continues serving the interrupt. |
|
190 * |
|
191 * \param aPtr HPA object context. |
|
192 * \param aPinHandle is not used. |
|
193 */ |
|
194 static void Isr (TAny* aPtr); |
|
195 |
|
196 /** |
|
197 * Clears WLAN PMEN line. |
|
198 * |
|
199 */ |
|
200 void EnterReset(); |
|
201 |
|
202 /** |
|
203 * Sets WLAN PMEN line. |
|
204 * |
|
205 */ |
|
206 void ExitReset(); |
|
207 |
|
208 /** |
|
209 * Disables WLAN interrupt notification. |
|
210 * |
|
211 */ |
|
212 void Disable(); |
|
213 |
|
214 /** |
|
215 * Enables WLAN interrupt notification. |
|
216 * |
|
217 */ |
|
218 void Enable(); |
|
219 |
|
220 private: |
|
221 |
|
222 TDfc iIrqDfc; |
|
223 WlanHpa::TConfig iConfig; |
|
224 }; |
|
225 |
|
226 |
|
227 |
|
228 #endif //_TIWLANHPA_ |
|
229 |