12#ifndef ZEPHYR_INCLUDE_DRIVERS_OTP_H_
13#define ZEPHYR_INCLUDE_DRIVERS_OTP_H_
43typedef int (*otp_api_read)(
const struct device *dev,
off_t offset,
void *
data,
size_t len);
49typedef int (*otp_api_program)(
const struct device *dev,
off_t offset,
const void *
data,
52__subsystem
struct otp_driver_api {
54#if defined(CONFIG_OTP_PROGRAM) || defined(__DOXYGEN__)
55 otp_api_program program;
73static inline int z_impl_otp_read(
const struct device *dev,
off_t offset,
void *data,
size_t len)
78#if defined(CONFIG_OTP_PROGRAM) || defined(__DOXYGEN__)
91static inline int z_impl_otp_program(
const struct device *dev,
off_t offset,
const void *data,
96 if (api->program ==
NULL) {
100 return api->program(dev, offset, data, len);
112#include <zephyr/syscalls/otp.h>
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1353
int otp_read(const struct device *dev, off_t offset, void *data, size_t len)
Read data from OTP memory.
int otp_program(const struct device *dev, off_t offset, const void *data, size_t len)
Program data to the given OTP memory.
#define ENOSYS
Function not implemented.
Definition errno.h:82
#define NULL
Definition iar_missing_defs.h:20
__INTPTR_TYPE__ off_t
Definition types.h:36
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