Zephyr API Documentation 4.3.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
34typedef void (*eeprom_target_changed_handler_t)(const struct device *dev, void *user_data);
35
45 void *user_data);
46
54size_t eeprom_target_get_size(const struct device *dev);
55
66int eeprom_target_read_data(const struct device *dev, off_t offset,
67 void *data, size_t len);
68
79int eeprom_target_write_data(const struct device *dev, off_t offset,
80 const void *data, size_t len);
81
94static inline __deprecated int eeprom_target_program(const struct device *dev,
95 const uint8_t *eeprom_data,
96 unsigned int length)
97{
98 return eeprom_target_write_data(dev, 0, eeprom_data, length);
99}
100
111static inline int eeprom_target_read(const struct device *dev, uint8_t *eeprom_data,
112 unsigned int offset)
113{
114 return eeprom_target_read_data(dev, offset, eeprom_data, 1);
115}
116
128int eeprom_target_set_addr(const struct device *dev, uint8_t addr);
129
133
134#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:111
void(* eeprom_target_changed_handler_t)(const struct device *dev, void *user_data)
Define the application callback handler function signature.
Definition eeprom.h:34
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:94
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