Merge branch 'docs/rename_partition_addr_param_pr3750' into 'master'
esp_partition_erase_range(): rename parameter "start_addr" to "offset" See merge request espressif/esp-idf!5469
This commit is contained in:
commit
ce9600ec81
2 changed files with 9 additions and 10 deletions
|
@ -249,8 +249,8 @@ esp_err_t esp_partition_write(const esp_partition_t* partition,
|
||||||
* @param partition Pointer to partition structure obtained using
|
* @param partition Pointer to partition structure obtained using
|
||||||
* esp_partition_find_first or esp_partition_get.
|
* esp_partition_find_first or esp_partition_get.
|
||||||
* Must be non-NULL.
|
* Must be non-NULL.
|
||||||
* @param start_addr Address where erase operation should start. Must be aligned
|
* @param offset Offset from the beginning of partition where erase operation
|
||||||
* to 4 kilobytes.
|
* should start. Must be aligned to 4 kilobytes.
|
||||||
* @param size Size of the range which should be erased, in bytes.
|
* @param size Size of the range which should be erased, in bytes.
|
||||||
* Must be divisible by 4 kilobytes.
|
* Must be divisible by 4 kilobytes.
|
||||||
*
|
*
|
||||||
|
@ -260,7 +260,7 @@ esp_err_t esp_partition_write(const esp_partition_t* partition,
|
||||||
* or one of error codes from lower-level flash driver.
|
* or one of error codes from lower-level flash driver.
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_partition_erase_range(const esp_partition_t* partition,
|
esp_err_t esp_partition_erase_range(const esp_partition_t* partition,
|
||||||
size_t start_addr, size_t size);
|
size_t offset, size_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configure MMU to map partition into data memory
|
* @brief Configure MMU to map partition into data memory
|
||||||
|
|
|
@ -387,27 +387,26 @@ esp_err_t esp_partition_write(const esp_partition_t* partition,
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t esp_partition_erase_range(const esp_partition_t* partition,
|
esp_err_t esp_partition_erase_range(const esp_partition_t* partition,
|
||||||
size_t start_addr, size_t size)
|
size_t offset, size_t size)
|
||||||
{
|
{
|
||||||
assert(partition != NULL);
|
assert(partition != NULL);
|
||||||
if (start_addr > partition->size) {
|
if (offset > partition->size) {
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
if (start_addr + size > partition->size) {
|
if (offset + size > partition->size) {
|
||||||
return ESP_ERR_INVALID_SIZE;
|
return ESP_ERR_INVALID_SIZE;
|
||||||
}
|
}
|
||||||
if (size % SPI_FLASH_SEC_SIZE != 0) {
|
if (size % SPI_FLASH_SEC_SIZE != 0) {
|
||||||
return ESP_ERR_INVALID_SIZE;
|
return ESP_ERR_INVALID_SIZE;
|
||||||
}
|
}
|
||||||
if (start_addr % SPI_FLASH_SEC_SIZE != 0) {
|
if (offset % SPI_FLASH_SEC_SIZE != 0) {
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
#ifndef CONFIG_SPI_FLASH_USE_LEGACY_IMPL
|
#ifndef CONFIG_SPI_FLASH_USE_LEGACY_IMPL
|
||||||
return esp_flash_erase_region(partition->flash_chip, partition->address + start_addr, size);
|
return esp_flash_erase_region(partition->flash_chip, partition->address + offset, size);
|
||||||
#else
|
#else
|
||||||
return spi_flash_erase_range(partition->address + start_addr, size);
|
return spi_flash_erase_range(partition->address + offset, size);
|
||||||
#endif // CONFIG_SPI_FLASH_USE_LEGACY_IMPL
|
#endif // CONFIG_SPI_FLASH_USE_LEGACY_IMPL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue