Function riot_sys::mtd_write_page

source ·
pub unsafe extern "C" fn mtd_write_page(
    mtd: *mut mtd_dev_t,
    src: *const c_void,
    page: u32,
    offset: u32,
    size: u32
) -> c_int
Expand description

@brief Write data to a MTD device with pagewise addressing

The MTD layer will take care of splitting up the transaction into multiple writes if it is required by the underlying storage media.

If the underlying sector needs to be erased before it can be written, the MTD layer will take care of the read-modify-write operation.

@p offset must be smaller than the page size

@note this requires the mtd_write_page module

@param mtd the device to write to @param[in] src the buffer to write @param[in] page Page number to start writing to @param[in] offset byte offset from the start of the page @param[in] size the number of bytes to write

@retval n number of bytes written on success @retval <0 value on error @retval -ENODEV if @p mtd is not a valid device @retval -ENOTSUP if operation is not supported on @p mtd @retval -EOVERFLOW if @p addr or @p count are not valid, i.e. outside memory, @retval -EIO if I/O error occurred @retval -EINVAL if parameters are invalid