@@ -52,8 +52,8 @@ struct bm_storage_evt {
5252 /* Specifies if the operation was performed synchronously or asynchronously. */
5353 enum bm_storage_evt_dispatch_type dispatch_type ;
5454 /* Result of the operation.
55- * NRF_SUCCESS on success.
56- * A positive NRF error otherwise.
55+ * 0 on success.
56+ * A negative errno otherwise.
5757 */
5858 uint32_t result ;
5959 /* Destination address where the operation was performed. */
@@ -143,12 +143,12 @@ struct bm_storage {
143143 *
144144 * @param[in] storage Storage instance to initialize.
145145 *
146- * @retval NRF_SUCCESS on success.
147- * @retval NRF_ERROR_NULL If @p storage is @c NULL.
148- * @retval NRF_ERROR_BUSY If the implementation-specific resource is busy.
149- * @retval NRF_ERROR_INTERNAL If an implementation-specific internal error occurred.
146+ * @retval 0 on success.
147+ * @retval -EFAULT If @p storage is @c NULL.
148+ * @retval -EBUSY If the implementation-specific resource is busy.
149+ * @retval -EIO If an implementation-specific internal error occurred.
150150 */
151- uint32_t bm_storage_init (struct bm_storage * storage );
151+ int bm_storage_init (struct bm_storage * storage );
152152
153153/**
154154 * @brief Uninitialize a storage instance.
@@ -158,13 +158,13 @@ uint32_t bm_storage_init(struct bm_storage *storage);
158158 *
159159 * @param[in] storage Storage instance to uninitialize.
160160 *
161- * @retval NRF_SUCCESS on success.
162- * @retval NRF_ERROR_NULL If @p storage is @c NULL.
163- * @retval NRF_ERROR_INVALID_STATE If @p storage is in an invalid state.
164- * @retval NRF_ERROR_BUSY If the implementation-specific backend is busy with an ongoing operation.
165- * @retval NRF_ERROR_NOT_SUPPORTED If the backend does not support uninitialization.
161+ * @retval 0 on success.
162+ * @retval -EFAULT If @p storage is @c NULL.
163+ * @retval -EPERM If @p storage is in an invalid state.
164+ * @retval -EBUSY If the implementation-specific backend is busy with an ongoing operation.
165+ * @retval -ENOTSUP If the backend does not support uninitialization.
166166 */
167- uint32_t bm_storage_uninit (struct bm_storage * storage );
167+ int bm_storage_uninit (struct bm_storage * storage );
168168
169169/**
170170 * @brief Read data from a storage instance.
@@ -174,16 +174,14 @@ uint32_t bm_storage_uninit(struct bm_storage *storage);
174174 * @param[out] dest Destination where the data will be copied to.
175175 * @param[in] len Length of the data to copy (in bytes).
176176 *
177- * @retval NRF_SUCCESS on success.
178- * @retval NRF_ERROR_NULL If @p storage is @c NULL.
179- * @retval NRF_ERROR_INVALID_STATE If @p storage is in an invalid state.
180- * @retval NRF_ERROR_INVALID_LENGTH If @p len is zero or not a multiple of
181- * @ref bm_storage_info.program_unit.
182- * @retval NRF_ERROR_INVALID_ADDR If @p dest or @p src are not 32-bit word aligned, or if they are
183- * outside the bounds of the memory region configured in @p storage.
184- * @retval NRF_ERROR_FORBIDDEN If the implementation-specific backend has not been initialized.
177+ * @retval 0 on success.
178+ * @retval -EFAULT If @p storage is @c NULL or if @p dest or @p src are not 32-bit word aligned,
179+ * or if they are outside the bounds of the memory region configured in @p storage.
180+ * @retval -EPERM If @p storage is in an invalid state or if the implementation-specific backend
181+ * has not been initialized.
182+ * @retval -EINVAL If @p len is zero or not a multiple of @ref bm_storage_info.program_unit.
185183 */
186- uint32_t bm_storage_read (const struct bm_storage * storage , uint32_t src , void * dest , uint32_t len );
184+ int bm_storage_read (const struct bm_storage * storage , uint32_t src , void * dest , uint32_t len );
187185
188186/**
189187 * @brief Write data to a storage instance.
@@ -195,19 +193,17 @@ uint32_t bm_storage_read(const struct bm_storage *storage, uint32_t src, void *d
195193 * @param[in] ctx Pointer to user data, passed to the implementation-specific API function call.
196194 * Can be NULL.
197195 *
198- * @retval NRF_SUCCESS on success.
199- * @retval NRF_ERROR_NULL If @p storage is @c NULL.
200- * @retval NRF_ERROR_INVALID_STATE If @p storage is in an invalid state.
201- * @retval NRF_ERROR_INVALID_LENGTH If @p len is zero or not a multiple of
202- * @ref bm_storage_info.program_unit.
203- * @retval NRF_ERROR_INVALID_ADDR If @p dest or @p src are not 32-bit word aligned, or if they are
204- * outside the bounds of the memory region configured in @p storage.
205- * @retval NRF_ERROR_FORBIDDEN If the implementation-specific backend has not been initialized.
206- * @retval NRF_ERROR_BUSY If the implementation-specific backend is busy with an ongoing operation.
207- * @retval NRF_ERROR_INTERNAL If an implementation-specific internal error occurred.
196+ * @retval 0 on success.
197+ * @retval -EFAULT If @p storage is @c NULL or if @p dest or @p src are not 32-bit word aligned,
198+ * or if they are outside the bounds of the memory region configured in @p storage.
199+ * @retval -EPERM If @p storage is in an invalid state or if the implementation-specific backend
200+ * has not been initialized.
201+ * @retval -EINVAL If @p len is zero or not a multiple of @ref bm_storage_info.program_unit.
202+ * @retval -EBUSY If the implementation-specific backend is busy with an ongoing operation.
203+ * @retval -EIO If an implementation-specific internal error occurred.
208204 */
209- uint32_t bm_storage_write (const struct bm_storage * storage , uint32_t dest , const void * src ,
210- uint32_t len , void * ctx );
205+ int bm_storage_write (const struct bm_storage * storage , uint32_t dest , const void * src ,
206+ uint32_t len , void * ctx );
211207
212208/**
213209 * @brief Erase data in a storage instance.
@@ -216,19 +212,16 @@ uint32_t bm_storage_write(const struct bm_storage *storage, uint32_t dest, const
216212 * @param[in] ctx Pointer to user data, passed to the implementation-specific API function call.
217213 * Can be NULL.
218214 *
219- * @retval NRF_SUCCESS on success.
220- * @retval NRF_ERROR_NULL If @p storage is @c NULL.
221- * @retval NRF_ERROR_INVALID_STATE If @p storage is in an invalid state.
222- * @retval NRF_ERROR_INVALID_LENGTH If @p len is zero or not a multiple of
223- * @ref bm_storage_info.erase_unit.
224- * @retval NRF_ERROR_INVALID_ADDR If @p addr is outside the bounds of the memory region configured
225- * in @p storage.
226- * @retval NRF_ERROR_FORBIDDEN If the implementation-specific backend has not been initialized.
227- * @retval NRF_ERROR_BUSY If the implementation-specific backend is busy with an ongoing operation.
228- * @retval NRF_ERROR_NOT_SUPPORTED If the implementation-specific backend does not implement this
229- * function.
215+ * @retval 0 on success.
216+ * @retval -EFAULT If @p storage is @c NULL or if @p addr is outside the bounds of the memory region
217+ * configured in @p storage.
218+ * @retval -EPERM If @p storage is in an invalid state or if the implementation-specific backend
219+ * has not been initialized.
220+ * @retval -EINVAL If @p len is zero or not a multiple of @ref bm_storage_info.erase_unit.
221+ * @retval -EBUSY If the implementation-specific backend is busy with an ongoing operation.
222+ * @retval -ENOTSUP If the implementation-specific backend does not implement this function.
230223 */
231- uint32_t bm_storage_erase (const struct bm_storage * storage , uint32_t addr , uint32_t len , void * ctx );
224+ int bm_storage_erase (const struct bm_storage * storage , uint32_t addr , uint32_t len , void * ctx );
232225
233226/**
234227 * @brief Query the status of a storage instance.
0 commit comments