Lines Matching +full:retained +full:- +full:ram
4 * SPDX-License-Identifier: Apache-2.0
9 * @brief Public API for retained memory drivers
31 * @brief Retained memory driver interface
32 * @defgroup retained_mem_interface Retained memory driver interface
41 * @brief Callback API to get size of retained memory area.
48 * @brief Callback API to read from retained memory area.
56 * @brief Callback API to write to retained memory area.
64 * @brief Callback API to clear retained memory area (reset all data to 0x00).
70 * @brief Retained memory driver API
71 * API which can be used by a device to store data in a retained memory area. Retained memory is
72 * memory that is retained while the device is powered but is lost when power to the device is
74 * non-initialised RAM region, or in specific registers, but is not reset when a different
76 * byte-level reading and writing without a need to erase data before writing.
88 * @brief Returns the size of the retained memory area.
90 * @param dev Retained memory device to use.
99 struct retained_mem_driver_api *api = (struct retained_mem_driver_api *)dev->api; in z_impl_retained_mem_size()
101 return api->size(dev); in z_impl_retained_mem_size()
105 * @brief Reads data from the Retained memory area.
107 * @param dev Retained memory device to use.
120 struct retained_mem_driver_api *api = (struct retained_mem_driver_api *)dev->api; in z_impl_retained_mem_read()
123 /* Validate user-supplied parameters */ in z_impl_retained_mem_read()
128 area_size = api->size(dev); in z_impl_retained_mem_read()
130 if (offset < 0 || size > area_size || (area_size - size) < (size_t)offset) { in z_impl_retained_mem_read()
131 return -EINVAL; in z_impl_retained_mem_read()
134 return api->read(dev, offset, buffer, size); in z_impl_retained_mem_read()
138 * @brief Writes data to the Retained memory area - underlying data does not need to
141 * @param dev Retained memory device to use.
154 struct retained_mem_driver_api *api = (struct retained_mem_driver_api *)dev->api; in z_impl_retained_mem_write()
157 /* Validate user-supplied parameters */ in z_impl_retained_mem_write()
162 area_size = api->size(dev); in z_impl_retained_mem_write()
164 if (offset < 0 || size > area_size || (area_size - size) < (size_t)offset) { in z_impl_retained_mem_write()
165 return -EINVAL; in z_impl_retained_mem_write()
168 return api->write(dev, offset, buffer, size); in z_impl_retained_mem_write()
172 * @brief Clears data in the retained memory area by setting it to 0x00.
174 * @param dev Retained memory device to use.
182 struct retained_mem_driver_api *api = (struct retained_mem_driver_api *)dev->api; in z_impl_retained_mem_clear()
184 return api->clear(dev); in z_impl_retained_mem_clear()