mirror of
https://github.com/eclipse-threadx/levelx.git
synced 2026-09-14 04:06:00 +08:00
Merge pull request #65 from borlandong/fix-performance-issue
Updated the logic to skip unnecessary main data read in _lx_nand_flash_sector_read
This commit is contained in:
@@ -143,9 +143,9 @@ LONG page;
|
|||||||
|
|
||||||
/* Read a page. */
|
/* Read a page. */
|
||||||
#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE
|
#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE
|
||||||
status = (nand_flash -> lx_nand_flash_driver_pages_read)(nand_flash, block, (ULONG)page, (UCHAR*)buffer, spare_buffer_ptr, 1);
|
status = (nand_flash -> lx_nand_flash_driver_pages_read)(nand_flash, block, (ULONG)page, (UCHAR*)NULL, spare_buffer_ptr, 1);
|
||||||
#else
|
#else
|
||||||
status = (nand_flash -> lx_nand_flash_driver_pages_read)(block, (ULONG)page, (UCHAR*)buffer, spare_buffer_ptr, 1);
|
status = (nand_flash -> lx_nand_flash_driver_pages_read)(block, (ULONG)page, (UCHAR*)NULL, spare_buffer_ptr, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check for an error from flash driver. */
|
/* Check for an error from flash driver. */
|
||||||
@@ -166,6 +166,26 @@ LONG page;
|
|||||||
/* Get the logical sector number from spare bytes, and check if it matches the addressed sector number. */
|
/* Get the logical sector number from spare bytes, and check if it matches the addressed sector number. */
|
||||||
if ((LX_UTILITY_LONG_GET(&spare_buffer_ptr[nand_flash -> lx_nand_flash_spare_data1_offset]) & LX_NAND_PAGE_TYPE_USER_DATA_MASK) == logical_sector)
|
if ((LX_UTILITY_LONG_GET(&spare_buffer_ptr[nand_flash -> lx_nand_flash_spare_data1_offset]) & LX_NAND_PAGE_TYPE_USER_DATA_MASK) == logical_sector)
|
||||||
{
|
{
|
||||||
|
#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE
|
||||||
|
status = (nand_flash -> lx_nand_flash_driver_pages_read)(nand_flash, block, (ULONG)page, (UCHAR*)buffer, NULL, 1);
|
||||||
|
#else
|
||||||
|
status = (nand_flash -> lx_nand_flash_driver_pages_read)(block, (ULONG)page, (UCHAR*)buffer, NULL, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Check for an error from flash driver. */
|
||||||
|
if (status)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* Call system error handler. */
|
||||||
|
_lx_nand_flash_system_error(nand_flash, status, block, 0);
|
||||||
|
#ifdef LX_THREAD_SAFE_ENABLE
|
||||||
|
|
||||||
|
/* Release the thread safe mutex. */
|
||||||
|
tx_mutex_put(&nand_flash -> lx_nand_flash_mutex);
|
||||||
|
#endif
|
||||||
|
/* Return an error. */
|
||||||
|
return(LX_ERROR);
|
||||||
|
}
|
||||||
#ifdef LX_THREAD_SAFE_ENABLE
|
#ifdef LX_THREAD_SAFE_ENABLE
|
||||||
|
|
||||||
/* Release the thread safe mutex. */
|
/* Release the thread safe mutex. */
|
||||||
|
|||||||
Reference in New Issue
Block a user