mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
refactor(esp_common): centralize ALIGN_UP/ALIGN_DOWN into esp_macros.h
Remove ~50 duplicate local definitions of ALIGN_UP/ALIGN_DOWN/ALIGN_UP_BY/ ALIGN_DOWN_BY across the codebase and replace them with canonical ESP_ALIGN_UP/ESP_ALIGN_DOWN from esp_macros.h.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "esp_log.h"
|
||||
#include "esp_rom_md5.h"
|
||||
#include "bootloader_util.h"
|
||||
#include "esp_macros.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
|
||||
#if CONFIG_IDF_TARGET_LINUX
|
||||
@@ -50,8 +51,6 @@
|
||||
#define INVARIANTS
|
||||
#endif
|
||||
|
||||
#define ALIGN_UP(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
|
||||
|
||||
typedef struct partition_list_item_ {
|
||||
esp_partition_t info;
|
||||
bool user_registered;
|
||||
@@ -592,7 +591,7 @@ esp_err_t esp_partition_copy(const esp_partition_t* dest_part, uint32_t dest_off
|
||||
return ESP_ERR_INVALID_SIZE;
|
||||
}
|
||||
|
||||
esp_err_t error = esp_partition_erase_range(dest_part, dest_offset, ALIGN_UP(dest_erase_size, SPI_FLASH_SEC_SIZE));
|
||||
esp_err_t error = esp_partition_erase_range(dest_part, dest_offset, ESP_ALIGN_UP(dest_erase_size, SPI_FLASH_SEC_SIZE));
|
||||
if (error) {
|
||||
ESP_LOGE(TAG, "Erasing destination partition range failed (err=0x%x)", error);
|
||||
return error;
|
||||
|
||||
Reference in New Issue
Block a user