source: svn/newcon3bcm2_21bu/magnum/portinginterface/gio/7552/bgio.h @ 22

Last change on this file since 22 was 22, checked in by phkim, 11 years ago
  1. phkim
  2. newcon3sk 를 kctv 로 브랜치 함
  • Property svn:executable set to *
File size: 45.6 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2011, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bgio.h $
11 * $brcm_Revision: Hydra_Software_Devel/30 $
12 * $brcm_Date: 4/13/11 6:53p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/gio/7038/bgio.h $
19 *
20 * Hydra_Software_Devel/30   4/13/11 6:53p tdo
21 * SW7425-112: Add GIO support for 7425 B0 chip
22 *
23 * Hydra_Software_Devel/29   4/13/11 6:18p tdo
24 * SW7425-112: undo previous check in
25 *
26 * Hydra_Software_Devel/28   4/13/11 6:14p tdo
27 * SW7425-112: Add GIO support for 7425 B0 chip
28 *
29 * Hydra_Software_Devel/27   11/17/10 9:02a tdo
30 * SW7231-11: Add GIO PI support for 7231/7344/7346
31 *
32 * Hydra_Software_Devel/26   11/17/10 12:37a tdo
33 * SW7231-11: Undo previous check-in, waiting for the rest of changeset
34 * check-in clear (due to mastership)
35 *
36 * Hydra_Software_Devel/25   11/16/10 11:55p tdo
37 * SW7231-11: Add GIO PI support for 7231/7344/7346
38 *
39 * Hydra_Software_Devel/24   8/12/10 12:59p tdo
40 * SW7358-6: Add support for 7358
41 *
42 * Hydra_Software_Devel/SW7358-6/1   8/12/10 2:47p xhuang
43 * SW7358-6: Add support for 7358 in gio
44 *
45 * Hydra_Software_Devel/23   6/24/10 7:07p vanessah
46 * SW7422-12:  Naming convention problem for the registers.
47 *
48 * Hydra_Software_Devel/21   4/8/08 5:47p tdo
49 * PR41205: Add _isr functions to avoid deadlock
50 *
51 * Hydra_Software_Devel/20   2/27/08 11:54a tdo
52 * PR34956: Re-organize GPIO pin  mux and add 3548 support.
53 *
54 * Hydra_Software_Devel/19   2/14/08 6:24p pntruong
55 * PR34956: Added stub to compile for 3548.
56 *
57 * Hydra_Software_Devel/18   11/20/07 10:52p tdo
58 * PR36883: Add gio PI suppport for 7335
59 *
60 * Hydra_Software_Devel/17   10/15/07 2:29p yuxiaz
61 * PR36114: Added GIO support for 7325.
62 *
63 * Hydra_Software_Devel/16   9/12/07 6:34p syang
64 * PR 30391, PR 32351: guard reg read and modify by kni critical section
65 *
66 * Hydra_Software_Devel/15   5/18/07 3:20p syang
67 * PR 31356: add gpio PI support for 7440 B0
68 *
69 * Hydra_Software_Devel/14   5/18/07 10:47a yuxiaz
70 * PR30839: Added 7405 support in GIO.
71 *
72 * Hydra_Software_Devel/13   12/29/06 11:32a syang
73 * PR 25750: add 7403 and 7400 B0 support
74 *
75 * Hydra_Software_Devel/12   8/7/06 2:15p syang
76 * PR 22789: add gpio70 for 7118
77 *
78 * Hydra_Software_Devel/11   7/21/06 11:26a syang
79 * PR 22789: added support for gio control set *_EXT_HI and more pins with
80 * control set *_EXT, added suuport for 7118, 3563 and 7440
81 *
82 * Hydra_Software_Devel/10   3/23/06 2:25p syang
83 * PR 19670: added support for 7438 A0
84 *
85 * Hydra_Software_Devel/9   2/3/06 5:00p syang
86 * PR 19425: added 7400 support
87 *
88 * Hydra_Software_Devel/8   7/14/05 5:05p syang
89 * PR 16058: added 7401 support
90 *
91 * Hydra_Software_Devel/7   3/16/05 12:32p syang
92 * PR 14421: added support for 3560
93 *
94 * Hydra_Software_Devel/6   3/15/04 6:26p syang
95 * PR 10097: fixed a typo in comments
96 *
97 * Hydra_Software_Devel/5   2/24/04 7:19p syang
98 * PR 9785: added desc for the case that pin type mismatch with connected
99 * bus
100 *
101 * Hydra_Software_Devel/4   2/20/04 11:20a syang
102 * PR 9785: added more detail to the desc of enums
103 *
104 * Hydra_Software_Devel/3   2/18/04 11:52a syang
105 * PR 9785: updated pin type to input, push-pull, open-drain.
106 *
107 * Hydra_Software_Devel/2   2/17/04 6:56p syang
108 * PR 9785: corrected a few typo
109 *
110 * Hydra_Software_Devel/1   2/17/04 6:37p syang
111 * PR 9785: init version
112 *
113 ***************************************************************************/
114#ifndef BGIO_H__
115#define BGIO_H__
116
117#include "bchp.h"          /* Chip information */
118#include "breg_mem.h"      /* Chip register access (memory mapped). */
119
120#ifdef __cplusplus
121extern "C" {
122#endif
123
124
125/****************************=Module Overview: *****************************
126GPIO module provides porting interface API for higher level software to
127control hardware GPIO pins. The API exposes hardware functionalities and
128hides the hardware and software details. It is targeted for Hydra core based
129chip, and is also intended to fit future chips.
130
131On a 7038 chip there are 67 pins that could be used as GPIO pins. The GPIO
132pins (hardware) are identified with enum of BGIO_PinId, and are represented
133as BGIO_Pin sub-module in software.
134
135A GPIO pin could be physically wired to a bus or a connection port of some
136device outside the 7038 chip. Through this GPIO pin, user could then write
137an application program to accept information from and/or to interact with
138the devices on the bus or the directly wired device, by reading from and/or
139writing to the GPIO pin. The value read from or written to a pin is either
1400 (low) or 1 (high).
141
142The application software need to get a GPIO module handle by calling
143BGIO_Open, and to use this module handle to create a sub-module handle to
144the GPIO pin by calling BGIO_Pin_Create. The sub-module handle could then
145be used to configure, to read from, and to write to the pin. All GPIO pin sub-
146module functions are prefixed with BGIO_Pin_.
147
148When BGIO needs to read a register and to modify it during pin configuring
149or value setting, the reading from and writing to register are guarded with
150BKNI critical section.
151
152As creating the BGIO_Pin sub-module for a GPIO pin, its PinId is passed to
153BGIO_Pin_Create as an input parameter, the corresponding pin control mux
154register is automatically configured by BGIO module to set the pin to work
155as a GPIO pin (notice that the physical pins are typically shared with other
156function modules of the chip). If some other function block is using the
157pin, the block's function might not perform correctly.
158
159As an usage example, user could physically connect two GPIO pins to the BSC
160bus, one to SCL clock line and another to SDA data line. And then write an
161application program to implement a BSC slave device, to interact with all
162other devices on the BSC bus.
163
164The virtual BSC slave device could be used to read and write registers,
165memory, input / output ports in the devices on the BSC bus, for debug or
166function purpose. Notice that some modules IN the 7038 chip might also be
167connected with the BSC bus through some other pins.
168
169GPIO Pin Type
170-------------
171
172Among the 67 GPIO pins, 59 of them are standard GPIO pins and the
173remaining 8 are special GPIO pins. A standard GPIO could be programmed to be
174a type of input, push-pull output, or open-drain output, and a special GPIO
175pin could only work in type of input and open-drain output.
176
177When programmed to be type of input, it can only be read from, and will not
178drive the bus or the port connected to it. The value read back could 0 (low)
179or 1 (high).
180
181During working as type of push-pull output, it is ideally the unique driver
182of the connected bus or port, till the type changes. The value to drive out
183is either 0 (low) or 1 (high). It could change by setting the value of the
184GPIO pin. However, it could also be read from, in order to monitor the
185activity. Driving 0 out is also called pull-down, and driving 1 out is
186called push-up.
187
188A pin of open drain output type is typically connected to a wired-AND bus
189line. The line is high (1) if no one pulls down it, and if any device pulls
190down it, it becomes low (0). The application program could read it and
191pulling it down (and then releasing it).
192
193The software configured GPIO pin type must match the type of bus line or
194port the GPIO pin is physically connected to. For example, if a GPIO pin is
195configured as push-pull type and its connected bus is a wired-AND bus, or if
196a GPIO pin is configured as open-drain type and its connected bus is not a
197wired-AND type, BGIO's behavior is undetermined.
198
199Please notice that the type could be dynamically changed by software. It is
200possible that the application program sets the GPIO pin as input type,
201reads a few bits, and then changes the pin type to push-pull output and then
202writes a few bits, and so on.
203
204Interrupt
205---------
206
207A GPIO pin could generate interrupt when certain condition happens. The
208conditions are represented in enum BGIO_IntrMode. BGIO_Pin sub-module
209provides API function to check the level 3 interrupt status, to clear the
210level 3 interrupt status, to set interrupt mode, to enable the interrupt
211for the GPIO pin.
212
213Application software is responsible to connect / register / enable level 1
214and level 2 interrupt.
215****************************************************************************/
216
217/***************************************************************************
218Summary:
219        The handle for the GPIO module.
220
221Description:
222        This is an opaque handle that application created with BGIO_Open.
223        BGIO_Handle represents the context of the GPIO module. It is needed
224        before using any other API functions of GPIO module. The higher level
225        software is responsive to ensure that there exists only one BGIO_Handle
226        per chip.
227
228        When the GPIO module handle is no longer needed, it should be closed
229        by BGIO_Close.
230
231See also:
232        BGIO_Open, BGIO_Close
233        BGIO_Pin_Handle, BGIO_Pin_Create
234****************************************************************************/
235typedef struct BGIO_P_Context *BGIO_Handle;
236
237/***************************************************************************
238Summary:
239        GPIO pin sub-module handle, or GPIO pin handle for simplicity.
240
241Description:
242        This is an opaque handle that holds the context for a GPIO pin. It is
243        needed when the GPIO pin is configured or used.
244
245        GPIO pin handle is created with BGIO_Pin_Create. There are 67 GPIO pins
246        (59 standard and 8 special) on a 7038 chip. When the GPIO pin handle is
247        created, its pin ID is needed.
248
249        When the GPIO pin sub-module handle is no longer needed, it should be
250        destroyed by BGIO_Destroy.
251
252        Please refer to the GPIO module overview for more usage info.
253
254See Also:
255        GPIO, BGIO_Handle
256        BGIO_Pin_Create, BGIO_Pin_Destroy
257        BGIO_Pin_GetId,
258        BGIO_Pin_SetType, BGIO_Pin_GetType,
259        BGIO_Pin_GetValue,
260        BGIO_Pin_PushPull_SetValue,
261        BGIO_Pin_OpenDrain_PullDown, BGIO_Pin_OpenDrain_Release,
262        BGIO_Pin_SetIntrMode, BGIO_Pin_GetIntrMode,
263        BGIO_Pin_GetIntrStatus, BGIO_Pin_ClearIntrStatus.
264***************************************************************************/
265typedef struct BGIO_P_Pin_Context        *BGIO_Pin_Handle;
266
267/***************************************************************************
268Summary:
269        This enumeration represents GPIO pins
270
271Description:
272        BGIO_PinId is an enumeration which represents all GPIO pins managed by
273        GPIO module.
274
275        Among the 67 GPIO pins, 59 of them are standard GPIO pins and the
276        remaining 8 are special GPIO pins. A standard GPIO could be programmed
277        to be a type of input, push-pull output, or open-drain output, and a
278        special GPIO pin could only work in type of input and open-drain output.
279
280See Also:
281        BGIO_Pin_Create, BGIO_Pin_GetId
282***************************************************************************/
283typedef enum BGIO_PinId
284{
285        BGIO_PinId_eGpio000,    /* standard GPIO pin 000 */
286        BGIO_PinId_eGpio001,    /* standard GPIO pin 001 */
287        BGIO_PinId_eGpio002,    /* standard GPIO pin 002 */
288        BGIO_PinId_eGpio003,    /* standard GPIO pin 003 */
289        BGIO_PinId_eGpio004,    /* standard GPIO pin 004 */
290        BGIO_PinId_eGpio005,    /* standard GPIO pin 005 */
291        BGIO_PinId_eGpio006,    /* standard GPIO pin 006 */
292        BGIO_PinId_eGpio007,    /* standard GPIO pin 007 */
293        BGIO_PinId_eGpio008,    /* standard GPIO pin 008 */
294        BGIO_PinId_eGpio009,    /* standard GPIO pin 009 */
295        BGIO_PinId_eGpio010,    /* standard GPIO pin 010 */
296        BGIO_PinId_eGpio011,    /* standard GPIO pin 011 */
297        BGIO_PinId_eGpio012,    /* standard GPIO pin 012 */
298        BGIO_PinId_eGpio013,    /* standard GPIO pin 013 */
299        BGIO_PinId_eGpio014,    /* standard GPIO pin 014 */
300        BGIO_PinId_eGpio015,    /* standard GPIO pin 015 */
301        BGIO_PinId_eGpio016,    /* standard GPIO pin 016 */
302        BGIO_PinId_eGpio017,    /* standard GPIO pin 017 */
303        BGIO_PinId_eGpio018,    /* standard GPIO pin 018 */
304        BGIO_PinId_eGpio019,    /* standard GPIO pin 019 */
305        BGIO_PinId_eGpio020,    /* standard GPIO pin 020 */
306        BGIO_PinId_eGpio021,    /* standard GPIO pin 021 */
307        BGIO_PinId_eGpio022,    /* standard GPIO pin 022 */
308        BGIO_PinId_eGpio023,    /* standard GPIO pin 023 */
309        BGIO_PinId_eGpio024,    /* standard GPIO pin 024 */
310        BGIO_PinId_eGpio025,    /* standard GPIO pin 025 */
311        BGIO_PinId_eGpio026,    /* standard GPIO pin 026 */
312        BGIO_PinId_eGpio027,    /* standard GPIO pin 027 */
313        BGIO_PinId_eGpio028,    /* standard GPIO pin 028 */
314        BGIO_PinId_eGpio029,    /* standard GPIO pin 029 */
315        BGIO_PinId_eGpio030,    /* standard GPIO pin 030 */
316        BGIO_PinId_eGpio031,    /* standard GPIO pin 031 */
317        BGIO_PinId_eGpio032,    /* standard GPIO pin 032 */
318        BGIO_PinId_eGpio033,    /* standard GPIO pin 033 */
319        BGIO_PinId_eGpio034,    /* standard GPIO pin 034 */
320        BGIO_PinId_eGpio035,    /* standard GPIO pin 035 */
321        BGIO_PinId_eGpio036,    /* standard GPIO pin 036 */
322        BGIO_PinId_eGpio037,    /* standard GPIO pin 037 */
323        BGIO_PinId_eGpio038,    /* standard GPIO pin 038 */
324        BGIO_PinId_eGpio039,    /* standard GPIO pin 039 */
325        BGIO_PinId_eGpio040,    /* standard GPIO pin 040 */
326        BGIO_PinId_eGpio041,    /* standard GPIO pin 041 */
327        BGIO_PinId_eGpio042,    /* standard GPIO pin 042 */
328        BGIO_PinId_eGpio043,    /* standard GPIO pin 043 */
329        BGIO_PinId_eGpio044,    /* standard GPIO pin 044 */
330        BGIO_PinId_eGpio045,    /* standard GPIO pin 045 */
331        BGIO_PinId_eGpio046,    /* standard GPIO pin 046 */
332        BGIO_PinId_eGpio047,    /* standard GPIO pin 047 */
333        BGIO_PinId_eGpio048,    /* standard GPIO pin 048 */
334        BGIO_PinId_eGpio049,    /* standard GPIO pin 049 */
335        BGIO_PinId_eGpio050,    /* standard GPIO pin 050 */
336        BGIO_PinId_eGpio051,    /* standard GPIO pin 051 */
337        BGIO_PinId_eGpio052,    /* standard GPIO pin 052 */
338        BGIO_PinId_eGpio053,    /* standard GPIO pin 053 */
339        BGIO_PinId_eGpio054,    /* standard GPIO pin 054 */
340        BGIO_PinId_eGpio055,    /* standard GPIO pin 055 */
341        BGIO_PinId_eGpio056,    /* standard GPIO pin 056 */
342        BGIO_PinId_eGpio057,    /* standard GPIO pin 057 */
343        BGIO_PinId_eGpio058,    /* standard GPIO pin 058 */
344        BGIO_PinId_eGpio059,    /* standard GPIO pin 059 */
345        BGIO_PinId_eGpio060,    /* standard GPIO pin 060 */
346        BGIO_PinId_eGpio061,    /* standard GPIO pin 061 */
347        BGIO_PinId_eGpio062,    /* standard GPIO pin 062 */
348        BGIO_PinId_eGpio063,    /* standard GPIO pin 063 */
349        BGIO_PinId_eGpio064,    /* standard GPIO pin 064 */
350        BGIO_PinId_eGpio065,    /* standard GPIO pin 065 */
351        BGIO_PinId_eGpio066,    /* standard GPIO pin 066 */
352        BGIO_PinId_eGpio067,    /* standard GPIO pin 067 */
353        BGIO_PinId_eGpio068,    /* standard GPIO pin 068 */
354        BGIO_PinId_eGpio069,    /* standard GPIO pin 069 */
355        BGIO_PinId_eGpio070,    /* standard GPIO pin 070 */
356        BGIO_PinId_eGpio071,    /* standard GPIO pin 071 */
357        BGIO_PinId_eGpio072,    /* standard GPIO pin 072 */
358        BGIO_PinId_eGpio073,    /* standard GPIO pin 073 */
359        BGIO_PinId_eGpio074,    /* standard GPIO pin 074 */
360        BGIO_PinId_eGpio075,    /* standard GPIO pin 075 */
361        BGIO_PinId_eGpio076,    /* standard GPIO pin 076 */
362        BGIO_PinId_eGpio077,    /* standard GPIO pin 077 */
363        BGIO_PinId_eGpio078,    /* standard GPIO pin 078 */
364        BGIO_PinId_eGpio079,    /* standard GPIO pin 079 */
365        BGIO_PinId_eGpio080,    /* standard GPIO pin 080 */
366        BGIO_PinId_eGpio081,    /* standard GPIO pin 081 */
367        BGIO_PinId_eGpio082,    /* standard GPIO pin 082 */
368        BGIO_PinId_eGpio083,    /* standard GPIO pin 083 */
369        BGIO_PinId_eGpio084,    /* standard GPIO pin 084 */
370        BGIO_PinId_eGpio085,    /* standard GPIO pin 085 */
371        BGIO_PinId_eGpio086,    /* standard GPIO pin 086 */
372        BGIO_PinId_eGpio087,    /* standard GPIO pin 087 */
373        BGIO_PinId_eGpio088,    /* standard GPIO pin 088 */
374        BGIO_PinId_eGpio089,    /* standard GPIO pin 089 */
375        BGIO_PinId_eGpio090,    /* standard GPIO pin 090 */
376        BGIO_PinId_eGpio091,    /* standard GPIO pin 091 */
377        BGIO_PinId_eGpio092,    /* standard GPIO pin 092 */
378        BGIO_PinId_eGpio093,    /* standard GPIO pin 093 */
379        BGIO_PinId_eGpio094,    /* standard GPIO pin 094 */
380        BGIO_PinId_eGpio095,    /* standard GPIO pin 095 */
381        BGIO_PinId_eGpio096,    /* standard GPIO pin 096 */
382        BGIO_PinId_eGpio097,    /* standard GPIO pin 097 */
383        BGIO_PinId_eGpio098,    /* standard GPIO pin 098 */
384        BGIO_PinId_eGpio099,    /* standard GPIO pin 099 */
385        BGIO_PinId_eGpio100,    /* standard GPIO pin 100 */
386        BGIO_PinId_eGpio101,    /* standard GPIO pin 101 */
387        BGIO_PinId_eGpio102,    /* standard GPIO pin 102 */
388        BGIO_PinId_eGpio103,    /* standard GPIO pin 103 */
389        BGIO_PinId_eGpio104,    /* standard GPIO pin 104 */
390        BGIO_PinId_eGpio105,    /* standard GPIO pin 105 */
391        BGIO_PinId_eGpio106,    /* standard GPIO pin 106 */
392        BGIO_PinId_eGpio107,    /* standard GPIO pin 107 */
393        BGIO_PinId_eGpio108,    /* standard GPIO pin 108 */
394        BGIO_PinId_eGpio109,    /* standard GPIO pin 109 */
395        BGIO_PinId_eGpio110,    /* standard GPIO pin 110 */
396        BGIO_PinId_eGpio111,    /* standard GPIO pin 111 */
397        BGIO_PinId_eGpio112,    /* standard GPIO pin 112 */
398        BGIO_PinId_eGpio113,    /* standard GPIO pin 113 */
399        BGIO_PinId_eGpio114,    /* standard GPIO pin 114 */
400        BGIO_PinId_eGpio115,    /* standard GPIO pin 115 */
401        BGIO_PinId_eGpio116,    /* standard GPIO pin 116 */
402        BGIO_PinId_eGpio117,    /* standard GPIO pin 117 */
403        BGIO_PinId_eGpio118,    /* standard GPIO pin 118 */
404        BGIO_PinId_eGpio119,    /* standard GPIO pin 119 */
405        BGIO_PinId_eGpio120,    /* standard GPIO pin 120 */
406        BGIO_PinId_eGpio121,    /* standard GPIO pin 121 */
407        BGIO_PinId_eGpio122,    /* standard GPIO pin 122 */
408        BGIO_PinId_eGpio123,    /* standard GPIO pin 123 */
409        BGIO_PinId_eGpio124,    /* standard GPIO pin 124 */
410        BGIO_PinId_eGpio125,    /* standard GPIO pin 125 */
411        BGIO_PinId_eGpio126,    /* standard GPIO pin 126 */
412        BGIO_PinId_eGpio127,    /* standard GPIO pin 127 */
413        BGIO_PinId_eGpio128,    /* standard GPIO pin 128 */
414        BGIO_PinId_eGpio129,    /* standard GPIO pin 129 */
415        BGIO_PinId_eGpio130,    /* standard GPIO pin 130 */
416        BGIO_PinId_eGpio131,    /* standard GPIO pin 131 */
417        BGIO_PinId_eGpio132,    /* standard GPIO pin 132 */
418        BGIO_PinId_eGpio133,    /* standard GPIO pin 133 */
419        BGIO_PinId_eGpio134,    /* standard GPIO pin 134 */
420        BGIO_PinId_eGpio135,    /* standard GPIO pin 135 */
421        BGIO_PinId_eGpio136,    /* standard GPIO pin 136 */
422        BGIO_PinId_eGpio137,    /* standard GPIO pin 137 */
423        BGIO_PinId_eGpio138,    /* standard GPIO pin 138 */
424        BGIO_PinId_eGpio139,    /* standard GPIO pin 139 */
425        BGIO_PinId_eGpio140,    /* standard GPIO pin 140 */
426        BGIO_PinId_eGpio141,    /* standard GPIO pin 141 */
427        BGIO_PinId_eGpio142,    /* standard GPIO pin 142 */
428        BGIO_PinId_eGpio143,    /* standard GPIO pin 143 */
429        BGIO_PinId_eGpio144,    /* standard GPIO pin 144 */
430        BGIO_PinId_eGpio145,    /* standard GPIO pin 145 */
431        BGIO_PinId_eGpio146,    /* standard GPIO pin 146 */
432        BGIO_PinId_eGpio147,    /* standard GPIO pin 147 */
433        BGIO_PinId_eGpio148,    /* standard GPIO pin 148 */
434        BGIO_PinId_eGpio149,    /* standard GPIO pin 149 */
435
436        BGIO_PinId_eSgpio00,    /* special GPIO pin 00 */
437        BGIO_PinId_eSgpio01,    /* special GPIO pin 01 */
438        BGIO_PinId_eSgpio02,    /* special GPIO pin 02 */
439        BGIO_PinId_eSgpio03,    /* special GPIO pin 03 */
440        BGIO_PinId_eSgpio04,    /* special GPIO pin 04 */
441        BGIO_PinId_eSgpio05,    /* special GPIO pin 05 */
442        BGIO_PinId_eSgpio06,    /* special GPIO pin 06 */
443        BGIO_PinId_eSgpio07,    /* special GPIO pin 07 */
444        BGIO_PinId_eSgpio08,    /* special GPIO pin 08 */
445        BGIO_PinId_eSgpio09,    /* special GPIO pin 09 */
446
447        BGIO_PinId_eAgpio00,    /* special AON GPIO pin 00 */
448        BGIO_PinId_eAgpio01,    /* special AON GPIO pin 01 */
449        BGIO_PinId_eAgpio02,    /* special AON GPIO pin 02 */
450        BGIO_PinId_eAgpio03,    /* special AON GPIO pin 03 */
451        BGIO_PinId_eAgpio04,    /* special AON GPIO pin 04 */
452        BGIO_PinId_eAgpio05,    /* special AON GPIO pin 05 */
453        BGIO_PinId_eAgpio06,    /* special AON GPIO pin 06 */
454        BGIO_PinId_eAgpio07,    /* special AON GPIO pin 07 */
455        BGIO_PinId_eAgpio08,    /* special AON GPIO pin 08 */
456        BGIO_PinId_eAgpio09,    /* special AON GPIO pin 09 */
457        BGIO_PinId_eAgpio10,    /* special AON GPIO pin 10 */
458        BGIO_PinId_eAgpio11,    /* special AON GPIO pin 11 */
459        BGIO_PinId_eAgpio12,    /* special AON GPIO pin 12 */
460        BGIO_PinId_eAgpio13,    /* special AON GPIO pin 13 */
461        BGIO_PinId_eAgpio14,    /* special AON GPIO pin 14 */
462        BGIO_PinId_eAgpio15,    /* special AON GPIO pin 15 */
463        BGIO_PinId_eAgpio16,    /* special AON GPIO pin 16 */
464        BGIO_PinId_eAgpio17,    /* special AON GPIO pin 17 */
465        BGIO_PinId_eAgpio18,    /* special AON GPIO pin 18 */
466        BGIO_PinId_eAgpio19,    /* special AON GPIO pin 19 */
467        BGIO_PinId_eAgpio20,    /* special AON GPIO pin 20 */
468        BGIO_PinId_eAgpio21,    /* special AON GPIO pin 21 */
469        BGIO_PinId_eAgpio22,    /* special AON GPIO pin 22 */
470        BGIO_PinId_eAgpio23,    /* special AON GPIO pin 23 */
471        BGIO_PinId_eAgpio24,    /* special AON GPIO pin 24 */
472        BGIO_PinId_eAgpio25,    /* special AON GPIO pin 25 */
473        BGIO_PinId_eAgpio26,    /* special AON GPIO pin 26 */
474
475        BGIO_PinId_eAsgpio00, /* standard AON special GPIO 00 */
476        BGIO_PinId_eAsgpio01, /* standard AON special GPIO 01 */
477        BGIO_PinId_eAsgpio02, /* standard AON special GPIO 02 */
478        BGIO_PinId_eAsgpio03, /* standard AON special GPIO 03 */
479        BGIO_PinId_eAsgpio04, /* standard AON special GPIO 04 */
480        BGIO_PinId_eAsgpio05, /* standard AON special GPIO 05 */
481
482        BGIO_PinId_eInvalid
483}
484BGIO_PinId;
485
486/* for backward compatible */
487#define BGIO_PinId_eGpio00   BGIO_PinId_eGpio000
488#define BGIO_PinId_eGpio01   BGIO_PinId_eGpio001
489#define BGIO_PinId_eGpio02   BGIO_PinId_eGpio002
490#define BGIO_PinId_eGpio03   BGIO_PinId_eGpio003
491#define BGIO_PinId_eGpio04   BGIO_PinId_eGpio004
492#define BGIO_PinId_eGpio05   BGIO_PinId_eGpio005
493#define BGIO_PinId_eGpio06   BGIO_PinId_eGpio006
494#define BGIO_PinId_eGpio07   BGIO_PinId_eGpio007
495#define BGIO_PinId_eGpio08   BGIO_PinId_eGpio008
496#define BGIO_PinId_eGpio09   BGIO_PinId_eGpio009
497#define BGIO_PinId_eGpio10   BGIO_PinId_eGpio010
498#define BGIO_PinId_eGpio11   BGIO_PinId_eGpio011
499#define BGIO_PinId_eGpio12   BGIO_PinId_eGpio012
500#define BGIO_PinId_eGpio13   BGIO_PinId_eGpio013
501#define BGIO_PinId_eGpio14   BGIO_PinId_eGpio014
502#define BGIO_PinId_eGpio15   BGIO_PinId_eGpio015
503#define BGIO_PinId_eGpio16   BGIO_PinId_eGpio016
504#define BGIO_PinId_eGpio17   BGIO_PinId_eGpio017
505#define BGIO_PinId_eGpio18   BGIO_PinId_eGpio018
506#define BGIO_PinId_eGpio19   BGIO_PinId_eGpio019
507#define BGIO_PinId_eGpio20   BGIO_PinId_eGpio020
508#define BGIO_PinId_eGpio21   BGIO_PinId_eGpio021
509#define BGIO_PinId_eGpio22   BGIO_PinId_eGpio022
510#define BGIO_PinId_eGpio23   BGIO_PinId_eGpio023
511#define BGIO_PinId_eGpio24   BGIO_PinId_eGpio024
512#define BGIO_PinId_eGpio25   BGIO_PinId_eGpio025
513#define BGIO_PinId_eGpio26   BGIO_PinId_eGpio026
514#define BGIO_PinId_eGpio27   BGIO_PinId_eGpio027
515#define BGIO_PinId_eGpio28   BGIO_PinId_eGpio028
516#define BGIO_PinId_eGpio29   BGIO_PinId_eGpio029
517#define BGIO_PinId_eGpio30   BGIO_PinId_eGpio030
518#define BGIO_PinId_eGpio31   BGIO_PinId_eGpio031
519#define BGIO_PinId_eGpio32   BGIO_PinId_eGpio032
520#define BGIO_PinId_eGpio33   BGIO_PinId_eGpio033
521#define BGIO_PinId_eGpio34   BGIO_PinId_eGpio034
522#define BGIO_PinId_eGpio35   BGIO_PinId_eGpio035
523#define BGIO_PinId_eGpio36   BGIO_PinId_eGpio036
524#define BGIO_PinId_eGpio37   BGIO_PinId_eGpio037
525#define BGIO_PinId_eGpio38   BGIO_PinId_eGpio038
526#define BGIO_PinId_eGpio39   BGIO_PinId_eGpio039
527#define BGIO_PinId_eGpio40   BGIO_PinId_eGpio040
528#define BGIO_PinId_eGpio41   BGIO_PinId_eGpio041
529#define BGIO_PinId_eGpio42   BGIO_PinId_eGpio042
530#define BGIO_PinId_eGpio43   BGIO_PinId_eGpio043
531#define BGIO_PinId_eGpio44   BGIO_PinId_eGpio044
532#define BGIO_PinId_eGpio45   BGIO_PinId_eGpio045
533#define BGIO_PinId_eGpio46   BGIO_PinId_eGpio046
534#define BGIO_PinId_eGpio47   BGIO_PinId_eGpio047
535#define BGIO_PinId_eGpio48   BGIO_PinId_eGpio048
536#define BGIO_PinId_eGpio49   BGIO_PinId_eGpio049
537#define BGIO_PinId_eGpio50   BGIO_PinId_eGpio050
538#define BGIO_PinId_eGpio51   BGIO_PinId_eGpio051
539#define BGIO_PinId_eGpio52   BGIO_PinId_eGpio052
540#define BGIO_PinId_eGpio53   BGIO_PinId_eGpio053
541#define BGIO_PinId_eGpio54   BGIO_PinId_eGpio054
542#define BGIO_PinId_eGpio55   BGIO_PinId_eGpio055
543#define BGIO_PinId_eGpio56   BGIO_PinId_eGpio056
544#define BGIO_PinId_eGpio57   BGIO_PinId_eGpio057
545#define BGIO_PinId_eGpio58   BGIO_PinId_eGpio058
546#define BGIO_PinId_eGpio59   BGIO_PinId_eGpio059
547#define BGIO_PinId_eGpio60   BGIO_PinId_eGpio060
548#define BGIO_PinId_eGpio61   BGIO_PinId_eGpio061
549#define BGIO_PinId_eGpio62   BGIO_PinId_eGpio062
550#define BGIO_PinId_eGpio63   BGIO_PinId_eGpio063
551#define BGIO_PinId_eGpio64   BGIO_PinId_eGpio064
552#define BGIO_PinId_eGpio65   BGIO_PinId_eGpio065
553#define BGIO_PinId_eGpio66   BGIO_PinId_eGpio066
554#define BGIO_PinId_eGpio67   BGIO_PinId_eGpio067
555#define BGIO_PinId_eGpio68   BGIO_PinId_eGpio068
556#define BGIO_PinId_eGpio69   BGIO_PinId_eGpio069
557#define BGIO_PinId_eGpio70   BGIO_PinId_eGpio070
558#define BGIO_PinId_eGpio71   BGIO_PinId_eGpio071
559#define BGIO_PinId_eGpio72   BGIO_PinId_eGpio072
560#define BGIO_PinId_eGpio73   BGIO_PinId_eGpio073
561#define BGIO_PinId_eGpio74   BGIO_PinId_eGpio074
562#define BGIO_PinId_eGpio75   BGIO_PinId_eGpio075
563#define BGIO_PinId_eGpio76   BGIO_PinId_eGpio076
564#define BGIO_PinId_eGpio77   BGIO_PinId_eGpio077
565#define BGIO_PinId_eGpio78   BGIO_PinId_eGpio078
566#define BGIO_PinId_eGpio79   BGIO_PinId_eGpio079
567#define BGIO_PinId_eGpio80   BGIO_PinId_eGpio080
568#define BGIO_PinId_eGpio81   BGIO_PinId_eGpio081
569#define BGIO_PinId_eGpio82   BGIO_PinId_eGpio082
570#define BGIO_PinId_eGpio83   BGIO_PinId_eGpio083
571#define BGIO_PinId_eGpio84   BGIO_PinId_eGpio084
572#define BGIO_PinId_eGpio85   BGIO_PinId_eGpio085
573#define BGIO_PinId_eGpio86   BGIO_PinId_eGpio086
574#define BGIO_PinId_eGpio87   BGIO_PinId_eGpio087
575#define BGIO_PinId_eGpio88   BGIO_PinId_eGpio088
576#define BGIO_PinId_eGpio89   BGIO_PinId_eGpio089
577#define BGIO_PinId_eGpio90   BGIO_PinId_eGpio090
578#define BGIO_PinId_eGpio91   BGIO_PinId_eGpio091
579#define BGIO_PinId_eGpio92   BGIO_PinId_eGpio092
580#define BGIO_PinId_eGpio93   BGIO_PinId_eGpio093
581#define BGIO_PinId_eGpio94   BGIO_PinId_eGpio094
582#define BGIO_PinId_eGpio95   BGIO_PinId_eGpio095
583#define BGIO_PinId_eGpio96   BGIO_PinId_eGpio096
584#define BGIO_PinId_eGpio97   BGIO_PinId_eGpio097
585#define BGIO_PinId_eGpio98   BGIO_PinId_eGpio098
586#define BGIO_PinId_eGpio99   BGIO_PinId_eGpio099
587
588/***************************************************************************
589Summary:
590        This enumeration represents GPIO pin types
591
592Description:
593        BGIO_PinType is an enumeration which represents all GPIO pin types
594        supported by GPIO module.
595
596        There are three GPIO pin types. They are input, push-pull output, or
597        open-drain output. A standard GPIO could be programmed to be any one of
598        the three types, and a special GPIO pin could only work in type of input
599        and open-drain output.
600
601        When programmed to be type of input, it can only be read from, and will
602        not drive the bus or the port connected to it. The value read back could
603        0 (low) or 1 (high).
604
605        During working as type of push-pull output, it is ideally the unique
606        driver of the connected bus or port, till the type changes. The value
607        to drive out is either 0 (low) or 1 (high). It could change by setting
608        the value of the GPIO pin. However, it could also be read from, in order
609        to monitor the activity. Driving 0 out is also called pull-down, and
610        driving 1 out is called push-up.
611
612        A pin of open drain output type is typically connected to a wired-AND
613        bus line. The line is high (1) if no one pulls down it, and if any
614        device pulls down it, it becomes low (0). The application program could
615        read it and pulling it down (and then releasing it).
616
617        Please notice that the type could be dynamically changed by software. It
618        is possible that the application program sets the GPIO pin as input type,
619        reads a few bits, and then changes the pin type to push-pull output and
620        then writes a few bits, and so on.
621
622See Also:
623        BGIO_Pin_SetPinType, BGIO_Pin_GetPinType.
624***************************************************************************/
625typedef enum BGIO_PinType
626{
627        BGIO_PinType_eInput,         /* Read only */
628        BGIO_PinType_ePushPull,      /* Set and read  */
629        BGIO_PinType_eOpenDrain,     /* Read, and pull down or release */
630        BGIO_PinType_eInvalid
631}
632BGIO_PinType;
633
634/***************************************************************************
635Summary:
636        This enumeration represents GPIO pin value.
637
638Description:
639        There are two possible values 0 (low) and 1 (high) for a GPIO pin.
640        BGIO_PinValue is an enumeration which represents them.
641
642        A push-pull GPIO pin could drive both 0 (low) and 1 (high) out to the
643        bus or connection port wired to this GPIO pin. A open-drain GPIO pin
644        could pull-down the connected AND-wired bus line, till it releases it.
645
646        The value of any GPIO pin could be read at any time. If a push-pull GPIO
647        pin is read, its value would be the value it drives out. When a open-
648        drain GPIO pin pulls-down, the value of 0 (low) will be returned by
649        reading. After it releases the bus, the value read from the pin depends
650        whether there is any other device on the bus that is pulling down the
651        bus.
652
653See Also:
654        BGIO_Pin_GetValue, BGIO_Pin_PushPull_SetValue,
655        BGIO_Pin_OpenDrain_Release, BGIO_Pin_OpenDrain_PullDown.
656***************************************************************************/
657typedef enum BGIO_PinValue
658{
659        BGIO_PinValue_e0 = 0,         /* low, driving low out means pull-down */
660        BGIO_PinValue_e1 = 1,         /* high, driving high out means push-up */
661        BGIO_PinValue_eInvalid
662}
663BGIO_PinValue;
664
665/***************************************************************************
666Summary:
667        This enumeration represents GPIO pin interrupt mode.
668
669Description:
670        BGIO_IntrMode is an enumeration which represents whether level 3
671        interrupt is disabled or enabled for a GPIO pin, and in what condition
672        the GPIO pin should generate interrupt if it is enabled.
673
674        7038 chips only support edge triggering interrupt mode. In this mode the
675        pin fires interrupt when its value changes, and user is expected to call
676        BGIO_Pin_ClearIntrStatus to clear the interrupt bit after the interrupt
677        is served. Besides edge triggering mode, 3560 chips also support level
678        triggering. In this mode the pin drive the interrupt bit when it has the
679        specified value. To clear a level-triggered interrupt, user is expected
680        to change the value of the pin.
681
682See Also:
683        BGIO_Pin_SetIntrMode, BGIO_Pin_GetIntrMode,
684        BGIO_Pin_ClearIntrStatus
685***************************************************************************/
686typedef enum BGIO_IntrMode
687{
688        BGIO_IntrMode_eDisabled,      /* interrupt is disabled */
689        BGIO_IntrMode_e0To1,          /* interrupt fires on rising edge */
690        BGIO_IntrMode_e1To0,          /* interrupt fires on falling edge */
691        BGIO_IntrMode_e0To1_Or_1To0,  /* interrupt fires on both edges */
692#if (BCHP_CHIP!=7038) && (BCHP_CHIP!=7438)
693        BGIO_IntrMode_e0,             /* interrupt generated on value 0 */
694        BGIO_IntrMode_e1,             /* interrupt generated on value 1 */
695#endif
696        BGIO_IntrMode_eInvalid
697}
698BGIO_IntrMode;
699
700/***************************************************************************
701 * Public API: BGIO generic
702 **************************************************************************/
703
704/***************************************************************************
705Summary:
706        This function opens and initializes the GPIO module.
707
708Description:
709        Before any thing could be done to a GPIO pin in the chip, a GPIO module
710        handle, BGIO_Handle, must be opened. From this handle, the sub-module
711        handle of a GPIO pin could be created.
712
713        It is user's responsibility to ensure that there is only one GPIO module
714        handle opened per chip.
715
716        This GPIO module handle should eventually be closed by calling BGIO_Close,
717        when it is no longer needed.
718
719Input:
720        hChip - The chip handle that application created earlier during chip
721        initialization sequence. This handle is used for getting chip
722        information, chip revision, and miscellaneous chip configurations.
723
724        hRegister - The register handle that application created earlier during
725        chip initialization sequence. This handle is used to access chip
726        registers (GPIO registers).
727
728Output:
729        phGpio - The opened GPIO module handle.
730
731Returns:
732        BERR_INVALID_PARAMETER - Invalid function parameters.
733        BERR_SUCCESS - Successfully opened BGIO.
734
735See Also:
736        BGIO_Close,
737        BGIO_Pin_Create
738**************************************************************************/
739BERR_Code BGIO_Open(
740        BGIO_Handle *         phGpio ,
741        BCHP_Handle           hChip,
742        BREG_Handle           hRegister );
743
744/***************************************************************************
745Summary:
746        Close the GPIO handle.
747
748Description:
749        Once this function is called the GPIO handle can no longer be used.
750
751        All GPIO pin sub-module handles should be destroyed before closing the
752        BGIO module handle by BGIO_Close.
753
754Input:
755        hGpio - The GPIO handle to be closed.
756
757Output:
758
759Returns:
760        BERR_INVALID_PARAMETER - hGpio is not a valid GPIO handle.
761        BERR_LEAKED_RESOURCE - There is still GPIO sub-module handle not
762    destroyed.
763        BERR_SUCCESS - Successfully destroyed.
764
765See Also:
766        BGIO_Open,
767        BGIO_Pin_Destroy.
768**************************************************************************/
769BERR_Code BGIO_Close(
770        BGIO_Handle           hGpio );
771
772
773/***************************************************************************
774 * Public API: GPIO pin sub-module
775 **************************************************************************/
776
777/***************************************************************************
778Summary:
779        Creates a GPIO pin sub-module handle to for a GPIO pin.
780
781Description:
782        Once created, the handle to the GPIO pin is required by GPIO pin sub-
783        module functions in order to configure and to use the GPIO pin.
784
785        If the sub-module handle has already been created with the same hGpio,
786        error is returned. This function also initializes the sub-module to
787        default configure.
788
789        During creating the BGIO_Pin sub-module for a GPIO pin, its PinId is
790        passed to BGIO_Pin_Create as an input parameter, the corresponding pin
791        control mux register is automatically configured by BGIO module to set
792        the pin to work as a GPIO pin (notice that the physical pins are
793        typically shared with other function modules of the chip). If some other
794        function block is using the pin, the block's function might not perform
795        correctly.
796
797        Refer to the GPIO module overview for more usage info.
798
799Input:
800        hGpio - Handle to the GPIO module.
801        ePinId - The hardware GPIO pin ID.
802
803Output:
804        phPin - The created GPIO pin sub-module handle. If failure
805        occurred phPin will holds NULL.
806
807Returns:
808        BERR_INVALID_PARAMETER - Invalid function parameters.
809        BERR_SUCCESS - Successfully created the handle.
810
811See Also:
812        BGIO_Pin_Destroy
813**************************************************************************/
814BERR_Code BGIO_Pin_Create(
815        BGIO_Handle           hGpio,
816        BGIO_PinId            ePinId,
817        BGIO_Pin_Handle *     phPin );
818
819/***************************************************************************
820Summary:
821        Destroys the GPIO pin sub-module handle of a GPIO pin.
822
823Description:
824        Once this function is called the sub-module handle can no longer be
825        used.
826
827        GPIO pin sub-module handle should be destroyed before closing the main
828        module handle BGIO_Handle by BGIO_Close.
829
830Input:
831        hPin - The GPIO pin sub-module handle to destroy.
832
833Output:
834
835Returns:
836        BERR_INVALID_PARAMETER - hPin is not a valid GPIO pin sub-module
837        handle.
838        BERR_SUCCESS - Successfully destroyed
839
840See Also:
841        BGIO_Pin_Create
842**************************************************************************/
843BERR_Code BGIO_Pin_Destroy(
844        BGIO_Pin_Handle       hPin );
845
846/***************************************************************************
847Summary:
848        Query the hardware pin ID from a GPIO pin sub-module handle.
849
850Description:
851        The hardware GPIO pin ID is passed to BGIO_Pin_Create when the GPIO pin
852        sub-module handle is created.
853
854Input:
855        hPin - Sub-module handle to the GPIO pin.
856
857Output:
858        pePinId - The returned hardware GPIO pin ID.
859
860Returns:
861        BERR_SUCCESS - Got the pin ID successfully.
862        BERR_INVALID_PARAMETER - One of the input parameters is invalid.
863
864See Also:
865        BGIO_Pin_Create.
866****************************************************************************/
867BERR_Code BGIO_Pin_GetId(
868        BGIO_Pin_Handle       hPin,
869        BGIO_PinId *          pePinId );
870
871/***************************************************************************
872Summary:
873        Set GPIO pin type.
874
875Description:
876        There are several GPIO pin types supported by GPIO module. Each type
877        works differently. This function sets the GPIO pin type.
878
879        The default pin type is BGIO_Pin_eInput.
880
881Input:
882        hPin - Sub-module handle to set the type for.
883        ePinType - GPIO pin type.
884
885Output:
886
887Returns:
888        BERR_SUCCESS - Pin type is set successfully.
889        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
890
891See Also:
892        BGIO_Pin_GetPinType.
893****************************************************************************/
894BERR_Code BGIO_Pin_SetType(
895        BGIO_Pin_Handle       hPin,
896        BGIO_PinType          ePinType );
897
898BERR_Code BGIO_Pin_SetType_isr(
899        BGIO_Pin_Handle       hPin,
900        BGIO_PinType          ePinType );
901
902/***************************************************************************
903Summary:
904        Query for GPIO pin type.
905
906Description:
907        GPIO pin type is initialized when the GPIO pin sub-module is created,
908        and could then be changed by BGIO_Pin_SetType.  This function returns
909        the current pin type of the GPIO pin.
910
911Input:
912        hPin - The GPIO pin sub-module handle.
913
914Output:
915        pePinType - Returned GPIO pin type.
916
917Returns:
918        BERR_SUCCESS - Pin type is got successfully.
919        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
920
921See Also:
922        BGIO_Pin_SetPinType.
923****************************************************************************/
924BERR_Code BGIO_Pin_GetType(
925        BGIO_Pin_Handle       hPin,
926        BGIO_PinType *        pePinType );
927
928/***************************************************************************
929Summary:
930        Get the current value of a GPIO pin.
931
932Description:
933        All GPIO pin type could be read from. This function returns the current
934        value of a GPIO pin. The value is either BGIO_PinValue_e0 (low) or
935        BGIO_PinValue_e1 (high).
936
937Input:
938        hPin - The GPIO pin sub-module handle to get value from.
939
940Output:
941        pePinValue - Returned current GPIO pin value.
942
943Returns:
944        BERR_SUCCESS - The current pin value is read successfully.
945        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
946
947See Also:
948        BGIO_Pin_PushPull_SetValue,
949        BGIO_Pin_OpenDrain_PullDown, BGIO_Pin_OpenDrain_Release
950****************************************************************************/
951BERR_Code BGIO_Pin_GetValue(
952        BGIO_Pin_Handle       hPin,
953        BGIO_PinValue *       pePinValue );
954
955/***************************************************************************
956Summary:
957        Set value for a GPIO pin of type BGIO_PinType_ePushPull.
958
959Description:
960        This function sets value for a GPIO pin of type BGIO_PinType_ePushPull.
961        This value will then be driven to the bus or connection port connected
962        to this GPIO pin, till the value is reset or the pin type is changed.
963
964        If this function is never called for a GPIO pin of BGIO_PinType_ePushPull,
965        its default value is BGIO_PinValue_e0.
966
967        If the GPIO pin type is not BGIO_PinType_ePushPull, this function will
968        return error code BERR_INVALID_PARAMETER.
969
970Input:
971        hPin - The GPIO pin sub-module handle to set value for.
972        ePinValue - GPIO pin value.
973
974Output:
975
976Returns:
977        BERR_SUCCESS - Pin value is set successfully.
978        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
979
980See Also:
981        BGIO_Pin_GetValue,
982        BGIO_Pin_OpenDrain_PullDown, BGIO_Pin_OpenDrain_Release
983        BGIO_Pin_SetType, BGIO_Pin_GetPinType.
984****************************************************************************/
985BERR_Code BGIO_Pin_PushPull_SetValue(
986        BGIO_Pin_Handle       hPin,
987        BGIO_PinValue         ePinValue );
988
989BERR_Code BGIO_Pin_PushPull_SetValue_isr(
990        BGIO_Pin_Handle       hPin,
991        BGIO_PinValue         ePinValue );
992
993/***************************************************************************
994Summary:
995        Perform pull down for GPIO pin of type BGIO_PinType_eOpenDrain.
996
997Description:
998        This function pulls down the AND-wired bus line connected to a GPIO pin
999        of type BGIO_PinType_eOpenDrain, till BGIO_Pin_OpenDrain_Release is
1000        called or the pin type is changed. When a GPIO pin of open drain is
1001        in the state of pull-down, its value is BGIO_PinValue_e0.
1002
1003        If this function is never called for a GPIO pin of
1004        BGIO_PinType_eOpenDrain, it is released.
1005
1006        If the GPIO pin type is not BGIO_PinType_eOpenDrain, this function will
1007        return error code BERR_INVALID_PARAMETER.
1008
1009Input:
1010        hPin - The GPIO pin sub-module handle to perform pull down.
1011
1012Output:
1013
1014Returns:
1015        BERR_SUCCESS - Performs pull down successfully.
1016        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1017
1018See Also:
1019        BGIO_Pin_GetValue,
1020        BGIO_Pin_SetType, BGIO_Pin_GetType,
1021        BGIO_Pin_OpenDrain_Release, BGIO_Pin_PushPull_SetValue.
1022****************************************************************************/
1023BERR_Code BGIO_Pin_OpenDrain_PullDown(
1024        BGIO_Pin_Handle       hPin );
1025
1026BERR_Code BGIO_Pin_OpenDrain_PullDown_isr(
1027        BGIO_Pin_Handle       hPin );
1028
1029/***************************************************************************
1030Summary:
1031        Perform release for a GPIO pin of type BGIO_PinType_eOpenDrain.
1032
1033Description:
1034        If the AND-wired bus line is pulling down by this GPIO pin of type
1035        BGIO_PinType_eOpenDrain, this function releases it. If the GPIO pin is
1036        not pulling down the bus, this function does nothing.
1037
1038        When a GPIO pin of open drain type is in the state of release, its
1039        value could be either BGIO_PinValue_e0 or BGIO_PinValue_e1, depending on
1040        whether there is another device that is pulling down the AND-wired bus
1041        line.
1042
1043        After a GPIO pin sub-module is created, it is in release state by
1044        default.
1045
1046        If the GPIO pin type is not BGIO_PinType_eOpenDrain, this function will
1047        return error code BERR_INVALID_PARAMETER.
1048
1049Input:
1050        hPin - The GPIO pin sub-module handle to perform release.
1051
1052Output:
1053
1054Returns:
1055        BERR_SUCCESS - Performs pull down successfully.
1056        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1057
1058See Also:
1059        BGIO_Pin_GetValue,
1060        BGIO_Pin_SetType, BGIO_Pin_GetType,
1061        BGIO_Pin_OpenDrain_PullDown, BGIO_Pin_PushPull_SetValue.
1062****************************************************************************/
1063BERR_Code BGIO_Pin_OpenDrain_Release(
1064        BGIO_Pin_Handle       hPin );
1065
1066BERR_Code BGIO_Pin_OpenDrain_Release_isr(
1067        BGIO_Pin_Handle       hPin );
1068
1069/***************************************************************************
1070Summary:
1071        Set the interrupt mode for the GPIO pin.
1072
1073Description:
1074        This function sets the level 3 interrupt mode for a GPIO pin. The level
1075        3 interrupt mode is represented by enum BGIO_IntrMode. One of its value
1076        is BGIO_IntrMode_eDisabled, the others represent that the interrupt is
1077        enabled for this GPIO pin and in what condition the GPIO pin should
1078        generate interrupt.
1079
1080        The default behavior is to have interrupt be disabled.
1081
1082Input:
1083        hPin - Sub-module handle to set the interrupt mode for.
1084        eIntrMode - Interrupt generation mode.
1085
1086Output:
1087
1088Returns:
1089        BERR_SUCCESS - Set the interrupt mode successfully.
1090        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1091
1092See Also:
1093        BGIO_Pin_GetIntrMode,
1094        BGIO_Pin_GetIntrStatus, BGIO_Pin_ClearIntrStatus
1095****************************************************************************/
1096BERR_Code BGIO_Pin_SetIntrMode(
1097        BGIO_Pin_Handle       hPin,
1098        BGIO_IntrMode         eIntrMode );
1099
1100BERR_Code BGIO_Pin_SetIntrMode_isr(
1101        BGIO_Pin_Handle       hPin,
1102        BGIO_IntrMode         eIntrMode );
1103
1104/***************************************************************************
1105Summary:
1106        Query for GPIO pin interrupt mode.
1107
1108Description:
1109        This function returns the current level 3 interrupt mode of a GPIO pin.
1110
1111Input:
1112        hPin - Sub-module handle to set the type for.
1113
1114Output:
1115        peIntrMode - Returned interrupt mode.
1116
1117Returns:
1118        BERR_SUCCESS - Got interrupt mode successfully.
1119        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1120
1121See Also:
1122        BGIO_Pin_SetIntrMode,
1123        BGIO_Pin_GetIntrStatus, BGIO_Pin_ClearIntrStatus
1124****************************************************************************/
1125BERR_Code BGIO_Pin_GetIntrMode(
1126        BGIO_Pin_Handle       hPin,
1127        BGIO_IntrMode *       peIntrMode );
1128
1129/***************************************************************************
1130Summary:
1131        Get the current level 3 interrupt status of a GPIO pin.
1132
1133Description:
1134        If some GPIO pin fires interrupt, the level 2 interrupt call back
1135        function would be called. The call back function should call
1136        BGIO_Pin_GetIntrStatus for each GPIO pin handle to check the level 3
1137        interrupt status, and handle it if *pbFire is true for a GPIO pin. After
1138        it is handled the level 3 interrupt status should be cleared.
1139
1140Input:
1141        hPin - The GPIO pin sub-module handle to get level 3 interrupt status for.
1142
1143Output:
1144        pbFire - Whether the level 3 interrupt status of this GPIO pin is true.
1145
1146Returns:
1147        BERR_SUCCESS - Got the current level 3 interrupt status of the GPIO pin
1148        successfully.
1149        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1150
1151See Also:
1152        BGIO_Pin_SetIntrMode, BGIO_Pin_GetIntrMode,
1153        BGIO_Pin_ClearIntrStatus
1154****************************************************************************/
1155BERR_Code BGIO_Pin_GetIntrStatus(
1156        BGIO_Pin_Handle       hPin,
1157        bool *                bFire );
1158
1159/***************************************************************************
1160Summary:
1161        Clear the level 3 interrupt status of a GPIO pin.
1162
1163Description:
1164        When some GPIO pin fires interrupt, the level 2 interrupt call back
1165        function would be called. The call back function should check each
1166        GPIO pin handle for its level 3 interrupt status, handle it and then
1167        clear the level 3 interrupt status if the status is true for a GPIO pin.
1168
1169        This function works only for edge triggering interrupt mode. For a GPIO
1170        pin with level triggering mode, user has to change the pin value to
1171        clear the interrupt status.
1172
1173        Edge triggering interrupt mode is supported by both 7038 chips and 3560
1174        chips. Level triggering is only supported by 3560 chips.
1175
1176Input:
1177        hPin - The GPIO pin sub-module handle to get value from.
1178
1179Output:
1180
1181
1182Returns:
1183        BERR_SUCCESS - Got the current level 3 interrupt status of the GPIO pin
1184        successfully.
1185        BERR_INVALID_PARAMETER - One of the input parameters was invalid.
1186
1187See Also:
1188        BGIO_Pin_GetIntrStatus
1189****************************************************************************/
1190BERR_Code BGIO_Pin_ClearIntrStatus(
1191        BGIO_Pin_Handle       hPin );
1192
1193BERR_Code BGIO_Pin_ClearIntrStatus_isr(
1194        BGIO_Pin_Handle       hPin );
1195
1196#ifdef __cplusplus
1197}
1198#endif
1199
1200#endif /* #ifndef BGIO_H__ */
1201
1202/* end of file */
Note: See TracBrowser for help on using the repository browser.