Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
eeprom.h
Go to the documentation of this file.
1
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#include <stddef.h>
16#include <sys/types.h>
17
26
33typedef void (*eeprom_target_changed_handler_t)(const struct device *dev, void *user_data);
34
44 void *user_data);
45
53size_t eeprom_target_get_size(const struct device *dev);
54
65int eeprom_target_read_data(const struct device *dev, off_t offset,
66 void *data, size_t len);
67
78int eeprom_target_write_data(const struct device *dev, off_t offset,
79 const void *data, size_t len);
80
93static inline __deprecated int eeprom_target_program(const struct device *dev,
94 const uint8_t *eeprom_data,
95 unsigned int length)
96{
97 return eeprom_target_write_data(dev, 0, eeprom_data, length);
98}
99
110static inline int eeprom_target_read(const struct device *dev, uint8_t *eeprom_data,
111 unsigned int offset)
112{
113 return eeprom_target_read_data(dev, offset, eeprom_data, 1);
114}
115
127int eeprom_target_set_addr(const struct device *dev, uint8_t addr);
128
132
133#endif /* ZEPHYR_INCLUDE_DRIVERS_I2C_TARGET_EEPROM_H_ */
int eeprom_target_read_data(const struct device *dev, off_t offset, void *data, size_t len)
Read data from the virtual EEPROM.
size_t eeprom_target_get_size(const struct device *dev)
Get size of the virtual EEPROM.
static int eeprom_target_read(const struct device *dev, uint8_t *eeprom_data, unsigned int offset)
Read single byte of virtual EEPROM memory.
Definition eeprom.h:110
void(* eeprom_target_changed_handler_t)(const struct device *dev, void *user_data)
Define the application callback handler function signature.
Definition eeprom.h:33
int eeprom_target_set_addr(const struct device *dev, uint8_t addr)
Change the address of eeprom target at runtime.
static int eeprom_target_program(const struct device *dev, const uint8_t *eeprom_data, unsigned int length)
Program memory of the virtual EEPROM.
Definition eeprom.h:93
void eeprom_target_set_changed_callback(const struct device *dev, eeprom_target_changed_handler_t handler, void *user_data)
Set the EEPROM changed callback handler.
int eeprom_target_write_data(const struct device *dev, off_t offset, const void *data, size_t len)
Write data to the virtual EEPROM.
__INTPTR_TYPE__ off_t
Definition types.h:36
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
void * data
Address of the device instance private data.
Definition device.h:523