Author SHA1 Message Date
Yuxin Zhou e848ac3db2 Release 6.1.10 2022-01-26 23:54:03 +00:00
Yuxin Zhou fdf7799991 Release 6.1.9 2021-10-13 06:50:30 +00:00
Yuxin Zhou 61f92c00c7 Release 6.1.8 2021-07-28 07:25:48 +00:00
7 changed files with 107 additions and 78 deletions
-1
View File
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
# Set up the project # Set up the project
project(levelx project(levelx
VERSION 6.0.0
LANGUAGES C ASM LANGUAGES C ASM
) )
+23 -8
View File
@@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */ /* APPLICATION INTERFACE DEFINITION RELEASE */
/* */ /* */
/* lx_api.h PORTABLE C */ /* lx_api.h PORTABLE C */
/* 6.1.7 */ /* 6.1.10 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -55,6 +55,17 @@
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* added standalone support, */ /* added standalone support, */
/* resulting in version 6.1.7 */ /* resulting in version 6.1.7 */
/* 08-02-2021 William E. Lamie Modified comment(s), and */
/* updated product constants, */
/* resulting in version 6.1.8 */
/* 10-15-2021 Bhupendra Naphade Modified comment(s), */
/* updated configuration for */
/* nand flash */
/* resulting in version 6.1.9 */
/* 01-31-2022 Bhupendra Naphade Modified comment(s), */
/* updated include order for */
/* standalone mode, */
/* resulting in version 6.1.10 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
@@ -72,12 +83,6 @@ extern "C" {
#endif #endif
/* Include necessary system files. */
#ifndef LX_STANDALONE_ENABLE
#include "tx_api.h"
#endif
/* Determine if the optional LevelX user define file should be used. */ /* Determine if the optional LevelX user define file should be used. */
#ifdef LX_INCLUDE_USER_DEFINE_FILE #ifdef LX_INCLUDE_USER_DEFINE_FILE
@@ -89,6 +94,12 @@ extern "C" {
#include "lx_user.h" #include "lx_user.h"
#endif #endif
/* Include the ThreadX api file. */
#ifndef LX_STANDALONE_ENABLE
#include "tx_api.h"
#endif
#ifdef LX_STANDALONE_ENABLE #ifdef LX_STANDALONE_ENABLE
@@ -159,7 +170,7 @@ typedef unsigned long long ULONG64;
#define AZURE_RTOS_LEVELX #define AZURE_RTOS_LEVELX
#define LEVELX_MAJOR_VERSION 6 #define LEVELX_MAJOR_VERSION 6
#define LEVELX_MINOR_VERSION 1 #define LEVELX_MINOR_VERSION 1
#define LEVELX_PATCH_VERSION 7 #define LEVELX_PATCH_VERSION 10
/* Define general LevelX Constants. */ /* Define general LevelX Constants. */
@@ -251,6 +262,10 @@ typedef unsigned long long ULONG64;
#define LX_NAND_ERASE_COUNT_WRITE_SIZE (nand_flash -> lx_nand_flash_pages_per_block + 1) #define LX_NAND_ERASE_COUNT_WRITE_SIZE (nand_flash -> lx_nand_flash_pages_per_block + 1)
#endif #endif
#ifndef LX_NAND_FLASH_MAPPING_LIST_UPDATE_DISABLE
#define LX_NAND_FLASH_MAPPING_LIST_UPDATE_DISABLE
#endif
/* Define the mask for the hash index into the NAND sector mapping cache table. The sector mapping cache is divided /* Define the mask for the hash index into the NAND sector mapping cache table. The sector mapping cache is divided
into 4 entry pieces that are indexed by the formula: into 4 entry pieces that are indexed by the formula:
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_block_obsoleted_check PORTABLE C */ /* _lx_nand_flash_block_obsoleted_check PORTABLE C */
/* 6.1.7 */ /* 6.1.9 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -86,6 +86,10 @@
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */ /* resulting in version 6.1.7 */
/* 10-15-2021 Bhupendra Naphade Modified comment(s), */
/* removed multiple write */
/* to page 0, */
/* resulting in version 6.1.9 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
VOID _lx_nand_flash_block_obsoleted_check(LX_NAND_FLASH *nand_flash, ULONG block) VOID _lx_nand_flash_block_obsoleted_check(LX_NAND_FLASH *nand_flash, ULONG block)
@@ -316,22 +320,11 @@ UINT status;
} }
/* Now store the erase count. */ /* Now store the erase count. */
page_word_ptr[0] = (erase_count | LX_BLOCK_ERASED); page_word_ptr[0] = (erase_count);
/* Write the erase count for the block. */ /* Write the erase count for the block. */
status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE); status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE);
/* Check to see if the write was successful. */
if (status == LX_SUCCESS)
{
/* Now store the erase count. */
page_word_ptr[0] = erase_count;
/* Write the erase count for the block. */
status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE);
}
/* Check for an error from flash driver. */ /* Check for an error from flash driver. */
if (status) if (status)
{ {
+11 -26
View File
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_block_reclaim PORTABLE C */ /* _lx_nand_flash_block_reclaim PORTABLE C */
/* 6.1.7 */ /* 6.1.9 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -88,6 +88,13 @@
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */ /* resulting in version 6.1.7 */
/* 08-02-2021 Bhupendra Naphade Modified comment(s), updated */
/* obselete page count check, */
/* resulting in version 6.1.8 */
/* 10-15-2021 Bhupendra Naphade Modified comment(s), */
/* removed multiple write */
/* to page 0, */
/* resulting in version 6.1.9 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_block_reclaim(LX_NAND_FLASH *nand_flash) UINT _lx_nand_flash_block_reclaim(LX_NAND_FLASH *nand_flash)
@@ -131,7 +138,7 @@ UINT status;
} }
/* Determine if this block is completely obsolete. */ /* Determine if this block is completely obsolete. */
if (obsolete_pages == nand_flash -> lx_nand_flash_pages_per_block) if (obsolete_pages == nand_flash -> lx_nand_flash_pages_per_block - 1)
{ {
/* Read page 0 of the block, which has the erase count in the first 4 bytes. */ /* Read page 0 of the block, which has the erase count in the first 4 bytes. */
@@ -215,22 +222,11 @@ UINT status;
} }
/* Now store the erase count. */ /* Now store the erase count. */
page_word_ptr[0] = (erase_count | LX_BLOCK_ERASED); page_word_ptr[0] = (erase_count);
/* Write the erase count for the block. */ /* Write the erase count for the block. */
status = _lx_nand_flash_driver_write(nand_flash, erase_block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE); status = _lx_nand_flash_driver_write(nand_flash, erase_block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE);
/* Check the status. */
if (status == LX_SUCCESS)
{
/* Now store the erase count. */
page_word_ptr[0] = erase_count;
/* Write the erase count for the block. */
status = _lx_nand_flash_driver_write(nand_flash, erase_block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE);
}
/* Check for an error from flash driver. */ /* Check for an error from flash driver. */
if (status) if (status)
{ {
@@ -575,22 +571,11 @@ UINT status;
} }
/* Now store the erase count. */ /* Now store the erase count. */
page_word_ptr[0] = (erase_count | LX_BLOCK_ERASED); page_word_ptr[0] = (erase_count);
/* Write the erase count for the block. */ /* Write the erase count for the block. */
status = _lx_nand_flash_driver_write(nand_flash, erase_block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE); status = _lx_nand_flash_driver_write(nand_flash, erase_block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE);
/* Determine if the write was successful. */
if (status == LX_SUCCESS)
{
/* Now store the erase count. */
page_word_ptr[0] = erase_count;
/* Write the erase count for the block. */
status = _lx_nand_flash_driver_write(nand_flash, erase_block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE);
}
/* Check for an error from flash driver. */ /* Check for an error from flash driver. */
if (status) if (status)
{ {
+8 -24
View File
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_open PORTABLE C */ /* _lx_nand_flash_open PORTABLE C */
/* 6.1.7 */ /* 6.1.9 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -94,6 +94,10 @@
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */ /* resulting in version 6.1.7 */
/* 10-15-2021 Bhupendra Naphade Modified comment(s), */
/* removed multiple write */
/* to page 0, */
/* resulting in version 6.1.9 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_open(LX_NAND_FLASH *nand_flash, CHAR *name, UINT (*nand_driver_initialize)(LX_NAND_FLASH *)) UINT _lx_nand_flash_open(LX_NAND_FLASH *nand_flash, CHAR *name, UINT (*nand_driver_initialize)(LX_NAND_FLASH *))
@@ -282,22 +286,11 @@ LX_INTERRUPT_SAVE_AREA
} }
/* Setup the initial erase count to 1. */ /* Setup the initial erase count to 1. */
page_word_ptr[0] = (((ULONG) 1) | LX_BLOCK_ERASED); page_word_ptr[0] = (((ULONG) 1));
/* Write the initial erase count for the block. */ /* Write the initial erase count for the block. */
status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE); status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE);
/* Check for status after the block erase. */
if (status == LX_SUCCESS)
{
/* Setup the initial erase count to 1. */
page_word_ptr[0] = ((ULONG) 1);
/* Write the initial erase count for the block. */
status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE);
}
/* Check for an error from flash driver. */ /* Check for an error from flash driver. */
if (status) if (status)
{ {
@@ -498,18 +491,9 @@ LX_INTERRUPT_SAVE_AREA
continue; continue;
} }
/* Write the initial erase count for the block. */ /* Write the final erase count for the block. */
page_word_ptr[0] = (max_erased_count | LX_BLOCK_ERASED);
status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE);
/* Determine if the write was successful. */
if (status == LX_SUCCESS)
{
/* Write the initial erase count for the block. */
page_word_ptr[0] = max_erased_count; page_word_ptr[0] = max_erased_count;
status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE); status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, 1);
}
/* Check for an error from flash driver. */ /* Check for an error from flash driver. */
if (status) if (status)
+42 -2
View File
@@ -37,7 +37,6 @@
#define EXTRA_BYTE_POSITION 2 /* 2 is the extra bytes starting byte postion */ #define EXTRA_BYTE_POSITION 2 /* 2 is the extra bytes starting byte postion */
#define ECC_BYTE_POSITION 40 /* 40 is the ECC starting byte position */ #define ECC_BYTE_POSITION 40 /* 40 is the ECC starting byte position */
/* Definition of the spare area is relative to the block size of the NAND part and perhaps manufactures of the NAND part. /* Definition of the spare area is relative to the block size of the NAND part and perhaps manufactures of the NAND part.
Here are some common definitions: Here are some common definitions:
@@ -169,7 +168,13 @@ UINT _lx_nand_flash_simulator_write(ULONG block, ULONG page, ULONG *source, ULO
{ {
ULONG *flash_address; ULONG *flash_address;
UCHAR *flash_spare_address;
UINT bytes_computed;
UINT ecc_bytes =0;
UCHAR new_ecc_buffer[24];
UCHAR *new_ecc_buffer_ptr = new_ecc_buffer;
UCHAR *ecc_buffer_ptr = new_ecc_buffer_ptr;
ULONG *page_ptr = &(nand_memory_area[block].physical_pages[page].memory[0]);
/* Increment the diag info. */ /* Increment the diag info. */
nand_block_diag[block].page_writes[page]++; nand_block_diag[block].page_writes[page]++;
@@ -192,6 +197,41 @@ ULONG *flash_address;
*flash_address++ = *source++; *flash_address++ = *source++;
} }
/* Loop to compute the ECC over the entire NAND flash page. */
bytes_computed = 0;
while (bytes_computed < BYTES_PER_PHYSICAL_PAGE)
{
/* Compute the ECC for this 256 byte piece of the page. */
_lx_nand_flash_256byte_ecc_compute((UCHAR *)page_ptr, (UCHAR *)new_ecc_buffer_ptr);
/* Move to the next 256 byte portion of the page. */
bytes_computed = bytes_computed + 256;
/* Move the page buffer forward. */
page_ptr = page_ptr + 256;
ecc_bytes = ecc_bytes + 3;
/* Move the ECC buffer forward, note there are 3 bytes of ECC per page. */
new_ecc_buffer_ptr = new_ecc_buffer_ptr + 3;
}
/* Setup destination pointer in the spare area. */
flash_spare_address = (UCHAR *) &(nand_memory_area[block].physical_pages[page].spare[ECC_BYTE_POSITION]);
while(ecc_bytes--)
{
/* Can the word be written? We can clear new bits, but just can't unclear
in a NAND device. */
if ((*ecc_buffer_ptr & *flash_spare_address) != *ecc_buffer_ptr)
return(LX_INVALID_WRITE);
/* Set an ecc byte in the spare area. */
*flash_spare_address++ = *ecc_buffer_ptr++;
}
return(LX_SUCCESS); return(LX_SUCCESS);
} }
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_extended_cache_enable PORTABLE C */ /* _lx_nor_flash_extended_cache_enable PORTABLE C */
/* 6.1.7 */ /* 6.1.9 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -80,6 +80,10 @@
/* 06-02-2021 Bhupendra Naphade Modified comment(s), and */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), and */
/* updated product constants */ /* updated product constants */
/* resulting in version 6.1.7 */ /* resulting in version 6.1.7 */
/* 10-15-2021 Bhupendra Naphade Modified comment(s), and */
/* added check for out of */
/* bound memory access, */
/* resulting in version 6.1.9 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_extended_cache_enable(LX_NOR_FLASH *nor_flash, VOID *memory, ULONG size) UINT _lx_nor_flash_extended_cache_enable(LX_NOR_FLASH *nor_flash, VOID *memory, ULONG size)
@@ -135,7 +139,16 @@ ULONG *cache_memory;
} }
/* Save the number of cache entries. */ /* Save the number of cache entries. */
if(i > LX_NOR_EXTENDED_CACHE_SIZE)
{
nor_flash -> lx_nor_flash_extended_cache_entries = LX_NOR_EXTENDED_CACHE_SIZE;
}
else
{
nor_flash -> lx_nor_flash_extended_cache_entries = i; nor_flash -> lx_nor_flash_extended_cache_entries = i;
}
#ifdef LX_THREAD_SAFE_ENABLE #ifdef LX_THREAD_SAFE_ENABLE