xref: /utopia/UTPA2-700.0.x/mxlib/include/drvHWI2C.h (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 /*! \defgroup G_HWI2C HWI2C interface
95     \ingroup  G_PERIPHERAL
96 
97     \brief
98 
99 	IIC is a multi-master, multi-slave, single-ended, serial computer bus. It is typically used for attaching lower-speed peripheral
100 	ICs to processors and micro-controllers. Alternatively I2C is spelled I2C (pronounced I-two-C) or IIC (pronounced I-I-C).
101 
102     <b>Features</b>
103     - IIC Initialize & De-initialize function
104     - IIC Send Data
105     - IIC Receive Data
106 
107     <b> Operation Code Flow: </b> \n
108     -# I2C Start Condition.
109     -# Send data.
110     -# Receive data.
111 	-# I2C End Condition.
112 
113     \defgroup G_HWI2C_INIT Initialization Task relative
114     \ingroup  G_HWI2C
115     \defgroup G_HWI2C_COMMON Common Task relative
116     \ingroup  G_HWI2C
117     \defgroup G_HWI2C_CONTROL Control relative
118     \ingroup  G_HWI2C
119     \defgroup G_HWI2C_INT  Interrupt relative
120     \ingroup  G_HWI2C
121     \defgroup G_HWI2C_ToBeModified GPIO api to be modified
122     \ingroup  G_HWI2C
123     \defgroup G_HWI2C_ToBeRemove GPIO api to be removed
124     \ingroup  G_HWI2C
125 */
126 
127 #ifndef _DRV_HWI2C_H_
128 #define _DRV_HWI2C_H_
129 
130 ////////////////////////////////////////////////////////////////////////////////
131 // Header Files
132 ////////////////////////////////////////////////////////////////////////////////
133 #ifdef __cplusplus
134 extern "C"
135 {
136 #endif
137 
138 #include "MsTypes.h"
139 #include "MsDevice.h"
140 
141 #define HWI2C_UTOPIA20 (0)
142 ////////////////////////////////////////////////////////////////////////////////
143 // Define & data type
144 ////////////////////////////////////////////////////////////////////////////////
145 #define MSIF_HWI2C_LIB_CODE                     {'H','I','2','C'}    //Lib code
146 #define MSIF_HWI2C_LIBVER                       {'0','6'}            //LIB version
147 #define MSIF_HWI2C_BUILDNUM                     {'0','6'}            //Build Number
148 #define MSIF_HWI2C_CHANGELIST                   {'0','0','5','6','2','3','3','3'} //P4 ChangeList Number
149 
150 #define HWI2C_DRV_VERSION               /* Character String for DRV/API version             */  \
151     MSIF_TAG,                           /* 'MSIF'                                           */  \
152     MSIF_CLASS,                         /* '00'                                             */  \
153     MSIF_CUS,                           /* 0x0000                                           */  \
154     MSIF_MOD,                           /* 0x0000                                           */  \
155     MSIF_CHIP,                                                                                  \
156     MSIF_CPU,                                                                                   \
157     MSIF_HWI2C_LIB_CODE,                /* IP__                                             */  \
158     MSIF_HWI2C_LIBVER,                  /* 0.0 ~ Z.Z                                        */  \
159     MSIF_HWI2C_BUILDNUM,                /* 00 ~ 99                                          */  \
160     MSIF_HWI2C_CHANGELIST,              /* CL#                                              */  \
161     MSIF_OS
162 
163 /// debug level
164 typedef enum _HWI2C_DbgLv
165 {
166     E_HWI2C_DBGLV_NONE,          /// no debug message
167     E_HWI2C_DBGLV_ERR_ONLY,      /// show error only
168     E_HWI2C_DBGLV_INFO,          /// show error & informaiton
169     E_HWI2C_DBGLV_ALL            /// show error, information & funciton name
170 }HWI2C_DbgLv;
171 
172 /// I2C select master port
173 typedef enum _HWI2C_PORT
174 {
175     E_HWI2C_PORT_0 = 0, /// port 0_0 //disable port 0
176     E_HWI2C_PORT0_1,    /// port 0_1
177     E_HWI2C_PORT0_2,    /// port 0_2
178     E_HWI2C_PORT0_3,    /// port 0_3
179     E_HWI2C_PORT0_4,    /// port 0_4
180     E_HWI2C_PORT0_5,    /// port 0_5
181     E_HWI2C_PORT0_6,    /// port 0_6
182     E_HWI2C_PORT0_7,    /// port 0_7
183 
184     E_HWI2C_PORT_1 = 8, /// port 1_0 //disable port 1
185     E_HWI2C_PORT1_1,    /// port 1_1
186     E_HWI2C_PORT1_2,    /// port 1_2
187     E_HWI2C_PORT1_3,    /// port 1_3
188     E_HWI2C_PORT1_4,    /// port 1_4
189     E_HWI2C_PORT1_5,    /// port 1_5
190     E_HWI2C_PORT1_6,    /// port 1_6
191     E_HWI2C_PORT1_7,    /// port 1_7
192 
193     E_HWI2C_PORT_2 = 16,/// port 2_0 //disable port 2
194     E_HWI2C_PORT2_1,    /// port 2_1
195     E_HWI2C_PORT2_2,    /// port 2_2
196     E_HWI2C_PORT2_3,    /// port 2_3
197     E_HWI2C_PORT2_4,    /// port 2_4
198     E_HWI2C_PORT2_5,    /// port 2_5
199     E_HWI2C_PORT2_6,    /// port 2_6
200     E_HWI2C_PORT2_7,    /// port 2_7
201 
202     E_HWI2C_PORT_3 = 24,/// port 3_0 //disable port 3
203     E_HWI2C_PORT3_1,    /// port 3_1
204     E_HWI2C_PORT3_2,    /// port 3_2
205     E_HWI2C_PORT3_3,    /// port 3_3
206     E_HWI2C_PORT3_4,    /// port 3_4
207     E_HWI2C_PORT3_5,    /// port 3_5
208     E_HWI2C_PORT3_6,    /// port 3_6
209     E_HWI2C_PORT3_7,    /// port 3_7
210 
211     E_HWI2C_PORT_4 = 32,/// port 4_0 //disable port 4
212     E_HWI2C_PORT4_1,    /// port 4_1
213     E_HWI2C_PORT4_2,    /// port 4_2
214     E_HWI2C_PORT4_3,    /// port 4_3
215     E_HWI2C_PORT4_4,    /// port 4_4
216     E_HWI2C_PORT4_5,    /// port 4_5
217     E_HWI2C_PORT4_6,    /// port 4_6
218     E_HWI2C_PORT4_7,    /// port 4_7
219 
220     E_HWI2C_PORT_5 = 40,/// port 5_0 //disable port 5
221     E_HWI2C_PORT5_1,    /// port 5_1
222     E_HWI2C_PORT5_2,    /// port 5_2
223     E_HWI2C_PORT5_3,    /// port 5_3
224     E_HWI2C_PORT5_4,    /// port 5_4
225     E_HWI2C_PORT5_5,    /// port 5_5
226     E_HWI2C_PORT5_6,    /// port 5_6
227     E_HWI2C_PORT5_7,    /// port 5_7
228 
229     E_HWI2C_PORT_NOSUP  /// non-support port
230 }HWI2C_PORT;
231 
232 /// I2C clock speed select
233 typedef enum _HWI2C_CLKSEL
234 {
235     E_HWI2C_HIGH = 0,  /// high speed
236     E_HWI2C_NORMAL,    /// normal speed
237     E_HWI2C_SLOW,      /// slow speed
238     E_HWI2C_VSLOW,     /// very slow
239     E_HWI2C_USLOW,     /// ultra slow
240     E_HWI2C_UVSLOW,    /// ultra-very slow
241     E_HWI2C_NOSUP      /// non-support speed
242 }HWI2C_CLKSEL;
243 
244 /// I2C state
245 typedef enum _HWI2C_State
246 {
247     E_HWI2C_IDLE,      /// idle state
248     E_HWI2C_READ_DATA, /// read data state
249     E_HWI2C_WRITE_DATA, /// write data state
250     E_HWI2C_DMA_READ_DATA, /// DMA read data state
251     E_HWI2C_DMA_WRITE_DATA /// DMA write data state
252 }HWI2C_State;
253 
254 typedef enum {
255     E_HWI2C_READ_MODE_DIRECT,                 ///< first transmit slave address + reg address and then start receive the data */
256     E_HWI2C_READ_MODE_DIRECTION_CHANGE,       ///< slave address + reg address in write mode, direction change to read mode, repeat start slave address in read mode, data from device
257     E_HWI2C_READ_MODE_DIRECTION_CHANGE_STOP_START,  ///< slave address + reg address in write mode + stop, direction change to read mode, repeat start slave address in read mode, data from device
258     E_HWI2C_READ_MODE_MAX
259 } HWI2C_ReadMode;
260 
261 typedef enum _HWI2C_DMA_ADDRMODE
262 {
263     E_HWI2C_DMA_ADDR_NORMAL = 0,
264     E_HWI2C_DMA_ADDR_10BIT,
265     E_HWI2C_DMA_ADDR_MAX,
266 }HWI2C_DMA_ADDRMODE;
267 
268 typedef enum _HWI2C_DMA_READMODE
269 {
270     E_HWI2C_DMA_READ_NOSTOP = 0,
271     E_HWI2C_DMA_READ_STOP,
272     E_HWI2C_DMA_READ_MAX,
273 }HWI2C_DMA_READMODE;
274 
275 typedef enum _HWI2C_DMA_MIUPRI
276 {
277     E_HWI2C_DMA_PRI_LOW = 0,
278     E_HWI2C_DMA_PRI_HIGH,
279     E_HWI2C_DMA_PRI_MAX,
280 }HWI2C_DMA_MIUPRI;
281 
282 typedef enum _HWI2C_DMA_MIUCH
283 {
284     E_HWI2C_DMA_MIU_CH0 = 0,
285     E_HWI2C_DMA_MIU_CH1,
286     E_HWI2C_DMA_MIU_MAX,
287 }HWI2C_DMA_MIUCH;
288 
289 /// I2C master pin config
290 typedef struct _HWI2C_PinCfg
291 {
292     MS_U32  u32Reg;    /// register
293     MS_U8   u8BitPos;  /// bit position
294     MS_BOOL bEnable;   /// enable or disable
295 }HWI2C_PinCfg;
296 
297 /// I2C port config
298 typedef struct _HWI2C_PortCfg
299 {
300     MS_U32              u32DmaPhyAddr;  /// DMA physical address
301     HWI2C_DMA_ADDRMODE  eDmaAddrMode;   /// DMA address mode
302     HWI2C_DMA_MIUPRI    eDmaMiuPri;     /// DMA miu priroity
303     HWI2C_DMA_MIUCH     eDmaMiuCh;      /// DMA miu channel
304     MS_BOOL             bDmaEnable;     /// DMA enable
305 
306     HWI2C_PORT          ePort;          /// number
307     HWI2C_CLKSEL        eSpeed;         /// clock speed
308     HWI2C_ReadMode      eReadMode;      /// read mode
309     MS_BOOL             bEnable;        /// enable
310 
311 }HWI2C_PortCfg;
312 
313 /// I2C Configuration for initialization
314 typedef struct DLL_PACKED _HWI2C_UnitCfg
315 {
316     HWI2C_PortCfg   sCfgPort[8];    /// port cfg info
317     HWI2C_PinCfg    sI2CPin;        /// pin info
318     HWI2C_CLKSEL    eSpeed;         /// speed
319     HWI2C_PORT      ePort;          /// port
320     HWI2C_ReadMode  eReadMode;      /// read mode
321 
322 }HWI2C_UnitCfg;
323 
324 /// I2C information
325 typedef struct _HWI2C_Info
326 {
327     MS_U32          u32IOMap; /// base address
328     HWI2C_UnitCfg   sUnitCfg; /// configuration
329 }HWI2C_Info;
330 
331 /// I2C status
332 typedef struct DLL_PACKED _HWI2C_Status
333 {
334     MS_U8       u8DbgLevel;   /// debug level
335     MS_BOOL     bIsInit;      /// initialized
336     MS_BOOL     bIsMaster;    /// master
337     HWI2C_State eState;       /// state
338 }HWI2C_Status;
339 
340 typedef struct _HWI2C_PortStatus
341 {
342     MS_U8       u8DbgLevel;   /// debug level
343     MS_BOOL     bIsInit;      /// initialized
344     MS_BOOL     bIsMaster;    /// master
345     HWI2C_State eState;       /// state
346     MS_U8       u8Port;
347 }HWI2C_PortStatus;
348 
349 typedef struct _HWI2C_DelayConfig
350 {
351     MS_U8 u8Port;
352 	MS_U32 u32StartDelay;
353 	MS_U32 u32StopDelay;
354 }HWI2C_DelayConfig;
355 
356 ////////////////////////////////////////////////////////////////////////////////
357 // Extern Function
358 ////////////////////////////////////////////////////////////////////////////////
359 #include "drvHWI2C_v2.h"
360 
361 //-------------------------------------------------------------------------------------------------
362 /// MOBF Encrypt
363 /// @ingroup G_HWI2C_INIT
364 /// @param u32Key \b IN: Key
365 /// @param bEnable \b IN: TRUE/FLASE
366 /// @return DRVAESDMA_OK : Success
367 /// @return Others : Fail
368 //-------------------------------------------------------------------------------------------------
369 MS_BOOL MDrv_HWI2C_Init(HWI2C_UnitCfg *psCfg);
370 //-------------------------------------------------------------------------------------------------
371 /// MOBF Encrypt
372 /// @ingroup G_HWI2C_CONTROL
373 /// @param u32Key \b IN: Key
374 /// @param bEnable \b IN: TRUE/FLASE
375 /// @return DRVAESDMA_OK : Success
376 /// @return Others : Fail
377 //-------------------------------------------------------------------------------------------------
378 MS_BOOL MDrv_HWI2C_Start(void);
379 //-------------------------------------------------------------------------------------------------
380 /// MOBF Encrypt
381 /// @ingroup G_HWI2C_CONTROL
382 /// @param u32Key \b IN: Key
383 /// @param bEnable \b IN: TRUE/FLASE
384 /// @return DRVAESDMA_OK : Success
385 /// @return Others : Fail
386 //-------------------------------------------------------------------------------------------------
387 MS_BOOL MDrv_HWI2C_Stop(void);
388 //-------------------------------------------------------------------------------------------------
389 /// MOBF Encrypt
390 /// @ingroup G_HWI2C_CONTROL
391 /// @param u32Key \b IN: Key
392 /// @param bEnable \b IN: TRUE/FLASE
393 /// @return DRVAESDMA_OK : Success
394 /// @return Others : Fail
395 //-------------------------------------------------------------------------------------------------
396 MS_BOOL MDrv_HWI2C_GetPortIndex(HWI2C_PORT ePort, MS_U8* pu8Port);
397 //-------------------------------------------------------------------------------------------------
398 /// MOBF Encrypt
399 /// @ingroup G_HWI2C_CONTROL
400 /// @param u32Key \b IN: Key
401 /// @param bEnable \b IN: TRUE/FLASE
402 /// @return DRVAESDMA_OK : Success
403 /// @return Others : Fail
404 //-------------------------------------------------------------------------------------------------
405 MS_BOOL MDrv_HWI2C_SelectPort(HWI2C_PORT ePort);
406 //-------------------------------------------------------------------------------------------------
407 /// MOBF Encrypt
408 /// @ingroup G_HWI2C_CONTROL
409 /// @param u32Key \b IN: Key
410 /// @param bEnable \b IN: TRUE/FLASE
411 /// @return DRVAESDMA_OK : Success
412 /// @return Others : Fail
413 //-------------------------------------------------------------------------------------------------
414 MS_BOOL MDrv_HWI2C_SetClk(HWI2C_CLKSEL eClk);
415 //-------------------------------------------------------------------------------------------------
416 /// MOBF Encrypt
417 /// @ingroup G_HWI2C_CONTROL
418 /// @param u32Key \b IN: Key
419 /// @param bEnable \b IN: TRUE/FLASE
420 /// @return DRVAESDMA_OK : Success
421 /// @return Others : Fail
422 //-------------------------------------------------------------------------------------------------
423 MS_BOOL MDrv_HWI2C_SetReadMode(HWI2C_ReadMode eReadMode);
424 //-------------------------------------------------------------------------------------------------
425 /// MOBF Encrypt
426 /// @ingroup G_HWI2C_COMMON
427 /// @param u32Key \b IN: Key
428 /// @param bEnable \b IN: TRUE/FLASE
429 /// @return DRVAESDMA_OK : Success
430 /// @return Others : Fail
431 //-------------------------------------------------------------------------------------------------
432 MS_BOOL MDrv_HWI2C_WriteByte(MS_U16 u16SlaveCfg, MS_U8 u8RegAddr, MS_U8 u8Data);
433 //-------------------------------------------------------------------------------------------------
434 /// MOBF Encrypt
435 /// @ingroup G_HWI2C_COMMON
436 /// @param u32Key \b IN: Key
437 /// @param bEnable \b IN: TRUE/FLASE
438 /// @return DRVAESDMA_OK : Success
439 /// @return Others : Fail
440 //-------------------------------------------------------------------------------------------------
441 MS_BOOL MDrv_HWI2C_WriteBytes(MS_U16 u16SlaveCfg, MS_U32 uAddrCnt, MS_U8 *pRegAddr, MS_U32 uSize, MS_U8 *pData);
442 //-------------------------------------------------------------------------------------------------
443 /// MOBF Encrypt
444 /// @ingroup G_HWI2C_COMMON
445 /// @param u32Key \b IN: Key
446 /// @param bEnable \b IN: TRUE/FLASE
447 /// @return DRVAESDMA_OK : Success
448 /// @return Others : Fail
449 //-------------------------------------------------------------------------------------------------
450 MS_BOOL MDrv_HWI2C_ReadByte(MS_U16 u16SlaveCfg, MS_U8 u8RegAddr, MS_U8 *pData);
451 //-------------------------------------------------------------------------------------------------
452 /// MOBF Encrypt
453 /// @ingroup G_HWI2C_COMMON
454 /// @param u32Key \b IN: Key
455 /// @param bEnable \b IN: TRUE/FLASE
456 /// @return DRVAESDMA_OK : Success
457 /// @return Others : Fail
458 //-------------------------------------------------------------------------------------------------
459 MS_BOOL MDrv_HWI2C_ReadBytes(MS_U16 u16SlaveCfg, MS_U32 uAddrCnt, MS_U8 *pRegAddr, MS_U32 uSize, MS_U8 *pData);
460 //-------------------------------------------------------------------------------------------------
461 /// MOBF Encrypt
462 /// @ingroup G_HWI2C_CONTROL
463 /// @param u32Key \b IN: Key
464 /// @param bEnable \b IN: TRUE/FLASE
465 /// @return DRVAESDMA_OK : Success
466 /// @return Others : Fail
467 //-------------------------------------------------------------------------------------------------
468 MS_BOOL MDrv_HWI2C_SelectPort1(HWI2C_PORT ePort);
469 //-------------------------------------------------------------------------------------------------
470 /// MOBF Encrypt
471 /// @ingroup G_HWI2C_CONTROL
472 /// @param u32Key \b IN: Key
473 /// @param bEnable \b IN: TRUE/FLASE
474 /// @return DRVAESDMA_OK : Success
475 /// @return Others : Fail
476 //-------------------------------------------------------------------------------------------------
477 MS_BOOL MDrv_HWI2C_SetClkP1(HWI2C_CLKSEL eClk);
478 //-------------------------------------------------------------------------------------------------
479 /// MOBF Encrypt
480 /// @ingroup G_HWI2C_CONTROL
481 /// @param u32Key \b IN: Key
482 /// @param bEnable \b IN: TRUE/FLASE
483 /// @return DRVAESDMA_OK : Success
484 /// @return Others : Fail
485 //-------------------------------------------------------------------------------------------------
486 MS_BOOL MDrv_HWI2C_SetReadModeP1(HWI2C_ReadMode eReadMode);
487 //-------------------------------------------------------------------------------------------------
488 /// MOBF Encrypt
489 /// @ingroup G_HWI2C_COMMON
490 /// @param u32Key \b IN: Key
491 /// @param bEnable \b IN: TRUE/FLASE
492 /// @return DRVAESDMA_OK : Success
493 /// @return Others : Fail
494 //-------------------------------------------------------------------------------------------------
495 MS_BOOL MDrv_HWI2C_WriteByteP1(MS_U16 u16SlaveCfg, MS_U8 u8RegAddr, MS_U8 u8Data);
496 //-------------------------------------------------------------------------------------------------
497 /// MOBF Encrypt
498 /// @ingroup G_HWI2C_COMMON
499 /// @param u32Key \b IN: Key
500 /// @param bEnable \b IN: TRUE/FLASE
501 /// @return DRVAESDMA_OK : Success
502 /// @return Others : Fail
503 //-------------------------------------------------------------------------------------------------
504 MS_BOOL MDrv_HWI2C_WriteBytesP1(MS_U16 u16SlaveCfg, MS_U32 uAddrCnt, MS_U8 *pRegAddr, MS_U32 uSize, MS_U8 *pData);
505 //-------------------------------------------------------------------------------------------------
506 /// MOBF Encrypt
507 /// @ingroup G_HWI2C_COMMON
508 /// @param u32Key \b IN: Key
509 /// @param bEnable \b IN: TRUE/FLASE
510 /// @return DRVAESDMA_OK : Success
511 /// @return Others : Fail
512 //-------------------------------------------------------------------------------------------------
513 MS_BOOL MDrv_HWI2C_ReadByteP1(MS_U16 u16SlaveCfg, MS_U8 u8RegAddr, MS_U8 *pData);
514 //-------------------------------------------------------------------------------------------------
515 /// MOBF Encrypt
516 /// @ingroup G_HWI2C_COMMON
517 /// @param u32Key \b IN: Key
518 /// @param bEnable \b IN: TRUE/FLASE
519 /// @return DRVAESDMA_OK : Success
520 /// @return Others : Fail
521 //-------------------------------------------------------------------------------------------------
522 MS_BOOL MDrv_HWI2C_ReadBytesP1(MS_U16 u16SlaveCfg, MS_U32 uAddrCnt, MS_U8 *pRegAddr, MS_U32 uSize, MS_U8 *pData);
523 //-------------------------------------------------------------------------------------------------
524 /// MOBF Encrypt
525 /// @ingroup G_HWI2C_COMMON
526 /// @param u32Key \b IN: Key
527 /// @param bEnable \b IN: TRUE/FLASE
528 /// @return DRVAESDMA_OK : Success
529 /// @return Others : Fail
530 //-------------------------------------------------------------------------------------------------
531 MS_BOOL MDrv_HWI2C_SetDbgLevel(HWI2C_DbgLv eLevel);
532 //-------------------------------------------------------------------------------------------------
533 /// MOBF Encrypt
534 /// @ingroup G_HWI2C_COMMON
535 /// @param u32Key \b IN: Key
536 /// @param bEnable \b IN: TRUE/FLASE
537 /// @return DRVAESDMA_OK : Success
538 /// @return Others : Fail
539 //-------------------------------------------------------------------------------------------------
540 MS_BOOL MDrv_HWI2C_GetLibVer(const MSIF_Version **ppVersion);
541 //-------------------------------------------------------------------------------------------------
542 /// MOBF Encrypt
543 /// @ingroup G_HWI2C_COMMON
544 /// @param u32Key \b IN: Key
545 /// @param bEnable \b IN: TRUE/FLASE
546 /// @return DRVAESDMA_OK : Success
547 /// @return Others : Fail
548 //-------------------------------------------------------------------------------------------------
549 void MDrv_HWI2C_GetStatus(HWI2C_Status *pStatus);
550 //-------------------------------------------------------------------------------------------------
551 /// MOBF Encrypt
552 /// @ingroup G_HWI2C_COMMON
553 /// @param u32Key \b IN: Key
554 /// @param bEnable \b IN: TRUE/FLASE
555 /// @return DRVAESDMA_OK : Success
556 /// @return Others : Fail
557 //-------------------------------------------------------------------------------------------------
558 const HWI2C_Info* MDrv_HWI2C_GetInfo(void);
559 //-------------------------------------------------------------------------------------------------
560 /// MOBF Encrypt
561 /// @ingroup G_HWI2C_CONTROL
562 /// @param u32Key \b IN: Key
563 /// @param bEnable \b IN: TRUE/FLASE
564 /// @return DRVAESDMA_OK : Success
565 /// @return Others : Fail
566 //-------------------------------------------------------------------------------------------------
567 MS_BOOL  MDrv_HWI2C_ConfigDelay(MS_U32 u32StartDelay, MS_U32 u32StopDelay);
568 //-------------------------------------------------------------------------------------------------
569 /// MOBF Encrypt
570 /// @ingroup G_HWI2C_COMMON
571 /// @param u32Key \b IN: Key
572 /// @param bEnable \b IN: TRUE/FLASE
573 /// @return DRVAESDMA_OK : Success
574 /// @return Others : Fail
575 //-------------------------------------------------------------------------------------------------
576 MS_U16 MDrv_HWI2C_SetPowerState(EN_POWER_MODE u16PowerState);
577 //-------------------------------------------------------------------------------------------------
578 /// MOBF Encrypt
579 /// @ingroup G_HWI2C_CONTROL
580 /// @param u32Key \b IN: Key
581 /// @param bEnable \b IN: TRUE/FLASE
582 /// @return DRVAESDMA_OK : Success
583 /// @return Others : Fail
584 //-------------------------------------------------------------------------------------------------
585 MS_BOOL  MDrv_HWI2C_ConfigDelay_EX(void *pParam_Config);
586 //-------------------------------------------------------------------------------------------------
587 /// MOBF Encrypt
588 /// @ingroup G_HWI2C_COMMON
589 /// @param u32Key \b IN: Key
590 /// @param bEnable \b IN: TRUE/FLASE
591 /// @return DRVAESDMA_OK : Success
592 /// @return Others : Fail
593 //-------------------------------------------------------------------------------------------------
594 void MDrv_HWI2C_GetStatus_EX(void *pParam_Status);
595 
596 // For Utopia2K
597 //-------------------------------------------------------------------------------------------------
598 /// MOBF Encrypt
599 /// @ingroup G_HWI2C_ToBeRemove
600 /// @param u32Key \b IN: Key
601 /// @param bEnable \b IN: TRUE/FLASE
602 /// @return DRVAESDMA_OK : Success
603 /// @return Others : Fail
604 //-------------------------------------------------------------------------------------------------
605 MS_BOOL MDrv_HWI2C_Init_U2K(HWI2C_UnitCfg *psCfg);
606 //-------------------------------------------------------------------------------------------------
607 /// MOBF Encrypt
608 /// @ingroup G_HWI2C_ToBeRemove
609 /// @param u32Key \b IN: Key
610 /// @param bEnable \b IN: TRUE/FLASE
611 /// @return DRVAESDMA_OK : Success
612 /// @return Others : Fail
613 //-------------------------------------------------------------------------------------------------
614 MS_BOOL MDrv_HWI2C_Start_U2K(void);
615 //-------------------------------------------------------------------------------------------------
616 /// MOBF Encrypt
617 /// @ingroup G_HWI2C_ToBeRemove
618 /// @param u32Key \b IN: Key
619 /// @param bEnable \b IN: TRUE/FLASE
620 /// @return DRVAESDMA_OK : Success
621 /// @return Others : Fail
622 //-------------------------------------------------------------------------------------------------
623 MS_BOOL MDrv_HWI2C_Stop_U2K(void);
624 //-------------------------------------------------------------------------------------------------
625 /// MOBF Encrypt
626 /// @ingroup G_HWI2C_ToBeRemove
627 /// @param u32Key \b IN: Key
628 /// @param bEnable \b IN: TRUE/FLASE
629 /// @return DRVAESDMA_OK : Success
630 /// @return Others : Fail
631 //-------------------------------------------------------------------------------------------------
632 MS_BOOL MDrv_HWI2C_WriteBytes_U2K(MS_U16 u16SlaveCfg, MS_U32 uAddrCnt, MS_U8 *pRegAddr, MS_U32 uSize, MS_U8 *pData);
633 //-------------------------------------------------------------------------------------------------
634 /// MOBF Encrypt
635 /// @ingroup G_HWI2C_ToBeRemove
636 /// @param u32Key \b IN: Key
637 /// @param bEnable \b IN: TRUE/FLASE
638 /// @return DRVAESDMA_OK : Success
639 /// @return Others : Fail
640 //-------------------------------------------------------------------------------------------------
641 MS_BOOL MDrv_HWI2C_ReadBytes_U2K(MS_U16 u16SlaveCfg, MS_U32 uAddrCnt, MS_U8 *pRegAddr, MS_U32 uSize, MS_U8 *pData);
642 //-------------------------------------------------------------------------------------------------
643 /// MOBF Encrypt
644 /// @ingroup G_HWI2C_ToBeRemove
645 /// @param u32Key \b IN: Key
646 /// @param bEnable \b IN: TRUE/FLASE
647 /// @return DRVAESDMA_OK : Success
648 /// @return Others : Fail
649 //-------------------------------------------------------------------------------------------------
650 MS_BOOL MDrv_HWI2C_SelectPort_U2K(HWI2C_PORT ePort);
651 //-------------------------------------------------------------------------------------------------
652 /// MOBF Encrypt
653 /// @ingroup G_HWI2C_ToBeRemove
654 /// @param u32Key \b IN: Key
655 /// @param bEnable \b IN: TRUE/FLASE
656 /// @return DRVAESDMA_OK : Success
657 /// @return Others : Fail
658 //-------------------------------------------------------------------------------------------------
659 MS_BOOL MDrv_HWI2C_SetClk_U2K(HWI2C_CLKSEL eClk);
660 //-------------------------------------------------------------------------------------------------
661 /// MOBF Encrypt
662 /// @ingroup G_HWI2C_CONTROL
663 /// @param u32Key \b IN: Key
664 /// @param bEnable \b IN: TRUE/FLASE
665 /// @return DRVAESDMA_OK : Success
666 /// @return Others : Fail
667 //-------------------------------------------------------------------------------------------------
668 void MDrv_HWI2C_SetStopBit(MS_U8 u8Port, MS_BOOL bGenStop);
669 //-------------------------------------------------------------------------------------------------
670 /// MOBF Encrypt
671 /// @ingroup G_HWI2C_CONTROL
672 /// @param u32Key \b IN: Key
673 /// @param bEnable \b IN: TRUE/FLASE
674 /// @return DRVAESDMA_OK : Success
675 /// @return Others : Fail
676 //-------------------------------------------------------------------------------------------------
677 MS_BOOL MDrv_HWI2C_GetStopBit(MS_U8 u8Port);
678 //-------------------------------------------------------------------------------------------------
679 /// MOBF Encrypt
680 /// @ingroup G_HWI2C_ToBeRemove
681 /// @param u32Key \b IN: Key
682 /// @param bEnable \b IN: TRUE/FLASE
683 /// @return DRVAESDMA_OK : Success
684 /// @return Others : Fail
685 //-------------------------------------------------------------------------------------------------
686 MS_BOOL MDrv_HWI2C_WriteBytes_CUST(MS_U16 u16SlaveCfg, MS_U32 uAddrCnt, MS_U8 *pRegAddr, MS_U32 uSize, MS_U8 *pData, HWI2C_PORT ePort, HWI2C_CLKSEL eClk);
687 //-------------------------------------------------------------------------------------------------
688 /// MOBF Encrypt
689 /// @ingroup G_HWI2C_ToBeRemove
690 /// @param u32Key \b IN: Key
691 /// @param bEnable \b IN: TRUE/FLASE
692 /// @return DRVAESDMA_OK : Success
693 /// @return Others : Fail
694 //-------------------------------------------------------------------------------------------------
695 MS_BOOL MDrv_HWI2C_ReadBytes_CUST(MS_U16 u16SlaveCfg, MS_U32 uAddrCnt, MS_U8 *pRegAddr, MS_U32 uSize, MS_U8 *pData, HWI2C_PORT ePort, HWI2C_CLKSEL eClk);
696 
697 #ifdef __cplusplus
698 }
699 #endif
700 
701 
702 #endif
703