23 #ifndef _DEV_I2C_I2C_H 24 #define _DEV_I2C_I2C_H 31 #include <rtems/thread.h> 33 #include <sys/ioctl.h> 75 #define I2C_BUS_OBTAIN 0x800 82 #define I2C_BUS_RELEASE 0x801 89 #define I2C_BUS_GET_CONTROL 0x802 96 #define I2C_BUS_SET_CLOCK 0x803 103 #define I2C_BUS_CLOCK_DEFAULT 100000 285 #define I2C_DEV_IO_CONTROL 0x900 305 ssize_t (*
write)(
i2c_dev *dev,
const void *buf,
size_t n, off_t offset);
313 int (*ioctl)(
i2c_dev *dev, ioctl_command_t command,
void *arg);
390 const char *bus_path,
void i2c_bus_obtain(i2c_bus *bus)
Obtains the bus.
Definition: i2c-bus.c:34
ssize_t read(int fd, void *buffer, size_t count)
Definition: read.c:27
int(* set_clock)(i2c_bus *bus, unsigned long clock)
Sets the bus clock.
Definition: i2c.h:131
Data which Ease the Burden of Consistently Setting Errno.
void i2c_bus_destroy_and_free(i2c_bus *bus)
Destroys a bus control and frees its memory.
Definition: i2c-bus.c:294
Watchdog_Interval rtems_interval
Used to manage and manipulate intervals specified by clock ticks.
Definition: types.h:127
I2C slave device control.
Definition: i2c.h:290
rtems_recursive_mutex mutex
Mutex to protect the bus access.
Definition: i2c.h:143
i2c_dev * i2c_dev_alloc_and_init(size_t size, const char *bus_path, uint16_t address)
Allocates a device control from the heap and initializes it.
Definition: i2c-dev.c:271
ssize_t write(int fd, const void *buffer, size_t count)
Definition: write.c:30
int i2c_dev_init(i2c_dev *dev, const char *bus_path, uint16_t address)
Initializes a device control.
Definition: i2c-dev.c:266
uint16_t default_address
Default slave device address.
Definition: i2c.h:148
Argument type for I2C_RDWR IO control call.
Definition: i2c-dev.h:125
unsigned long functionality
Controller functionality.
Definition: i2c.h:173
void(* destroy)(i2c_bus *bus)
Destroys the bus.
Definition: i2c.h:138
I2C transfer message.
Definition: i2c.h:138
uint16_t address
The device address.
Definition: i2c.h:338
int(* transfer)(i2c_bus *bus, i2c_msg *msgs, uint32_t msg_count)
Transfers I2C messages.
Definition: i2c.h:120
unsigned long retries
Transfer retry count.
Definition: i2c.h:163
int i2c_bus_register(i2c_bus *bus, const char *bus_path)
Registers a bus control.
Definition: i2c-bus.c:235
rtems_interval timeout
Transaction timeout in ticks.
Definition: i2c.h:168
I2C bus control.
Definition: i2c.h:108
void i2c_bus_release(i2c_bus *bus)
Releases the bus.
Definition: i2c-bus.c:39
RTEMS Port of Linux I2C Device API.
int i2c_bus_init(i2c_bus *bus)
Initializes a bus control.
Definition: i2c-bus.c:300
void i2c_dev_destroy(i2c_dev *dev)
Destroys a device control.
Definition: i2c-dev.c:251
i2c_bus * bus
The bus control.
Definition: i2c.h:333
bool ten_bit_address
Use 10-bit addresses.
Definition: i2c.h:153
int i2c_dev_register(i2c_dev *dev, const char *dev_path)
Registers a device control.
Definition: i2c-dev.c:140
RTEMS Port of Linux I2C API.
int bus_fd
File descriptor of the bus.
Definition: i2c.h:346
int i2c_bus_transfer(i2c_bus *bus, i2c_msg *msgs, uint32_t msg_count)
Transfers I2C messages.
Definition: i2c-bus.c:44
unsigned size
Definition: tte.h:74
bool use_pec
Use SMBus PEC.
Definition: i2c.h:158
i2c_bus * i2c_bus_alloc_and_init(size_t size)
Allocates a bus control from the heap and initializes it.
Definition: i2c-bus.c:307
void i2c_dev_destroy_and_free(i2c_dev *dev)
Destroys a device control and frees its memory.
Definition: i2c-dev.c:260
void i2c_bus_destroy(i2c_bus *bus)
Destroys a bus control.
Definition: i2c-bus.c:289