diff --git a/common/inc/lx_api.h b/common/inc/lx_api.h index 6e9ad2e..314831a 100644 --- a/common/inc/lx_api.h +++ b/common/inc/lx_api.h @@ -26,7 +26,7 @@ /* APPLICATION INTERFACE DEFINITION RELEASE */ /* */ /* lx_api.h PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -75,9 +75,11 @@ /* 10-31-2022 Xiuwen Cai Modified comment(s), and */ /* updated product constants, */ /* resulting in version 6.2.0 */ -/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ /* modified NAND logic, */ -/* resulting in version 6.x */ +/* added new driver interface */ +/* and user extension, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ @@ -190,7 +192,7 @@ typedef unsigned long long ULONG64; #define AZURE_RTOS_LEVELX #define LEVELX_MAJOR_VERSION 6 #define LEVELX_MINOR_VERSION 2 -#define LEVELX_PATCH_VERSION 0 +#define LEVELX_PATCH_VERSION 1 /* Define general LevelX Constants. */ @@ -385,6 +387,14 @@ typedef struct LX_NAND_DEVICE_INFO_STRUCT ULONG lx_nand_device_info_base_erase_count; } LX_NAND_DEVICE_INFO; + +/* Determine if the flash control block has an extension defined. If not, + define the extension to whitespace. */ + +#ifndef LX_NAND_FLASH_USER_EXTENSION +#define LX_NAND_FLASH_USER_EXTENSION +#endif + /* Define the NAND flash control block structure. */ typedef struct LX_NAND_FLASH_STRUCT @@ -454,6 +464,22 @@ typedef struct LX_NAND_FLASH_STRUCT ULONG lx_nand_flash_diagnostic_block_erased_verifies; ULONG lx_nand_flash_diagnostic_page_erased_verifies; +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + UINT (*lx_nand_flash_driver_read)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block, ULONG page, ULONG *destination, ULONG words); + UINT (*lx_nand_flash_driver_write)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block, ULONG page, ULONG *source, ULONG words); + UINT (*lx_nand_flash_driver_block_erase)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block, ULONG erase_count); + UINT (*lx_nand_flash_driver_block_erased_verify)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block); + UINT (*lx_nand_flash_driver_page_erased_verify)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block, ULONG page); + UINT (*lx_nand_flash_driver_block_status_get)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block, UCHAR *bad_block_flag); + UINT (*lx_nand_flash_driver_block_status_set)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block, UCHAR bad_block_flag); + UINT (*lx_nand_flash_driver_extra_bytes_get)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block, ULONG page, UCHAR *destination, UINT size); + UINT (*lx_nand_flash_driver_extra_bytes_set)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block, ULONG page, UCHAR *source, UINT size); + UINT (*lx_nand_flash_driver_system_error)(struct LX_NAND_FLASH_STRUCT *nand_flash, UINT error_code, ULONG block, ULONG page); + + UINT (*lx_nand_flash_driver_pages_read)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages); + UINT (*lx_nand_flash_driver_pages_write)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages); + UINT (*lx_nand_flash_driver_pages_copy)(struct LX_NAND_FLASH_STRUCT *nand_flash, ULONG source_block, ULONG source_page, ULONG destination_block, ULONG destination_page, ULONG pages, UCHAR* data_buffer); +#else UINT (*lx_nand_flash_driver_read)(ULONG block, ULONG page, ULONG *destination, ULONG words); UINT (*lx_nand_flash_driver_write)(ULONG block, ULONG page, ULONG *source, ULONG words); UINT (*lx_nand_flash_driver_block_erase)(ULONG block, ULONG erase_count); @@ -468,7 +494,7 @@ typedef struct LX_NAND_FLASH_STRUCT UINT (*lx_nand_flash_driver_pages_read)(ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages); UINT (*lx_nand_flash_driver_pages_write)(ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages); UINT (*lx_nand_flash_driver_pages_copy)(ULONG source_block, ULONG source_page, ULONG destination_block, ULONG destination_page, ULONG pages, UCHAR* data_buffer); - +#endif UCHAR *lx_nand_flash_page_buffer; UINT lx_nand_flash_page_buffer_size; @@ -483,6 +509,10 @@ typedef struct LX_NAND_FLASH_STRUCT /* Define the NAND flash control block open next/previous pointers. */ struct LX_NAND_FLASH_STRUCT *lx_nand_flash_open_next, *lx_nand_flash_open_previous; + + /* Define the user extension in the flash control block. This + is typically defined in lx_user.h. */ + LX_NAND_FLASH_USER_EXTENSION } LX_NAND_FLASH; @@ -508,6 +538,13 @@ typedef struct LX_NOR_FLASH_EXTENDED_CACHE_ENTRY_STRUCT } LX_NOR_FLASH_EXTENDED_CACHE_ENTRY; +/* Determine if the flash control block has an extension defined. If not, + define the extension to whitespace. */ + +#ifndef LX_NOR_FLASH_USER_EXTENSION +#define LX_NOR_FLASH_USER_EXTENSION +#endif + /* Define the NOR flash control block structure. */ typedef struct LX_NOR_FLASH_STRUCT @@ -553,11 +590,19 @@ typedef struct LX_NOR_FLASH_STRUCT ULONG lx_nor_flash_diagnostic_sector_not_free; ULONG lx_nor_flash_diagnostic_sector_data_not_free; +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + UINT (*lx_nor_flash_driver_read)(struct LX_NOR_FLASH_STRUCT *nor_flash, ULONG *flash_address, ULONG *destination, ULONG words); + UINT (*lx_nor_flash_driver_write)(struct LX_NOR_FLASH_STRUCT *nor_flash, ULONG *flash_address, ULONG *source, ULONG words); + UINT (*lx_nor_flash_driver_block_erase)(struct LX_NOR_FLASH_STRUCT *nor_flash, ULONG block, ULONG erase_count); + UINT (*lx_nor_flash_driver_block_erased_verify)(struct LX_NOR_FLASH_STRUCT *nor_flash, ULONG block); + UINT (*lx_nor_flash_driver_system_error)(struct LX_NOR_FLASH_STRUCT *nor_flash, UINT error_code); +#else UINT (*lx_nor_flash_driver_read)(ULONG *flash_address, ULONG *destination, ULONG words); UINT (*lx_nor_flash_driver_write)(ULONG *flash_address, ULONG *source, ULONG words); UINT (*lx_nor_flash_driver_block_erase)(ULONG block, ULONG erase_count); UINT (*lx_nor_flash_driver_block_erased_verify)(ULONG block); UINT (*lx_nor_flash_driver_system_error)(UINT error_code); +#endif ULONG *lx_nor_flash_sector_buffer; UINT lx_nor_flash_sector_mapping_cache_enabled; @@ -585,6 +630,10 @@ typedef struct LX_NOR_FLASH_STRUCT struct LX_NOR_FLASH_STRUCT *lx_nor_flash_open_next, *lx_nor_flash_open_previous; + /* Define the user extension in the flash control block. This + is typically defined in lx_user.h. */ + LX_NOR_FLASH_USER_EXTENSION + } LX_NOR_FLASH; diff --git a/common/inc/lx_user_sample.h b/common/inc/lx_user_sample.h index d466f8d..98777f3 100644 --- a/common/inc/lx_user_sample.h +++ b/common/inc/lx_user_sample.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* lx_user.h PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* */ /* AUTHOR */ /* */ @@ -48,9 +48,9 @@ /* 06-02-2021 Bhupendra Naphade Modified comment(s), and */ /* added standalone support, */ /* resulting in version 6.1.7 */ -/* xx-xx-xxxx Xiuwen Cai Modified comment(s), and */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), and */ /* added new NAND options, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ @@ -113,7 +113,15 @@ /* #define LX_STANDALONE_ENABLE */ +/* Define user extension for NOR flash control block. */ +/* +#define LX_NOR_FLASH_USER_EXTENSION ???? +*/ +/* Define user extension for NAND flash control block. */ +/* +#define LX_NAND_FLASH_USER_EXTENSION ???? +*/ #endif diff --git a/common/src/fx_nand_flash_simulated_driver.c b/common/src/fx_nand_flash_simulated_driver.c index 7ec86c2..f6ec801 100644 --- a/common/src/fx_nand_flash_simulated_driver.c +++ b/common/src/fx_nand_flash_simulated_driver.c @@ -71,7 +71,7 @@ VOID _fx_nand_flash_simulator_driver(FX_MEDIA *media_ptr); /* FUNCTION RELEASE */ /* */ /* _fx_nand_simulator_driver PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -126,9 +126,9 @@ VOID _fx_nand_flash_simulator_driver(FX_MEDIA *media_ptr); /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ -/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ /* changed to use new API, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ VOID _fx_nand_flash_simulator_driver(FX_MEDIA *media_ptr) diff --git a/common/src/lx_nand_flash_256byte_ecc_compute.c b/common/src/lx_nand_flash_256byte_ecc_compute.c index 1260f34..d0aa712 100644 --- a/common/src/lx_nand_flash_256byte_ecc_compute.c +++ b/common/src/lx_nand_flash_256byte_ecc_compute.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_256byte_ecc_compute PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -77,9 +77,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ -/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ /* inverted output, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_256byte_ecc_compute(UCHAR *page_buffer, UCHAR *ecc_buffer) diff --git a/common/src/lx_nand_flash_block_allocate.c b/common/src/lx_nand_flash_block_allocate.c index bc5f452..1a35b97 100644 --- a/common/src/lx_nand_flash_block_allocate.c +++ b/common/src/lx_nand_flash_block_allocate.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_block_allocate PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -70,7 +70,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_block_allocate(LX_NAND_FLASH* nand_flash, ULONG* block) diff --git a/common/src/lx_nand_flash_block_data_move.c b/common/src/lx_nand_flash_block_data_move.c index 2f65928..21b037d 100644 --- a/common/src/lx_nand_flash_block_data_move.c +++ b/common/src/lx_nand_flash_block_data_move.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_block_data_move PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -83,7 +83,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_block_data_move(LX_NAND_FLASH *nand_flash, ULONG new_block) diff --git a/common/src/lx_nand_flash_block_find.c b/common/src/lx_nand_flash_block_find.c index a6224a0..eaac3d9 100644 --- a/common/src/lx_nand_flash_block_find.c +++ b/common/src/lx_nand_flash_block_find.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_block_find PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -77,7 +77,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_block_find(LX_NAND_FLASH *nand_flash, ULONG logical_sector, ULONG *block, USHORT *block_status) diff --git a/common/src/lx_nand_flash_block_mapping_set.c b/common/src/lx_nand_flash_block_mapping_set.c index 933e6a7..c09f757 100644 --- a/common/src/lx_nand_flash_block_mapping_set.c +++ b/common/src/lx_nand_flash_block_mapping_set.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_block_mapping_set PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -71,7 +71,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_block_mapping_set(LX_NAND_FLASH *nand_flash, ULONG logical_sector, ULONG block) diff --git a/common/src/lx_nand_flash_block_status_set.c b/common/src/lx_nand_flash_block_status_set.c index a100ff5..d26367d 100644 --- a/common/src/lx_nand_flash_block_status_set.c +++ b/common/src/lx_nand_flash_block_status_set.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_block_status_set PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -71,7 +71,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_block_status_set(LX_NAND_FLASH *nand_flash, ULONG block, ULONG block_status) diff --git a/common/src/lx_nand_flash_data_page_copy.c b/common/src/lx_nand_flash_data_page_copy.c index b16d175..60fec05 100644 --- a/common/src/lx_nand_flash_data_page_copy.c +++ b/common/src/lx_nand_flash_data_page_copy.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_data_page_copy PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -78,7 +78,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_data_page_copy(LX_NAND_FLASH* nand_flash, ULONG logical_sector, ULONG source_block, USHORT src_block_status, @@ -121,7 +121,11 @@ ULONG number_of_pages; { /* Read one page. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_read)(nand_flash, source_block, (ULONG)source_page, LX_NULL, spare_buffer_ptr, 1); +#else status = (nand_flash -> lx_nand_flash_driver_pages_read)(source_block, (ULONG)source_page, LX_NULL, spare_buffer_ptr, 1); +#endif /* Check for an error from flash driver. */ if (status) @@ -146,7 +150,11 @@ ULONG number_of_pages; { /* Call the driver to copy the page. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_copy)(nand_flash, source_block, (ULONG)source_page, destination_block, destination_page, 1, nand_flash -> lx_nand_flash_page_buffer); +#else status = (nand_flash -> lx_nand_flash_driver_pages_copy)(source_block, (ULONG)source_page, destination_block, destination_page, 1, nand_flash -> lx_nand_flash_page_buffer); +#endif /* Check for an error from flash driver. */ if (status) @@ -197,7 +205,11 @@ ULONG number_of_pages; { /* Call the driver to copy pages. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_copy)(nand_flash, source_block, (ULONG)source_page, destination_block, destination_page, number_of_pages, nand_flash -> lx_nand_flash_page_buffer); +#else status = (nand_flash -> lx_nand_flash_driver_pages_copy)(source_block, (ULONG)source_page, destination_block, destination_page, number_of_pages, nand_flash -> lx_nand_flash_page_buffer); +#endif /* Check for an error from flash driver. */ if (status) diff --git a/common/src/lx_nand_flash_defragment.c b/common/src/lx_nand_flash_defragment.c index a0b40a7..d8066b5 100644 --- a/common/src/lx_nand_flash_defragment.c +++ b/common/src/lx_nand_flash_defragment.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_defragment PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -77,9 +77,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ -/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ /* deprecated this API, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_defragment(LX_NAND_FLASH *nand_flash) diff --git a/common/src/lx_nand_flash_driver_block_erase.c b/common/src/lx_nand_flash_driver_block_erase.c index bb46820..91fae63 100644 --- a/common/src/lx_nand_flash_driver_block_erase.c +++ b/common/src/lx_nand_flash_driver_block_erase.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_driver_block_erase PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -76,9 +76,10 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ -/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ /* removed cache support, */ -/* resulting in version 6.x */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_driver_block_erase(LX_NAND_FLASH *nand_flash, ULONG block, ULONG erase_count) @@ -91,7 +92,11 @@ UINT status; nand_flash -> lx_nand_flash_diagnostic_block_erases++; /* Call driver erase block function. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_block_erase)(nand_flash, block, erase_count); +#else status = (nand_flash -> lx_nand_flash_driver_block_erase)(block, erase_count); +#endif /* Return status. */ return(status); diff --git a/common/src/lx_nand_flash_driver_block_erased_verify.c b/common/src/lx_nand_flash_driver_block_erased_verify.c index 20330d9..8d0317d 100644 --- a/common/src/lx_nand_flash_driver_block_erased_verify.c +++ b/common/src/lx_nand_flash_driver_block_erased_verify.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_driver_block_erased_verify PORTABLE C */ -/* 6.1.7 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -77,6 +77,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_driver_block_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block) @@ -88,8 +91,11 @@ UINT status; nand_flash -> lx_nand_flash_diagnostic_block_erased_verifies++; /* Call driver block erased verify function. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_block_erased_verify)(nand_flash, block); +#else status = (nand_flash -> lx_nand_flash_driver_block_erased_verify)(block); - +#endif /* Return status. */ return(status); } diff --git a/common/src/lx_nand_flash_driver_block_status_get.c b/common/src/lx_nand_flash_driver_block_status_get.c index f3aac8f..e3c4e50 100644 --- a/common/src/lx_nand_flash_driver_block_status_get.c +++ b/common/src/lx_nand_flash_driver_block_status_get.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_driver_block_status_get PORTABLE C */ -/* 6.1.7 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -78,6 +78,10 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ +/* removed cache support, */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_driver_block_status_get(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR *bad_block_flag) @@ -90,7 +94,11 @@ UINT status; nand_flash -> lx_nand_flash_diagnostic_block_status_gets++; /* Call driver block status get function. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_block_status_get)(nand_flash, block, bad_block_flag); +#else status = (nand_flash -> lx_nand_flash_driver_block_status_get)(block, bad_block_flag); +#endif /* Return status. */ return(status); diff --git a/common/src/lx_nand_flash_driver_block_status_set.c b/common/src/lx_nand_flash_driver_block_status_set.c index 2241208..65a6da0 100644 --- a/common/src/lx_nand_flash_driver_block_status_set.c +++ b/common/src/lx_nand_flash_driver_block_status_set.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_driver_block_status_set PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -78,9 +78,10 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ -/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ /* removed cache support, */ -/* resulting in version 6.x */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_driver_block_status_set(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR bad_block_flag) @@ -93,7 +94,11 @@ UINT status; nand_flash -> lx_nand_flash_diagnostic_block_status_sets++; /* Call driver block status set function. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_block_status_set)(nand_flash, block, bad_block_flag); +#else status = (nand_flash -> lx_nand_flash_driver_block_status_set)(block, bad_block_flag); +#endif /* Return status. */ return(status); diff --git a/common/src/lx_nand_flash_driver_page_erased_verify.c b/common/src/lx_nand_flash_driver_page_erased_verify.c index 5744ec7..f2cf43f 100644 --- a/common/src/lx_nand_flash_driver_page_erased_verify.c +++ b/common/src/lx_nand_flash_driver_page_erased_verify.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_driver_page_erased_verify PORTABLE C */ -/* 6.1.7 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -77,6 +77,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_driver_page_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page) @@ -88,8 +91,11 @@ UINT status; nand_flash -> lx_nand_flash_diagnostic_page_erased_verifies++; /* Call driver page erased verify function. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_page_erased_verify)(nand_flash, block, page); +#else status = (nand_flash -> lx_nand_flash_driver_page_erased_verify)(block, page); - +#endif /* Return status. */ return(status); } diff --git a/common/src/lx_nand_flash_erase_count_set.c b/common/src/lx_nand_flash_erase_count_set.c index 5feb19b..223cca5 100644 --- a/common/src/lx_nand_flash_erase_count_set.c +++ b/common/src/lx_nand_flash_erase_count_set.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_erase_count_set PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -71,7 +71,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_erase_count_set(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR erase_count) diff --git a/common/src/lx_nand_flash_extended_cache_enable.c b/common/src/lx_nand_flash_extended_cache_enable.c index 527c03e..5f06ec1 100644 --- a/common/src/lx_nand_flash_extended_cache_enable.c +++ b/common/src/lx_nand_flash_extended_cache_enable.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_extended_cache_enable PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -79,9 +79,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ -/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ /* deprecated this API, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_extended_cache_enable(LX_NAND_FLASH *nand_flash, VOID *memory, ULONG size) diff --git a/common/src/lx_nand_flash_format.c b/common/src/lx_nand_flash_format.c index 903c1d2..83d2432 100644 --- a/common/src/lx_nand_flash_format.c +++ b/common/src/lx_nand_flash_format.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_format PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -87,7 +87,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_format(LX_NAND_FLASH* nand_flash, CHAR* name, diff --git a/common/src/lx_nand_flash_free_block_list_add.c b/common/src/lx_nand_flash_free_block_list_add.c index 99b0b3c..ba55f46 100644 --- a/common/src/lx_nand_flash_free_block_list_add.c +++ b/common/src/lx_nand_flash_free_block_list_add.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_free_block_list_add PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -70,7 +70,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_free_block_list_add(LX_NAND_FLASH* nand_flash, ULONG block) diff --git a/common/src/lx_nand_flash_mapped_block_list_add.c b/common/src/lx_nand_flash_mapped_block_list_add.c index e6ad1df..2985cbc 100644 --- a/common/src/lx_nand_flash_mapped_block_list_add.c +++ b/common/src/lx_nand_flash_mapped_block_list_add.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_mapped_block_list_add PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -70,7 +70,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_mapped_block_list_add(LX_NAND_FLASH* nand_flash, ULONG block_mapping_index) diff --git a/common/src/lx_nand_flash_mapped_block_list_get.c b/common/src/lx_nand_flash_mapped_block_list_get.c index 0f45ce9..958d8aa 100644 --- a/common/src/lx_nand_flash_mapped_block_list_get.c +++ b/common/src/lx_nand_flash_mapped_block_list_get.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_mapped_block_list_get PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -71,7 +71,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_mapped_block_list_get(LX_NAND_FLASH* nand_flash, ULONG *block_mapping_index) diff --git a/common/src/lx_nand_flash_mapped_block_list_remove.c b/common/src/lx_nand_flash_mapped_block_list_remove.c index 2bdbbf9..a44740a 100644 --- a/common/src/lx_nand_flash_mapped_block_list_remove.c +++ b/common/src/lx_nand_flash_mapped_block_list_remove.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_mapped_block_list_remove PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -70,7 +70,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_mapped_block_list_remove(LX_NAND_FLASH* nand_flash, ULONG block_mapping_index) diff --git a/common/src/lx_nand_flash_memory_initialize.c b/common/src/lx_nand_flash_memory_initialize.c index bc20cb0..b8abdd5 100644 --- a/common/src/lx_nand_flash_memory_initialize.c +++ b/common/src/lx_nand_flash_memory_initialize.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_memory_initialize PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -72,7 +72,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_memory_initialize(LX_NAND_FLASH *nand_flash, ULONG* memory_ptr, UINT memory_size) diff --git a/common/src/lx_nand_flash_metadata_allocate.c b/common/src/lx_nand_flash_metadata_allocate.c index 4ac025a..b13e545 100644 --- a/common/src/lx_nand_flash_metadata_allocate.c +++ b/common/src/lx_nand_flash_metadata_allocate.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_metadata_allocate PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -78,7 +78,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_metadata_allocate(LX_NAND_FLASH *nand_flash) diff --git a/common/src/lx_nand_flash_metadata_build.c b/common/src/lx_nand_flash_metadata_build.c index b4c123c..18ead2c 100644 --- a/common/src/lx_nand_flash_metadata_build.c +++ b/common/src/lx_nand_flash_metadata_build.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_metadata_build PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -69,7 +69,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_metadata_build(LX_NAND_FLASH *nand_flash) diff --git a/common/src/lx_nand_flash_metadata_write.c b/common/src/lx_nand_flash_metadata_write.c index d14e250..791e95f 100644 --- a/common/src/lx_nand_flash_metadata_write.c +++ b/common/src/lx_nand_flash_metadata_write.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_metadata_write PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -74,7 +74,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_metadata_write(LX_NAND_FLASH *nand_flash, UCHAR* main_buffer, ULONG spare_value) @@ -110,7 +110,11 @@ UCHAR *spare_buffer_ptr; page = nand_flash -> lx_nand_flash_metadata_block_current_page; /* Write the page. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_write)(nand_flash, block, page, main_buffer, spare_buffer_ptr, 1); +#else status = (nand_flash -> lx_nand_flash_driver_pages_write)(block, page, main_buffer, spare_buffer_ptr, 1); +#endif /* Check for an error from flash driver. */ if (status) @@ -133,7 +137,11 @@ UCHAR *spare_buffer_ptr; page = nand_flash -> lx_nand_flash_backup_metadata_block_current_page; /* Write the page. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_write)(nand_flash, block, page, main_buffer, spare_buffer_ptr, 1); +#else status = (nand_flash -> lx_nand_flash_driver_pages_write)(block, page, main_buffer, spare_buffer_ptr, 1); +#endif /* Check for an error from flash driver. */ if (status) diff --git a/common/src/lx_nand_flash_open.c b/common/src/lx_nand_flash_open.c index af5ee6d..b6a5b27 100644 --- a/common/src/lx_nand_flash_open.c +++ b/common/src/lx_nand_flash_open.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_open PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -85,7 +85,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_open(LX_NAND_FLASH *nand_flash, CHAR *name, UINT (*nand_driver_initialize)(LX_NAND_FLASH *), @@ -194,7 +194,11 @@ LX_INTERRUPT_SAVE_AREA } /* Call driver read function to read page 0. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_read)(nand_flash, block, 0, page_buffer_ptr, spare_buffer_ptr, 1); +#else status = (nand_flash -> lx_nand_flash_driver_pages_read)(block, 0, page_buffer_ptr, spare_buffer_ptr, 1); +#endif /* Check for an error from flash driver. */ if (status) @@ -269,7 +273,11 @@ LX_INTERRUPT_SAVE_AREA { /* Call driver read function to read page. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_read)(nand_flash, block, page, page_buffer_ptr, spare_buffer_ptr, 1); +#else status = (nand_flash -> lx_nand_flash_driver_pages_read)(block, page, page_buffer_ptr, spare_buffer_ptr, 1); +#endif /* Check for an error from flash driver. */ if (status) diff --git a/common/src/lx_nand_flash_partial_defragment.c b/common/src/lx_nand_flash_partial_defragment.c index 35bd65d..42410ad 100644 --- a/common/src/lx_nand_flash_partial_defragment.c +++ b/common/src/lx_nand_flash_partial_defragment.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_partial_defragment PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -78,9 +78,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ -/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ /* deprecated this API, */ -/* resulting in version 6.x */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_partial_defragment(LX_NAND_FLASH *nand_flash, UINT max_blocks) diff --git a/common/src/lx_nand_flash_sector_read.c b/common/src/lx_nand_flash_sector_read.c index 218c902..622f2ab 100644 --- a/common/src/lx_nand_flash_sector_read.c +++ b/common/src/lx_nand_flash_sector_read.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_sector_read PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -77,7 +77,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_sector_read(LX_NAND_FLASH *nand_flash, ULONG logical_sector, VOID *buffer) @@ -143,8 +143,12 @@ LONG page; { /* Read a page. */ +#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); +#else status = (nand_flash -> lx_nand_flash_driver_pages_read)(block, (ULONG)page, (UCHAR*)buffer, spare_buffer_ptr, 1); - +#endif + /* Check for an error from flash driver. */ if (status) { @@ -181,7 +185,11 @@ LONG page; { /* Read a page. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_read)(nand_flash, block, logical_sector % nand_flash -> lx_nand_flash_pages_per_block, (UCHAR*)buffer, spare_buffer_ptr, 1); +#else status = (nand_flash -> lx_nand_flash_driver_pages_read)(block, logical_sector % nand_flash -> lx_nand_flash_pages_per_block, (UCHAR*)buffer, spare_buffer_ptr, 1); +#endif /* Check for an error from flash driver. */ if (status) diff --git a/common/src/lx_nand_flash_sector_release.c b/common/src/lx_nand_flash_sector_release.c index 14e02fc..d1c4881 100644 --- a/common/src/lx_nand_flash_sector_release.c +++ b/common/src/lx_nand_flash_sector_release.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_sector_release PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -86,7 +86,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_sector_release(LX_NAND_FLASH *nand_flash, ULONG logical_sector) @@ -155,7 +155,11 @@ USHORT new_block_status; { /* Read a page. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_read)(nand_flash, block, (ULONG)page, LX_NULL, spare_buffer_ptr, 1); +#else status = (nand_flash -> lx_nand_flash_driver_pages_read)(block, (ULONG)page, LX_NULL, spare_buffer_ptr, 1); +#endif /* Check for an error from flash driver. */ if (status) @@ -411,7 +415,11 @@ USHORT new_block_status; LX_UTILITY_LONG_SET(&spare_buffer_ptr[nand_flash -> lx_nand_flash_spare_data1_offset], LX_NAND_PAGE_TYPE_USER_DATA_RELEASED | logical_sector); /* Write the page. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_write)(nand_flash, block, available_pages, (UCHAR*)nand_flash -> lx_nand_flash_page_buffer, spare_buffer_ptr, 1); +#else status = (nand_flash -> lx_nand_flash_driver_pages_write)(block, available_pages, (UCHAR*)nand_flash -> lx_nand_flash_page_buffer, spare_buffer_ptr, 1); +#endif /* Check for an error from flash driver. */ if (status) diff --git a/common/src/lx_nand_flash_sector_write.c b/common/src/lx_nand_flash_sector_write.c index e31ccd5..673218c 100644 --- a/common/src/lx_nand_flash_sector_write.c +++ b/common/src/lx_nand_flash_sector_write.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_sector_write PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -88,7 +88,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_sector_write(LX_NAND_FLASH *nand_flash, ULONG logical_sector, VOID *buffer) @@ -253,7 +253,11 @@ UINT copy_block = LX_FALSE; page = new_block_status & LX_NAND_BLOCK_STATUS_PAGE_NUMBER_MASK; /* Write the page. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nand_flash -> lx_nand_flash_driver_pages_write)(nand_flash, new_block, page, (UCHAR*)buffer, spare_buffer_ptr, 1); +#else status = (nand_flash -> lx_nand_flash_driver_pages_write)(new_block, page, (UCHAR*)buffer, spare_buffer_ptr, 1); +#endif /* Check for an error from flash driver. */ if (status) diff --git a/common/src/lx_nand_flash_sectors_read.c b/common/src/lx_nand_flash_sectors_read.c index 2ac356f..0b2b9a0 100644 --- a/common/src/lx_nand_flash_sectors_read.c +++ b/common/src/lx_nand_flash_sectors_read.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_sectors_read PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -74,7 +74,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_sectors_read(LX_NAND_FLASH *nand_flash, ULONG logical_sector, VOID *buffer, ULONG sector_count) diff --git a/common/src/lx_nand_flash_sectors_release.c b/common/src/lx_nand_flash_sectors_release.c index 402ed47..04c9d8f 100644 --- a/common/src/lx_nand_flash_sectors_release.c +++ b/common/src/lx_nand_flash_sectors_release.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_sectors_release PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -72,7 +72,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_sectors_release(LX_NAND_FLASH *nand_flash, ULONG logical_sector, ULONG sector_count) diff --git a/common/src/lx_nand_flash_sectors_write.c b/common/src/lx_nand_flash_sectors_write.c index c0c59d9..a457e5e 100644 --- a/common/src/lx_nand_flash_sectors_write.c +++ b/common/src/lx_nand_flash_sectors_write.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_sectors_write PORTABLE C */ -/* 6.x */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* Xiuwen Cai, Microsoft Corporation */ @@ -74,7 +74,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Xiuwen Cai Initial Version 6.x */ +/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nand_flash_sectors_write(LX_NAND_FLASH *nand_flash, ULONG logical_sector, VOID *buffer, ULONG sector_count) diff --git a/common/src/lx_nand_flash_simulator.c b/common/src/lx_nand_flash_simulator.c index 40f9cf0..6efb49a 100644 --- a/common/src/lx_nand_flash_simulator.c +++ b/common/src/lx_nand_flash_simulator.c @@ -105,12 +105,29 @@ ULONG *nand_flash_memory; UINT _lx_nand_flash_simulator_initialize(LX_NAND_FLASH *nand_flash); +UINT _lx_nand_flash_simulator_erase_all(VOID); + +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_read(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, ULONG *destination, ULONG words); +UINT _lx_nand_flash_simulator_write(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, ULONG *source, ULONG words); +UINT _lx_nand_flash_simulator_block_erase(LX_NAND_FLASH *nand_flash, ULONG block, ULONG erase_count); +UINT _lx_nand_flash_simulator_block_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block); +UINT _lx_nand_flash_simulator_page_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page); +UINT _lx_nand_flash_simulator_block_status_get(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR *bad_block_byte); +UINT _lx_nand_flash_simulator_block_status_set(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR bad_block_byte); +UINT _lx_nand_flash_simulator_extra_bytes_get(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR *destination, UINT size); +UINT _lx_nand_flash_simulator_extra_bytes_set(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR *source, UINT size); +UINT _lx_nand_flash_simulator_system_error(LX_NAND_FLASH *nand_flash, UINT error_code, ULONG block, ULONG page); + +UINT _lx_nand_flash_simulator_pages_read(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages); +UINT _lx_nand_flash_simulator_pages_write(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages); +UINT _lx_nand_flash_simulator_pages_copy(LX_NAND_FLASH *nand_flash, ULONG source_block, ULONG source_page, ULONG destination_block, ULONG destination_page, ULONG pages, UCHAR* data_buffer); +#else UINT _lx_nand_flash_simulator_read(ULONG block, ULONG page, ULONG *destination, ULONG words); UINT _lx_nand_flash_simulator_write(ULONG block, ULONG page, ULONG *source, ULONG words); UINT _lx_nand_flash_simulator_block_erase(ULONG block, ULONG erase_count); UINT _lx_nand_flash_simulator_block_erased_verify(ULONG block); UINT _lx_nand_flash_simulator_page_erased_verify(ULONG block, ULONG page); -UINT _lx_nand_flash_simulator_erase_all(VOID); UINT _lx_nand_flash_simulator_block_status_get(ULONG block, UCHAR *bad_block_byte); UINT _lx_nand_flash_simulator_block_status_set(ULONG block, UCHAR bad_block_byte); UINT _lx_nand_flash_simulator_extra_bytes_get(ULONG block, ULONG page, UCHAR *destination, UINT size); @@ -120,6 +137,7 @@ UINT _lx_nand_flash_simulator_system_error(UINT error_code, ULONG block, ULONG UINT _lx_nand_flash_simulator_pages_read(ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages); UINT _lx_nand_flash_simulator_pages_write(ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages); UINT _lx_nand_flash_simulator_pages_copy(ULONG source_block, ULONG source_page, ULONG destination_block, ULONG destination_page, ULONG pages, UCHAR* data_buffer); +#endif UINT _lx_nand_flash_simulator_page_ecc_check(ULONG block, ULONG page); UINT _lx_nand_flash_simulator_initialize(LX_NAND_FLASH *nand_flash) @@ -200,12 +218,19 @@ UINT status; return ecc_status; } +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_read(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, ULONG *destination, ULONG words) +#else UINT _lx_nand_flash_simulator_read(ULONG block, ULONG page, ULONG *destination, ULONG words) +#endif { ULONG *flash_address; UINT status; +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nand_flash); +#endif status = _lx_nand_flash_simulator_page_ecc_check(block, page); @@ -222,8 +247,11 @@ UINT status; return(status); } - +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_pages_read(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages) +#else UINT _lx_nand_flash_simulator_pages_read(ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages) +#endif { UINT i; @@ -236,7 +264,11 @@ UINT ecc_status = LX_SUCCESS; if (main_buffer) { +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = _lx_nand_flash_simulator_read(nand_flash, block, page + i, (ULONG*)(main_buffer + i * BYTES_PER_PHYSICAL_PAGE), WORDS_PER_PHYSICAL_PAGE); +#else status = _lx_nand_flash_simulator_read(block, page + i, (ULONG*)(main_buffer + i * BYTES_PER_PHYSICAL_PAGE), WORDS_PER_PHYSICAL_PAGE); +#endif if (status == LX_NAND_ERROR_CORRECTED) { ecc_status = LX_NAND_ERROR_CORRECTED; @@ -247,13 +279,20 @@ UINT ecc_status = LX_SUCCESS; break; } } - +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = _lx_nand_flash_simulator_extra_bytes_get(nand_flash, block, page + i, spare_buffer + i * SPARE_BYTES_PER_PAGE, SPARE_BYTES_PER_PAGE); +#else status = _lx_nand_flash_simulator_extra_bytes_get(block, page + i, spare_buffer + i * SPARE_BYTES_PER_PAGE, SPARE_BYTES_PER_PAGE); +#endif } return (ecc_status); } +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_write(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, ULONG *source, ULONG words) +#else UINT _lx_nand_flash_simulator_write(ULONG block, ULONG page, ULONG *source, ULONG words) +#endif { ULONG *flash_address; @@ -265,6 +304,10 @@ 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]); +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nand_flash); +#endif + /* Increment the diag info. */ nand_block_diag[block].page_writes[page]++; if (nand_block_diag[block].page_writes[page] > nand_block_diag[block].max_page_writes[page]) @@ -324,7 +367,11 @@ ULONG *page_ptr = &(nand_memory_area[block].physical_pages[page].memory[0]); return(LX_SUCCESS); } +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_pages_write(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages) +#else UINT _lx_nand_flash_simulator_pages_write(ULONG block, ULONG page, UCHAR* main_buffer, UCHAR* spare_buffer, ULONG pages) +#endif { UINT i; @@ -333,8 +380,13 @@ UINT status = LX_SUCCESS; for (i = 0; i < pages; i++) { +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + _lx_nand_flash_simulator_extra_bytes_set(nand_flash, block, page + i, spare_buffer + i * SPARE_BYTES_PER_PAGE, SPARE_BYTES_PER_PAGE); + status = _lx_nand_flash_simulator_write(nand_flash, block, page + i, (ULONG*)(main_buffer + i * BYTES_PER_PHYSICAL_PAGE), WORDS_PER_PHYSICAL_PAGE); +#else _lx_nand_flash_simulator_extra_bytes_set(block, page + i, spare_buffer + i * SPARE_BYTES_PER_PAGE, SPARE_BYTES_PER_PAGE); status = _lx_nand_flash_simulator_write(block, page + i, (ULONG*)(main_buffer + i * BYTES_PER_PHYSICAL_PAGE), WORDS_PER_PHYSICAL_PAGE); +#endif if (status == LX_INVALID_WRITE) { break; @@ -344,8 +396,11 @@ UINT status = LX_SUCCESS; return (status); } - +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_pages_copy(LX_NAND_FLASH *nand_flash, ULONG source_block, ULONG source_page, ULONG destination_block, ULONG destination_page, ULONG pages, UCHAR *data_buffer) +#else UINT _lx_nand_flash_simulator_pages_copy(ULONG source_block, ULONG source_page, ULONG destination_block, ULONG destination_page, ULONG pages, UCHAR *data_buffer) +#endif { UINT i; UINT status = LX_SUCCESS; @@ -353,12 +408,20 @@ UINT _lx_nand_flash_simulator_pages_copy(ULONG source_block, ULONG source_page, for (i = 0; i < pages; i++) { +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = _lx_nand_flash_simulator_pages_read(nand_flash, source_block, source_page + i, data_buffer, data_buffer + BYTES_PER_PHYSICAL_PAGE, 1); +#else status = _lx_nand_flash_simulator_pages_read(source_block, source_page + i, data_buffer, data_buffer + BYTES_PER_PHYSICAL_PAGE, 1); +#endif if (status != LX_SUCCESS && status != LX_NAND_ERROR_CORRECTED) { break; } - _lx_nand_flash_simulator_pages_write(destination_block, destination_page + i, data_buffer, data_buffer + BYTES_PER_PHYSICAL_PAGE, 1); +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = _lx_nand_flash_simulator_pages_write(nand_flash, destination_block, destination_page + i, data_buffer, data_buffer + BYTES_PER_PHYSICAL_PAGE, 1); +#else + status = _lx_nand_flash_simulator_pages_write(destination_block, destination_page + i, data_buffer, data_buffer + BYTES_PER_PHYSICAL_PAGE, 1); +#endif if (status != LX_SUCCESS) { break; @@ -369,7 +432,11 @@ UINT _lx_nand_flash_simulator_pages_copy(ULONG source_block, ULONG source_page, } +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_block_erase(LX_NAND_FLASH *nand_flash, ULONG block, ULONG erase_count) +#else UINT _lx_nand_flash_simulator_block_erase(ULONG block, ULONG erase_count) +#endif { ULONG *pointer; @@ -377,6 +444,9 @@ ULONG words; UINT i; LX_PARAMETER_NOT_USED(erase_count); +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nand_flash); +#endif /* Increment the diag info. */ nand_block_diag[block].erases++; @@ -431,12 +501,20 @@ UINT i, j; } +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_block_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block) +#else UINT _lx_nand_flash_simulator_block_erased_verify(ULONG block) +#endif { ULONG *word_ptr; ULONG words; +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nand_flash); +#endif + /* Determine if the block is completely erased. */ /* Pickup the pointer to the first word of the block. */ @@ -458,13 +536,20 @@ ULONG words; return(LX_SUCCESS); } - +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_page_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page) +#else UINT _lx_nand_flash_simulator_page_erased_verify(ULONG block, ULONG page) +#endif { ULONG *word_ptr; ULONG words; +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nand_flash); +#endif + /* Determine if the block is completely erased. */ /* Pickup the pointer to the first word of the block's page. */ @@ -486,10 +571,17 @@ ULONG words; return(LX_SUCCESS); } - +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_block_status_get(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR *bad_block_byte) +#else UINT _lx_nand_flash_simulator_block_status_get(ULONG block, UCHAR *bad_block_byte) +#endif { +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nand_flash); +#endif + /* Pickup the bad block byte and return it. */ *bad_block_byte = nand_memory_area[block].physical_pages[0].spare[BAD_BLOCK_POSITION]; @@ -497,9 +589,17 @@ UINT _lx_nand_flash_simulator_block_status_get(ULONG block, UCHAR *bad_block_by return(LX_SUCCESS); } +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_block_status_set(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR bad_block_byte) +#else UINT _lx_nand_flash_simulator_block_status_set(ULONG block, UCHAR bad_block_byte) +#endif { +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nand_flash); +#endif + /* Set the bad block byte. */ nand_memory_area[block].physical_pages[0].spare[BAD_BLOCK_POSITION] = bad_block_byte; @@ -508,12 +608,18 @@ UINT _lx_nand_flash_simulator_block_status_set(ULONG block, UCHAR bad_block_byt } - +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_extra_bytes_get(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR *destination, UINT size) +#else UINT _lx_nand_flash_simulator_extra_bytes_get(ULONG block, ULONG page, UCHAR *destination, UINT size) +#endif { UCHAR *source; +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nand_flash); +#endif /* Setup source pointer in the spare area. */ source = (UCHAR *) &(nand_memory_area[block].physical_pages[page].spare[EXTRA_BYTE_POSITION]); @@ -530,12 +636,18 @@ UCHAR *source; return(LX_SUCCESS); } - +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_extra_bytes_set(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR *source, UINT size) +#else UINT _lx_nand_flash_simulator_extra_bytes_set(ULONG block, ULONG page, UCHAR *source, UINT size) +#endif { UCHAR *destination; +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nand_flash); +#endif /* Increment the diag info. */ nand_block_diag[block].page_writes[page]++; @@ -557,11 +669,18 @@ UCHAR *destination; return(LX_SUCCESS); } +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nand_flash_simulator_system_error(LX_NAND_FLASH *nand_flash, UINT error_code, ULONG block, ULONG page) +#else UINT _lx_nand_flash_simulator_system_error(UINT error_code, ULONG block, ULONG page) +#endif { LX_PARAMETER_NOT_USED(error_code); LX_PARAMETER_NOT_USED(block); LX_PARAMETER_NOT_USED(page); +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nand_flash); +#endif /* Custom processing goes here... all errors except for LX_NAND_ERROR_CORRECTED are fatal. */ return(LX_ERROR); diff --git a/common/src/lx_nand_flash_system_error.c b/common/src/lx_nand_flash_system_error.c index b5021cc..b24a944 100644 --- a/common/src/lx_nand_flash_system_error.c +++ b/common/src/lx_nand_flash_system_error.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nand_flash_system_error PORTABLE C */ -/* 6.1.7 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -77,6 +77,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ VOID _lx_nand_flash_system_error(LX_NAND_FLASH *nand_flash, UINT error_code, ULONG block, ULONG page) @@ -105,7 +108,11 @@ VOID _lx_nand_flash_system_error(LX_NAND_FLASH *nand_flash, UINT error_code, UL { /* Yes, call the driver's system error handler. */ +#ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + (nand_flash -> lx_nand_flash_driver_system_error)(nand_flash, error_code, block, page); +#else (nand_flash -> lx_nand_flash_driver_system_error)(error_code, block, page); +#endif } } diff --git a/common/src/lx_nor_flash_driver_block_erase.c b/common/src/lx_nor_flash_driver_block_erase.c index c867b36..942f6f2 100644 --- a/common/src/lx_nor_flash_driver_block_erase.c +++ b/common/src/lx_nor_flash_driver_block_erase.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nor_flash_driver_block_erase PORTABLE C */ -/* 6.1.7 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -76,6 +76,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nor_flash_driver_block_erase(LX_NOR_FLASH *nor_flash, ULONG block, ULONG erase_count) @@ -118,7 +121,11 @@ ULONG *cache_entry_end; #endif /* Call the actual driver block erase function. */ +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nor_flash -> lx_nor_flash_driver_block_erase)(nor_flash, block, erase_count); +#else status = (nor_flash -> lx_nor_flash_driver_block_erase)(block, erase_count); +#endif /* Return completion status. */ return(status); diff --git a/common/src/lx_nor_flash_driver_read.c b/common/src/lx_nor_flash_driver_read.c index b659289..8b69ca6 100644 --- a/common/src/lx_nor_flash_driver_read.c +++ b/common/src/lx_nor_flash_driver_read.c @@ -39,8 +39,8 @@ /* */ /* FUNCTION RELEASE */ /* */ -/* _lx_nor_flash_extended_cache_read PORTABLE C */ -/* 6.1.7 */ +/* _lx_nor_flash_extended_cache_read PORTABLE C */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -77,6 +77,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nor_flash_driver_read(LX_NOR_FLASH *nor_flash, ULONG *flash_address, ULONG *destination, ULONG words) @@ -160,10 +163,16 @@ UINT least_used_cache_entry; cache_entry_start = nor_flash -> lx_nor_flash_base_address + cache_offset; /* Call the actual driver read function. */ +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nor_flash -> lx_nor_flash_driver_read)(nor_flash, cache_entry_start, + nor_flash -> lx_nor_flash_extended_cache[least_used_cache_entry].lx_nor_flash_extended_cache_entry_sector_memory, + LX_NOR_SECTOR_SIZE); +#else status = (nor_flash -> lx_nor_flash_driver_read)(cache_entry_start, nor_flash -> lx_nor_flash_extended_cache[least_used_cache_entry].lx_nor_flash_extended_cache_entry_sector_memory, LX_NOR_SECTOR_SIZE); - +#endif + /* Determine if there was an error. */ if (status != LX_SUCCESS) { @@ -191,7 +200,11 @@ UINT least_used_cache_entry; { /* Call the actual driver read function. */ +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nor_flash -> lx_nor_flash_driver_read)(nor_flash, flash_address, destination, words); +#else status = (nor_flash -> lx_nor_flash_driver_read)(flash_address, destination, words); +#endif /* Return completion status. */ return(status); @@ -201,7 +214,11 @@ UINT status; /* Call the actual driver read function. */ +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nor_flash -> lx_nor_flash_driver_read)(nor_flash, flash_address, destination, words); +#else status = (nor_flash -> lx_nor_flash_driver_read)(flash_address, destination, words); +#endif /* Return completion status. */ return(status); diff --git a/common/src/lx_nor_flash_driver_write.c b/common/src/lx_nor_flash_driver_write.c index 0dec68f..1125e02 100644 --- a/common/src/lx_nor_flash_driver_write.c +++ b/common/src/lx_nor_flash_driver_write.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nor_flash_driver_write PORTABLE C */ -/* 6.1.7 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -77,6 +77,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nor_flash_driver_write(LX_NOR_FLASH *nor_flash, ULONG *flash_address, ULONG *source, ULONG words) @@ -126,8 +129,12 @@ ULONG cache_offset; } /* In any case, call the actual driver write function. */ +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nor_flash -> lx_nor_flash_driver_write)(nor_flash, flash_address, source, words); +#else status = (nor_flash -> lx_nor_flash_driver_write)(flash_address, source, words); - +#endif + /* Return completion status. */ return(status); @@ -136,7 +143,11 @@ UINT status; /* Call the actual driver write function. */ +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nor_flash -> lx_nor_flash_driver_write)(nor_flash, flash_address, source, words); +#else status = (nor_flash -> lx_nor_flash_driver_write)(flash_address, source, words); +#endif /* Return completion status. */ return(status); diff --git a/common/src/lx_nor_flash_open.c b/common/src/lx_nor_flash_open.c index 2b805dd..9fecd0d 100644 --- a/common/src/lx_nor_flash_open.c +++ b/common/src/lx_nor_flash_open.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nor_flash_open PORTABLE C */ -/* 6.1.7 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -92,6 +92,9 @@ /* 06-02-2021 Bhupendra Naphade Modified comment(s), and */ /* updated product constants */ /* resulting in version 6.1.7 */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ UINT _lx_nor_flash_open(LX_NOR_FLASH *nor_flash, CHAR *name, UINT (*nor_driver_initialize)(LX_NOR_FLASH *)) @@ -393,7 +396,11 @@ LX_INTERRUPT_SAVE_AREA nor_flash -> lx_nor_flash_diagnostic_erased_block++; /* Check to see if the block is erased. */ +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + status = (nor_flash -> lx_nor_flash_driver_block_erased_verify)(nor_flash, l); +#else status = (nor_flash -> lx_nor_flash_driver_block_erased_verify)(l); +#endif /* Is the block completely erased? */ if (status != LX_SUCCESS) diff --git a/common/src/lx_nor_flash_simulator.c b/common/src/lx_nor_flash_simulator.c index f68c08e..02b2d09 100644 --- a/common/src/lx_nor_flash_simulator.c +++ b/common/src/lx_nor_flash_simulator.c @@ -60,13 +60,20 @@ FLASH_BLOCK nor_memory_area[TOTAL_BLOCKS]; ULONG nor_sector_memory[WORDS_PER_PHYSICAL_SECTOR]; UINT _lx_nor_flash_simulator_initialize(LX_NOR_FLASH *nor_flash); +UINT _lx_nor_flash_simulator_erase_all(VOID); +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nor_flash_simulator_read(LX_NOR_FLASH *nor_flash, ULONG *flash_address, ULONG *destination, ULONG words); +UINT _lx_nor_flash_simulator_write(LX_NOR_FLASH *nor_flash, ULONG *flash_address, ULONG *source, ULONG words); +UINT _lx_nor_flash_simulator_block_erase(LX_NOR_FLASH *nor_flash, ULONG block, ULONG erase_count); +UINT _lx_nor_flash_simulator_block_erased_verify(LX_NOR_FLASH *nor_flash, ULONG block); +UINT _lx_nor_flash_simulator_system_error(LX_NOR_FLASH *nor_flash, UINT error_code, ULONG block, ULONG sector); +#else UINT _lx_nor_flash_simulator_read(ULONG *flash_address, ULONG *destination, ULONG words); UINT _lx_nor_flash_simulator_write(ULONG *flash_address, ULONG *source, ULONG words); UINT _lx_nor_flash_simulator_block_erase(ULONG block, ULONG erase_count); UINT _lx_nor_flash_simulator_block_erased_verify(ULONG block); -UINT _lx_nor_flash_simulator_erase_all(VOID); UINT _lx_nor_flash_simulator_system_error(UINT error_code, ULONG block, ULONG sector); - +#endif UINT _lx_nor_flash_simulator_initialize(LX_NOR_FLASH *nor_flash) @@ -92,10 +99,17 @@ UINT _lx_nor_flash_simulator_initialize(LX_NOR_FLASH *nor_flash) return(LX_SUCCESS); } - +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nor_flash_simulator_read(LX_NOR_FLASH *nor_flash, ULONG *flash_address, ULONG *destination, ULONG words) +#else UINT _lx_nor_flash_simulator_read(ULONG *flash_address, ULONG *destination, ULONG words) +#endif { +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nor_flash); +#endif + /* Loop to read flash. */ while (words--) { @@ -107,9 +121,17 @@ UINT _lx_nor_flash_simulator_read(ULONG *flash_address, ULONG *destination, ULO } +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nor_flash_simulator_write(LX_NOR_FLASH *nor_flash, ULONG *flash_address, ULONG *source, ULONG words) +#else UINT _lx_nor_flash_simulator_write(ULONG *flash_address, ULONG *source, ULONG words) +#endif { +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nor_flash); +#endif + /* Loop to write flash. */ while (words--) { @@ -121,12 +143,19 @@ UINT _lx_nor_flash_simulator_write(ULONG *flash_address, ULONG *source, ULONG w return(LX_SUCCESS); } +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nor_flash_simulator_block_erase(LX_NOR_FLASH *nor_flash, ULONG block, ULONG erase_count) +#else UINT _lx_nor_flash_simulator_block_erase(ULONG block, ULONG erase_count) +#endif { ULONG *pointer; ULONG words; +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nor_flash); +#endif LX_PARAMETER_NOT_USED(erase_count); /* Setup pointer. */ @@ -168,12 +197,20 @@ ULONG words; } +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nor_flash_simulator_block_erased_verify(LX_NOR_FLASH *nor_flash, ULONG block) +#else UINT _lx_nor_flash_simulator_block_erased_verify(ULONG block) +#endif { ULONG *word_ptr; ULONG words; +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nor_flash); +#endif + /* Determine if the block is completely erased. */ /* Pickup the pointer to the first word of the block. */ @@ -195,8 +232,16 @@ ULONG words; return(LX_SUCCESS); } +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE +UINT _lx_nor_flash_simulator_system_error(LX_NOR_FLASH *nor_flash, UINT error_code, ULONG block, ULONG sector) +#else UINT _lx_nor_flash_simulator_system_error(UINT error_code, ULONG block, ULONG sector) +#endif { + +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + LX_PARAMETER_NOT_USED(nor_flash); +#endif LX_PARAMETER_NOT_USED(error_code); LX_PARAMETER_NOT_USED(block); LX_PARAMETER_NOT_USED(sector); diff --git a/common/src/lx_nor_flash_system_error.c b/common/src/lx_nor_flash_system_error.c index 746e868..e545430 100644 --- a/common/src/lx_nor_flash_system_error.c +++ b/common/src/lx_nor_flash_system_error.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _lx_nor_flash_system_error PORTABLE C */ -/* 6.1.7 */ +/* 6.2.1 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -75,6 +75,9 @@ /* resulting in version 6.1 */ /* 06-02-2021 Bhupendra Naphade Modified comment(s), */ /* resulting in version 6.1.7 */ +/* 03-08-2023 Xiuwen Cai Modified comment(s), */ +/* added new driver interface, */ +/* resulting in version 6.2.1 */ /* */ /**************************************************************************/ VOID _lx_nor_flash_system_error(LX_NOR_FLASH *nor_flash, UINT error_code) @@ -91,7 +94,11 @@ VOID _lx_nor_flash_system_error(LX_NOR_FLASH *nor_flash, UINT error_code) { /* Yes, call the driver's system error handler. */ +#ifdef LX_NOR_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE + (nor_flash -> lx_nor_flash_driver_system_error)(nor_flash, error_code); +#else (nor_flash -> lx_nor_flash_driver_system_error)(error_code); +#endif } }