1 /** 2 * @file 3 * 4 * @brief Public APIs for the I2C EEPROM Target driver. 5 */ 6 7 /* 8 * Copyright (c) 2017 BayLibre, SAS 9 * 10 * SPDX-License-Identifier: Apache-2.0 11 */ 12 #ifndef ZEPHYR_INCLUDE_DRIVERS_I2C_TARGET_EEPROM_H_ 13 #define ZEPHYR_INCLUDE_DRIVERS_I2C_TARGET_EEPROM_H_ 14 15 /** 16 * @brief I2C EEPROM Target Driver API 17 * @defgroup i2c_eeprom_target_api I2C EEPROM Target Driver API 18 * @ingroup io_interfaces 19 * @{ 20 */ 21 22 /** 23 * @brief Program memory of the virtual EEPROM 24 * 25 * @param dev Pointer to the device structure for the driver instance. 26 * @param eeprom_data Pointer of data to program into the virtual eeprom memory 27 * @param length Length of data to program into the virtual eeprom memory 28 * 29 * @retval 0 If successful. 30 * @retval -EINVAL Invalid data size 31 */ 32 int eeprom_target_program(const struct device *dev, const uint8_t *eeprom_data, 33 unsigned int length); 34 35 /** 36 * @brief Read single byte of virtual EEPROM memory 37 * 38 * @param dev Pointer to the device structure for the driver instance. 39 * @param eeprom_data Pointer of byte where to store the virtual eeprom memory 40 * @param offset Offset into EEPROM memory where to read the byte 41 * 42 * @retval 0 If successful. 43 * @retval -EINVAL Invalid data pointer or offset 44 */ 45 int eeprom_target_read(const struct device *dev, uint8_t *eeprom_data, 46 unsigned int offset); 47 48 /** 49 * @brief Change the address of eeprom taget at runtime 50 * 51 * @param dev Pointer to the device structure for the driver instance. 52 * @param addr New address to assign to the eeprom target devide 53 * 54 * @retval 0 Is successful 55 * @retval -EINVAL If parameters are invalid 56 * @retval -EIO General input / output error during i2c_taget_register 57 * @retval -ENOSYS If target mode is not implemented 58 */ 59 int eeprom_target_set_addr(const struct device *dev, uint8_t addr); 60 61 /** 62 * @} 63 */ 64 65 #endif /* ZEPHYR_INCLUDE_DRIVERS_I2C_TARGET_EEPROM_H_ */ 66