From fe457da9586e96ab277ef8b6e6ddcb21e8bb8bfe Mon Sep 17 00:00:00 2001 From: FlyLu Date: Thu, 15 Jun 2017 16:05:34 +0800 Subject: [PATCH] [DeviceDrivers]Fix continuous write page bug for spi_flash_at45dbxx driver --- components/drivers/spi/spi_flash_at45dbxx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/drivers/spi/spi_flash_at45dbxx.c b/components/drivers/spi/spi_flash_at45dbxx.c index 0585e395ca..f9a15b27dd 100644 --- a/components/drivers/spi/spi_flash_at45dbxx.c +++ b/components/drivers/spi/spi_flash_at45dbxx.c @@ -140,12 +140,12 @@ static rt_size_t AT45DB_flash_read_page_256(rt_device_t dev, rt_off_t pos, void* { uint32_t index, nr; uint8_t * read_buffer = buffer; + uint32_t page = pos; nr = size; for (index = 0; index < nr; index++) { - uint32_t page = pos; uint8_t send_buffer[8]; uint32_t i; @@ -170,12 +170,12 @@ static rt_size_t AT45DB_flash_read_page_512(rt_device_t dev, rt_off_t pos, void* { uint32_t index, nr; uint8_t * read_buffer = buffer; + uint32_t page = pos; nr = size; for (index = 0; index < nr; index++) { - uint32_t page = pos; uint8_t send_buffer[8]; uint32_t i; @@ -200,12 +200,12 @@ static rt_size_t AT45DB_flash_read_page_1024(rt_device_t dev, rt_off_t pos, void { uint32_t index, nr; uint8_t * read_buffer = buffer; + uint32_t page = pos; nr = size; for (index = 0; index < nr; index++) { - uint32_t page = pos; uint8_t send_buffer[8]; uint32_t i; @@ -230,12 +230,12 @@ static rt_size_t AT45DB_flash_write_page_256(rt_device_t dev, rt_off_t pos, cons { rt_uint32_t index, nr; const uint8_t * write_buffer = buffer; + uint32_t page = pos; nr = size; for (index = 0; index < nr; index++) { - uint32_t page = pos; uint8_t send_buffer[4]; send_buffer[0] = AT45DB_MM_PAGE_PROG_THRU_BUFFER1; @@ -258,12 +258,12 @@ static rt_size_t AT45DB_flash_write_page_512(rt_device_t dev, rt_off_t pos, cons { rt_uint32_t index, nr; const uint8_t * write_buffer = buffer; + uint32_t page = pos; nr = size; for (index = 0; index < nr; index++) { - uint32_t page = pos; uint8_t send_buffer[4]; send_buffer[0] = AT45DB_MM_PAGE_PROG_THRU_BUFFER1; @@ -286,12 +286,12 @@ static rt_size_t AT45DB_flash_write_page_1024(rt_device_t dev, rt_off_t pos, con { rt_uint32_t index, nr; const uint8_t * write_buffer = buffer; + uint32_t page = pos; nr = size; for (index = 0; index < nr; index++) { - uint32_t page = pos; uint8_t send_buffer[4]; send_buffer[0] = AT45DB_MM_PAGE_PROG_THRU_BUFFER1;