zephyr::raw

Function flash_erase

Source
pub unsafe extern "C" fn flash_erase(
    dev: *const device,
    offset: i32,
    size: usize,
) -> i32
Expand description

@brief Erase part or all of a flash memory

Acceptable values of erase size and offset are subject to hardware-specific multiples of page size and offset. Please check the API implemented by the underlying sub driver, for example by using flash_get_page_info_by_offs() if that is supported by your flash driver.

Any necessary erase protection management is performed by the driver erase implementation itself.

The function should be used only for devices that are really explicit erase devices; in case when code relies on erasing device, i.e. setting it to erase-value, prior to some operations, but should work with explicit erase and RAM non-volatile devices, then flash_flatten should rather be used.

@param dev : flash device @param offset : erase area starting offset @param size : size of area to be erased

@return 0 on success, negative errno code on fail.

@see flash_flatten() @see flash_get_page_info_by_offs() @see flash_get_page_info_by_idx()