[drivers/spi_flash_sfud] accept the error from spi read or write in spi_write_read function.
This commit is contained in:
parent
0dc7da688f
commit
7e9d54d87a
|
@ -151,11 +151,11 @@ static sfud_err spi_write_read(const sfud_spi *spi, const uint8_t *write_buf, si
|
|||
if(rtt_dev->rt_spi_device->bus->mode & RT_SPI_BUS_MODE_QSPI) {
|
||||
qspi_dev = (struct rt_qspi_device *) (rtt_dev->rt_spi_device);
|
||||
if (write_size && read_size) {
|
||||
if (rt_qspi_send_then_recv(qspi_dev, write_buf, write_size, read_buf, read_size) == 0) {
|
||||
if (rt_qspi_send_then_recv(qspi_dev, write_buf, write_size, read_buf, read_size) <= 0) {
|
||||
result = SFUD_ERR_TIMEOUT;
|
||||
}
|
||||
} else if (write_size) {
|
||||
if (rt_qspi_send(qspi_dev, write_buf, write_size) == 0) {
|
||||
if (rt_qspi_send(qspi_dev, write_buf, write_size) <= 0) {
|
||||
result = SFUD_ERR_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
@ -168,11 +168,11 @@ static sfud_err spi_write_read(const sfud_spi *spi, const uint8_t *write_buf, si
|
|||
result = SFUD_ERR_TIMEOUT;
|
||||
}
|
||||
} else if (write_size) {
|
||||
if (rt_spi_send(rtt_dev->rt_spi_device, write_buf, write_size) == 0) {
|
||||
if (rt_spi_send(rtt_dev->rt_spi_device, write_buf, write_size) <= 0) {
|
||||
result = SFUD_ERR_TIMEOUT;
|
||||
}
|
||||
} else {
|
||||
if (rt_spi_recv(rtt_dev->rt_spi_device, read_buf, read_size) == 0) {
|
||||
if (rt_spi_recv(rtt_dev->rt_spi_device, read_buf, read_size) <= 0) {
|
||||
result = SFUD_ERR_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
@ -729,6 +729,7 @@ static void sf(uint8_t argc, char **argv) {
|
|||
for (i = 0; i < size; i += write_size) {
|
||||
result = sfud_write(sfud_dev, addr + i, write_size, write_data);
|
||||
if (result != SFUD_SUCCESS) {
|
||||
rt_kprintf("Writing %s failed, already wr for %lu bytes, write %d each time\n", sfud_dev->name, i, write_size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -756,6 +757,7 @@ static void sf(uint8_t argc, char **argv) {
|
|||
}
|
||||
|
||||
if (result != SFUD_SUCCESS) {
|
||||
rt_kprintf("Read %s failed, already rd for %lu bytes, read %d each time\n", sfud_dev->name, i, read_size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue