kopia lustrzana https://github.com/espressif/esp-idf
spi_flash: remove unnecessary src pointer alignment check in spi_flash_write
ROM SPIWrite routine can work with unaligned sources, so this check is unnecessary. Furthermore, it breaks nvs_set_str and nvs_get_blob when data pointer is unaligned. Also fix stray backslash in COUNTER_STOP macropull/42/merge
rodzic
d7b4197ade
commit
2119b98469
|
@ -39,7 +39,7 @@ static spi_flash_counters_t s_flash_stats;
|
|||
#define COUNTER_STOP(counter) \
|
||||
do{ \
|
||||
s_flash_stats.counter.count++; \
|
||||
s_flash_stats.counter.time += (xthal_get_ccount() - ts_begin) / (XT_CLOCK_FREQ / 1000000); \\
|
||||
s_flash_stats.counter.time += (xthal_get_ccount() - ts_begin) / (XT_CLOCK_FREQ / 1000000); \
|
||||
} while(0)
|
||||
|
||||
#define COUNTER_ADD_BYTES(counter, size) \
|
||||
|
@ -126,10 +126,6 @@ esp_err_t IRAM_ATTR spi_flash_erase_range(uint32_t start_addr, uint32_t size)
|
|||
|
||||
esp_err_t IRAM_ATTR spi_flash_write(size_t dest_addr, const void *src, size_t size)
|
||||
{
|
||||
// TODO: replace this check with code which deals with unaligned sources
|
||||
if (((ptrdiff_t) src) % 4 != 0) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
// Destination alignment is also checked in ROM code, but we can give
|
||||
// better error code here
|
||||
// TODO: add handling of unaligned destinations
|
||||
|
|
|
@ -74,7 +74,7 @@ esp_err_t spi_flash_erase_range(size_t start_addr, size_t size);
|
|||
/**
|
||||
* @brief Write data to Flash.
|
||||
*
|
||||
* @note Both des_addr and src_addr have to be 4-byte aligned.
|
||||
* @note Address in flash, dest, has to be 4-byte aligned.
|
||||
* This is a temporary limitation which will be removed.
|
||||
*
|
||||
* @param dest destination address in Flash
|
||||
|
@ -88,7 +88,7 @@ esp_err_t spi_flash_write(size_t dest, const void *src, size_t size);
|
|||
/**
|
||||
* @brief Read data from Flash.
|
||||
*
|
||||
* @note Both des_addr and src_addr have to be 4-byte aligned.
|
||||
* @note Both src and dest have to be 4-byte aligned.
|
||||
* This is a temporary limitation which will be removed.
|
||||
*
|
||||
* @param src source address of the data in Flash.
|
||||
|
|
Ładowanie…
Reference in New Issue