| 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: breg_i2c.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/22 $ |
|---|
| 12 | * $brcm_Date: 3/21/11 4:04p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/basemodules/reg/breg_i2c.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/22 3/21/11 4:04p agin |
|---|
| 21 | * SW7346-96: Add additional prototypes for read and write sw i2c. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/21 10/4/10 3:39p adtran |
|---|
| 24 | * SW35230-1525: add WriteRead atomic operation |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/20 3/24/10 11:46a vle |
|---|
| 27 | * SW7601-171: Add BI2C_P_SetupHdmiHwAccess to set up I2C for HDMI HDCP |
|---|
| 28 | * auto Ri/Pj link integrity check feature |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/SW7601-171/1 3/9/10 3:22p vle |
|---|
| 31 | * SW7601-171: Add BI2C_P_SetupHdmiHwAccess to set up I2C for HDMI HDCP |
|---|
| 32 | * auto Ri/Pj link integrity check feature |
|---|
| 33 | * |
|---|
| 34 | * Hydra_Software_Devel/19 2/5/09 1:08p vle |
|---|
| 35 | * PR51682: Add declarations for BREG_I2C_ReadSwEDDC |
|---|
| 36 | * |
|---|
| 37 | * Hydra_Software_Devel/18 12/9/08 11:59a mward |
|---|
| 38 | * PR48987: Add declarations for some I2C bit-bang functions now used by |
|---|
| 39 | * bhdm. |
|---|
| 40 | * |
|---|
| 41 | * Hydra_Software_Devel/17 4/24/08 10:17a farshidf |
|---|
| 42 | * PR41729: correct the compile |
|---|
| 43 | * |
|---|
| 44 | * Hydra_Software_Devel/16 4/23/08 6:27p farshidf |
|---|
| 45 | * PR41729: update the function name |
|---|
| 46 | * |
|---|
| 47 | * Hydra_Software_Devel/15 4/23/08 6:23p farshidf |
|---|
| 48 | * PR41729: Add BREG_I2C_ReadNoAddrNoAck_Func |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/14 4/18/05 10:46a agin |
|---|
| 51 | * PR14828: add read and write no ack functions. |
|---|
| 52 | * |
|---|
| 53 | * Hydra_Software_Devel/13 3/14/05 5:51p agin |
|---|
| 54 | * PR14351: Fassl's changes |
|---|
| 55 | * |
|---|
| 56 | * Hydra_Software_Devel/12 3/2/05 5:49p agin |
|---|
| 57 | * PR14318: Added support for I2C write for NVRAM devices. |
|---|
| 58 | * |
|---|
| 59 | * Hydra_Software_Devel/11 7/8/04 2:23p brianlee |
|---|
| 60 | * PR11845: Add I2C API for 3-byte sub address. |
|---|
| 61 | * |
|---|
| 62 | * Hydra_Software_Devel/10 1/13/04 5:02p brianlee |
|---|
| 63 | * PR9268: Make write structures constant. |
|---|
| 64 | * |
|---|
| 65 | * Hydra_Software_Devel/9 9/12/03 4:58p brianlee |
|---|
| 66 | * Add chip address to EDDC read/write functions. |
|---|
| 67 | * |
|---|
| 68 | * Hydra_Software_Devel/8 9/11/03 10:59a brianlee |
|---|
| 69 | * Modified function definitions to match I2C definitions. |
|---|
| 70 | * |
|---|
| 71 | * Hydra_Software_Devel/7 8/22/03 2:52p marcusk |
|---|
| 72 | * Updated with latest changes discussed in the UPG design review. |
|---|
| 73 | * |
|---|
| 74 | * Hydra_Software_Devel/6 5/30/03 12:04p marcusk |
|---|
| 75 | * Updated documentation to use Open rather than Create to be more |
|---|
| 76 | * consistant. |
|---|
| 77 | * |
|---|
| 78 | * Hydra_Software_Devel/5 3/31/03 1:20p marcusk |
|---|
| 79 | * Updated with comments on threadsafety |
|---|
| 80 | * |
|---|
| 81 | * Hydra_Software_Devel/4 3/31/03 10:32a marcusk |
|---|
| 82 | * Updated comments. |
|---|
| 83 | * |
|---|
| 84 | * Hydra_Software_Devel/3 3/31/03 9:42a marcusk |
|---|
| 85 | * Updated with comments. |
|---|
| 86 | * |
|---|
| 87 | * Hydra_Software_Devel/2 3/10/03 2:39p marcusk |
|---|
| 88 | * Removed const keyword from read routines (copy paste error). |
|---|
| 89 | * |
|---|
| 90 | * Hydra_Software_Devel/1 3/5/03 5:13p marcusk |
|---|
| 91 | * Initial version. |
|---|
| 92 | * |
|---|
| 93 | ***************************************************************************/ |
|---|
| 94 | |
|---|
| 95 | /*= Module Overview ******************************************************** |
|---|
| 96 | This module provides a standard abstraction API for accessing I2C registers. |
|---|
| 97 | Several I2C busses may exist on a single platform. Some may be hardware based, |
|---|
| 98 | while others software based (using GPIO pins). In order to hide the |
|---|
| 99 | specific implementation of the I2C bus from a PortingInterface this I2C |
|---|
| 100 | register access abstraction is used. |
|---|
| 101 | |
|---|
| 102 | ---++++ 7 or 10 Bit I2C Chip Addresses |
|---|
| 103 | For all I2C functions, the chipAddr parameter is always used as the |
|---|
| 104 | *un-shifted* 7 bit (bits 15:7 = 0) or 10 bit (bits 15:10 = 0) chip address. |
|---|
| 105 | If (bits 9:7 == 0) then 7 bit addressing is used by default. Some I2C |
|---|
| 106 | implementations will return errors for 10 bit chip addresses (for example |
|---|
| 107 | if a hardware I2C implementation does not support 10 bit chip addresses). |
|---|
| 108 | |
|---|
| 109 | ---++++ Non 8-Bit Sub-Address Handling |
|---|
| 110 | Although most I2C devices use 8 or 16 bit sub-addresses, some may require |
|---|
| 111 | larger sub addresses. These devices must be use the BREG_I2C_WriteNoAddr and |
|---|
| 112 | BREG_I2C_ReadNoAddr in order to form larger sub-addresses. |
|---|
| 113 | |
|---|
| 114 | The following example shows how to access read from a device with a 32 bit sub |
|---|
| 115 | address: |
|---|
| 116 | |
|---|
| 117 | <verbatim> |
|---|
| 118 | BERR_Code BXXX_ReadRegister( |
|---|
| 119 | BREG_I2C_Handle cntx, |
|---|
| 120 | uint16_t chipAddr, |
|---|
| 121 | uint32_t subAddr, |
|---|
| 122 | uint8_t *pData, |
|---|
| 123 | size_t length ) |
|---|
| 124 | { |
|---|
| 125 | BREG_I2C_WriteNoAddr(cntx, chipAddr, &subAddr, sizeof(subAddr) ); |
|---|
| 126 | BREG_I2C_ReadNoAddr(cntx, chipAddr, pData, length); |
|---|
| 127 | } |
|---|
| 128 | </verbatim> |
|---|
| 129 | |
|---|
| 130 | Writing to a device with a non 8 or 16 bit sub address is slightly different; |
|---|
| 131 | you need to pre-pend your data with the sub address you wish to write. |
|---|
| 132 | |
|---|
| 133 | ---++++ I2C Register Handles |
|---|
| 134 | Hardware and software I2C implementations must follow the defined function |
|---|
| 135 | prototype definitions. All I2C PortingInterfaces supply the a function |
|---|
| 136 | that initializes a standard BREG_I2C_Handle (and fills it with function |
|---|
| 137 | pointers provided by the specific I2C PortingInterfaces implementation). |
|---|
| 138 | Please refer to the specific I2C PortingInterface implementations for more |
|---|
| 139 | details. |
|---|
| 140 | |
|---|
| 141 | An example of this type of function would be: |
|---|
| 142 | |
|---|
| 143 | <verbatim> |
|---|
| 144 | BERR_Code BI2C_Open( BI2C_Handle I2cHandle, BREG_I2C_Handle *pI2cRegHandle ); |
|---|
| 145 | </verbatim> |
|---|
| 146 | |
|---|
| 147 | This handle should be created during initialization and passed to the |
|---|
| 148 | appropriate porting interfaces. The porting interfaces in turn pass |
|---|
| 149 | this handle to the abstract I2C functions when then call the appropriate |
|---|
| 150 | I2C implementation though function pointers contained in the BREG_I2C_Handle. |
|---|
| 151 | |
|---|
| 152 | ---++++ Handling ThreadSafe with I2C |
|---|
| 153 | Since multiple modules (PortingInterface and otherwise) may be sharing the |
|---|
| 154 | same I2C bus, any function calls to the modules in question must be serialized |
|---|
| 155 | to prevent thread collisions. |
|---|
| 156 | |
|---|
| 157 | 1 All calls to the modules sharing the same I2C handle must be protected |
|---|
| 158 | through the use of a mutex. This protection must be handled by the |
|---|
| 159 | upper level software (driver, middleware, etc). |
|---|
| 160 | 1 Upper level software can create an additional layer between the I2C |
|---|
| 161 | RegisterInterface and the corresponding I2C PortingInterface instance |
|---|
| 162 | that implements the I2C register access. In this layer a mutex is |
|---|
| 163 | used to protect all I2C accesses. This could easily be done |
|---|
| 164 | using the BREG_I2C_Impl structure. |
|---|
| 165 | ***************************************************************************/ |
|---|
| 166 | |
|---|
| 167 | #ifndef BREG_I2C_H |
|---|
| 168 | #define BREG_I2C_H |
|---|
| 169 | |
|---|
| 170 | #ifdef __cplusplus |
|---|
| 171 | extern "C" { |
|---|
| 172 | #endif |
|---|
| 173 | |
|---|
| 174 | /* |
|---|
| 175 | Summary: |
|---|
| 176 | This is an opaque handle that is used for I2C register functions. |
|---|
| 177 | */ |
|---|
| 178 | typedef struct BREG_I2C_Impl *BREG_I2C_Handle; |
|---|
| 179 | |
|---|
| 180 | /* |
|---|
| 181 | Summary: |
|---|
| 182 | This function writes a programmable number of I2C registers using an 8 bit |
|---|
| 183 | sub address. |
|---|
| 184 | */ |
|---|
| 185 | BERR_Code BREG_I2C_Write( |
|---|
| 186 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 187 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 188 | uint8_t subAddr, /* 8 bit sub address */ |
|---|
| 189 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 190 | size_t length /* number of bytes to write */ |
|---|
| 191 | ); |
|---|
| 192 | |
|---|
| 193 | /* |
|---|
| 194 | Summary: |
|---|
| 195 | This function uses software "bit-bang" to write a programmable number of I2C registers using an 8 bit |
|---|
| 196 | sub address. |
|---|
| 197 | */ |
|---|
| 198 | BERR_Code BREG_I2C_WriteSw( |
|---|
| 199 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 200 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 201 | uint8_t subAddr, /* 8 bit sub address */ |
|---|
| 202 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 203 | size_t length /* number of bytes to write */ |
|---|
| 204 | ); |
|---|
| 205 | |
|---|
| 206 | /* |
|---|
| 207 | Summary: |
|---|
| 208 | This function writes a programmable number of I2C registers using an 8 bit |
|---|
| 209 | sub address and no ack. |
|---|
| 210 | */ |
|---|
| 211 | BERR_Code BREG_I2C_WriteNoAck( |
|---|
| 212 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 213 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 214 | uint8_t subAddr, /* 8 bit sub address */ |
|---|
| 215 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 216 | size_t length /* number of bytes to write */ |
|---|
| 217 | ); |
|---|
| 218 | |
|---|
| 219 | /* |
|---|
| 220 | Summary: |
|---|
| 221 | This function writes a programmable number of I2C registers using a 16 bit |
|---|
| 222 | sub address. |
|---|
| 223 | */ |
|---|
| 224 | BERR_Code BREG_I2C_WriteA16( |
|---|
| 225 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 226 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 227 | uint16_t subAddr, /* 16 bit sub address */ |
|---|
| 228 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 229 | size_t length /* number of bytes to write */ |
|---|
| 230 | ); |
|---|
| 231 | |
|---|
| 232 | /* |
|---|
| 233 | Summary: |
|---|
| 234 | This function uses software "bit-bang" to write a programmable number of I2C registers using a 16 bit |
|---|
| 235 | sub address. |
|---|
| 236 | */ |
|---|
| 237 | BERR_Code BREG_I2C_WriteSwA16( |
|---|
| 238 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 239 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 240 | uint16_t subAddr, /* 16 bit sub address */ |
|---|
| 241 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 242 | size_t length /* number of bytes to write */ |
|---|
| 243 | ); |
|---|
| 244 | |
|---|
| 245 | /* |
|---|
| 246 | Summary: |
|---|
| 247 | This function writes a programmable number of I2C registers using a 24 bit |
|---|
| 248 | sub address. |
|---|
| 249 | */ |
|---|
| 250 | BERR_Code BREG_I2C_WriteA24( |
|---|
| 251 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 252 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 253 | uint32_t subAddr, /* 24 bit sub address */ |
|---|
| 254 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 255 | size_t length /* number of bytes to write */ |
|---|
| 256 | ); |
|---|
| 257 | |
|---|
| 258 | /* |
|---|
| 259 | Summary: |
|---|
| 260 | This function uses software "bit-bang" to write a programmable number of I2C registers using a 24 bit |
|---|
| 261 | sub address. |
|---|
| 262 | */ |
|---|
| 263 | BERR_Code BREG_I2C_WriteSwA24( |
|---|
| 264 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 265 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 266 | uint32_t subAddr, /* 24 bit sub address */ |
|---|
| 267 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 268 | size_t length /* number of bytes to write */ |
|---|
| 269 | ); |
|---|
| 270 | |
|---|
| 271 | /* |
|---|
| 272 | Summary: |
|---|
| 273 | This function writes a programmable number of I2C registers without a sub address |
|---|
| 274 | (raw write). |
|---|
| 275 | */ |
|---|
| 276 | BERR_Code BREG_I2C_WriteNoAddr( |
|---|
| 277 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 278 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 279 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 280 | size_t length /* number of bytes to write */ |
|---|
| 281 | ); |
|---|
| 282 | |
|---|
| 283 | /* |
|---|
| 284 | Summary: |
|---|
| 285 | This function writes a programmable number of I2C registers without a sub address |
|---|
| 286 | (raw write), and without waiting for an ack. |
|---|
| 287 | */ |
|---|
| 288 | BERR_Code BREG_I2C_WriteNoAddrNoAck( |
|---|
| 289 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 290 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 291 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 292 | size_t length /* number of bytes to write */ |
|---|
| 293 | ); |
|---|
| 294 | |
|---|
| 295 | /* |
|---|
| 296 | Summary: |
|---|
| 297 | This function writes an I2C NVRAM device using an 8 bit sub address. |
|---|
| 298 | */ |
|---|
| 299 | BERR_Code BREG_I2C_WriteNvram( |
|---|
| 300 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 301 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 302 | uint8_t subAddr, /* 8 bit sub address */ |
|---|
| 303 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 304 | size_t length /* number of bytes to write */ |
|---|
| 305 | ); |
|---|
| 306 | |
|---|
| 307 | /* |
|---|
| 308 | Summary: |
|---|
| 309 | This function reads a programmable number of I2C registers using an 8 bit |
|---|
| 310 | sub address. |
|---|
| 311 | */ |
|---|
| 312 | BERR_Code BREG_I2C_Read( |
|---|
| 313 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 314 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 315 | uint8_t subAddr, /* 8 bit sub address */ |
|---|
| 316 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 317 | size_t length /* number of bytes to read */ |
|---|
| 318 | ); |
|---|
| 319 | |
|---|
| 320 | /* |
|---|
| 321 | Summary: |
|---|
| 322 | This function uses software "bit-bang" to read a programmable number of I2C registers using an 8 bit |
|---|
| 323 | sub address. |
|---|
| 324 | */ |
|---|
| 325 | BERR_Code BREG_I2C_ReadSw( |
|---|
| 326 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 327 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 328 | uint8_t subAddr, /* 8 bit sub address */ |
|---|
| 329 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 330 | size_t length /* number of bytes to read */ |
|---|
| 331 | ); |
|---|
| 332 | |
|---|
| 333 | /* |
|---|
| 334 | Summary: |
|---|
| 335 | This function reads a programmable number of I2C registers using an 8 bit |
|---|
| 336 | sub address and no ack.. |
|---|
| 337 | */ |
|---|
| 338 | BERR_Code BREG_I2C_ReadNoAck( |
|---|
| 339 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 340 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 341 | uint8_t subAddr, /* 8 bit sub address */ |
|---|
| 342 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 343 | size_t length /* number of bytes to read */ |
|---|
| 344 | ); |
|---|
| 345 | |
|---|
| 346 | /* |
|---|
| 347 | Summary: |
|---|
| 348 | This function reads a programmable number of I2C registers using a 16 bit |
|---|
| 349 | sub address. |
|---|
| 350 | */ |
|---|
| 351 | BERR_Code BREG_I2C_ReadA16( |
|---|
| 352 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 353 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 354 | uint16_t subAddr, /* 16 bit sub address */ |
|---|
| 355 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 356 | size_t length /* number of bytes to read */ |
|---|
| 357 | ); |
|---|
| 358 | |
|---|
| 359 | /* |
|---|
| 360 | Summary: |
|---|
| 361 | This function uses software "bit-bang" to read a programmable number of I2C registers using a 16 bit |
|---|
| 362 | sub address. |
|---|
| 363 | */ |
|---|
| 364 | BERR_Code BREG_I2C_ReadSwA16( |
|---|
| 365 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 366 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 367 | uint16_t subAddr, /* 16 bit sub address */ |
|---|
| 368 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 369 | size_t length /* number of bytes to read */ |
|---|
| 370 | ); |
|---|
| 371 | |
|---|
| 372 | /* |
|---|
| 373 | Summary: |
|---|
| 374 | This function reads a programmable number of I2C registers using a 24 bit |
|---|
| 375 | sub address. |
|---|
| 376 | */ |
|---|
| 377 | BERR_Code BREG_I2C_ReadA24( |
|---|
| 378 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 379 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 380 | uint32_t subAddr, /* 32 bit sub address */ |
|---|
| 381 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 382 | size_t length /* number of bytes to read */ |
|---|
| 383 | ); |
|---|
| 384 | |
|---|
| 385 | /* |
|---|
| 386 | Summary: |
|---|
| 387 | This function uses software "bit-bang" to read a programmable number of I2C registers using a 24 bit |
|---|
| 388 | sub address. |
|---|
| 389 | */ |
|---|
| 390 | BERR_Code BREG_I2C_ReadSwA24( |
|---|
| 391 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 392 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 393 | uint32_t subAddr, /* 32 bit sub address */ |
|---|
| 394 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 395 | size_t length /* number of bytes to read */ |
|---|
| 396 | ); |
|---|
| 397 | |
|---|
| 398 | /* |
|---|
| 399 | Summary: |
|---|
| 400 | This function reads a programmable number of I2C registers without a sub address |
|---|
| 401 | (raw read). |
|---|
| 402 | */ |
|---|
| 403 | BERR_Code BREG_I2C_ReadNoAddr( |
|---|
| 404 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 405 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 406 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 407 | size_t length /* number of bytes to read */ |
|---|
| 408 | ); |
|---|
| 409 | |
|---|
| 410 | /* |
|---|
| 411 | Summary: |
|---|
| 412 | This function uses software "bit-bang" to read a programmable number of I2C registers without a sub address |
|---|
| 413 | (raw read). |
|---|
| 414 | */ |
|---|
| 415 | BERR_Code BREG_I2C_ReadSwNoAddr( |
|---|
| 416 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 417 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 418 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 419 | size_t length /* number of bytes to read */ |
|---|
| 420 | ); |
|---|
| 421 | |
|---|
| 422 | /* |
|---|
| 423 | Summary: |
|---|
| 424 | This function reads a programmable number of I2C registers without a sub address and no Ack |
|---|
| 425 | (raw read). |
|---|
| 426 | */ |
|---|
| 427 | |
|---|
| 428 | BERR_Code BREG_I2C_ReadNoAddrNoAck( |
|---|
| 429 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 430 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 431 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 432 | size_t length /* number of bytes to read */ |
|---|
| 433 | ); |
|---|
| 434 | /* |
|---|
| 435 | Summary: |
|---|
| 436 | This function is used to perform an Enhanced Display Data Channel read protocol. |
|---|
| 437 | */ |
|---|
| 438 | BERR_Code BREG_I2C_ReadEDDC( |
|---|
| 439 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 440 | uint8_t chipAddr, /* chip address */ |
|---|
| 441 | uint8_t segment, /* EDDC segment pointer */ |
|---|
| 442 | uint8_t subAddr, /* 8-bit sub address */ |
|---|
| 443 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 444 | size_t length /* number of bytes to read */ |
|---|
| 445 | ); |
|---|
| 446 | |
|---|
| 447 | /* |
|---|
| 448 | Summary: |
|---|
| 449 | This function uses software "bit-bang" to read an Enhanced Display Data Channel read protocol. |
|---|
| 450 | */ |
|---|
| 451 | BERR_Code BREG_I2C_ReadSwEDDC( |
|---|
| 452 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 453 | uint8_t chipAddr, /* chip address */ |
|---|
| 454 | uint8_t segment, /* EDDC segment pointer */ |
|---|
| 455 | uint8_t subAddr, /* 8-bit sub address */ |
|---|
| 456 | uint8_t *pData, /* pointer to memory location to store read data */ |
|---|
| 457 | size_t length /* number of bytes to read */ |
|---|
| 458 | ); |
|---|
| 459 | |
|---|
| 460 | /* |
|---|
| 461 | Summary: |
|---|
| 462 | This function is used to perform an Enhanced Display Data Channel write protocol. |
|---|
| 463 | */ |
|---|
| 464 | BERR_Code BREG_I2C_WriteEDDC( |
|---|
| 465 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 466 | uint8_t chipAddr, /* chip address */ |
|---|
| 467 | uint8_t segment, /* EDDC segment pointer */ |
|---|
| 468 | uint8_t subAddr, /* 8-bit sub address */ |
|---|
| 469 | const uint8_t *pData, /* pointer to data to write */ |
|---|
| 470 | size_t length /* number of bytes to write */ |
|---|
| 471 | ); |
|---|
| 472 | |
|---|
| 473 | |
|---|
| 474 | /* |
|---|
| 475 | Summary: |
|---|
| 476 | This function set up i2c for HDMI HDCP HW Ri/Pj Link integrity check |
|---|
| 477 | */ |
|---|
| 478 | BERR_Code BREG_I2C_SetupHdmiHwAccess( |
|---|
| 479 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 480 | uint32_t dataTransferFormat, /* Data Transfer Format */ |
|---|
| 481 | uint32_t cnt1, /* Counter 1 value */ |
|---|
| 482 | uint32_t cnt2 /* Counter 2 value */ |
|---|
| 483 | ); |
|---|
| 484 | |
|---|
| 485 | |
|---|
| 486 | /* |
|---|
| 487 | Summary: |
|---|
| 488 | This function is used to perform write and read as an atomic operation. |
|---|
| 489 | */ |
|---|
| 490 | BERR_Code BREG_I2C_WriteRead( |
|---|
| 491 | BREG_I2C_Handle i2cHandle, /* I2C Handle */ |
|---|
| 492 | uint16_t chipAddr, /* 7 or 10 bit chip address (_unshifted_) */ |
|---|
| 493 | uint8_t subAddr, /* 8 bit sub address */ |
|---|
| 494 | const uint8_t *pWriteData, /* pointer to data to write */ |
|---|
| 495 | size_t writeLength, /* number of bytes to write */ |
|---|
| 496 | const uint8_t *pReadData, /* pointer to data to write */ |
|---|
| 497 | size_t readLength /* number of bytes to write */ |
|---|
| 498 | ); |
|---|
| 499 | |
|---|
| 500 | |
|---|
| 501 | #ifdef __cplusplus |
|---|
| 502 | } |
|---|
| 503 | #endif |
|---|
| 504 | |
|---|
| 505 | #endif |
|---|
| 506 | /* End of File */ |
|---|