RTEMS  5.0.0
Modules | Files | Data Structures | Macros | Functions

Modules

 EEPROM Driver
 Driver for EEPROM device.
 
 GPIO NXP PCA9535 Driver
 Driver for NXP PCA9535 16-bit GPIO device.
 
 Switch NXP PCA9535 Driver
 Driver for NXP PCA9548A 8-channel switch device.
 
 Temperature Sensor LM75A Driver
 Driver for NXP or Texas Instruments LM75A temperature sensor.
 

Files

file  i2c-dev.c
 Inter-Integrated Circuit (I2C) Bus Implementation.
 

Data Structures

struct  i2c_dev
 I2C slave device control. More...
 

Macros

#define I2C_DEV_IO_CONTROL   0x900
 Base number for device IO control commands.
 

Functions

int i2c_dev_init (i2c_dev *dev, const char *bus_path, uint16_t address)
 Initializes a device control. More...
 
i2c_devi2c_dev_alloc_and_init (size_t size, const char *bus_path, uint16_t address)
 Allocates a device control from the heap and initializes it. More...
 
void i2c_dev_destroy (i2c_dev *dev)
 Destroys a device control. More...
 
void i2c_dev_destroy_and_free (i2c_dev *dev)
 Destroys a device control and frees its memory. More...
 
int i2c_dev_register (i2c_dev *dev, const char *dev_path)
 Registers a device control. More...
 

Detailed Description

Function Documentation

◆ i2c_dev_alloc_and_init()

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.

After a sucessful allocation and initialization the device control must be destroyed via i2c_dev_destroy_and_free(). A registered device control will be automatically destroyed in case the device file is unlinked. Make sure to call i2c_dev_destroy_and_free() in a custom destruction handler.

Parameters
[in]sizeThe size of the device control. This enables the addition of device specific data to the base device control. The device control is zero initialized.
[in]bus_pathThe path to the bus device file.
[in]addressThe address of the device.
Return values
non-NULLThe new device control.
NULLAn error occurred. The errno is set to indicate the error.
See also
i2c_dev_register()

◆ i2c_dev_destroy()

void i2c_dev_destroy ( i2c_dev dev)

Destroys a device control.

Parameters
[in]devThe device control.

◆ i2c_dev_destroy_and_free()

void i2c_dev_destroy_and_free ( i2c_dev dev)

Destroys a device control and frees its memory.

Parameters
[in]devThe device control.

◆ i2c_dev_init()

int i2c_dev_init ( i2c_dev dev,
const char *  bus_path,
uint16_t  address 
)

Initializes a device control.

After a sucessful initialization the device control must be destroyed via i2c_dev_destroy(). A registered device control will be automatically destroyed in case the device file is unlinked. Make sure to call i2c_dev_destroy_and_free() in a custom destruction handler.

Parameters
[in]deviceThe device control.
[in]bus_pathThe path to the bus device file.
[in]addressThe address of the device.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.
See also
i2c_dev_register()

◆ i2c_dev_register()

int i2c_dev_register ( i2c_dev dev,
const char *  dev_path 
)

Registers a device control.

This function claims ownership of the device control regardless if the registration is successful or not.

Parameters
[in]devThe dev control.
[in]dev_pathThe path to the device file of the device.
Return values
0Successful operation.
-1An error occurred. The errno is set to indicate the error.