pub unsafe extern "C" fn flash_copy(
src_dev: *const device,
src_offset: i32,
dst_dev: *const device,
dst_offset: i32,
size: i32,
buf: *mut u8,
buf_size: usize,
) -> i32
Expand description
@brief Copy flash memory from one device to another.
Copy a region of flash memory from one place to another. The source and destination flash devices may be the same or different devices. However, this function will fail if the source and destination devices are the same if memory regions overlap and are not identical.
The caller must supply a buffer of suitable size and ensure that the destination is erased beforehand, if necessary.
@note If the source and destination devices are the same, and the source and destination offsets are also the same, this function succeeds without performing any copy operation.
@param src_dev Source flash device. @param dst_dev Destination flash device. @param src_offset Offset within the source flash device. @param dst_offset Offset within the destination flash device. @param size Size of the region to copy, in bytes. @param[out] buf Pointer to a buffer of size @a buf_size. @param buf_size Size of the buffer pointed to by @a buf.
@retval 0 on success @retval -EINVAL if an argument is invalid. @retval -EIO if an I/O error occurs. @retval -ENODEV if either @a src_dev or @a dst_dev are not ready.