source: svn/newcon3bcm2_21bu/dta/src/settop_api/vsb/TDA18219/inc/tmdlI2C.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 10.3 KB
Line 
1/**
2  Copyright (C) 2008 NXP B.V., All Rights Reserved.
3  This source code and any compilation or derivative thereof is the proprietary
4  information of NXP B.V. and is confidential in nature. Under no circumstances
5  is this software to be  exposed to or placed under an Open Source License of
6  any type without the expressed written permission of NXP B.V.
7 *
8 * \file          tmdlI2C.h
9 *                %version: 4 %
10 *
11 * \date          %date_modified%
12 *
13 * \brief         Describe briefly the purpose of this file.
14 *
15 * REFERENCE DOCUMENTS :
16 *
17 * Detailed description may be added here.
18 *
19 * \section info Change Information
20 *
21 * \verbatim
22   Date          Modified by CRPRNr  TASKNr  Maintenance description
23   -------------|-----------|-------|-------|-----------------------------------
24   9-JULY-2007  | A.TANT    |       |       | CREATION OF I2C ARCHITECTURE 2.0.0
25   -------------|-----------|-------|-------|-----------------------------------
26                |           |       |       |
27   -------------|-----------|-------|-------|-----------------------------------
28   \endverbatim
29 *
30*/
31
32
33#ifndef TMDLI2C_H
34#define TMDLI2C_H
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40
41/*============================================================================*/
42/*                       INCLUDE FILES                                        */
43/*============================================================================*/
44
45/*============================================================================*/
46/*                       MACRO DEFINITION                                     */
47/*============================================================================*/
48
49/* SW Error codes */
50#define I2C_ERR_BASE               (CID_COMP_PARPORT | CID_LAYER_HWAPI)
51#define I2C_ERR_COMP               (CID_COMP_PARPORT | CID_LAYER_HWAPI | TM_ERR_COMP_UNIQUE_START)
52
53#define I2C_ERR_BAD_UNIT_NUMBER    (I2C_ERR_BASE + TM_ERR_BAD_UNIT_NUMBER)
54#define I2C_ERR_NOT_INITIALIZED    (I2C_ERR_BASE + TM_ERR_NOT_INITIALIZED)
55//#define I2C_ERR_INIT_FAILED        (I2C_ERR_BASE + TM_ERR_INIT_FAILED)
56#define I2C_ERR_BAD_PARAMETER      (I2C_ERR_BASE + TM_ERR_BAD_PARAMETER)
57#define I2C_ERR_NOT_SUPPORTED      (I2C_ERR_BASE + TM_ERR_NOT_SUPPORTED)
58#define I2C_ERR_NOT_INSTALLED      (I2C_ERR_COMP + 0x0001)
59#define I2C_ERR_FAILED             (I2C_ERR_COMP + 0x0002)
60#define I2C_ERR_HW                 (I2C_ERR_COMP + 0x0003)
61//#define I2C_ERR_NOT_READY          (I2C_ERR_COMP + 0x0002)
62//#define I2C_ERR_BAD_CRC            (I2C_ERR_COMP + 0x0003)
63//#define I2C_ERR_BAD_VERSION        (I2C_ERR_COMP + 0x0004)
64
65typedef enum _tmI2CInterfaceType_t {
66    tmI2CInterfaceUnknown = 0,  /* No I2C Interface Defined */
67    tmI2CInterfaceURTParallel,  /* URT Parallel I2C Interface */
68    tmI2CInterfaceURTUSB,       /* URT USB I2C Interface */
69    tmI2CInterfaceMMPParallel,  /* MMP Parallel I2C Interface */
70    tmI2CInterfaceCypressUSB,   /* Cypress USB I2C Interface */
71        tmI2CInterfaceNxpCyI2c,     /* NXP USB I2C Interface based on Cypress */
72        tmI2CInterfaceCH341USB,     /* CH341 USB I2C Interface */
73        tmI2CInterfaceFTDI,         /* FTDI USB I2C Interface */
74    tmI2CInterfaceCustomer,     /* Customer I2C Interface */
75    tmI2CInterfaceSimuSamba,    /* Simu Samba I2C Interface */
76    tmI2CInterfaceMax
77} tmI2CInterfaceType_t, *ptmI2CInterfaceType_t;
78
79typedef enum _tmI2CPortType_t {
80    tmI2CPortUnknown = 0,   /* No Port Type Defined */
81    tmI2CPortLPT1,          /* LPT1 Port Type */
82    tmI2CPortLPT2,          /* LPT2 Port Type */
83    tmI2CPortLPT3,          /* LPT3 Port Type */
84    tmI2CPortUSB,           /* USB Port Type */
85    tmI2CPortMax
86} tmI2CPortType_t, *ptmI2CPortType_t;
87
88typedef enum _tmI2CAction_t
89{
90    tmI2CActionUnknown,
91    tmI2CActionWrite = 0,
92    tmI2CActionRead,
93    tmI2CActionMax
94}   tmI2CAction_t, *ptmI2CAction_t;
95
96typedef enum
97{
98    tmI2CIdentModeUnknown = 0,
99    tmI2CIdentModePosition,
100    tmI2CIdentModeInstanceIndex,
101    tmI2CIdentModeSerialNumber,
102    tmI2CIdentModeMax
103} tmI2CIdentMode_t, *ptmI2CIdentMode_t;
104
105typedef struct _tmI2CLLDriverVersion
106{
107    UInt32  major;
108    UInt32  minor;
109    UInt32  build;
110    UInt32  revision;
111} tmI2CLLDriverVersion, *ptmI2CLLDriverVersion;
112
113// Serial Number
114typedef struct _tmI2CSerialNumber
115{
116    Bool    biSerialNumberAvailable;
117    UInt8   iSerialNumber[32];
118    UInt32  dwInstanceIndex;
119} tmI2CSerialNumber, *ptmI2CSerialNumber;
120
121// Enumeration
122typedef struct _tmI2CEnumDevices
123{
124    UInt32              dwInstanceCount;
125    tmI2CSerialNumber   devices[8];
126} tmI2CEnumDevices, *ptmI2CEnumDevices;
127
128typedef struct _tmI2CInterfaceConfig_t
129{
130    tmI2CInterfaceType_t    eInterfaceType;         /* Interface Type */
131    tmI2CPortType_t         ePortType;              /* Port Type */
132    tmI2CIdentMode_t        tIdentificationMode;
133    union
134    {
135        UInt8               position;
136        UInt32              dwInstanceIndex;
137        UInt8               serialNumber[32];
138    }Identification;
139    UInt32                  dwAdditionalDataSize;   /* Additional Data Size */
140    void*                   pAdditionalData;        /* Additional Data Pointer */
141} tmI2CInterfaceConfig_t, *ptmI2CInterfaceConfig_t;
142
143// Callback for I2C Log
144typedef tmErrorCode_t (*w_tmdlI2CCallBack) (tmUnitSelect_t tUnit, CUInt32 uHwAddress, CUInt32 addrSize, CUInt8* pAddr, CUInt32 dataSize, CUInt8* pData, tmErrorCode_t err, tmI2CAction_t i2cAction, Bool bHwAddrAsWriteAddr);
145
146#ifdef TMFL_NEWSPI
147
148typedef enum _tmSpiChipSelect_t
149{
150    tmSpiChipSelect_Port1 = 0,
151    tmSpiChipSelect_Port2,
152    tmSpiChipSelect_Port3,
153    tmSpiChipSelect_Port4,
154    tmSpiChipSelect_Invalid
155}   tmSpiChipSelect_t, *ptmSpiChipSelect_t;
156
157typedef enum
158{
159        tmSpiCsPolarityActiveHigh = 0,
160        tmSpiCsPolarityActiveLow       
161} tmSpiCsPolarityDef, *ptmSpiCsPolarityDef;
162
163typedef enum
164{
165        tmSpiModeThreeLines = 0,
166        tmSpiModeFourLines     
167} tmSpiModeDef, *ptmSpiModeDef;
168
169#else
170
171typedef enum _tmSpiChipSelect_t
172{
173    tmSpiChipSelect_PortD_Bit4 = 0,
174    tmSpiChipSelect_PortD_Bit5,
175    tmSpiChipSelect_PortD_Bit6,
176    tmSpiChipSelect_PortD_Bit7,
177    tmSpiChipSelect_Invalid
178}   tmSpiChipSelect_t, *ptmSpiChipSelect_t;
179
180#endif
181
182/*============================================================================*/
183/*                       EXTERN FUNCTION PROTOTYPES                           */
184/*============================================================================*/
185
186extern tmErrorCode_t
187tmdlI2CGetSWVersion
188(
189    ptmSWVersion_t   pSWVersion  /*  O: Receives SW Version  */
190);
191
192extern tmErrorCode_t
193tmdlI2CGetLowLevelSWVersion
194(
195    tmUnitSelect_t          tUnit,
196    ptmSWVersion_t          pSWVersion,     /*  O: Receives SW Version  */
197    ptmI2CLLDriverVersion   pLLSWVersion    /*  O: Receives LL SW Version  */
198);
199
200extern tmErrorCode_t
201tmdlI2CGetLowLevelDevices
202(
203    tmUnitSelect_t      tUnit,
204    ptmI2CEnumDevices   pDevices    /*  O: Receives LL Devices */
205);
206
207extern tmErrorCode_t
208tmdlI2CInit
209(
210    tmUnitSelect_t  tUnit,   /* I: FrontEnd unit number */
211    tmbslFrontEndDependency_t* psSrvFunc
212);
213
214extern tmErrorCode_t
215tmdlI2CDeInit
216(
217    tmUnitSelect_t  tUnit
218);
219
220extern tmErrorCode_t
221tmdlI2CSetInterface
222(
223    tmUnitSelect_t  tUnit,
224    ptmI2CInterfaceConfig_t psI2CInterface
225);
226
227extern tmErrorCode_t
228tmdlI2CSetPath
229(
230    tmUnitSelect_t  tUnit,
231    int     pPath_length,
232    wchar_t*      My_path
233);
234
235extern tmErrorCode_t
236tmdlI2CGetInterface
237(
238    tmUnitSelect_t  tUnit,
239    ptmI2CInterfaceConfig_t psI2CInterface
240);
241
242extern tmErrorCode_t
243tmdlI2CSetGPIO
244(
245 tmUnitSelect_t  tUnit,
246 UInt8          Port,
247 UInt8          Mask,
248 UInt8          Value
249);
250
251extern tmErrorCode_t
252tmdlI2CWrite
253(
254    tmUnitSelect_t  tUnit,
255    UInt32          uHwAddress,
256    UInt32          AddrSize,
257    UInt8*          pAddr,
258    UInt32          WriteLen,
259    UInt8*          pData
260);
261
262extern tmErrorCode_t
263tmdlI2CRead
264(
265    tmUnitSelect_t  tUnit,
266    UInt32          uHwAddress,
267    UInt32          AddrSize,
268    UInt8*          pAddr,
269    UInt32          ReadLen,
270    UInt8*          pData
271);
272
273extern tmErrorCode_t
274tmdlI2CReadAllI2cMap
275(
276    tmUnitSelect_t  tUnit,
277    UInt32          uHwAddress,
278    UInt32          ReadLen,
279    UInt8*          pData
280);
281
282extern tmErrorCode_t
283tmdlI2CSetErrorEnable
284(
285    tmUnitSelect_t  tUnit,
286    Bool            bErrorEnable
287);
288
289extern tmErrorCode_t
290tmdlI2CGetErrorEnable
291(
292    tmUnitSelect_t  tUnit,
293    Bool*           pbErrorEnable
294);
295
296extern tmErrorCode_t
297tmdlI2CSetPortType
298(
299    tmUnitSelect_t  tUnit,
300    tmI2CPortType_t dwPortType
301);
302
303extern tmErrorCode_t
304tmdlI2CGetPortType
305(
306    tmUnitSelect_t      tUnit,
307    ptmI2CPortType_t    pdwPortType
308);
309
310extern tmErrorCode_t
311tmdlI2CSetBitrate
312(
313    tmUnitSelect_t  tUnit,
314    UInt32          dwBitrate
315);
316
317extern tmErrorCode_t
318tmdlI2CGetBitrate
319(
320    tmUnitSelect_t  tUnit,
321    UInt32*         pdwBitrate
322);
323
324extern tmErrorCode_t
325tmdlI2CSetHwAddrAsWriteAddr
326(
327    tmUnitSelect_t  tUnit,
328    Bool            bHwAddrAsWriteAddr
329);
330
331extern tmErrorCode_t
332tmdlI2CGetHwAddrAsWriteAddr
333(
334    tmUnitSelect_t  tUnit,
335    Bool*           pbHwAddrAsWriteAddr
336);
337
338#ifdef TMFL_NEWSPI
339
340extern tmErrorCode_t
341tmdlSpiWrite
342(
343    tmUnitSelect_t    tUnit,
344    tmSpiChipSelect_t eCS,
345    UInt32            dwDataLengthInBits,
346    UInt8*            pData
347);
348
349extern tmErrorCode_t
350tmdlSpiRead
351(
352    tmUnitSelect_t    tUnit,
353    tmSpiChipSelect_t eCS,
354    UInt32            dwDataLengthInBits,
355    UInt8*            pData
356);
357
358extern tmErrorCode_t
359tmdlSpiWriteRead
360(
361    tmUnitSelect_t    tUnit,
362    tmSpiChipSelect_t eCS,
363    UInt32            dwWriteDataLengthInBits,
364    UInt8*            pWriteData,
365        UInt32            dwReadDataLengthInBits,
366    UInt8*            pReadData
367);
368
369extern tmErrorCode_t
370tmdlSpiSetConfig
371(
372    tmUnitSelect_t      tUnit,
373    tmSpiCsPolarityDef  eCsPolarity,
374    tmSpiModeDef        eSpiMode
375);
376
377extern tmErrorCode_t
378tmdlSpiGetConfig
379(
380    tmUnitSelect_t      tUnit,
381    tmSpiCsPolarityDef  *eCsPolarity,
382    tmSpiModeDef        *eSpiMode
383);
384
385#else
386
387extern tmErrorCode_t
388tmdlSpiWrite
389(
390    tmUnitSelect_t    tUnit,
391    tmSpiChipSelect_t eCS,
392    UInt32            DataLenthInBits,
393    UInt8*            pData
394);
395
396extern tmErrorCode_t
397tmdlSpiRead
398(
399    tmUnitSelect_t    tUnit,
400    tmSpiChipSelect_t eCS,
401    UInt32            DataLenthInBits,
402    UInt8*            pData
403);
404
405#endif
406
407#ifdef __cplusplus
408}
409#endif
410
411#endif /* TMDLI2C_H */
412/*============================================================================*/
413/*                            END OF FILE                                     */
414/*============================================================================*/
415
Note: See TracBrowser for help on using the repository browser.