mirror of
https://github.com/eclipse-threadx/levelx.git
synced 2026-09-14 12:37:01 +08:00
Update on 23 Oct 2023. Expand to see details.
f203c27 Update headers and readme for 6.3.0 release. 40d3d10 Avoid clearing user extension in flash control block on opening flash 689dcc1 Added obsolete count and mapping bitmap cache for NOR flash. optimized block seraching logic. b183526 Enable weekly pipeline build to avoid CodeQL expiration 2eec506 Enable codeql in onebranch pipeline
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _lx_nor_flash_sector_write PORTABLE C */
|
||||
/* 6.1.7 */
|
||||
/* 6.3.0 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -87,6 +87,10 @@
|
||||
/* resulting in version 6.1 */
|
||||
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
|
||||
/* resulting in version 6.1.7 */
|
||||
/* 10-31-2023 Xiuwen Cai Modified comment(s), */
|
||||
/* added mapping bitmap cache, */
|
||||
/* added obsolete count cache, */
|
||||
/* resulting in version 6.3.0 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _lx_nor_flash_sector_write(LX_NOR_FLASH *nor_flash, ULONG logical_sector, VOID *buffer)
|
||||
@@ -101,7 +105,9 @@ ULONG new_mapping_entry;
|
||||
ULONG i;
|
||||
LX_NOR_SECTOR_MAPPING_CACHE_ENTRY *sector_mapping_cache_entry_ptr;
|
||||
UINT status;
|
||||
|
||||
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
|
||||
ULONG block;
|
||||
#endif
|
||||
|
||||
#ifdef LX_THREAD_SAFE_ENABLE
|
||||
|
||||
@@ -269,6 +275,18 @@ UINT status;
|
||||
/* Return status. */
|
||||
return(LX_ERROR);
|
||||
}
|
||||
#ifndef LX_NOR_DISABLE_EXTENDED_CACHE
|
||||
#ifdef LX_NOR_ENABLE_MAPPING_BITMAP
|
||||
|
||||
/* Determine if the logical sector is within the mapping bitmap. */
|
||||
if (logical_sector < nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap_max_logical_sector)
|
||||
{
|
||||
|
||||
/* Set the bit in the mapping bitmap. */
|
||||
nor_flash -> lx_nor_flash_extended_cache_mapping_bitmap[logical_sector >> 5] |= (ULONG)(1 << (logical_sector & 31));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Increment the number of mapped physical sectors. */
|
||||
nor_flash -> lx_nor_flash_mapped_physical_sectors++;
|
||||
@@ -303,6 +321,20 @@ UINT status;
|
||||
/* Increment the number of obsolete physical sectors. */
|
||||
nor_flash -> lx_nor_flash_obsolete_physical_sectors++;
|
||||
|
||||
#ifdef LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
|
||||
|
||||
/* Get the block number from mapping address. */
|
||||
block = (ULONG)(old_mapping_address - nor_flash -> lx_nor_flash_base_address) / nor_flash -> lx_nor_flash_words_per_block;
|
||||
|
||||
/* Determine if this block is within the range of the obsolete count cache. */
|
||||
if (block < nor_flash -> lx_nor_flash_extended_cache_obsolete_count_max_block)
|
||||
{
|
||||
|
||||
/* Increment the obsolete count for this block. */
|
||||
nor_flash -> lx_nor_flash_extended_cache_obsolete_count[block] ++;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Decrement the number of mapped physical sectors. */
|
||||
nor_flash -> lx_nor_flash_mapped_physical_sectors--;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user