source: svn/trunk/newcon3bcm2_21bu/magnum/portinginterface/i2c/7552/bi2c.h

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 27.0 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2012, 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: bi2c.h $
11 * $brcm_Revision: Hydra_Software_Devel/69 $
12 * $brcm_Date: 1/3/12 1:15p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/portinginterface/i2c/7346/bi2c.h $
19 *
20 * Hydra_Software_Devel/69   1/3/12 1:15p agin
21 * SWNOOS-507:  Improve i2c performance.
22 *
23 * Hydra_Software_Devel/68   12/16/11 7:37p bselva
24 * SW7360-6: Added appframework support for 7360 platform
25 *
26 * Hydra_Software_Devel/67   10/28/11 2:27p mward
27 * SW7435-7: Add 7435 like 7425.
28 *
29 * Hydra_Software_Devel/66   10/7/11 6:49a agin
30 * SW7429-7:  Add support for i2c.
31 *
32 * Hydra_Software_Devel/65   9/30/11 9:47a agin
33 * SWNOOS-485:  Support 7346 B0.
34 *
35 * Hydra_Software_Devel/64   9/12/11 12:41p jzhu
36 * SWBLURAY-27236:7640 B0 BRINGUP, change 7640 b0 I2C to 3 channels
37 *
38 * Hydra_Software_Devel/63   8/29/11 1:51p jrubio
39 * SW7346-470: remove 7346A0 wrap over code
40 *
41 * Hydra_Software_Devel/62   6/23/11 11:13a agin
42 * SWNOOS-464:  Add prototype for BI2C_Set4ByteXfrMode and
43 * BI2C_Is4ByteXfrMode.
44 *
45 * Hydra_Software_Devel/61   3/9/11 5:31p etrudeau
46 * SWBLURAY-23692: 7640 has 4 i2c channels with BSC Master C not connected
47 *
48 * Hydra_Software_Devel/60   2/24/11 10:59a agin
49 * SW7346-96:  Enable extra sw i2c channel for 7346 by default.
50 *
51 * Hydra_Software_Devel/59   2/21/11 7:34a agin
52 * SW7346-96:  Add ability to use GPIO lines not tied to the BSC I2C for
53 * I2C bit bang.
54 *
55 * Hydra_Software_Devel/58   1/26/11 2:26p etrudeau
56 * SWBLURAY-23692: add 7640 support
57 *
58 * Hydra_Software_Devel/57   11/17/10 7:28p agin
59 * SW7231-19:  Add I2C PI support for 7231/7344/7346
60 *
61 * Hydra_Software_Devel/56   11/1/10 5:08p xhuang
62 * SW7552-4: Add 7552 support
63 *
64 * Hydra_Software_Devel/55   8/27/10 5:17p tdo
65 * SW7425-12: Add 7425 I2C support
66 *
67 * Hydra_Software_Devel/54   8/11/10 4:04p jrubio
68 * SW7358-7: fix typo
69 *
70 * Hydra_Software_Devel/53   8/11/10 12:40p agin
71 * SW7358-7:  Add support for 7358A0 in I2C.
72 *
73 * Hydra_Software_Devel/52   6/25/10 11:58a agin
74 * SW7422-12:  Change BI2C_MAX_I2C_CHANNELS and BI2C_MAX_I2C_MSTR_CHANNELS
75 * to 5 for 7422.
76 *
77 * Hydra_Software_Devel/51   6/22/10 11:37a vanessah
78 * SW7422-12:  To support appframework. Missing files added:
79 * magnum\portinginterface\pwr rockford\appframework\src\board\97422  To
80 * do list: 1. in framework_board.c, more initialization to be done.  2.
81 * More registers mapping, like clock generation as well as
82 * BCHP_SUN_TOP_CTRL_PIN_MUX_CTRL etc
83 *
84 * Hydra_Software_Devel/50   11/9/09 11:27a gmohile
85 * SW7408-1 : Add 7408 support
86 *
87 * Hydra_Software_Devel/49   10/22/09 1:26p agin
88 * SW7405-2686: Change BREG_I2C to abstract SW and HW implementation.
89 *
90 * Hydra_Software_Devel/48   10/2/09 6:34p lwhite
91 * SW7468-6: Add 7468 support
92 *
93 * Hydra_Software_Devel/47   9/25/09 1:20p agin
94 * SW7405-3038:  Add BI2C_SwReset().
95 *
96 * Hydra_Software_Devel/46   9/15/09 10:40a rpereira
97 * SW7630-45: Adding 7630 support
98 *
99 * Hydra_Software_Devel/45   9/1/09 8:59p rpereira
100 * SW7550-30: Adding 7550 support
101 *
102 * Hydra_Software_Devel/44   7/29/09 12:36p jrubio
103 * PR55232: add 7342/7340
104 *
105 * Hydra_Software_Devel/43   7/21/09 4:39p mward
106 * PR 55545: Support 7125.
107 *
108 * Hydra_Software_Devel/42   7/20/09 10:18a agin
109 * PR56687: Change I2C clock enum from Khz to Hz.
110 *
111 * Hydra_Software_Devel/41   4/27/09 11:16a jhaberf
112 * PR53796: Updating i2c build to support BCM35130 DTV chip.
113 *
114 * Hydra_Software_Devel/40   4/10/09 5:36p rpereira
115 * PR52971: added 7635 support
116 *
117 * Hydra_Software_Devel/39   2/20/09 11:14a agin
118 * PR52310: Add i2c sda delay control for 7601.
119 *
120 * Hydra_Software_Devel/38   2/19/09 3:29p agin
121 * PR52310: Add i2c sda delay control for 7601.
122 *
123 * Hydra_Software_Devel/37   1/31/09 1:15a jrubio
124 * PR51629: add 7336 support
125 *
126 * Hydra_Software_Devel/36   12/8/08 6:39p agin
127 * PR49867: Added I2C_MAX_I2C_CHANNELS for 7420.
128 *
129 * Hydra_Software_Devel/35   12/2/08 4:28p kaushikb
130 * PR49867: Adding support for 7420
131 *
132 * Hydra_Software_Devel/34   8/21/08 8:27a fbasso
133 * PR 44540: added support for 7601.
134 *
135 * Hydra_Software_Devel/33   4/4/08 10:43a farshidf
136 * PR39178: add support for 3548 and 3556
137 *
138 * Hydra_Software_Devel/32   1/13/08 9:02p rpereira
139 * PR36162: BI2C_MAX_I2C_CHANNELS and BI2C_MAX_I2C_MSTR_CHANNELS incorrect
140 * in bi2c.h for BCM7440 Bx
141 *
142 * Hydra_Software_Devel/31   11/27/07 6:02p farshidf
143 * PR36894: update for 7335
144 *
145 * Hydra_Software_Devel/30   10/14/07 3:52p jkim
146 * PR14344: Add 7325 support
147 *
148 * Hydra_Software_Devel/29   4/24/07 5:25p jkim
149 * PR29538: Add burst mode support
150 *
151 * Hydra_Software_Devel/28   3/30/07 6:54p katrep
152 * PR29073:Added support for 7405
153 *
154 * Hydra_Software_Devel/27   10/31/06 3:14p erickson
155 * PR25108: add 7403 support
156 *
157 * Hydra_Software_Devel/26   9/18/06 2:27p agin
158 * PR23800: Timeout value hardcoded in bi2c.c
159 *
160 * Hydra_Software_Devel/25   9/6/06 4:13p jkim
161 * PR14344: adding 7440 support
162 *
163 * Hydra_Software_Devel/24   8/30/06 6:04p mward
164 * PR21678: 7118 chip 97118 board - has 1 virtual 2 total channels.
165 *
166 * Hydra_Software_Devel/23   8/30/06 5:05p mward
167 * PR21678: 7118 chip 97118 board - has 2 virtual channels.
168 *
169 * Hydra_Software_Devel/22   8/9/06 10:58a agin
170 * PR23362: Add 3563 support.
171 *
172 * Hydra_Software_Devel/22   8/9/06 10:50a agin
173 * PR23362: Add 3563 support.
174 *
175 * Hydra_Software_Devel/21   6/15/06 5:13p mward
176 * PR21678: Add support for 7118 chip 97118 board
177 *
178 * Hydra_Software_Devel/20   2/14/06 2:58p agin
179 * PR19666: 7438, not 7348.
180 *
181 * Hydra_Software_Devel/19   2/14/06 2:27p agin
182 * PR19666: Need to create 7438 I2C porting interface.
183 *
184 * Hydra_Software_Devel/18   1/23/06 4:58p agin
185 * PR19220: Support 5th I2C controller.
186 *
187 * Hydra_Software_Devel/17   1/14/06 10:19p agin
188 * PR19076: Support BCM7400.
189 *
190 * Hydra_Software_Devel/15   9/9/05 5:05p jkim
191 * PR16945:Per conversation with Dave Lwin, change BI2C_Delete2cRegHandle
192 * back to BI2C_CloseI2cRegHandle
193 *
194 * Hydra_Software_Devel/14   9/7/05 3:44p jkim
195 * PR16942: Change MAX_I2C_MSTR_CHANNELS to BI2C_MAX_I2C_MSTR_CHANNELS and
196 * MAX_I2C_CHANNELS to BI2C_MAX_I2C_CHANNELS
197 *
198 * Hydra_Software_Devel/13   8/1/05 5:23p vsilyaev
199 * PR 16012: Added support for 7401\
200 *
201 * Hydra_Software_Devel/12   3/16/05 4:04p dlwin
202 * PR 14240: More updated for 3560, added code to support sharing of
203 * one I2C master.
204 *
205 * Hydra_Software_Devel/11   3/10/05 8:30a dlwin
206 * PR 14240: Added support for 3560 and future chip that use this same
207 * I2C core.
208 *
209 * Hydra_Software_Devel/10   1/28/04 10:21a brianlee
210 * PR9499: Fix breg_i2c.h file inclusion.
211 *
212 * Hydra_Software_Devel/9   11/6/03 9:47a brianlee
213 * Added BI2C_CloseI2cRegHandle() function.
214 *
215 * Hydra_Software_Devel/8   10/15/03 2:33p brianlee
216 * Moved #defne MAX_I2C_CHANNELS to bi2c.h so application code can use it.
217 *
218 * Hydra_Software_Devel/7   9/25/03 11:17a brianlee
219 * Added tags for Midas service generator.
220 *
221 * Hydra_Software_Devel/6   9/18/03 10:16a brianlee
222 * Make SetClk and GetClk functions public so the caller can change the
223 * clock rate after the channel is opened.
224 *
225 * Hydra_Software_Devel/5   9/11/03 11:40a brianlee
226 * Changed enum values for clock speed.  Also added polling option.
227 *
228 * Hydra_Software_Devel/4   8/21/03 4:02p brianlee
229 * Removed EDDCRead and EDDCWrite functions.  Make them private.
230 * Application should go through register interface to perform these
231 * functions.
232 *
233 * Hydra_Software_Devel/3   8/19/03 10:26a brianlee
234 * Fixed a typo.
235 *
236 * Hydra_Software_Devel/2   7/31/03 9:43a brianlee
237 * Made some functions private.  Application should go through I2C
238 * register handle to perform read/write.
239 *
240 * Hydra_Software_Devel/1   7/22/03 6:33p brianlee
241 * Initial version.
242 *
243 ***************************************************************************/
244
245
246/*= Module Overview *********************************************************
247<verbatim>
248
249Overview
250The I2C PI module controls the 4 I2C master controllers within the BCM7038.
251The I2C master controllers within the BCM7038 are independent of each other.
252Each controller is capable of the following clock rates: 47KHz, 50KHz, 93KHz,
253100KHz, 187KHz, 200KHz, 375KHz, and 400KHz.  The I2C controllers now support
254unlimited data transfer sizes through the ability to suppress START and STOP
255conditions.
256
257Design
258The design for BI2C PI API is broken into two parts.
259  Part 1 (open/close/configuration):
260    These APIs are used for opening and closing BI2C device/device channel.
261    When a device/device channel is opened, the device/device channel can be
262    configured for transfer speed.
263  Part 2 (command):
264    These APIs are sending read and write commands using the I2C master controller.
265
266Usage
267The usage of BI2C involves the following:
268
269   * Configure/Open of BI2C
270      * Configure BI2C device for the target system
271      * Open BI2C device
272      * Configure BI2C device channel for the target system
273      * Open BI2C device channel
274      * Create BI2C register handle
275
276   * Sending commands
277      * Send read/write commands using BI2C register handle.
278
279Sample Code
280void main( void )
281{
282    BI2C_Handle       hI2c;
283    BI2C_ChannelHandle   hI2cChan;
284    BI2C_ChannelSettings defChnSettings;
285    BREG_Handle       hReg;
286    BCHP_Handle       hChip;
287    int chanNo;
288    unsigned char      data[10];
289    BREG_I2C_Handle      hI2cReg;
290    BINT_Handle         hInt;
291
292    // Do other initialization, i.e. for BREG, BCHP, etc
293
294    BI2C_Open( &hI2c, hChip, hReg, hInt, (BI2C_Settings *)NULL );
295
296    chanNo = 0; // example for channel 0
297    BI2C_GetChannelDefaultSettings( hI2c, chanNo, &defChnSettings );
298
299    // Make any changes required from the default values
300    defChnSettings.clkRate      = BI2C_Clk_eClk400Khz;
301
302    BI2C_OpenChannel( hI2c, &hI2cChan, chanNo, &defChnSettings );
303
304    // Get handle to I2C Reg
305    BI2C_CreateI2cRegHandle (hI2cChan, &hI2cReg);
306
307    //
308    // Do a read of 2 bytes from register 0x1b of I2C device whose
309    // chip ID is 0x9C.
310    //
311    BREG_I2C_Read (hI2cReg, 0x9c, 0x1b, &data, 2);
312
313    //
314    // Do a write of 3 bytes from register 0x1000 of I2C device whose
315    // chip ID is 0x8E.
316    //
317    // Fill in data to send
318    data[0]               = 0xb2;
319    data[1]               = 0x77;
320    data[2]               = 0x20;
321    BREG_I2C_WriteA16 (hI2cReg, 0x8e, 0x1000, &data, 3);
322}
323
324</verbatim>
325***************************************************************************/
326
327
328#ifndef BI2C_H__
329#define BI2C_H__
330
331#include "bchp.h"
332#include "breg_mem.h"
333#include "breg_i2c.h"
334#include "bint.h"
335#include "bkni.h"
336#include "berr_ids.h"
337
338#ifdef __cplusplus
339extern "C" {
340#endif
341
342/***************************************************************************
343Summary:
344    Number of I2C channels
345
346Description:
347
348See Also:
349
350****************************************************************************/
351#if (BCHP_CHIP==7118)
352#define BI2C_MAX_I2C_CHANNELS               2
353#define BI2C_MAX_I2C_MSTR_CHANNELS          1
354#elif (BCHP_CHIP==7468)
355#define BI2C_MAX_I2C_CHANNELS               2
356#define BI2C_MAX_I2C_MSTR_CHANNELS          2
357#elif (BCHP_CHIP==7408) || (BCHP_CHIP==7550) || (BCHP_CHIP==7601) || \
358      (BCHP_CHIP==7630) || (BCHP_CHIP==7635) || (BCHP_CHIP==7640 && BCHP_VER>=BCHP_VER_B0)
359#define BI2C_MAX_I2C_CHANNELS               3
360#define BI2C_MAX_I2C_MSTR_CHANNELS          3
361#elif (BCHP_CHIP==3560) || (BCHP_CHIP==3563)
362#define BI2C_MAX_I2C_CHANNELS               4
363#define BI2C_MAX_I2C_MSTR_CHANNELS          1
364#elif (BCHP_CHIP==3548) || (BCHP_CHIP==3556) || (BCHP_CHIP==7038) || \
365      (BCHP_CHIP==7125) || (BCHP_CHIP==7231) || (BCHP_CHIP==7325) || (BCHP_CHIP==7335) || \
366      (BCHP_CHIP==7340) || (BCHP_CHIP==7342) || (BCHP_CHIP==7344) || (BCHP_CHIP==7346) || (BCHP_CHIP==7358) || \
367      (BCHP_CHIP==7401) || (BCHP_CHIP==7403) || (BCHP_CHIP==7405) || \
368      (BCHP_CHIP==7438) || (BCHP_CHIP==7552) || (BCHP_CHIP==35130) || (BCHP_CHIP==7640 && BCHP_VER==BCHP_VER_A0) || \
369      (BCHP_CHIP==7360)
370#if (BCHP_CHIP==7346) && (BCHP_VER>=BCHP_VER_B0)
371#define BI2C_MAX_I2C_CHANNELS               5
372#define BI2C_MAX_I2C_MSTR_CHANNELS          5
373#else
374#define BI2C_MAX_I2C_CHANNELS               4
375#define BI2C_MAX_I2C_MSTR_CHANNELS          4
376#endif
377#elif (BCHP_CHIP==7400) || (BCHP_CHIP==7420) || (BCHP_CHIP==7422) || \
378      (BCHP_CHIP==7425) || (BCHP_CHIP==7429) || (BCHP_CHIP==7440) || \
379      (BCHP_CHIP==7435)
380#define BI2C_MAX_I2C_CHANNELS               5
381#define BI2C_MAX_I2C_MSTR_CHANNELS          5
382#else
383#error Please define the number of i2c channels
384#endif
385
386#if (BCHP_CHIP==7346) && (BCHP_VER==BCHP_VER_A0)
387#define EXTRA_SW_I2C_MSTR_CHANNELS 1
388#else
389#define EXTRA_SW_I2C_MSTR_CHANNELS 0
390#endif
391
392/***************************************************************************
393Summary:
394    Error Codes specific to BI2C
395
396Description:
397
398See Also:39178
399
400****************************************************************************/
401#define BI2C_ERR_NOTAVAIL_CHN_NO            BERR_MAKE_CODE(BERR_I2C_ID, 0)
402#define BI2C_ERR_NO_ACK                     BERR_MAKE_CODE(BERR_I2C_ID, 1)
403#define BI2C_ERR_SINGLE_MSTR_CREATE         BERR_MAKE_CODE(BERR_I2C_ID, 2)
404
405
406
407/***************************************************************************
408Summary:
409    The handles for i2c module.
410
411Description:
412    Since BI2C is a device channel, it has main device handle as well
413    as a device channel handle.
414
415See Also:
416    BI2C_Open(), BI2C_OpenChannel()
417
418****************************************************************************/
419typedef struct BI2C_P_Handle                *BI2C_Handle;
420typedef struct BI2C_P_ChannelHandle         *BI2C_ChannelHandle;
421
422/***************************************************************************
423Summary:
424    Enumeration for i2c clock rate
425
426Description:
427    This enumeration defines the clock rate for the I2C master
428
429See Also:
430    None.
431
432****************************************************************************/
433typedef unsigned int BI2C_Clk;
434#define BI2C_Clk_eClk47Khz  47000
435#define BI2C_Clk_eClk50Khz  50000
436#define BI2C_Clk_eClk93Khz  93000
437#define BI2C_Clk_eClk100Khz 100000
438#define BI2C_Clk_eClk187Khz 187000
439#define BI2C_Clk_eClk200Khz 200000
440#define BI2C_Clk_eClk375Khz 375000
441#define BI2C_Clk_eClk400Khz 400000
442
443/***************************************************************************
444Summary:
445    Enumeration for i2c clock rate
446
447Description:
448    This enumeration defines the clock rate for the I2C master
449
450See Also:
451    None.
452
453****************************************************************************/
454typedef enum
455{
456    BI2C_eSdaDelay370ns = 370,
457    BI2C_eSdaDelay482ns = 482,
458    BI2C_eSdaDelay593ns = 593,
459    BI2C_eSdaDelay704ns = 704,
460    BI2C_eSdaDelay815ns = 815,
461    BI2C_eSdaDelay926ns = 926,
462    BI2C_eSdaDelay1037ns = 1037
463}  BI2C_SdaDelay;
464
465/***************************************************************************
466Summary:
467    Enumeration for i2c timeout field
468
469Description:
470    This enumeration defines whether to use a timeout value based on i2c
471    clk speed or not.
472
473See Also:
474    None.
475
476****************************************************************************/
477typedef enum
478{
479   BI2C_TimeoutBasedOnClkSpeed  = 0
480}  BI2C_Timeout;
481
482/***************************************************************************
483Summary:
484    Required default settings structure for I2C module.
485
486Description:
487    The default setting structure defines the default configure of
488    I2C when the device is opened.  Since BI2C is a device
489    channel, it also has default settings for a device channel.
490    Currently there are no parameters for device setting.
491
492See Also:
493    BI2C_Open(), BI2C_OpenChannel()
494
495****************************************************************************/
496typedef void *BI2C_Settings;
497
498typedef struct BI2C_ChannelSettings
499{
500    BI2C_Clk            clkRate;        /* I2C clock speed */
501    bool                intMode;        /* use interrupt flag */
502    unsigned int        timeoutMs;      /* Timeout value in milliseconds.  */
503                                        /* If equal to BI2C_TimeoutBasedOnClkSpeed, */
504                                        /* timeout value is calculated based on the */
505                                        /* i2c clk speed */
506        bool                            burstMode;              /* enable/disable burst mode read */
507        bool                            softI2c;                /* i2c gpio mode */
508        bool                            fourByteXferMode; /* use four byte transfer mode */
509} BI2C_ChannelSettings;
510
511/***************************************************************************
512Summary:
513    This function opens I2C module.
514
515Description:
516    This function is responsible for opening BI2C module. When BI2C is
517    opened, it will create a module handle and configure the module based
518    on the default settings. Once the device is opened, it must be closed
519    before it can be opened again.
520
521Returns:
522    TODO:
523
524See Also:
525    BI2C_Close(), BI2C_OpenChannel(), BI2C_CloseChannel(),
526    BI2C_GetDefaultSettings()
527
528****************************************************************************/
529BERR_Code BI2C_Open(
530    BI2C_Handle *pI2C,                  /* [out] Returns handle */
531    BCHP_Handle hChip,                  /* [in] Chip handle */
532    BREG_Handle hRegister,              /* [in] Register handle */
533    BINT_Handle hInterrupt,             /* [in] Interrupt handle */
534    const BI2C_Settings *pDefSettings   /* [in] Default settings */
535    );
536
537/***************************************************************************
538Summary:
539    This function closes I2C module.
540
541Description:
542    This function is responsible for closing BI2C module. Closing BI2C
543    will free main BI2C handle. It is required that all opened
544    BI2C channels must be closed before calling this function. If this
545    is not done, the results will be unpredicable.
546
547Returns:
548    TODO:
549
550See Also:
551    BI2C_Open(), BI2C_CloseChannel()
552
553****************************************************************************/
554BERR_Code BI2C_Close(
555    BI2C_Handle hDev                    /* [in] Device handle */
556    );
557
558/***************************************************************************
559Summary:
560    This function returns the default settings for I2C module.
561
562Description:
563    This function is responsible for returns the default setting for
564    BI2C module. The returning default setting should be when
565    opening the device.
566
567Returns:
568    TODO:
569
570See Also:
571    BI2C_Open()
572
573****************************************************************************/
574BERR_Code BI2C_GetDefaultSettings(
575    BI2C_Settings *pDefSettings,        /* [out] Returns default setting */
576    BCHP_Handle hChip                   /* [in] Chip handle */
577    );
578
579/***************************************************************************
580Summary:
581    This function returns the total number of channels supported by
582    I2C module.
583
584Description:
585    This function is responsible for getting total number of channels
586    supported by BI2C module, since BI2C device is implemented as a
587    device channel.
588
589Returns:
590    TODO:
591
592See Also:
593    BI2C_OpenChannel(), BI2C_ChannelDefaultSettings()
594
595****************************************************************************/
596BERR_Code BI2C_GetTotalChannels(
597    BI2C_Handle hDev,                   /* [in] Device handle */
598    unsigned int *totalChannels         /* [out] Returns total number downstream channels supported */
599    );
600
601/***************************************************************************
602Summary:
603    This function gets default setting for a I2C module channel.
604
605Description:
606    This function is responsible for returning the default setting for
607    channel of BI2C. The return default setting is used when opening
608    a channel.
609
610Returns:
611    TODO:
612
613See Also:
614    BI2C_OpenChannel()
615
616****************************************************************************/
617BERR_Code BI2C_GetChannelDefaultSettings(
618    BI2C_Handle hDev,                   /* [in] Device handle */
619    unsigned int channelNo,             /* [in] Channel number to default setting for */
620    BI2C_ChannelSettings *pChnDefSettings /* [out] Returns channel default setting */
621    );
622
623/***************************************************************************
624Summary:
625    This function opens I2C module channel.
626
627Description:
628    This function is responsible for opening BI2C module channel. When a
629    BI2C channel is opened, it will create a module channel handle and
630    configure the module based on the channel default settings. Once a
631    channel is opened, it must be closed before it can be opened again.
632
633Returns:
634    TODO:
635
636See Also:
637    BI2C_CloseChannel(), BI2C_GetChannelDefaultSettings()
638
639****************************************************************************/
640BERR_Code BI2C_OpenChannel(
641    BI2C_Handle hDev,                   /* [in] Device handle */
642    BI2C_ChannelHandle *phChn,          /* [out] Returns channel handle */
643    unsigned int channelNo,             /* [in] Channel number to open */
644    const BI2C_ChannelSettings *pChnDefSettings /* [in] Channel default setting */
645    );
646
647/***************************************************************************
648Summary:
649    This function closes I2C module channel.
650
651Description:
652    This function is responsible for closing BI2C module channel. Closing
653    BI2C channel it will free BI2C channel handle. It is required that all
654    opened BI2C channels must be closed before closing BI2C.
655
656Returns:
657    TODO:
658
659See Also:
660    BI2C_OpenChannel(), BI2C_CloseChannel()
661
662****************************************************************************/
663BERR_Code BI2C_CloseChannel(
664    BI2C_ChannelHandle hChn             /* [in] Device channel handle */
665    );
666
667/***************************************************************************
668Summary:
669    This function gets I2C module device handle based on
670    the device channel handle.
671
672Description:
673    This function is responsible returning BI2C module handle based on the
674    BI2C module channel.
675
676Returns:
677    TODO:
678
679See Also:
680
681****************************************************************************/
682BERR_Code BI2C_GetDevice(
683    BI2C_ChannelHandle hChn,            /* [in] Device channel handle */
684    BI2C_Handle *pI2C                   /* [out] Returns Device handle */
685    );
686
687
688/***************************************************************************
689Summary:
690    This function creates an I2C register handle.
691
692Description:
693    This function is responsible for creating an I2C register handle for
694    master I2C controller.  It fills in the BREG_I2C_Handle structure with
695    pointers to the I2C PI functions.  The application can then use this
696    I2C register interface to perform read and write operations.
697
698Returns:
699    TODO:
700
701See Also:
702
703****************************************************************************/
704BERR_Code BI2C_CreateI2cRegHandle(
705    BI2C_ChannelHandle hChn,            /* [in] Device channel handle */
706    BREG_I2C_Handle *pI2cRegHandle      /* [out] register handle */
707    );
708
709/***************************************************************************
710Summary:
711    This function closes I2C register handle
712
713Description:
714    This function is responsible for closing the I2C register handle.
715    This function frees BI2C register handle.
716
717Returns:
718    TODO:
719
720See Also:
721    BI2C_CreateI2cRegHandle()
722
723****************************************************************************/
724BERR_Code BI2C_CloseI2cRegHandle(
725    BREG_I2C_Handle     hI2cReg             /* [in] I2C register handle */
726    );
727
728/***************************************************************************
729Summary:
730    This function sets the clock rate for an I2C channel
731
732Description:
733    This function allows the user to change the I2C clock rate.
734
735Returns:
736    TODO:
737
738See Also:
739
740****************************************************************************/
741void BI2C_SetClk(
742    BI2C_ChannelHandle  hChn,           /* [in] Device channel handle */
743    BI2C_Clk            clk             /* [in] clock rate setting */
744    );
745
746/***************************************************************************
747Summary:
748    This function gets the clock rate for an I2C channel
749
750Description:
751    This function returns the current clock rate setting for an I2C channel
752
753Returns:
754    TODO:
755
756See Also:
757
758****************************************************************************/
759BI2C_Clk BI2C_GetClk(
760    BI2C_ChannelHandle  hChn            /* [in] Device channel handle */
761    );
762
763/***************************************************************************
764Summary:
765    This function sets the SDA delay for an I2C channel
766
767Description:
768    This function allows the user to change the SDS delay.
769
770Returns:
771    TODO:
772
773See Also:
774
775****************************************************************************/
776void BI2C_SetSdaDelay(
777    BI2C_ChannelHandle  hChn,           /* Device channel handle */
778    BI2C_SdaDelay       sdaDelay        /* Sda delay value */
779    );
780
781/***************************************************************************
782Summary:
783        This function enable/disable I2C burst mode operations.
784
785Description:
786
787Returns:
788        TODO:
789
790See Also:
791
792****************************************************************************/
793BERR_Code BI2C_SetBurstMode(
794        BI2C_ChannelHandle hChn,        /* [in] I2C channel handle */
795        bool bBurstMode                         /* [out] Enable or Disable burst mode */
796        );
797
798/***************************************************************************
799Summary:
800        This function will verify if I2C burst mode has been enabled or
801        disabled on an I2C channel.
802
803Description:
804
805Returns:
806        TODO:
807
808See Also:
809
810****************************************************************************/
811BERR_Code BI2C_GetBurstMode(
812        BI2C_ChannelHandle hChn,        /* [in] I2C channel handle */
813        bool *pbBurstMode                       /* [out] current burst mode? */
814        );
815
816/***************************************************************************
817Summary:
818        This function will set the DATA_REG_SIZE field.
819
820Description:
821
822Returns:
823        TODO:
824
825See Also:
826
827****************************************************************************/
828void BI2C_Set4ByteXfrMode(
829    BI2C_ChannelHandle  hChn,           /* Device channel handle */
830    bool b4ByteMode                     /* Enable or Disable 4 byte xfr mode */
831    );
832
833/***************************************************************************
834Summary:
835        This function will check if the DATA_REG_SIZE field is set.
836
837Description:
838
839Returns:
840        TODO:
841
842See Also:
843
844****************************************************************************/
845bool BI2C_Is4ByteXfrMode(
846    BI2C_ChannelHandle  hChn           /* Device channel handle */
847    );
848
849/***************************************************************************
850Summary:
851        This function will perform a software reset.
852
853Description:
854
855After an interruption in protocol, power loss or system reset, any 2-wire
856part can be protocol reset by following these steps: (a) Create a start bit
857condition, (b) clock 9 cycles, (c) create another start bit followed by stop
858bit condition. The device is ready for next communication after above steps
859have been completed.
860
861Returns:
862        TODO:
863
864See Also:
865
866****************************************************************************/
867BERR_Code BI2C_SwReset(
868    BI2C_ChannelHandle  hChn           /* [in] Device channel handle */
869        );
870
871#ifdef __cplusplus
872}
873#endif
874
875#endif
876
877
878
Note: See TracBrowser for help on using the repository browser.