RTEMS
5.0.0
|
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_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. 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... | |
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.
[in] | size | The 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_path | The path to the bus device file. |
[in] | address | The address of the device. |
non-NULL | The new device control. |
NULL | An error occurred. The errno is set to indicate the error. |
void i2c_dev_destroy | ( | i2c_dev * | dev | ) |
Destroys a device control.
[in] | dev | The device control. |
void i2c_dev_destroy_and_free | ( | i2c_dev * | dev | ) |
Destroys a device control and frees its memory.
[in] | dev | The device control. |
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.
[in] | device | The device control. |
[in] | bus_path | The path to the bus device file. |
[in] | address | The address of the device. |
0 | Successful operation. |
-1 | An error occurred. The errno is set to indicate the error. |
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.
[in] | dev | The dev control. |
[in] | dev_path | The path to the device file of the device. |
0 | Successful operation. |
-1 | An error occurred. The errno is set to indicate the error. |