RTEMS: i2c_dev Struct Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Data Fields
i2c_dev Struct Reference
Device Drivers » Inter-Integrated Circuit (I2C) Driver » I2C Device Driver

I2C slave device control. More...

`#include <i2c.h>`

## Data Fields
ssize_t(* | read )(i2c_dev *dev, void *buf, size_t n, off_t offset)
| Reads from the device.
ssize_t(* | write )(i2c_dev *dev, const void *buf, size_t n, off_t offset)
| Writes to the device.
int(* | ioctl )(i2c_dev *dev, ioctl_command_t command, void *arg)
| Device IO control.
off_t(* | get_size )(i2c_dev *dev)
| Gets the file size.
blksize_t(* | get_block_size )(i2c_dev *dev)
| Gets the file block size.
void(* | destroy )(i2c_dev *dev)
| Destroys the device.
i2c_bus * | bus
| The bus control.
uint16_t | address
| The device address.
int | bus_fd
| File descriptor of the bus.

## Detailed Description

I2C slave device control.

## Field Documentation

## ◆ bus_fd

int i2c_dev::bus_fd

File descriptor of the bus.

This prevents destruction of the bus since we hold a reference to it with this.

## ◆ ioctl

int(* i2c_dev::ioctl) (i2c_dev *dev, ioctl_command_t command, void *arg)

Device IO control.

Return values

  0 | Successful operation.
  negative | Negative error number in case of an error.

## ◆ read

ssize_t(* i2c_dev::read) (i2c_dev *dev, void *buf, size_t n, off_t offset)

Reads from the device.

Return values

  non-negative | Bytes transferred from device.
  negative | Negative error number in case of an error.

## ◆ write

ssize_t(* i2c_dev::write) (i2c_dev *dev, const void *buf, size_t n, off_t offset)

Writes to the device.

Return values

  non-negative | Bytes transferred to device.
  negative | Negative error number in case of an error.

The documentation for this struct was generated from the following file:

- cpukit/include/dev/i2c/i2c.h