mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(sdmmc_io): fixed fixed_addr mode will still increase addr when splitting
This commit is contained in:
parent
b1c8757b9f
commit
fded5b0ce3
@ -381,11 +381,15 @@ esp_err_t sdmmc_io_rw_extended(sdmmc_card_t* card, int func,
|
||||
esp_err_t sdmmc_io_read_bytes(sdmmc_card_t* card, uint32_t function,
|
||||
uint32_t addr, void* dst, size_t size)
|
||||
{
|
||||
uint32_t arg = SD_ARG_CMD53_READ | SD_ARG_CMD53_INCREMENT;
|
||||
//Extract and unset the bit used to indicate the OP Code (inverted logic)
|
||||
uint32_t arg = SD_ARG_CMD53_READ;
|
||||
bool incr_addr = true;
|
||||
//Extract and unset the bit used to indicate the OP Code
|
||||
if (addr & SDMMC_IO_FIXED_ADDR) {
|
||||
arg &= ~SD_ARG_CMD53_INCREMENT;
|
||||
addr &= ~SDMMC_IO_FIXED_ADDR;
|
||||
incr_addr = false;
|
||||
}
|
||||
if (incr_addr) {
|
||||
arg |= SD_ARG_CMD53_INCREMENT;
|
||||
}
|
||||
|
||||
/* host quirk: SDIO transfer with length not divisible by 4 bytes
|
||||
@ -405,7 +409,9 @@ esp_err_t sdmmc_io_read_bytes(sdmmc_card_t* card, uint32_t function,
|
||||
}
|
||||
pc_dst += will_transfer;
|
||||
size -= will_transfer;
|
||||
addr += will_transfer;
|
||||
if (incr_addr) {
|
||||
addr += will_transfer;
|
||||
}
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
@ -413,11 +419,15 @@ esp_err_t sdmmc_io_read_bytes(sdmmc_card_t* card, uint32_t function,
|
||||
esp_err_t sdmmc_io_write_bytes(sdmmc_card_t* card, uint32_t function,
|
||||
uint32_t addr, const void* src, size_t size)
|
||||
{
|
||||
uint32_t arg = SD_ARG_CMD53_WRITE | SD_ARG_CMD53_INCREMENT;
|
||||
//Extract and unset the bit used to indicate the OP Code (inverted logic)
|
||||
uint32_t arg = SD_ARG_CMD53_WRITE;
|
||||
bool incr_addr = true;
|
||||
//Extract and unset the bit used to indicate the OP Code
|
||||
if (addr & SDMMC_IO_FIXED_ADDR) {
|
||||
arg &= ~SD_ARG_CMD53_INCREMENT;
|
||||
addr &= ~SDMMC_IO_FIXED_ADDR;
|
||||
incr_addr = false;
|
||||
}
|
||||
if (incr_addr) {
|
||||
arg |= SD_ARG_CMD53_INCREMENT;
|
||||
}
|
||||
|
||||
/* same host quirk as in sdmmc_io_read_bytes */
|
||||
@ -434,7 +444,9 @@ esp_err_t sdmmc_io_write_bytes(sdmmc_card_t* card, uint32_t function,
|
||||
}
|
||||
pc_src += will_transfer;
|
||||
size -= will_transfer;
|
||||
addr += will_transfer;
|
||||
if (incr_addr) {
|
||||
addr += will_transfer;
|
||||
}
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user