[DeviceDrivers]Fix continuous write page bug for spi_flash_at45dbxx driver
@@ -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;
