mirror of
https://github.com/eclipse-threadx/levelx.git
synced 2026-09-14 04:06:00 +08:00
Add new levelx APIs
New APIs -------- - lx_nor_flash_format(): erases nor flash blocks and setup block metadata - lx_nor_flash_open_extended(): same as lx_nor_flash_open() with user data pointer a last argument. - lx_nand_flash_open_extended(): same as lx_nand_flash_open() with user data pointer a last argument. Updates ------- - lx_nor_flash_open(): calls lx_nor_flash_open_extended() with a NULL as last argument - lx_nand_flash_open(): calls lx_nand_flash_open_extended() with a NULL as last argument - regression tests: to call the lx_nor_flash_format() Test results ------------- 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.27 sec 3/3 Test #1: standalone_free_sector_verify_build::levelx_nand_flash_test ........ Passed 6.29 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.29 sec 3/3 Test #1: nor_obsolete_mapping_cache_build::levelx_nand_flash_test ........ Passed 6.58 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.58 sec 3/3 Test #1: nor_obsolete_cache_build::levelx_nand_flash_test ........ Passed 6.67 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.67 sec 3/3 Test #1: nor_mapping_cache_build::levelx_nand_flash_test ........ Passed 6.77 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.78 sec 3/3 Test #1: full_build::levelx_nand_flash_test ........ Passed 6.91 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.91 sec 3/3 Test #1: free_sector_verify_build::levelx_nand_flash_test ........ Passed 7.14 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 7.14 sec 3/3 Test #1: standalone_full_build::levelx_nand_flash_test ........ Passed 7.21 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 7.21 sec 3/3 Test #1: standalone_build::levelx_nand_flash_test ........ Passed 12.05 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 12.06 sec 3/3 Test #1: default_build_coverage::levelx_nand_flash_test ........ Passed 48.78 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 48.81 sec Add new levelx APIs New APIs -------- - lx_nor_flash_format(): erases nor flash blocks and setup block metadata - lx_nor_flash_open_extended(): same as lx_nor_flash_open() with user data pointer a last argument. - lx_nand_flash_open_extended(): same as lx_nand_flash_open() with user data pointer a last argument. Updates ------- - lx_nor_flash_open(): calls lx_nor_flash_open_extended() with a NULL as last argument - lx_nand_flash_open(): calls lx_nand_flash_open_extended() with a NULL as last argument - regression tests: to call the lx_nor_flash_format() Test results ------------- 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.27 sec 3/3 Test #1: standalone_free_sector_verify_build::levelx_nand_flash_test ........ Passed 6.29 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.29 sec 3/3 Test #1: nor_obsolete_mapping_cache_build::levelx_nand_flash_test ........ Passed 6.58 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.58 sec 3/3 Test #1: nor_obsolete_cache_build::levelx_nand_flash_test ........ Passed 6.67 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.67 sec 3/3 Test #1: nor_mapping_cache_build::levelx_nand_flash_test ........ Passed 6.77 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.78 sec 3/3 Test #1: full_build::levelx_nand_flash_test ........ Passed 6.91 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 6.91 sec 3/3 Test #1: free_sector_verify_build::levelx_nand_flash_test ........ Passed 7.14 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 7.14 sec 3/3 Test #1: standalone_full_build::levelx_nand_flash_test ........ Passed 7.21 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 7.21 sec 3/3 Test #1: standalone_build::levelx_nand_flash_test ........ Passed 12.05 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 12.06 sec 3/3 Test #1: default_build_coverage::levelx_nand_flash_test ........ Passed 48.78 sec 100% tests passed, 0 tests failed out of 3 Total Test time (real) = 48.81 sec fix: Write the correct meta data on the block after erase add missing nand_flash_format_extended API
This commit is contained in:
+19
-4
@@ -1,6 +1,7 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2024 Microsoft Corporation
|
||||
*
|
||||
* Copyright (c) 2024 Microsoft Corporation
|
||||
* Portion Copyright (c) 2025 STMicroelectronics
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the MIT License which is available at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
@@ -528,7 +529,6 @@ typedef struct LX_NAND_FLASH_STRUCT
|
||||
#endif
|
||||
UCHAR *lx_nand_flash_page_buffer;
|
||||
UINT lx_nand_flash_page_buffer_size;
|
||||
|
||||
#ifdef LX_THREAD_SAFE_ENABLE
|
||||
|
||||
/* When this conditional is used, the LevelX code utilizes a ThreadX mutex for thread
|
||||
@@ -537,6 +537,8 @@ typedef struct LX_NAND_FLASH_STRUCT
|
||||
TX_MUTEX lx_nand_flash_mutex;
|
||||
#endif
|
||||
|
||||
/* user data pointer optionally passed by the application to the driver via the lx_nand_flash_open_extended */
|
||||
VOID *lx_nand_flash_driver_info_ptr;
|
||||
/* 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;
|
||||
@@ -666,7 +668,8 @@ typedef struct LX_NOR_FLASH_STRUCT
|
||||
a higher layer. */
|
||||
TX_MUTEX lx_nor_flash_mutex;
|
||||
#endif
|
||||
|
||||
/* user data pointer optionally passed by the application to the driver via the lx_nor_flash_open_extended */
|
||||
VOID *lx_nor_flash_driver_info_ptr;
|
||||
/* Define the NOR flash control block open next/previous pointers. */
|
||||
struct LX_NOR_FLASH_STRUCT *lx_nor_flash_open_next,
|
||||
*lx_nor_flash_open_previous;
|
||||
@@ -725,8 +728,10 @@ extern ULONG _lx_nor_flash_opened_cou
|
||||
#define lx_nand_flash_partial_defragment _lx_nand_flash_partial_defragment
|
||||
#define lx_nand_flash_extended_cache_enable _lx_nand_flash_extended_cache_enable
|
||||
#define lx_nand_flash_format _lx_nand_flash_format
|
||||
#define lx_nand_flash_format_extended _lx_nand_flash_format_extended
|
||||
#define lx_nand_flash_initialize _lx_nand_flash_initialize
|
||||
#define lx_nand_flash_open _lx_nand_flash_open
|
||||
#define lx_nand_flash_open_extended _lx_nand_flash_open_extended
|
||||
#define lx_nand_flash_page_ecc_check _lx_nand_flash_page_ecc_check
|
||||
#define lx_nand_flash_page_ecc_compute _lx_nand_flash_page_ecc_compute
|
||||
#define lx_nand_flash_sector_read _lx_nand_flash_sector_read
|
||||
@@ -743,7 +748,9 @@ extern ULONG _lx_nor_flash_opened_cou
|
||||
#define lx_nor_flash_partial_defragment _lx_nor_flash_partial_defragment
|
||||
#define lx_nor_flash_extended_cache_enable _lx_nor_flash_extended_cache_enable
|
||||
#define lx_nor_flash_initialize _lx_nor_flash_initialize
|
||||
#define lx_nor_flash_format _lx_nor_flash_format
|
||||
#define lx_nor_flash_open _lx_nor_flash_open
|
||||
#define lx_nor_flash_open_extended _lx_nor_flash_open_extended
|
||||
#define lx_nor_flash_sector_read _lx_nor_flash_sector_read
|
||||
#define lx_nor_flash_sector_release _lx_nor_flash_sector_release
|
||||
#define lx_nor_flash_sector_write _lx_nor_flash_sector_write
|
||||
@@ -759,7 +766,13 @@ UINT _lx_nand_flash_extended_cache_enable(LX_NAND_FLASH *nand_flash, VOID *m
|
||||
UINT _lx_nand_flash_format(LX_NAND_FLASH* nand_flash, CHAR* name,
|
||||
UINT(*nand_driver_initialize)(LX_NAND_FLASH*),
|
||||
ULONG* memory_ptr, UINT memory_size);
|
||||
UINT _lx_nand_flash_format_extended(LX_NAND_FLASH* nand_flash, CHAR* name,
|
||||
UINT(*nand_driver_initialize)(LX_NAND_FLASH*), VOID *nand_driver_info_ptr,
|
||||
ULONG* memory_ptr, UINT memory_size);
|
||||
UINT _lx_nand_flash_open(LX_NAND_FLASH *nand_flash, CHAR *name, UINT (*nand_driver_initialize)(LX_NAND_FLASH *), ULONG* memory_ptr, UINT memory_size);
|
||||
UINT _lx_nand_flash_open_extended(LX_NAND_FLASH *nand_flash, CHAR *name,
|
||||
UINT (*nand_driver_initialize)(LX_NAND_FLASH *), VOID *nand_driver_info_ptr,
|
||||
ULONG* memory_ptr, UINT memory_size);
|
||||
UINT _lx_nand_flash_page_ecc_check(LX_NAND_FLASH *nand_flash, UCHAR *page_buffer, UCHAR *ecc_buffer);
|
||||
UINT _lx_nand_flash_page_ecc_compute(LX_NAND_FLASH *nand_flash, UCHAR *page_buffer, UCHAR *ecc_buffer);
|
||||
UINT _lx_nand_flash_partial_defragment(LX_NAND_FLASH *nand_flash, UINT max_blocks);
|
||||
@@ -774,7 +787,9 @@ UINT _lx_nor_flash_close(LX_NOR_FLASH *nor_flash);
|
||||
UINT _lx_nor_flash_defragment(LX_NOR_FLASH *nor_flash);
|
||||
UINT _lx_nor_flash_extended_cache_enable(LX_NOR_FLASH *nor_flash, VOID *memory, ULONG size);
|
||||
UINT _lx_nor_flash_initialize(void);
|
||||
UINT _lx_nor_flash_format(LX_NOR_FLASH *nor_flash, CHAR *name, UINT (*nor_driver_initialize)(LX_NOR_FLASH *), VOID *nor_driver_info_ptr);
|
||||
UINT _lx_nor_flash_open(LX_NOR_FLASH *nor_flash, CHAR *name, UINT (*nor_driver_initialize)(LX_NOR_FLASH *));
|
||||
UINT _lx_nor_flash_open_extended(LX_NOR_FLASH *nor_flash, CHAR *name, UINT (*nor_driver_initialize)(LX_NOR_FLASH *), VOID *nor_driver_info_ptr);
|
||||
UINT _lx_nor_flash_partial_defragment(LX_NOR_FLASH *nor_flash, UINT max_blocks);
|
||||
UINT _lx_nor_flash_sector_read(LX_NOR_FLASH *nor_flash, ULONG logical_sector, VOID *buffer);
|
||||
UINT _lx_nor_flash_sector_release(LX_NOR_FLASH *nor_flash, ULONG logical_sector);
|
||||
|
||||
Reference in New Issue
Block a user