xref: /utopia/UTPA2-700.0.x/modules/gpio/hal/k6lite/gpio/halGPIO.c (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // ("MStar Confidential Information") by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////
94 
95 #ifndef _HALGPIO_C_
96 #define _HALGPIO_C_
97 
98 //-------------------------------------------------------------------------------------------------
99 //  Include Files
100 //-------------------------------------------------------------------------------------------------
101 
102 #include "MsCommon.h"
103 #include "MsTypes.h"
104 #include "drvGPIO.h"
105 #include "halGPIO.h"
106 #include "regGPIO.h"
107 
108 //-------------------------------------------------------------------------------------------------
109 //  Driver Compiler Options
110 //-------------------------------------------------------------------------------------------------
111 
112 //-------------------------------------------------------------------------------------------------
113 //  Local Defines
114 //-------------------------------------------------------------------------------------------------
115 #define GPIO_HAL_ERR(x, args...)        //{printf(x, ##args);}
116 #define GPIO_HAL_NOTSUPPORT()           {printf("%s not support!\n", __FUNCTION__);}
117 
118 #define _CONCAT( a, b )     a##b
119 #define CONCAT( a, b )      _CONCAT( a, b )
120 
121 #define BIT0    BIT(0)
122 #define BIT1    BIT(1)
123 #define BIT2    BIT(2)
124 #define BIT3    BIT(3)
125 #define BIT4    BIT(4)
126 #define BIT5    BIT(5)
127 #define BIT6    BIT(6)
128 #define BIT7    BIT(7)
129 
130 // Dummy
131 #define GPIO999_OEN     0, 0
132 #define GPIO999_OUT     0, 0
133 #define GPIO999_IN      0, 0
134 
135 #define GPIO0_PAD PAD_PM_IRIN
136 #define GPIO0_OEN 0x000f28, BIT0
137 #define GPIO0_OUT 0x000f28, BIT1
138 #define GPIO0_IN  0x000f28, BIT2
139 
140 #define GPIO1_PAD PAD_PM_SPI_CZ
141 #define GPIO1_OEN 0x000f30, BIT0
142 #define GPIO1_OUT 0x000f30, BIT1
143 #define GPIO1_IN  0x000f30, BIT2
144 
145 #define GPIO2_PAD PAD_PM_SPI_CK
146 #define GPIO2_OEN 0x000f32, BIT0
147 #define GPIO2_OUT 0x000f32, BIT1
148 #define GPIO2_IN  0x000f32, BIT2
149 
150 #define GPIO3_PAD PAD_PM_SPI_DI
151 #define GPIO3_OEN 0x000f34, BIT0
152 #define GPIO3_OUT 0x000f34, BIT1
153 #define GPIO3_IN  0x000f34, BIT2
154 
155 #define GPIO4_PAD PAD_PM_SPI_DO
156 #define GPIO4_OEN 0x000f36, BIT0
157 #define GPIO4_OUT 0x000f36, BIT1
158 #define GPIO4_IN  0x000f36, BIT2
159 
160 #define GPIO5_PAD PAD_PM_SPI_WPZ
161 #define GPIO5_OEN 0x000f88, BIT0
162 #define GPIO5_OUT 0x000f88, BIT1
163 #define GPIO5_IN  0x000f88, BIT2
164 
165 #define GPIO6_PAD PAD_PM_SPI_HOLDZ
166 #define GPIO6_OEN 0x000f8a, BIT0
167 #define GPIO6_OUT 0x000f8a, BIT1
168 #define GPIO6_IN  0x000f8a, BIT2
169 
170 #define GPIO7_PAD PAD_PM_SPI_RSTZ
171 #define GPIO7_OEN 0x000f8c, BIT0
172 #define GPIO7_OUT 0x000f8c, BIT1
173 #define GPIO7_IN  0x000f8c, BIT2
174 
175 #define GPIO8_PAD PAD_PM_GPIO0
176 #define GPIO8_OEN 0x000f00, BIT0
177 #define GPIO8_OUT 0x000f00, BIT1
178 #define GPIO8_IN  0x000f00, BIT2
179 
180 #define GPIO9_PAD PAD_PM_GPIO1
181 #define GPIO9_OEN 0x000f02, BIT0
182 #define GPIO9_OUT 0x000f02, BIT1
183 #define GPIO9_IN  0x000f02, BIT2
184 
185 #define GPIO10_PAD PAD_PM_GPIO2
186 #define GPIO10_OEN 0x000f04, BIT0
187 #define GPIO10_OUT 0x000f04, BIT1
188 #define GPIO10_IN  0x000f04, BIT2
189 
190 #define GPIO11_PAD PAD_PM_GPIO3
191 #define GPIO11_OEN 0x000f06, BIT0
192 #define GPIO11_OUT 0x000f06, BIT1
193 #define GPIO11_IN  0x000f06, BIT2
194 
195 #define GPIO12_PAD PAD_PM_GPIO4
196 #define GPIO12_OEN 0x000f08, BIT0
197 #define GPIO12_OUT 0x000f08, BIT1
198 #define GPIO12_IN  0x000f08, BIT2
199 
200 #define GPIO13_PAD PAD_PM_GPIO5
201 #define GPIO13_OEN 0x000f0a, BIT0
202 #define GPIO13_OUT 0x000f0a, BIT1
203 #define GPIO13_IN  0x000f0a, BIT2
204 
205 #define GPIO14_PAD PAD_PM_GPIO6
206 #define GPIO14_OEN 0x000f0c, BIT0
207 #define GPIO14_OUT 0x000f0c, BIT1
208 #define GPIO14_IN  0x000f0c, BIT2
209 
210 #define GPIO15_PAD PAD_PM_GPIO7
211 #define GPIO15_OEN 0x000f0e, BIT0
212 #define GPIO15_OUT 0x000f0e, BIT1
213 #define GPIO15_IN  0x000f0e, BIT2
214 
215 #define GPIO16_PAD PAD_PM_GPIO8
216 #define GPIO16_OEN 0x000f10, BIT0
217 #define GPIO16_OUT 0x000f10, BIT1
218 #define GPIO16_IN  0x000f10, BIT2
219 
220 #define GPIO17_PAD PAD_PM_GPIO9
221 #define GPIO17_OEN 0x000f12, BIT0
222 #define GPIO17_OUT 0x000f12, BIT1
223 #define GPIO17_IN  0x000f12, BIT2
224 
225 #define GPIO18_PAD PAD_PM_GPIO10
226 #define GPIO18_OEN 0x000f14, BIT0
227 #define GPIO18_OUT 0x000f14, BIT1
228 #define GPIO18_IN  0x000f14, BIT2
229 
230 #define GPIO19_PAD PAD_PM_GPIO11
231 #define GPIO19_OEN 0x000f16, BIT0
232 #define GPIO19_OUT 0x000f16, BIT1
233 #define GPIO19_IN  0x000f16, BIT2
234 
235 #define GPIO20_PAD PAD_PM_GPIO12
236 #define GPIO20_OEN 0x000f18, BIT0
237 #define GPIO20_OUT 0x000f18, BIT1
238 #define GPIO20_IN  0x000f18, BIT2
239 
240 #define GPIO21_PAD PAD_PM_GPIO13
241 #define GPIO21_OEN 0x000f1a, BIT0
242 #define GPIO21_OUT 0x000f1a, BIT1
243 #define GPIO21_IN  0x000f1a, BIT2
244 
245 #define GPIO22_PAD PAD_PM_GPIO14
246 #define GPIO22_OEN 0x000f1c, BIT0
247 #define GPIO22_OUT 0x000f1c, BIT1
248 #define GPIO22_IN  0x000f1c, BIT2
249 
250 #define GPIO23_PAD PAD_PM_GPIO15
251 #define GPIO23_OEN 0x000f1e, BIT0
252 #define GPIO23_OUT 0x000f1e, BIT1
253 #define GPIO23_IN  0x000f1e, BIT2
254 
255 #define GPIO24_PAD PAD_PM_CEC
256 #define GPIO24_OEN 0x000f2c, BIT0
257 #define GPIO24_OUT 0x000f2c, BIT1
258 #define GPIO24_IN  0x000f2c, BIT2
259 
260 #define GPIO25_PAD PAD_HDMITX_HPD
261 #define GPIO25_OEN 0x001166, BIT3
262 #define GPIO25_OUT 0x001166, BIT2
263 #define GPIO25_IN  0x001166, BIT0
264 
265 #define GPIO26_PAD PAD_PM_SD_CDZ
266 #define GPIO26_OEN 0x000f8e, BIT0
267 #define GPIO26_OUT 0x000f8e, BIT1
268 #define GPIO26_IN  0x000f8e, BIT2
269 
270 #define GPIO27_PAD PAD_VID0
271 #define GPIO27_OEN 0x000f90, BIT0
272 #define GPIO27_OUT 0x000f90, BIT1
273 #define GPIO27_IN  0x000f90, BIT2
274 
275 #define GPIO28_PAD PAD_VID1
276 #define GPIO28_OEN 0x000f92, BIT0
277 #define GPIO28_OUT 0x000f92, BIT1
278 #define GPIO28_IN  0x000f92, BIT2
279 
280 #define GPIO29_PAD PAD_PM_GT0_MDIO
281 #define GPIO29_OEN 0x000f50, BIT0
282 #define GPIO29_OUT 0x000f50, BIT1
283 #define GPIO29_IN  0x000f50, BIT2
284 
285 #define GPIO30_PAD PAD_PM_GT0_MDC
286 #define GPIO30_OEN 0x000f4e, BIT0
287 #define GPIO30_OUT 0x000f4e, BIT1
288 #define GPIO30_IN  0x000f4e, BIT2
289 
290 #define GPIO31_PAD PAD_PM_GT0_RX_CLK
291 #define GPIO31_OEN 0x000f52, BIT0
292 #define GPIO31_OUT 0x000f52, BIT1
293 #define GPIO31_IN  0x000f52, BIT2
294 
295 #define GPIO32_PAD PAD_PM_GT0_RX_CTL
296 #define GPIO32_OEN 0x000f54, BIT0
297 #define GPIO32_OUT 0x000f54, BIT1
298 #define GPIO32_IN  0x000f54, BIT2
299 
300 #define GPIO33_PAD PAD_PM_GT0_RX_D0
301 #define GPIO33_OEN 0x000f56, BIT0
302 #define GPIO33_OUT 0x000f56, BIT1
303 #define GPIO33_IN  0x000f56, BIT2
304 
305 #define GPIO34_PAD PAD_PM_GT0_RX_D1
306 #define GPIO34_OEN 0x000f58, BIT0
307 #define GPIO34_OUT 0x000f58, BIT1
308 #define GPIO34_IN  0x000f58, BIT2
309 
310 #define GPIO35_PAD PAD_PM_GT0_RX_D2
311 #define GPIO35_OEN 0x000f5a, BIT0
312 #define GPIO35_OUT 0x000f5a, BIT1
313 #define GPIO35_IN  0x000f5a, BIT2
314 
315 #define GPIO36_PAD PAD_PM_GT0_RX_D3
316 #define GPIO36_OEN 0x000f5c, BIT0
317 #define GPIO36_OUT 0x000f5c, BIT1
318 #define GPIO36_IN  0x000f5c, BIT2
319 
320 #define GPIO37_PAD PAD_PM_GT0_TX_CLK
321 #define GPIO37_OEN 0x000f5e, BIT0
322 #define GPIO37_OUT 0x000f5e, BIT1
323 #define GPIO37_IN  0x000f5e, BIT2
324 
325 #define GPIO38_PAD PAD_PM_GT0_TX_CTL
326 #define GPIO38_OEN 0x000f60, BIT0
327 #define GPIO38_OUT 0x000f60, BIT1
328 #define GPIO38_IN  0x000f60, BIT2
329 
330 #define GPIO39_PAD PAD_PM_GT0_TX_D0
331 #define GPIO39_OEN 0x000f62, BIT0
332 #define GPIO39_OUT 0x000f62, BIT1
333 #define GPIO39_IN  0x000f62, BIT2
334 
335 #define GPIO40_PAD PAD_PM_GT0_TX_D1
336 #define GPIO40_OEN 0x000f64, BIT0
337 #define GPIO40_OUT 0x000f64, BIT1
338 #define GPIO40_IN  0x000f64, BIT2
339 
340 #define GPIO41_PAD PAD_PM_GT0_TX_D2
341 #define GPIO41_OEN 0x000f66, BIT0
342 #define GPIO41_OUT 0x000f66, BIT1
343 #define GPIO41_IN  0x000f66, BIT2
344 
345 #define GPIO42_PAD PAD_PM_GT0_TX_D3
346 #define GPIO42_OEN 0x000f68, BIT0
347 #define GPIO42_OUT 0x000f68, BIT1
348 #define GPIO42_IN  0x000f68, BIT2
349 
350 #define GPIO43_PAD PAD_PM_LED0
351 #define GPIO43_OEN 0x000f94, BIT0
352 #define GPIO43_OUT 0x000f94, BIT1
353 #define GPIO43_IN  0x000f94, BIT2
354 
355 #define GPIO44_PAD PAD_PM_LED1
356 #define GPIO44_OEN 0x000f96, BIT0
357 #define GPIO44_OUT 0x000f96, BIT1
358 #define GPIO44_IN  0x000f96, BIT2
359 
360 #define GPIO45_PAD PAD_SAR_GPIO0
361 #define GPIO45_OEN 0x001423, BIT0
362 #define GPIO45_OUT 0x001424, BIT0
363 #define GPIO45_IN  0x001425, BIT0
364 
365 #define GPIO46_PAD PAD_SAR_GPIO1
366 #define GPIO46_OEN 0x001423, BIT1
367 #define GPIO46_OUT 0x001424, BIT1
368 #define GPIO46_IN  0x001425, BIT1
369 
370 #define GPIO47_PAD PAD_SAR_GPIO2
371 #define GPIO47_OEN 0x001423, BIT2
372 #define GPIO47_OUT 0x001424, BIT2
373 #define GPIO47_IN  0x001425, BIT2
374 
375 #define GPIO48_PAD PAD_SAR_GPIO3
376 #define GPIO48_OEN 0x001423, BIT3
377 #define GPIO48_OUT 0x001424, BIT3
378 #define GPIO48_IN  0x001425, BIT3
379 
380 #define GPIO49_PAD PAD_SAR_GPIO4
381 #define GPIO49_OEN 0x001423, BIT4
382 #define GPIO49_OUT 0x001424, BIT4
383 #define GPIO49_IN  0x001425, BIT4
384 
385 #define GPIO50_PAD PAD_VPLUG_DET
386 #define GPIO50_OEN 0x001423, BIT5
387 #define GPIO50_OUT 0x001424, BIT5
388 #define GPIO50_IN  0x001425, BIT5
389 
390 #define GPIO51_PAD PAD_HSYNC_OUT
391 #define GPIO51_OEN 0x1025ec, BIT5
392 #define GPIO51_OUT 0x1025ec, BIT4
393 #define GPIO51_IN  0x1025ec, BIT0
394 
395 #define GPIO52_PAD PAD_VSYNC_OUT
396 #define GPIO52_OEN 0x1025ee, BIT5
397 #define GPIO52_OUT 0x1025ee, BIT4
398 #define GPIO52_IN  0x1025ee, BIT0
399 
400 #define GPIO53_PAD PAD_SD_CLK
401 #define GPIO53_OEN 0x1025a4, BIT5
402 #define GPIO53_OUT 0x1025a4, BIT4
403 #define GPIO53_IN  0x1025a4, BIT0
404 
405 #define GPIO54_PAD PAD_SD_CMD
406 #define GPIO54_OEN 0x1025a6, BIT5
407 #define GPIO54_OUT 0x1025a6, BIT4
408 #define GPIO54_IN  0x1025a6, BIT0
409 
410 #define GPIO55_PAD PAD_SD_D0
411 #define GPIO55_OEN 0x1025a8, BIT5
412 #define GPIO55_OUT 0x1025a8, BIT4
413 #define GPIO55_IN  0x1025a8, BIT0
414 
415 #define GPIO56_PAD PAD_SD_D1
416 #define GPIO56_OEN 0x1025aa, BIT5
417 #define GPIO56_OUT 0x1025aa, BIT4
418 #define GPIO56_IN  0x1025aa, BIT0
419 
420 #define GPIO57_PAD PAD_SD_D2
421 #define GPIO57_OEN 0x1025ac, BIT5
422 #define GPIO57_OUT 0x1025ac, BIT4
423 #define GPIO57_IN  0x1025ac, BIT0
424 
425 #define GPIO58_PAD PAD_SD_D3
426 #define GPIO58_OEN 0x1025ae, BIT5
427 #define GPIO58_OUT 0x1025ae, BIT4
428 #define GPIO58_IN  0x1025ae, BIT0
429 
430 #define GPIO59_PAD PAD_GPIO0
431 #define GPIO59_OEN 0x1025b0, BIT5
432 #define GPIO59_OUT 0x1025b0, BIT4
433 #define GPIO59_IN  0x1025b0, BIT0
434 
435 #define GPIO60_PAD PAD_GPIO1
436 #define GPIO60_OEN 0x1025b2, BIT5
437 #define GPIO60_OUT 0x1025b2, BIT4
438 #define GPIO60_IN  0x1025b2, BIT0
439 
440 #define GPIO61_PAD PAD_GPIO2
441 #define GPIO61_OEN 0x1025b4, BIT5
442 #define GPIO61_OUT 0x1025b4, BIT4
443 #define GPIO61_IN  0x1025b4, BIT0
444 
445 #define GPIO62_PAD PAD_GPIO3
446 #define GPIO62_OEN 0x1025b6, BIT5
447 #define GPIO62_OUT 0x1025b6, BIT4
448 #define GPIO62_IN  0x1025b6, BIT0
449 
450 #define GPIO63_PAD PAD_GPIO4
451 #define GPIO63_OEN 0x1025b8, BIT5
452 #define GPIO63_OUT 0x1025b8, BIT4
453 #define GPIO63_IN  0x1025b8, BIT0
454 
455 #define GPIO64_PAD PAD_GPIO5
456 #define GPIO64_OEN 0x1025ba, BIT5
457 #define GPIO64_OUT 0x1025ba, BIT4
458 #define GPIO64_IN  0x1025ba, BIT0
459 
460 #define GPIO65_PAD PAD_GPIO6
461 #define GPIO65_OEN 0x1025bc, BIT5
462 #define GPIO65_OUT 0x1025bc, BIT4
463 #define GPIO65_IN  0x1025bc, BIT0
464 
465 #define GPIO66_PAD PAD_GPIO7
466 #define GPIO66_OEN 0x1025be, BIT5
467 #define GPIO66_OUT 0x1025be, BIT4
468 #define GPIO66_IN  0x1025be, BIT0
469 
470 #define GPIO67_PAD PAD_GPIO8
471 #define GPIO67_OEN 0x1025c0, BIT5
472 #define GPIO67_OUT 0x1025c0, BIT4
473 #define GPIO67_IN  0x1025c0, BIT0
474 
475 #define GPIO68_PAD PAD_GPIO9
476 #define GPIO68_OEN 0x1025c2, BIT5
477 #define GPIO68_OUT 0x1025c2, BIT4
478 #define GPIO68_IN  0x1025c2, BIT0
479 
480 #define GPIO69_PAD PAD_SM0_CLK
481 #define GPIO69_OEN 0x102500, BIT5
482 #define GPIO69_OUT 0x102500, BIT4
483 #define GPIO69_IN  0x102500, BIT0
484 
485 #define GPIO70_PAD PAD_SM0_RST
486 #define GPIO70_OEN 0x102502, BIT5
487 #define GPIO70_OUT 0x102502, BIT4
488 #define GPIO70_IN  0x102502, BIT0
489 
490 #define GPIO71_PAD PAD_SM0_VCC
491 #define GPIO71_OEN 0x102504, BIT5
492 #define GPIO71_OUT 0x102504, BIT4
493 #define GPIO71_IN  0x102504, BIT0
494 
495 #define GPIO72_PAD PAD_SM0_CD
496 #define GPIO72_OEN 0x102506, BIT5
497 #define GPIO72_OUT 0x102506, BIT4
498 #define GPIO72_IN  0x102506, BIT0
499 
500 #define GPIO73_PAD PAD_SM0_IO
501 #define GPIO73_OEN 0x102508, BIT5
502 #define GPIO73_OUT 0x102508, BIT4
503 #define GPIO73_IN  0x102508, BIT0
504 
505 #define GPIO74_PAD PAD_SM0_VSEL
506 #define GPIO74_OEN 0x10250a, BIT5
507 #define GPIO74_OUT 0x10250a, BIT4
508 #define GPIO74_IN  0x10250a, BIT0
509 
510 #define GPIO75_PAD PAD_SM0_C4
511 #define GPIO75_OEN 0x10250c, BIT5
512 #define GPIO75_OUT 0x10250c, BIT4
513 #define GPIO75_IN  0x10250c, BIT0
514 
515 #define GPIO76_PAD PAD_SM0_C8
516 #define GPIO76_OEN 0x10250d, BIT5
517 #define GPIO76_OUT 0x10250d, BIT4
518 #define GPIO76_IN  0x10250d, BIT0
519 
520 #define GPIO77_PAD PAD_CI_RST
521 #define GPIO77_OEN 0x10269a, BIT5
522 #define GPIO77_OUT 0x10269a, BIT4
523 #define GPIO77_IN  0x10269a, BIT0
524 
525 #define GPIO78_PAD PAD_CI_WAITZ
526 #define GPIO78_OEN 0x10269c, BIT5
527 #define GPIO78_OUT 0x10269c, BIT4
528 #define GPIO78_IN  0x10269c, BIT0
529 
530 #define GPIO79_PAD PAD_CI_IRQAZ
531 #define GPIO79_OEN 0x10269e, BIT5
532 #define GPIO79_OUT 0x10269e, BIT4
533 #define GPIO79_IN  0x10269e, BIT0
534 
535 #define GPIO80_PAD PAD_CI_IORDZ
536 #define GPIO80_OEN 0x1026a0, BIT5
537 #define GPIO80_OUT 0x1026a0, BIT4
538 #define GPIO80_IN  0x1026a0, BIT0
539 
540 #define GPIO81_PAD PAD_CI_REGZ
541 #define GPIO81_OEN 0x1026a2, BIT5
542 #define GPIO81_OUT 0x1026a2, BIT4
543 #define GPIO81_IN  0x1026a2, BIT0
544 
545 #define GPIO82_PAD PAD_CI_WEZ
546 #define GPIO82_OEN 0x1026a4, BIT5
547 #define GPIO82_OUT 0x1026a4, BIT4
548 #define GPIO82_IN  0x1026a4, BIT0
549 
550 #define GPIO83_PAD PAD_CI_IOWRZ
551 #define GPIO83_OEN 0x1026a6, BIT5
552 #define GPIO83_OUT 0x1026a6, BIT4
553 #define GPIO83_IN  0x1026a6, BIT0
554 
555 #define GPIO84_PAD PAD_CI_CEZ
556 #define GPIO84_OEN 0x1026a8, BIT5
557 #define GPIO84_OUT 0x1026a8, BIT4
558 #define GPIO84_IN  0x1026a8, BIT0
559 
560 #define GPIO85_PAD PAD_CI_OEZ
561 #define GPIO85_OEN 0x1026aa, BIT5
562 #define GPIO85_OUT 0x1026aa, BIT4
563 #define GPIO85_IN  0x1026aa, BIT0
564 
565 #define GPIO86_PAD PAD_CI_CDZ
566 #define GPIO86_OEN 0x1026ac, BIT5
567 #define GPIO86_OUT 0x1026ac, BIT4
568 #define GPIO86_IN  0x1026ac, BIT0
569 
570 #define GPIO87_PAD PAD_CI_A0
571 #define GPIO87_OEN 0x1026ae, BIT5
572 #define GPIO87_OUT 0x1026ae, BIT4
573 #define GPIO87_IN  0x1026ae, BIT0
574 
575 #define GPIO88_PAD PAD_CI_A1
576 #define GPIO88_OEN 0x1026b0, BIT5
577 #define GPIO88_OUT 0x1026b0, BIT4
578 #define GPIO88_IN  0x1026b0, BIT0
579 
580 #define GPIO89_PAD PAD_CI_A2
581 #define GPIO89_OEN 0x1026b2, BIT5
582 #define GPIO89_OUT 0x1026b2, BIT4
583 #define GPIO89_IN  0x1026b2, BIT0
584 
585 #define GPIO90_PAD PAD_CI_A3
586 #define GPIO90_OEN 0x1026b4, BIT5
587 #define GPIO90_OUT 0x1026b4, BIT4
588 #define GPIO90_IN  0x1026b4, BIT0
589 
590 #define GPIO91_PAD PAD_CI_A4
591 #define GPIO91_OEN 0x1026b6, BIT5
592 #define GPIO91_OUT 0x1026b6, BIT4
593 #define GPIO91_IN  0x1026b6, BIT0
594 
595 #define GPIO92_PAD PAD_CI_A5
596 #define GPIO92_OEN 0x1026b8, BIT5
597 #define GPIO92_OUT 0x1026b8, BIT4
598 #define GPIO92_IN  0x1026b8, BIT0
599 
600 #define GPIO93_PAD PAD_CI_A6
601 #define GPIO93_OEN 0x1026ba, BIT5
602 #define GPIO93_OUT 0x1026ba, BIT4
603 #define GPIO93_IN  0x1026ba, BIT0
604 
605 #define GPIO94_PAD PAD_CI_A7
606 #define GPIO94_OEN 0x1026bc, BIT5
607 #define GPIO94_OUT 0x1026bc, BIT4
608 #define GPIO94_IN  0x1026bc, BIT0
609 
610 #define GPIO95_PAD PAD_CI_A8
611 #define GPIO95_OEN 0x1026be, BIT5
612 #define GPIO95_OUT 0x1026be, BIT4
613 #define GPIO95_IN  0x1026be, BIT0
614 
615 #define GPIO96_PAD PAD_CI_A9
616 #define GPIO96_OEN 0x1026c0, BIT5
617 #define GPIO96_OUT 0x1026c0, BIT4
618 #define GPIO96_IN  0x1026c0, BIT0
619 
620 #define GPIO97_PAD PAD_CI_A10
621 #define GPIO97_OEN 0x1026c2, BIT5
622 #define GPIO97_OUT 0x1026c2, BIT4
623 #define GPIO97_IN  0x1026c2, BIT0
624 
625 #define GPIO98_PAD PAD_CI_A11
626 #define GPIO98_OEN 0x1026c4, BIT5
627 #define GPIO98_OUT 0x1026c4, BIT4
628 #define GPIO98_IN  0x1026c4, BIT0
629 
630 #define GPIO99_PAD PAD_CI_A12
631 #define GPIO99_OEN 0x1026c6, BIT5
632 #define GPIO99_OUT 0x1026c6, BIT4
633 #define GPIO99_IN  0x1026c6, BIT0
634 
635 #define GPIO100_PAD PAD_CI_A13
636 #define GPIO100_OEN 0x1026c8, BIT5
637 #define GPIO100_OUT 0x1026c8, BIT4
638 #define GPIO100_IN  0x1026c8, BIT0
639 
640 #define GPIO101_PAD PAD_CI_A14
641 #define GPIO101_OEN 0x1026ca, BIT5
642 #define GPIO101_OUT 0x1026ca, BIT4
643 #define GPIO101_IN  0x1026ca, BIT0
644 
645 #define GPIO102_PAD PAD_CI_D0
646 #define GPIO102_OEN 0x1026cc, BIT5
647 #define GPIO102_OUT 0x1026cc, BIT4
648 #define GPIO102_IN  0x1026cc, BIT0
649 
650 #define GPIO103_PAD PAD_CI_D1
651 #define GPIO103_OEN 0x1026ce, BIT5
652 #define GPIO103_OUT 0x1026ce, BIT4
653 #define GPIO103_IN  0x1026ce, BIT0
654 
655 #define GPIO104_PAD PAD_CI_D2
656 #define GPIO104_OEN 0x1026d0, BIT5
657 #define GPIO104_OUT 0x1026d0, BIT4
658 #define GPIO104_IN  0x1026d0, BIT0
659 
660 #define GPIO105_PAD PAD_CI_D3
661 #define GPIO105_OEN 0x1026d2, BIT5
662 #define GPIO105_OUT 0x1026d2, BIT4
663 #define GPIO105_IN  0x1026d2, BIT0
664 
665 #define GPIO106_PAD PAD_CI_D4
666 #define GPIO106_OEN 0x1026d4, BIT5
667 #define GPIO106_OUT 0x1026d4, BIT4
668 #define GPIO106_IN  0x1026d4, BIT0
669 
670 #define GPIO107_PAD PAD_CI_D5
671 #define GPIO107_OEN 0x1026d6, BIT5
672 #define GPIO107_OUT 0x1026d6, BIT4
673 #define GPIO107_IN  0x1026d6, BIT0
674 
675 #define GPIO108_PAD PAD_CI_D6
676 #define GPIO108_OEN 0x1026d8, BIT5
677 #define GPIO108_OUT 0x1026d8, BIT4
678 #define GPIO108_IN  0x1026d8, BIT0
679 
680 #define GPIO109_PAD PAD_CI_D7
681 #define GPIO109_OEN 0x1026da, BIT5
682 #define GPIO109_OUT 0x1026da, BIT4
683 #define GPIO109_IN  0x1026da, BIT0
684 
685 #define GPIO110_PAD PAD_TS0_CLK
686 #define GPIO110_OEN 0x102524, BIT5
687 #define GPIO110_OUT 0x102524, BIT4
688 #define GPIO110_IN  0x102524, BIT0
689 
690 #define GPIO111_PAD PAD_TS0_SYNC
691 #define GPIO111_OEN 0x102526, BIT5
692 #define GPIO111_OUT 0x102526, BIT4
693 #define GPIO111_IN  0x102526, BIT0
694 
695 #define GPIO112_PAD PAD_TS0_VLD
696 #define GPIO112_OEN 0x102528, BIT5
697 #define GPIO112_OUT 0x102528, BIT4
698 #define GPIO112_IN  0x102528, BIT0
699 
700 #define GPIO113_PAD PAD_TS0_D0
701 #define GPIO113_OEN 0x10252a, BIT5
702 #define GPIO113_OUT 0x10252a, BIT4
703 #define GPIO113_IN  0x10252a, BIT0
704 
705 #define GPIO114_PAD PAD_TS0_D1
706 #define GPIO114_OEN 0x10252c, BIT5
707 #define GPIO114_OUT 0x10252c, BIT4
708 #define GPIO114_IN  0x10252c, BIT0
709 
710 #define GPIO115_PAD PAD_TS0_D2
711 #define GPIO115_OEN 0x10252e, BIT5
712 #define GPIO115_OUT 0x10252e, BIT4
713 #define GPIO115_IN  0x10252e, BIT0
714 
715 #define GPIO116_PAD PAD_TS0_D3
716 #define GPIO116_OEN 0x102530, BIT5
717 #define GPIO116_OUT 0x102530, BIT4
718 #define GPIO116_IN  0x102530, BIT0
719 
720 #define GPIO117_PAD PAD_TS0_D4
721 #define GPIO117_OEN 0x102532, BIT5
722 #define GPIO117_OUT 0x102532, BIT4
723 #define GPIO117_IN  0x102532, BIT0
724 
725 #define GPIO118_PAD PAD_TS0_D5
726 #define GPIO118_OEN 0x102534, BIT5
727 #define GPIO118_OUT 0x102534, BIT4
728 #define GPIO118_IN  0x102534, BIT0
729 
730 #define GPIO119_PAD PAD_TS0_D6
731 #define GPIO119_OEN 0x102536, BIT5
732 #define GPIO119_OUT 0x102536, BIT4
733 #define GPIO119_IN  0x102536, BIT0
734 
735 #define GPIO120_PAD PAD_TS0_D7
736 #define GPIO120_OEN 0x102538, BIT5
737 #define GPIO120_OUT 0x102538, BIT4
738 #define GPIO120_IN  0x102538, BIT0
739 
740 #define GPIO121_PAD PAD_TS1_CLK
741 #define GPIO121_OEN 0x10263a, BIT5
742 #define GPIO121_OUT 0x10263a, BIT4
743 #define GPIO121_IN  0x10263a, BIT0
744 
745 #define GPIO122_PAD PAD_TS1_SYNC
746 #define GPIO122_OEN 0x10263c, BIT5
747 #define GPIO122_OUT 0x10263c, BIT4
748 #define GPIO122_IN  0x10263c, BIT0
749 
750 #define GPIO123_PAD PAD_TS1_VLD
751 #define GPIO123_OEN 0x10263e, BIT5
752 #define GPIO123_OUT 0x10263e, BIT4
753 #define GPIO123_IN  0x10263e, BIT0
754 
755 #define GPIO124_PAD PAD_TS1_D0
756 #define GPIO124_OEN 0x102640, BIT5
757 #define GPIO124_OUT 0x102640, BIT4
758 #define GPIO124_IN  0x102640, BIT0
759 
760 #define GPIO125_PAD PAD_TS1_D1
761 #define GPIO125_OEN 0x102642, BIT5
762 #define GPIO125_OUT 0x102642, BIT4
763 #define GPIO125_IN  0x102642, BIT0
764 
765 #define GPIO126_PAD PAD_TS1_D2
766 #define GPIO126_OEN 0x102644, BIT5
767 #define GPIO126_OUT 0x102644, BIT4
768 #define GPIO126_IN  0x102644, BIT0
769 
770 #define GPIO127_PAD PAD_TS1_D3
771 #define GPIO127_OEN 0x102646, BIT5
772 #define GPIO127_OUT 0x102646, BIT4
773 #define GPIO127_IN  0x102646, BIT0
774 
775 #define GPIO128_PAD PAD_TS1_D4
776 #define GPIO128_OEN 0x102648, BIT5
777 #define GPIO128_OUT 0x102648, BIT4
778 #define GPIO128_IN  0x102648, BIT0
779 
780 #define GPIO129_PAD PAD_TS1_D5
781 #define GPIO129_OEN 0x10264a, BIT5
782 #define GPIO129_OUT 0x10264a, BIT4
783 #define GPIO129_IN  0x10264a, BIT0
784 
785 #define GPIO130_PAD PAD_TS1_D6
786 #define GPIO130_OEN 0x10264c, BIT5
787 #define GPIO130_OUT 0x10264c, BIT4
788 #define GPIO130_IN  0x10264c, BIT0
789 
790 #define GPIO131_PAD PAD_TS1_D7
791 #define GPIO131_OEN 0x10264e, BIT5
792 #define GPIO131_OUT 0x10264e, BIT4
793 #define GPIO131_IN  0x10264e, BIT0
794 
795 #define GPIO132_PAD PAD_TS2_CLK
796 #define GPIO132_OEN 0x102650, BIT5
797 #define GPIO132_OUT 0x102650, BIT4
798 #define GPIO132_IN  0x102650, BIT0
799 
800 #define GPIO133_PAD PAD_TS2_SYNC
801 #define GPIO133_OEN 0x102652, BIT5
802 #define GPIO133_OUT 0x102652, BIT4
803 #define GPIO133_IN  0x102652, BIT0
804 
805 #define GPIO134_PAD PAD_TS2_VLD
806 #define GPIO134_OEN 0x102654, BIT5
807 #define GPIO134_OUT 0x102654, BIT4
808 #define GPIO134_IN  0x102654, BIT0
809 
810 #define GPIO135_PAD PAD_TS2_D0
811 #define GPIO135_OEN 0x102656, BIT5
812 #define GPIO135_OUT 0x102656, BIT4
813 #define GPIO135_IN  0x102656, BIT0
814 
815 #define GPIO136_PAD PAD_TS2_D1
816 #define GPIO136_OEN 0x102658, BIT5
817 #define GPIO136_OUT 0x102658, BIT4
818 #define GPIO136_IN  0x102658, BIT0
819 
820 #define GPIO137_PAD PAD_TS2_D2
821 #define GPIO137_OEN 0x10265a, BIT5
822 #define GPIO137_OUT 0x10265a, BIT4
823 #define GPIO137_IN  0x10265a, BIT0
824 
825 #define GPIO138_PAD PAD_TS2_D3
826 #define GPIO138_OEN 0x10265c, BIT5
827 #define GPIO138_OUT 0x10265c, BIT4
828 #define GPIO138_IN  0x10265c, BIT0
829 
830 #define GPIO139_PAD PAD_TS2_D4
831 #define GPIO139_OEN 0x10265e, BIT5
832 #define GPIO139_OUT 0x10265e, BIT4
833 #define GPIO139_IN  0x10265e, BIT0
834 
835 #define GPIO140_PAD PAD_TS2_D5
836 #define GPIO140_OEN 0x102660, BIT5
837 #define GPIO140_OUT 0x102660, BIT4
838 #define GPIO140_IN  0x102660, BIT0
839 
840 #define GPIO141_PAD PAD_TS2_D6
841 #define GPIO141_OEN 0x102662, BIT5
842 #define GPIO141_OUT 0x102662, BIT4
843 #define GPIO141_IN  0x102662, BIT0
844 
845 #define GPIO142_PAD PAD_TS2_D7
846 #define GPIO142_OEN 0x102664, BIT5
847 #define GPIO142_OUT 0x102664, BIT4
848 #define GPIO142_IN  0x102664, BIT0
849 
850 #define GPIO143_PAD PAD_SPDIF_OUT
851 #define GPIO143_OEN 0x1025a0, BIT5
852 #define GPIO143_OUT 0x1025a0, BIT4
853 #define GPIO143_IN  0x1025a0, BIT0
854 
855 #define GPIO144_PAD PAD_I2CM0_SCL
856 #define GPIO144_OEN 0x10251c, BIT5
857 #define GPIO144_OUT 0x10251c, BIT4
858 #define GPIO144_IN  0x10251c, BIT0
859 
860 #define GPIO145_PAD PAD_I2CM0_SDA
861 #define GPIO145_OEN 0x10251e, BIT5
862 #define GPIO145_OUT 0x10251e, BIT4
863 #define GPIO145_IN  0x10251e, BIT0
864 
865 #define GPIO146_PAD PAD_I2CM1_SCL
866 #define GPIO146_OEN 0x102520, BIT5
867 #define GPIO146_OUT 0x102520, BIT4
868 #define GPIO146_IN  0x102520, BIT0
869 
870 #define GPIO147_PAD PAD_I2CM1_SDA
871 #define GPIO147_OEN 0x102522, BIT5
872 #define GPIO147_OUT 0x102522, BIT4
873 #define GPIO147_IN  0x102522, BIT0
874 
875 #define GPIO148_PAD PAD_HDMITX_SCL
876 #define GPIO148_OEN 0x1025da, BIT5
877 #define GPIO148_OUT 0x1025da, BIT4
878 #define GPIO148_IN  0x1025da, BIT0
879 
880 #define GPIO149_PAD PAD_HDMITX_SDA
881 #define GPIO149_OEN 0x1025dc, BIT5
882 #define GPIO149_OUT 0x1025dc, BIT4
883 #define GPIO149_IN  0x1025dc, BIT0
884 
885 #define GPIO150_PAD PAD_EMMC_IO0
886 #define GPIO150_OEN 0x102570, BIT5
887 #define GPIO150_OUT 0x102570, BIT4
888 #define GPIO150_IN  0x102570, BIT0
889 
890 #define GPIO151_PAD PAD_EMMC_IO1
891 #define GPIO151_OEN 0x102572, BIT5
892 #define GPIO151_OUT 0x102572, BIT4
893 #define GPIO151_IN  0x102572, BIT0
894 
895 #define GPIO152_PAD PAD_EMMC_IO2
896 #define GPIO152_OEN 0x102574, BIT5
897 #define GPIO152_OUT 0x102574, BIT4
898 #define GPIO152_IN  0x102574, BIT0
899 
900 #define GPIO153_PAD PAD_EMMC_IO3
901 #define GPIO153_OEN 0x102576, BIT5
902 #define GPIO153_OUT 0x102576, BIT4
903 #define GPIO153_IN  0x102576, BIT0
904 
905 #define GPIO154_PAD PAD_EMMC_IO4
906 #define GPIO154_OEN 0x102578, BIT5
907 #define GPIO154_OUT 0x102578, BIT4
908 #define GPIO154_IN  0x102578, BIT0
909 
910 #define GPIO155_PAD PAD_EMMC_IO5
911 #define GPIO155_OEN 0x10257a, BIT5
912 #define GPIO155_OUT 0x10257a, BIT4
913 #define GPIO155_IN  0x10257a, BIT0
914 
915 #define GPIO156_PAD PAD_EMMC_IO6
916 #define GPIO156_OEN 0x10257c, BIT5
917 #define GPIO156_OUT 0x10257c, BIT4
918 #define GPIO156_IN  0x10257c, BIT0
919 
920 #define GPIO157_PAD PAD_EMMC_IO7
921 #define GPIO157_OEN 0x10257e, BIT5
922 #define GPIO157_OUT 0x10257e, BIT4
923 #define GPIO157_IN  0x10257e, BIT0
924 
925 #define GPIO158_PAD PAD_EMMC_IO8
926 #define GPIO158_OEN 0x102580, BIT5
927 #define GPIO158_OUT 0x102580, BIT4
928 #define GPIO158_IN  0x102580, BIT0
929 
930 #define GPIO159_PAD PAD_EMMC_IO9
931 #define GPIO159_OEN 0x102582, BIT5
932 #define GPIO159_OUT 0x102582, BIT4
933 #define GPIO159_IN  0x102582, BIT0
934 
935 #define GPIO160_PAD PAD_EMMC_IO10
936 #define GPIO160_OEN 0x102584, BIT5
937 #define GPIO160_OUT 0x102584, BIT4
938 #define GPIO160_IN  0x102584, BIT0
939 
940 #define GPIO161_PAD PAD_EMMC_IO11
941 #define GPIO161_OEN 0x102586, BIT5
942 #define GPIO161_OUT 0x102586, BIT4
943 #define GPIO161_IN  0x102586, BIT0
944 
945 #define GPIO162_PAD PAD_EMMC_IO12
946 #define GPIO162_OEN 0x102588, BIT5
947 #define GPIO162_OUT 0x102588, BIT4
948 #define GPIO162_IN  0x102588, BIT0
949 
950 #define GPIO163_PAD PAD_EMMC_IO13
951 #define GPIO163_OEN 0x10258a, BIT5
952 #define GPIO163_OUT 0x10258a, BIT4
953 #define GPIO163_IN  0x10258a, BIT0
954 
955 #define GPIO164_PAD PAD_EMMC_IO14
956 #define GPIO164_OEN 0x10258c, BIT5
957 #define GPIO164_OUT 0x10258c, BIT4
958 #define GPIO164_IN  0x10258c, BIT0
959 
960 #define GPIO165_PAD PAD_EMMC_IO15
961 #define GPIO165_OEN 0x10258e, BIT5
962 #define GPIO165_OUT 0x10258e, BIT4
963 #define GPIO165_IN  0x10258e, BIT0
964 
965 #define GPIO166_PAD PAD_EMMC_IO16
966 #define GPIO166_OEN 0x102590, BIT5
967 #define GPIO166_OUT 0x102590, BIT4
968 #define GPIO166_IN  0x102590, BIT0
969 
970 #define GPIO167_PAD PAD_EMMC_IO17
971 #define GPIO167_OEN 0x102592, BIT5
972 #define GPIO167_OUT 0x102592, BIT4
973 #define GPIO167_IN  0x102592, BIT0
974 
975 #define GPIO168_PAD PAD_DM_P0
976 #define GPIO168_OEN 0x103a8a, BIT4
977 #define GPIO168_OUT 0x103a8a, BIT2
978 #define GPIO168_IN  0x103ab1, BIT5
979 
980 #define GPIO169_PAD PAD_DP_P0
981 #define GPIO169_OEN 0x103a8a, BIT5
982 #define GPIO169_OUT 0x103a8a, BIT3
983 #define GPIO169_IN  0x103ab1, BIT4
984 
985 #define GPIO170_PAD PAD_DM_P1
986 #define GPIO170_OEN 0x103a0a, BIT4
987 #define GPIO170_OUT 0x103a0a, BIT2
988 #define GPIO170_IN  0x103a31, BIT5
989 
990 #define GPIO171_PAD PAD_DP_P1
991 #define GPIO171_OEN 0x103a0a, BIT5
992 #define GPIO171_OUT 0x103a0a, BIT3
993 #define GPIO171_IN  0x103a31, BIT4
994 
995 #define GPIO172_PAD PAD_DM_P2
996 #define GPIO172_OEN 0x10380a, BIT4
997 #define GPIO172_OUT 0x10380a, BIT2
998 #define GPIO172_IN  0x103831, BIT5
999 
1000 #define GPIO173_PAD PAD_DP_P2
1001 #define GPIO173_OEN 0x10380a, BIT5
1002 #define GPIO173_OUT 0x10380a, BIT3
1003 #define GPIO173_IN  0x103831, BIT4
1004 
1005 
1006 #define GPIO174_PAD PADA_TSIO_OUTN_CH0
1007 #define GPIO174_OEN 0x171f02, BIT2
1008 #define GPIO174_OUT 0x171f03, BIT0
1009 #define GPIO174_IN  0x171f1b, BIT0
1010 
1011 #define GPIO175_PAD PADA_TSIO_OUTP_CH0
1012 #define GPIO175_OEN 0x171f02, BIT0
1013 #define GPIO175_OUT 0x171f03, BIT2
1014 #define GPIO175_IN  0x171f1b, BIT2
1015 
1016 #define GPIO176_PAD PADA_TSIO_OUTN_CH1
1017 #define GPIO176_OEN 0x171f02, BIT3
1018 #define GPIO176_OUT 0x171f03, BIT1
1019 #define GPIO176_IN  0x171f1b, BIT1
1020 
1021 #define GPIO177_PAD PADA_TSIO_OUTP_CH1
1022 #define GPIO177_OEN 0x171f02, BIT1
1023 #define GPIO177_OUT 0x171f03, BIT3
1024 #define GPIO177_IN  0x171f1b, BIT3
1025 
1026 #define GPIO178_PAD PADA_TSIO_INN
1027 #define GPIO178_OEN 0x171f28, BIT1
1028 #define GPIO178_OUT 0x171f28, BIT0
1029 #define GPIO178_IN  0x171f22, BIT3
1030 
1031 #define GPIO179_PAD PADA_TSIO_INP
1032 #define GPIO179_OEN 0x171f28, BIT3
1033 #define GPIO179_OUT 0x171f28, BIT2
1034 #define GPIO179_IN  0x171f22, BIT4
1035 
1036 //-------------------------------------------------------------------------------------------------
1037 //  Local Structures
1038 //-------------------------------------------------------------------------------------------------
1039 
1040 static const struct gpio_setting
1041 {
1042     MS_U32 r_oen;
1043     MS_U8  m_oen;
1044     MS_U32 r_out;
1045     MS_U8  m_out;
1046     MS_U32 r_in;
1047     MS_U8  m_in;
1048 } gpio_table[] =
1049 {
1050 #define __GPIO__(_x_)   { CONCAT(CONCAT(GPIO, _x_), _OEN),   \
1051                           CONCAT(CONCAT(GPIO, _x_), _OUT),   \
1052                           CONCAT(CONCAT(GPIO, _x_), _IN) }
1053 #define __GPIO(_x_)     __GPIO__(_x_)
1054 
1055 //
1056 // !! WARNING !! DO NOT MODIFIY !!!!
1057 //
1058 // These defines order must match following
1059 // 1. the PAD name in GPIO excel
1060 // 2. the perl script to generate the package header file
1061 //
1062     __GPIO(999), // 0 is not used
1063 
1064     __GPIO(0), __GPIO(1), __GPIO(2), __GPIO(3), __GPIO(4),
1065     __GPIO(5), __GPIO(6), __GPIO(7), __GPIO(8), __GPIO(9),
1066     __GPIO(10), __GPIO(11), __GPIO(12), __GPIO(13), __GPIO(14),
1067     __GPIO(15), __GPIO(16), __GPIO(17), __GPIO(18), __GPIO(19),
1068     __GPIO(20), __GPIO(21), __GPIO(22), __GPIO(23), __GPIO(24),
1069     __GPIO(25), __GPIO(26), __GPIO(27), __GPIO(28), __GPIO(29),
1070     __GPIO(30), __GPIO(31), __GPIO(32), __GPIO(33), __GPIO(34),
1071     __GPIO(35), __GPIO(36), __GPIO(37), __GPIO(38), __GPIO(39),
1072     __GPIO(40), __GPIO(41), __GPIO(42), __GPIO(43), __GPIO(44),
1073     __GPIO(45), __GPIO(46), __GPIO(47), __GPIO(48), __GPIO(49),
1074     __GPIO(50), __GPIO(51), __GPIO(52), __GPIO(53), __GPIO(54),
1075     __GPIO(55), __GPIO(56), __GPIO(57), __GPIO(58), __GPIO(59),
1076     __GPIO(60), __GPIO(61), __GPIO(62), __GPIO(63), __GPIO(64),
1077     __GPIO(65), __GPIO(66), __GPIO(67), __GPIO(68), __GPIO(69),
1078     __GPIO(70), __GPIO(71), __GPIO(72), __GPIO(73), __GPIO(74),
1079     __GPIO(75), __GPIO(76), __GPIO(77), __GPIO(78), __GPIO(79),
1080     __GPIO(80), __GPIO(81), __GPIO(82), __GPIO(83), __GPIO(84),
1081     __GPIO(85), __GPIO(86), __GPIO(87), __GPIO(88), __GPIO(89),
1082     __GPIO(90), __GPIO(91), __GPIO(92), __GPIO(93), __GPIO(94),
1083     __GPIO(95), __GPIO(96), __GPIO(97), __GPIO(98), __GPIO(99),
1084     __GPIO(100), __GPIO(101), __GPIO(102), __GPIO(103), __GPIO(104),
1085     __GPIO(105), __GPIO(106), __GPIO(107), __GPIO(108), __GPIO(109),
1086     __GPIO(110), __GPIO(111), __GPIO(112), __GPIO(113), __GPIO(114),
1087     __GPIO(115), __GPIO(116), __GPIO(117), __GPIO(118), __GPIO(119),
1088     __GPIO(120), __GPIO(121), __GPIO(122), __GPIO(123), __GPIO(124),
1089     __GPIO(125), __GPIO(126), __GPIO(127), __GPIO(128), __GPIO(129),
1090     __GPIO(130), __GPIO(131), __GPIO(132), __GPIO(133), __GPIO(134),
1091     __GPIO(135), __GPIO(136), __GPIO(137), __GPIO(138), __GPIO(139),
1092     __GPIO(140), __GPIO(141), __GPIO(142), __GPIO(143), __GPIO(144),
1093     __GPIO(145), __GPIO(146), __GPIO(147), __GPIO(148), __GPIO(149),
1094     __GPIO(150), __GPIO(151), __GPIO(152), __GPIO(153), __GPIO(154),
1095     __GPIO(155), __GPIO(156), __GPIO(157), __GPIO(158), __GPIO(159),
1096     __GPIO(160), __GPIO(161), __GPIO(162), __GPIO(163), __GPIO(164),
1097     __GPIO(165), __GPIO(166), __GPIO(167), __GPIO(168), __GPIO(169),
1098     __GPIO(170), __GPIO(171), __GPIO(172), __GPIO(173), __GPIO(174),
1099     __GPIO(175), __GPIO(176), __GPIO(177), __GPIO(178), __GPIO(179),
1100 };
1101 
1102 
1103 //-------------------------------------------------------------------------------------------------
1104 //  Global Variables
1105 //-------------------------------------------------------------------------------------------------
1106 static MS_VIRT _gMIO_MapBase = 0;
1107 static MS_VIRT _gMIO_MapBase_PM = 0;
1108 static MS_VIRT _gMIO_MapBase_nonPM = 0;
1109 
1110 //-------------------------------------------------------------------------------------------------
1111 //  Local Variables
1112 //-------------------------------------------------------------------------------------------------
1113 
1114 //-------------------------------------------------------------------------------------------------
1115 //  Debug Functions
1116 //-------------------------------------------------------------------------------------------------
1117 
1118 
1119 //-------------------------------------------------------------------------------------------------
1120 //  Local Functions
1121 //-------------------------------------------------------------------------------------------------
1122 
1123 //-------------------------------------------------------------------------------------------------
1124 //  Global Functions
1125 //-------------------------------------------------------------------------------------------------
HAL_Gpio_Set_High(MS_GPIO_NUM gpio)1126 static void HAL_Gpio_Set_High(MS_GPIO_NUM gpio)
1127 {
1128     if (gpio >= 1 && gpio <= END_GPIO_NUM)
1129     {
1130         _gMIO_MapBase = _gMIO_MapBase_PM;
1131         MDrv_WriteRegBit(gpio_table[gpio].r_out, 1, gpio_table[gpio].m_out);
1132         MDrv_WriteRegBit(gpio_table[gpio].r_oen, 0, gpio_table[gpio].m_oen);
1133     }
1134     else
1135     {
1136         MS_ASSERT(0);
1137     }
1138 }
1139 
HAL_Gpio_Set_Low(MS_GPIO_NUM gpio)1140 static void HAL_Gpio_Set_Low(MS_GPIO_NUM gpio)
1141 {
1142     if (gpio >= 1 && gpio <= END_GPIO_NUM)
1143     {
1144         _gMIO_MapBase = _gMIO_MapBase_PM;
1145         MDrv_WriteRegBit(gpio_table[gpio].r_out, 0, gpio_table[gpio].m_out);
1146         MDrv_WriteRegBit(gpio_table[gpio].r_oen, 0, gpio_table[gpio].m_oen);
1147     }
1148     else
1149     {
1150         MS_ASSERT(0);
1151     }
1152 }
1153 
HAL_Gpio_Set_Input(MS_GPIO_NUM gpio)1154 static void HAL_Gpio_Set_Input(MS_GPIO_NUM gpio)
1155 {
1156     if (gpio >= 1 && gpio <= END_GPIO_NUM)
1157     {
1158         _gMIO_MapBase = _gMIO_MapBase_PM;
1159         MDrv_WriteRegBit(gpio_table[gpio].r_oen, 1, gpio_table[gpio].m_oen);
1160     }
1161     else
1162     {
1163         MS_ASSERT(0);
1164     }
1165 }
1166 
HAL_Gpio_Get_InOut(MS_GPIO_NUM gpio)1167 static int HAL_Gpio_Get_InOut(MS_GPIO_NUM gpio)
1168 {
1169     int r;
1170 
1171     if (gpio >= 1 && gpio <= END_GPIO_NUM)
1172     {
1173         _gMIO_MapBase = _gMIO_MapBase_PM;
1174         r = MDrv_ReadRegBit(gpio_table[gpio].r_oen, gpio_table[gpio].m_oen);
1175     }
1176     else
1177     {
1178         r = 0;
1179         MS_ASSERT(0);
1180     }
1181 
1182     return (r != 0);
1183 }
1184 
1185 
HAL_Gpio_Get_Level(MS_GPIO_NUM gpio)1186 static int HAL_Gpio_Get_Level(MS_GPIO_NUM gpio)
1187 {
1188     int r;
1189 
1190     if (gpio >= 1 && gpio <= END_GPIO_NUM)
1191     {
1192         _gMIO_MapBase = _gMIO_MapBase_PM;
1193         r = MDrv_ReadRegBit(gpio_table[gpio].r_in, gpio_table[gpio].m_in);
1194     }
1195     else
1196     {
1197         r = 0;
1198         MS_ASSERT(0);
1199     }
1200 
1201     return (r != 0);
1202 }
1203 
1204 const struct gpio_operations __gpio =
1205 {
1206     .set_high  = HAL_Gpio_Set_High,
1207     .set_low   = HAL_Gpio_Set_Low,
1208     .set_input = HAL_Gpio_Set_Input,
1209     .get_inout = HAL_Gpio_Get_InOut,
1210     .get_level = HAL_Gpio_Get_Level,
1211 };
1212 
1213 
HAL_GPIO_SetIOMapBase(MS_VIRT u32Base)1214 void HAL_GPIO_SetIOMapBase(MS_VIRT u32Base)
1215 {
1216     _gMIO_MapBase_nonPM = u32Base;
1217 }
1218 
HAL_GPIO_SetIOMapBase_PM(MS_VIRT u32Base)1219 void HAL_GPIO_SetIOMapBase_PM(MS_VIRT u32Base)
1220 {
1221     _gMIO_MapBase_PM = u32Base;
1222 }
1223 
HAL_GPIO_Interrupt_Init(void)1224 void HAL_GPIO_Interrupt_Init(void)
1225 {
1226 
1227 }
1228 
HAL_GPIO_Interrupt_Action(void)1229 void HAL_GPIO_Interrupt_Action(void)
1230 {
1231 
1232 }
1233 
HAL_GPIO_Attach_Interrupt(MS_GPIO_NUM gpio_num,GPIO_Edge gpio_edge_type,GPIO_Callback pCallback)1234 GPIO_Result HAL_GPIO_Attach_Interrupt(MS_GPIO_NUM gpio_num,GPIO_Edge gpio_edge_type,GPIO_Callback pCallback)
1235 {
1236     printf("Not Support HAL_GPIO_Attach_Interrupt %d, %d \n", gpio_num, gpio_edge_type);
1237     return E_GPIO_NOT_SUPPORT;
1238 }
1239 
HAL_GPIO_Datach_Interrupt(MS_GPIO_NUM gpio_num)1240 GPIO_Result HAL_GPIO_Datach_Interrupt(MS_GPIO_NUM gpio_num)
1241 {
1242     printf("Not Support HAL_GPIO_Datach_Interrupt %d\n", gpio_num);
1243     return E_GPIO_NOT_SUPPORT;
1244 }
1245 
HAL_GPIO_Enable_Interrupt(MS_GPIO_NUM gpio)1246 GPIO_Result HAL_GPIO_Enable_Interrupt(MS_GPIO_NUM gpio)
1247 {
1248     printf("Not Support HAL_GPIO_Enable_Interrupt %d\n", gpio);
1249     return E_GPIO_NOT_SUPPORT;
1250 }
1251 
HAL_GPIO_Disable_Interrupt(MS_GPIO_NUM gpio)1252 GPIO_Result HAL_GPIO_Disable_Interrupt(MS_GPIO_NUM gpio)
1253 {
1254     printf("Not Support HAL_GPIO_Disable_Interrupt %d\n", gpio);
1255     return E_GPIO_NOT_SUPPORT;
1256 }
1257 
HAL_GPIO_Enable_Interrupt_all(void)1258 void HAL_GPIO_Enable_Interrupt_all(void)
1259 {
1260 
1261 }
1262 
HAL_GPIO_Disable_Interrupt_all(void)1263 void HAL_GPIO_Disable_Interrupt_all(void)
1264 {
1265 
1266 }
1267 
1268 #endif      //_HALGPIO_C_
1269