| Samsung Internal API reference 2.0

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Data Structures | Typedefs | Functions
I2C API
Samsung Internal API

## Data Structures
struct | TEES_I2CTransfer
| I2C data transfer buffer. More...

## Typedefs
typedef struct __TEES_I2CHandlerImpl * | TEES_I2CHandler

## Functions
TEE_Result | TEES_I2CInit (const char *name, uint32_t transac_len, TEES_I2CHandler *handler)
| Initialize I2C device and set transfer parameters to `handler`. More...
TEE_Result | TEES_I2CExit (TEES_I2CHandler handler)
| Terminate connection to I2C device. More...
TEE_Result | TEES_I2CWrite (TEES_I2CHandler handler, uint8_t chip, TEES_I2CTransfer *tx)
| Write data buffer `tx` to initialized I2C device. More...
TEE_Result | TEES_I2CRead (TEES_I2CHandler handler, uint8_t chip, TEES_I2CTransfer *rx)
| Read data buffer `rx` from initialized I2C device. More...
TEE_Result | TEES_I2CWriteRead (TEES_I2CHandler handler, uint8_t chip, TEES_I2CTransfer *tx, TEES_I2CTransfer *rx)
| Write data buffer `tx` and read buffer `rx` from initialized I2C device at the same time. More...

## Detailed Description

Provides set of functions to manipulate device connected with I2C bus.

## Data Structure Documentation

struct TEES_I2CTransfer

I2C data transfer buffer.

Data Fields
void * | buf | pointer to buffer used for I2C data transfer.
size_t | len | size of buffer `buf`.

## Typedef Documentation

TEES_I2CHandler

`#include <tee_i2c.h>`

Handler for I2C device.

## Function Documentation

TEE_Result TEES_I2CExit | ( | TEES_I2CHandler | handler | ) |

`#include <tee_i2c.h>`

Terminate connection to I2C device.

Parameters

  [in] | handler | initialized parameters.

Return values

  TEE_SUCCESS | in case of success.
  TEE_ERROR_xxx | in case of errors.

TEE_Result TEES_I2CInit | ( | const char * | name,
|  | uint32_t | transac_len,
|  | TEES_I2CHandler * | handler
| ) |  |

`#include <tee_i2c.h>`

Initialize I2C device and set transfer parameters to `handler`.

Parameters

  [in] | name | interface name.
  [in] | transac_len | size of transaction.
  [out] | handler | Pointer to structure which contains set up parameters.

Return values

  TEE_SUCCESS | in case of success.
  TEE_ERROR_xxx | in case of errors.

TEE_Result TEES_I2CRead | ( | TEES_I2CHandler | handler,
|  | uint8_t | chip,
|  | TEES_I2CTransfer * | rx
| ) |  |

`#include <tee_i2c.h>`

Read data buffer `rx` from initialized I2C device.

Parameters

  [in] | handler | initialized parameters.
  [in] | chip | address of target device on I2C bus.
  [out] | rx | Pointer to buffer to receive.

Return values

  TEE_SUCCESS | in case of success.
  TEE_ERROR_xxx | in case of errors.

TEE_Result TEES_I2CWrite | ( | TEES_I2CHandler | handler,
|  | uint8_t | chip,
|  | TEES_I2CTransfer * | tx
| ) |  |

`#include <tee_i2c.h>`

Write data buffer `tx` to initialized I2C device.

Parameters

  [in] | handler | initialized parameters.
  [in] | chip | address of target device on I2C bus.
  [in] | tx | Pointer to buffer to transfer.

Return values

  TEE_SUCCESS | in case of success.
  TEE_ERROR_xxx | in case of errors.

TEE_Result TEES_I2CWriteRead | ( | TEES_I2CHandler | handler,
|  | uint8_t | chip,
|  | TEES_I2CTransfer * | tx,
|  | TEES_I2CTransfer * | rx
| ) |  |

`#include <tee_i2c.h>`

Write data buffer `tx` and read buffer `rx` from initialized I2C device at the same time.

Parameters

  [in] | handler | initialized parameters.
  [in] | chip | address of target device on I2C bus.
  [in] | tx | Pointer to buffer to transfer.
  [out] | rx | Pointer to buffer to receive.

Return values

  TEE_SUCCESS | in case of success.
  TEE_ERROR_xxx | in case of errors.