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  * @since 1.13
19  * @version 1.0.0
20  * @ingroup io_interfaces
21  * @{
22  */
23 
24 /**
25  * @brief Program memory of the virtual EEPROM
26  *
27  * @param dev Pointer to the device structure for the driver instance.
28  * @param eeprom_data Pointer of data to program into the virtual eeprom memory
29  * @param length Length of data to program into the virtual eeprom memory
30  *
31  * @retval 0 If successful.
32  * @retval -EINVAL Invalid data size
33  */
34 int eeprom_target_program(const struct device *dev, const uint8_t *eeprom_data,
35 			 unsigned int length);
36 
37 /**
38  * @brief Read single byte of virtual EEPROM memory
39  *
40  * @param dev Pointer to the device structure for the driver instance.
41  * @param eeprom_data Pointer of byte where to store the virtual eeprom memory
42  * @param offset Offset into EEPROM memory where to read the byte
43  *
44  * @retval 0 If successful.
45  * @retval -EINVAL Invalid data pointer or offset
46  */
47 int eeprom_target_read(const struct device *dev, uint8_t *eeprom_data,
48 		      unsigned int offset);
49 
50 /**
51  * @brief Change the address of eeprom target at runtime
52  *
53  * @param dev Pointer to the device structure for the driver instance.
54  * @param addr New address to assign to the eeprom target device
55  *
56  * @retval 0 Is successful
57  * @retval -EINVAL If parameters are invalid
58  * @retval -EIO General input / output error during i2c_taget_register
59  * @retval -ENOSYS If target mode is not implemented
60  */
61 int eeprom_target_set_addr(const struct device *dev, uint8_t addr);
62 
63 /**
64  * @}
65  */
66 
67 #endif /* ZEPHYR_INCLUDE_DRIVERS_I2C_TARGET_EEPROM_H_ */
68