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
Bo Chen d4089f56e3 Release 6.1.7 2021-06-02 06:46:59 +00:00
Scott Larson d42808cdeb add renesas RA 2021-04-05 16:04:14 -07:00
Scott Larson c1d0fb9275 Update LICENSED-HARDWARE.txt 2021-04-01 14:36:20 -07:00
Scott Larson 6eadbd6d97 update to v6.1.3 2021-01-07 16:36:28 -08:00
Scott Larson f11f115a41 fix date 2020-12-15 10:18:28 -08:00
Scott Larson ce04276ace update nxp 2020-12-15 10:09:09 -08:00
Scott Larson 6b20a667e3 add mediatek 2020-12-11 14:49:43 -08:00
Scott Larson 2af719ed1a add ST to hw list 2020-11-17 09:33:27 -08:00
57 changed files with 529 additions and 250 deletions
+31 -5
View File
@@ -2,10 +2,11 @@ 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
) )
option(LX_STANDALONE_ENABLE "Enable LevelX in standalone mode" OFF)
if(NOT DEFINED THREADX_ARCH) if(NOT DEFINED THREADX_ARCH)
message(FATAL_ERROR "Error: THREADX_ARCH not defined") message(FATAL_ERROR "Error: THREADX_ARCH not defined")
endif() endif()
@@ -19,14 +20,38 @@ add_library(${PROJECT_NAME})
add_library("azrtos::${PROJECT_NAME}" ALIAS ${PROJECT_NAME}) add_library("azrtos::${PROJECT_NAME}" ALIAS ${PROJECT_NAME})
# Define any required dependencies between this library and others # Define any required dependencies between this library and others
target_link_libraries(${PROJECT_NAME} PUBLIC if(NOT LX_STANDALONE_ENABLE)
"azrtos::threadx" target_link_libraries(${PROJECT_NAME} PUBLIC
"azrtos::filex" "azrtos::threadx")
) endif()
# A place for generated/copied include files (no need to change)
set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc)
# Pick up the common stuff # Pick up the common stuff
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common) add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/common)
# Include the user's override file if required
if (NOT LX_USER_FILE)
message(STATUS "Using default lx_user.h file")
set(LX_USER_FILE ${CMAKE_CURRENT_LIST_DIR}/common/inc/lx_user_sample.h)
else()
message(STATUS "Using custom lx_user.h file from ${LX_USER_FILE}")
endif()
configure_file(${LX_USER_FILE} ${CUSTOM_INC_DIR}/lx_user.h COPYONLY)
target_include_directories(${PROJECT_NAME}
PUBLIC
${CUSTOM_INC_DIR}
)
if(NOT LX_STANDALONE_ENABLE)
target_compile_definitions(${PROJECT_NAME} PUBLIC "LX_INCLUDE_USER_DEFINE_FILE" )
else()
# Enable LevelX and FileX standalone support (No Azure RTOS support)
set(FX_STANDALONE_ENABLE ON CACHE BOOL "Standalone enable")
target_compile_definitions(${PROJECT_NAME} PUBLIC "LX_INCLUDE_USER_DEFINE_FILE" -DLX_STANDALONE_ENABLE -DFX_STANDALONE_ENABLE)
endif()
# Enable a build target that produces a ZIP file of all sources # Enable a build target that produces a ZIP file of all sources
set(CPACK_SOURCE_GENERATOR "ZIP") set(CPACK_SOURCE_GENERATOR "ZIP")
set(CPACK_SOURCE_IGNORE_FILES set(CPACK_SOURCE_IGNORE_FILES
@@ -40,3 +65,4 @@ set(CPACK_SOURCE_IGNORE_FILES
) )
set(CPACK_VERBATIM_VARIABLES YES) set(CPACK_VERBATIM_VARIABLES YES)
include(CPack) include(CPack)
+16 -2
View File
@@ -1,6 +1,6 @@
LICENSED HARDWARE LIST LICENSED HARDWARE LIST
Last Updated: 2020-10-15 Last Updated: 2021-04-01
Microsoft has entered into OEM Agreements with manufacturers of the following Microsoft has entered into OEM Agreements with manufacturers of the following
microprocessors and microcontrollers (the “hardware”) to enable those microprocessors and microcontrollers (the “hardware”) to enable those
@@ -11,6 +11,16 @@ Production Use” rights in Section 2 of the Microsoft Software License Terms fo
Microsoft Azure RTOS. If hardware is not listed below, you do not have those Microsoft Azure RTOS. If hardware is not listed below, you do not have those
rights. rights.
STMicroelectronics:
STM32 MCUs
STM32 MPUs
MediaTek:
MT3620 MCU (Azure Sphere)
Microchip: Microchip:
PIC 32-bit MCUs PIC 32-bit MCUs
@@ -18,12 +28,16 @@ Microchip:
SAM 32-bit MPUs SAM 32-bit MPUs
NXP: NXP:
i.MX RT105x/6x cross over MCUs
i.MX RT10xx and RT116x/7x series crossover MCUs
LPC5500 series
Renesas: Renesas:
Synergy Platform Synergy Platform
RX Family of MCUs RX Family of MCUs
RA Family of MCUs
RZ Family of MPUs RZ Family of MPUs
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
+88 -6
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.2 */ /* 6.1.10 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -49,6 +49,23 @@
/* added support for lx_user.h */ /* added support for lx_user.h */
/* so user can specify values, */ /* so user can specify values, */
/* resulting in version 6.1.2 */ /* resulting in version 6.1.2 */
/* 12-31-2020 William E. Lamie Modified comment(s), and */
/* updated product constants, */
/* resulting in version 6.1.3 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* added standalone support, */
/* 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 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
@@ -66,10 +83,6 @@ extern "C" {
#endif #endif
/* Include necessary system files. */
#include "tx_api.h"
/* 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
@@ -81,6 +94,71 @@ 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
/* Define compiler library include files. */
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#ifndef VOID
#define VOID void
typedef char CHAR;
typedef char BOOL;
typedef unsigned char UCHAR;
typedef int INT;
typedef unsigned int UINT;
typedef long LONG;
typedef unsigned long ULONG;
typedef short SHORT;
typedef unsigned short USHORT;
#endif
#ifndef ULONG64_DEFINED
#define ULONG64_DEFINED
typedef unsigned long long ULONG64;
#endif
/* Define basic alignment type used in block and byte pool operations. This data type must
be at least 32-bits in size and also be large enough to hold a pointer type. */
#ifndef ALIGN_TYPE_DEFINED
#define ALIGN_TYPE_DEFINED
#define ALIGN_TYPE ULONG
#endif
/* Define the LX_MEMSET macro to the standard library function, if not already defined. */
#ifndef LX_MEMSET
#define LX_MEMSET(a,b,c) memset((a),(b),(c))
#endif
/* Disable usage of ThreadX mutex in standalone mode */
#ifdef LX_THREAD_SAFE_ENABLE
#undef LX_THREAD_SAFE_ENABLE
#endif
#define LX_INTERRUPT_SAVE_AREA
#define LX_DISABLE
#define LX_RESTORE
#else
#define LX_MEMSET TX_MEMSET
#define LX_INTERRUPT_SAVE_AREA TX_INTERRUPT_SAVE_AREA
#define LX_DISABLE TX_DISABLE
#define LX_RESTORE TX_RESTORE
#endif
/* Disable warning of parameter not used. */ /* Disable warning of parameter not used. */
#ifndef LX_PARAMETER_NOT_USED #ifndef LX_PARAMETER_NOT_USED
@@ -92,7 +170,7 @@ extern "C" {
#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 2 #define LEVELX_PATCH_VERSION 10
/* Define general LevelX Constants. */ /* Define general LevelX Constants. */
@@ -184,6 +262,10 @@ extern "C" {
#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:
+8 -1
View File
@@ -26,7 +26,7 @@
/* PORT SPECIFIC C INFORMATION RELEASE */ /* PORT SPECIFIC C INFORMATION RELEASE */
/* */ /* */
/* lx_user.h PORTABLE C */ /* lx_user.h PORTABLE C */
/* 6.1.2 */ /* 6.1.7 */
/* */ /* */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
@@ -45,6 +45,9 @@
/* DATE NAME DESCRIPTION */ /* DATE NAME DESCRIPTION */
/* */ /* */
/* 11-09-2020 William E. Lamie Initial Version 6.1.2 */ /* 11-09-2020 William E. Lamie Initial Version 6.1.2 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), and */
/* added standalone support, */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
@@ -113,6 +116,10 @@
#define LX_THREAD_SAFE_ENABLE #define LX_THREAD_SAFE_ENABLE
*/ */
/* Defined, LevelX will be used in standalone mode (without Azure RTOS ThreadX) */
/* #define LX_STANDALONE_ENABLE */
#endif #endif
+3 -2
View File
@@ -23,7 +23,6 @@
/* Include necessary system files. */ /* Include necessary system files. */
#include "tx_api.h"
#include "fx_api.h" #include "fx_api.h"
#include "lx_api.h" #include "lx_api.h"
@@ -69,7 +68,7 @@ VOID _fx_nand_flash_simulator_driver(FX_MEDIA *media_ptr);
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _fx_nand_simulator_driver PORTABLE C */ /* _fx_nand_simulator_driver PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -122,6 +121,8 @@ VOID _fx_nand_flash_simulator_driver(FX_MEDIA *media_ptr);
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
VOID _fx_nand_flash_simulator_driver(FX_MEDIA *media_ptr) VOID _fx_nand_flash_simulator_driver(FX_MEDIA *media_ptr)
+3 -2
View File
@@ -23,7 +23,6 @@
/* Include necessary system files. */ /* Include necessary system files. */
#include "tx_api.h"
#include "fx_api.h" #include "fx_api.h"
#include "lx_api.h" #include "lx_api.h"
@@ -65,7 +64,7 @@ VOID _fx_nor_flash_simulator_driver(FX_MEDIA *media_ptr);
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _fx_nor_flash_simulator_driver PORTABLE C */ /* _fx_nor_flash_simulator_driver PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -118,6 +117,8 @@ VOID _fx_nor_flash_simulator_driver(FX_MEDIA *media_ptr);
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
VOID _fx_nor_flash_simulator_driver(FX_MEDIA *media_ptr) VOID _fx_nor_flash_simulator_driver(FX_MEDIA *media_ptr)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_256byte_ecc_check PORTABLE C */ /* _lx_nand_flash_256byte_ecc_check PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -74,6 +74,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_256byte_ecc_check(UCHAR *page_buffer, UCHAR *ecc_buffer) UINT _lx_nand_flash_256byte_ecc_check(UCHAR *page_buffer, UCHAR *ecc_buffer)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_256byte_ecc_compute PORTABLE C */ /* _lx_nand_flash_256byte_ecc_compute PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -75,6 +75,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_256byte_ecc_compute(UCHAR *page_buffer, UCHAR *ecc_buffer) UINT _lx_nand_flash_256byte_ecc_compute(UCHAR *page_buffer, UCHAR *ecc_buffer)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_block_full_update PORTABLE C */ /* _lx_nand_flash_block_full_update PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -78,6 +78,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_block_full_update(LX_NAND_FLASH *nand_flash, ULONG block, ULONG erase_count) UINT _lx_nand_flash_block_full_update(LX_NAND_FLASH *nand_flash, ULONG block, ULONG erase_count)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -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 */ /* 6.1.9 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -84,6 +84,12 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* 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)
@@ -314,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)
{ {
+15 -28
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_block_reclaim PORTABLE C */ /* _lx_nand_flash_block_reclaim PORTABLE C */
/* 6.1 */ /* 6.1.9 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -86,6 +86,15 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* 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)
@@ -129,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. */
@@ -213,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)
{ {
@@ -573,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 -6
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_close PORTABLE C */ /* _lx_nand_flash_close PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -72,16 +72,18 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_close(LX_NAND_FLASH *nand_flash) UINT _lx_nand_flash_close(LX_NAND_FLASH *nand_flash)
{ {
TX_INTERRUPT_SAVE_AREA LX_INTERRUPT_SAVE_AREA
/* Lockout interrupts for NAND flash close. */ /* Lockout interrupts for NAND flash close. */
TX_DISABLE LX_DISABLE
/* See if the media is the only one on the media opened list. */ /* See if the media is the only one on the media opened list. */
if ((_lx_nand_flash_opened_ptr == nand_flash) && if ((_lx_nand_flash_opened_ptr == nand_flash) &&
@@ -117,7 +119,7 @@ TX_INTERRUPT_SAVE_AREA
nand_flash -> lx_nand_flash_state = LX_NAND_FLASH_CLOSED; nand_flash -> lx_nand_flash_state = LX_NAND_FLASH_CLOSED;
/* Restore interrupt posture. */ /* Restore interrupt posture. */
TX_RESTORE LX_RESTORE
#ifdef LX_THREAD_SAFE_ENABLE #ifdef LX_THREAD_SAFE_ENABLE
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_defragment PORTABLE C */ /* _lx_nand_flash_defragment PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -75,6 +75,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_defragment(LX_NAND_FLASH *nand_flash) UINT _lx_nand_flash_defragment(LX_NAND_FLASH *nand_flash)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_driver_block_erase PORTABLE C */ /* _lx_nand_flash_driver_block_erase PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -74,6 +74,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_driver_block_erase(LX_NAND_FLASH *nand_flash, ULONG block, ULONG erase_count) UINT _lx_nand_flash_driver_block_erase(LX_NAND_FLASH *nand_flash, ULONG block, ULONG erase_count)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_driver_block_erased_verify PORTABLE C */ /* _lx_nand_flash_driver_block_erased_verify PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -75,6 +75,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_driver_block_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block) UINT _lx_nand_flash_driver_block_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_driver_block_status_get PORTABLE C */ /* _lx_nand_flash_driver_block_status_get PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -76,6 +76,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_driver_block_status_get(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR *bad_block_flag) UINT _lx_nand_flash_driver_block_status_get(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR *bad_block_flag)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_driver_block_status_set PORTABLE C */ /* _lx_nand_flash_driver_block_status_set PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -76,6 +76,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_driver_block_status_set(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR bad_block_flag) UINT _lx_nand_flash_driver_block_status_set(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR bad_block_flag)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_driver_extra_bytes_get PORTABLE C */ /* _lx_nand_flash_driver_extra_bytes_get PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -77,6 +77,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_driver_extra_bytes_get(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR *destination, UINT size) UINT _lx_nand_flash_driver_extra_bytes_get(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR *destination, UINT size)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_driver_extra_bytes_set PORTABLE C */ /* _lx_nand_flash_driver_extra_bytes_set PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -78,6 +78,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_driver_extra_bytes_set(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR *source, UINT size) UINT _lx_nand_flash_driver_extra_bytes_set(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, UCHAR *source, UINT size)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_driver_page_erased_verify PORTABLE C */ /* _lx_nand_flash_driver_page_erased_verify PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -75,6 +75,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_driver_page_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page) UINT _lx_nand_flash_driver_page_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_driver_read PORTABLE C */ /* _lx_nand_flash_driver_read PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -76,6 +76,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_driver_read(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, ULONG *destination, ULONG words) UINT _lx_nand_flash_driver_read(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, ULONG *destination, ULONG words)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_driver_write PORTABLE C */ /* _lx_nand_flash_driver_write PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -76,6 +76,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_driver_write(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, ULONG *source, ULONG words) UINT _lx_nand_flash_driver_write(LX_NAND_FLASH *nand_flash, ULONG block, ULONG page, ULONG *source, ULONG words)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_extended_cache_enable PORTABLE C */ /* _lx_nand_flash_extended_cache_enable PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -77,6 +77,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_extended_cache_enable(LX_NAND_FLASH *nand_flash, VOID *memory, ULONG size) UINT _lx_nand_flash_extended_cache_enable(LX_NAND_FLASH *nand_flash, VOID *memory, ULONG size)
@@ -91,13 +93,13 @@ ULONG i;
working_ptr = (UCHAR *) memory; working_ptr = (UCHAR *) memory;
/* Check for a NULL pointer. If NULL, disable all the caches. */ /* Check for a NULL pointer. If NULL, disable all the caches. */
if (working_ptr == TX_NULL) if (working_ptr == LX_NULL)
{ {
/* Disable all extended caches. */ /* Disable all extended caches. */
nand_flash -> lx_nand_flash_block_status_cache = TX_NULL; nand_flash -> lx_nand_flash_block_status_cache = LX_NULL;
nand_flash -> lx_nand_flash_page_extra_bytes_cache = TX_NULL; nand_flash -> lx_nand_flash_page_extra_bytes_cache = LX_NULL;
nand_flash -> lx_nand_flash_page_0_cache = TX_NULL; nand_flash -> lx_nand_flash_page_0_cache = LX_NULL;
/* Return success! */ /* Return success! */
return(LX_SUCCESS); return(LX_SUCCESS);
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_logical_sector_find PORTABLE C */ /* _lx_nand_flash_logical_sector_find PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -85,6 +85,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_logical_sector_find(LX_NAND_FLASH *nand_flash, ULONG logical_sector, ULONG superceded_check, ULONG *block, ULONG *page) UINT _lx_nand_flash_logical_sector_find(LX_NAND_FLASH *nand_flash, ULONG logical_sector, ULONG superceded_check, ULONG *block, ULONG *page)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_next_block_to_erase_find PORTABLE C */ /* _lx_nand_flash_next_block_to_erase_find PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -82,6 +82,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_next_block_to_erase_find(LX_NAND_FLASH *nand_flash, ULONG *return_erase_block, ULONG *return_erase_count, ULONG *return_mapped_pages, ULONG *return_obsolete_pages) UINT _lx_nand_flash_next_block_to_erase_find(LX_NAND_FLASH *nand_flash, ULONG *return_erase_block, ULONG *return_erase_count, ULONG *return_mapped_pages, ULONG *return_obsolete_pages)
+17 -31
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_open PORTABLE C */ /* _lx_nand_flash_open PORTABLE C */
/* 6.1 */ /* 6.1.9 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -92,6 +92,12 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* 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 *))
@@ -115,12 +121,12 @@ LX_NAND_FLASH *tail_ptr;
ULONG logical_sector; ULONG logical_sector;
#endif #endif
TX_INTERRUPT_SAVE_AREA LX_INTERRUPT_SAVE_AREA
LX_PARAMETER_NOT_USED(name); LX_PARAMETER_NOT_USED(name);
/* Clear the NAND flash control block. */ /* Clear the NAND flash control block. */
TX_MEMSET(nand_flash, 0, sizeof(LX_NAND_FLASH)); LX_MEMSET(nand_flash, 0, sizeof(LX_NAND_FLASH));
/* Call the flash driver's initialization function. */ /* Call the flash driver's initialization function. */
(nand_driver_initialize)(nand_flash); (nand_driver_initialize)(nand_flash);
@@ -280,22 +286,11 @@ TX_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)
{ {
@@ -496,18 +491,9 @@ TX_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)
@@ -905,7 +891,7 @@ TX_INTERRUPT_SAVE_AREA
status = tx_mutex_create(&nand_flash -> lx_nand_flash_mutex, "NAND Flash Mutex", TX_NO_INHERIT); status = tx_mutex_create(&nand_flash -> lx_nand_flash_mutex, "NAND Flash Mutex", TX_NO_INHERIT);
/* Determine if the mutex creation encountered an error. */ /* Determine if the mutex creation encountered an error. */
if (status != TX_SUCCESS) if (status != LX_SUCCESS)
{ {
/* Call system error handler, since this should not happen. */ /* Call system error handler, since this should not happen. */
@@ -927,7 +913,7 @@ TX_INTERRUPT_SAVE_AREA
nand_flash -> lx_nand_flash_max_mapped_sector = max_mapped_sector; nand_flash -> lx_nand_flash_max_mapped_sector = max_mapped_sector;
/* Lockout interrupts. */ /* Lockout interrupts. */
TX_DISABLE LX_DISABLE
/* At this point, the NAND flash has been opened successfully. Place the /* At this point, the NAND flash has been opened successfully. Place the
NAND flash control block on the linked list of currently opened NAND flashes. */ NAND flash control block on the linked list of currently opened NAND flashes. */
@@ -966,7 +952,7 @@ TX_INTERRUPT_SAVE_AREA
_lx_nand_flash_opened_count++; _lx_nand_flash_opened_count++;
/* Restore interrupts. */ /* Restore interrupts. */
TX_RESTORE LX_RESTORE
/* Return a successful completion. */ /* Return a successful completion. */
return(LX_SUCCESS); return(LX_SUCCESS);
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_page_ecc_check PORTABLE C */ /* _lx_nand_flash_page_ecc_check PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -75,6 +75,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_page_ecc_check(LX_NAND_FLASH *nand_flash, UCHAR *page_buffer, UCHAR *ecc_buffer) UINT _lx_nand_flash_page_ecc_check(LX_NAND_FLASH *nand_flash, UCHAR *page_buffer, UCHAR *ecc_buffer)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_page_ecc_compute PORTABLE C */ /* _lx_nand_flash_page_ecc_compute PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -74,6 +74,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_page_ecc_compute(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)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_partial_defragment PORTABLE C */ /* _lx_nand_flash_partial_defragment PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -78,6 +78,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_partial_defragment(LX_NAND_FLASH *nand_flash, UINT max_blocks) UINT _lx_nand_flash_partial_defragment(LX_NAND_FLASH *nand_flash, UINT max_blocks)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_physical_page_allocate PORTABLE C */ /* _lx_nand_flash_physical_page_allocate PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -85,6 +85,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_physical_page_allocate(LX_NAND_FLASH *nand_flash, ULONG *block, ULONG *page, ULONG *erase_count) UINT _lx_nand_flash_physical_page_allocate(LX_NAND_FLASH *nand_flash, ULONG *block, ULONG *page, ULONG *erase_count)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_sector_mapping_cache_invalidate PORTABLE C */ /* _lx_nand_flash_sector_mapping_cache_invalidate PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -74,6 +74,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
VOID _lx_nand_flash_sector_mapping_cache_invalidate(LX_NAND_FLASH *nand_flash, ULONG logical_sector) VOID _lx_nand_flash_sector_mapping_cache_invalidate(LX_NAND_FLASH *nand_flash, ULONG logical_sector)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_sector_read PORTABLE C */ /* _lx_nand_flash_sector_read PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -80,6 +80,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_sector_read(LX_NAND_FLASH *nand_flash, ULONG logical_sector, VOID *buffer) UINT _lx_nand_flash_sector_read(LX_NAND_FLASH *nand_flash, ULONG logical_sector, VOID *buffer)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_sector_release PORTABLE C */ /* _lx_nand_flash_sector_release PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -85,6 +85,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_sector_release(LX_NAND_FLASH *nand_flash, ULONG logical_sector) UINT _lx_nand_flash_sector_release(LX_NAND_FLASH *nand_flash, ULONG logical_sector)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_sector_write PORTABLE C */ /* _lx_nand_flash_sector_write PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -90,6 +90,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nand_flash_sector_write(LX_NAND_FLASH *nand_flash, ULONG logical_sector, VOID *buffer) UINT _lx_nand_flash_sector_write(LX_NAND_FLASH *nand_flash, ULONG logical_sector, VOID *buffer)
+42 -3
View File
@@ -23,7 +23,6 @@
/* Include necessary files. */ /* Include necessary files. */
#include "tx_api.h"
#include "lx_api.h" #include "lx_api.h"
/* Define constants for the NAND flash simulation. */ /* Define constants for the NAND flash simulation. */
@@ -38,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:
@@ -170,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]++;
@@ -193,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);
} }
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nand_flash_system_error PORTABLE C */ /* _lx_nand_flash_system_error PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -75,6 +75,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
VOID _lx_nand_flash_system_error(LX_NAND_FLASH *nand_flash, UINT error_code, ULONG block, ULONG page) VOID _lx_nand_flash_system_error(LX_NAND_FLASH *nand_flash, UINT error_code, ULONG block, ULONG page)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_block_reclaim PORTABLE C */ /* _lx_nor_flash_block_reclaim PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -81,6 +81,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_block_reclaim(LX_NOR_FLASH *nor_flash) UINT _lx_nor_flash_block_reclaim(LX_NOR_FLASH *nor_flash)
+8 -6
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_close PORTABLE C */ /* _lx_nor_flash_close PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -72,16 +72,18 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_close(LX_NOR_FLASH *nor_flash) UINT _lx_nor_flash_close(LX_NOR_FLASH *nor_flash)
{ {
TX_INTERRUPT_SAVE_AREA LX_INTERRUPT_SAVE_AREA
/* Lockout interrupts for NOR flash close. */ /* Lockout interrupts for NOR flash close. */
TX_DISABLE LX_DISABLE
/* See if the media is the only one on the media opened list. */ /* See if the media is the only one on the media opened list. */
if ((_lx_nor_flash_opened_ptr == nor_flash) && if ((_lx_nor_flash_opened_ptr == nor_flash) &&
@@ -117,7 +119,7 @@ TX_INTERRUPT_SAVE_AREA
nor_flash -> lx_nor_flash_state = LX_NOR_FLASH_CLOSED; nor_flash -> lx_nor_flash_state = LX_NOR_FLASH_CLOSED;
/* Restore interrupt posture. */ /* Restore interrupt posture. */
TX_RESTORE LX_RESTORE
#ifdef LX_THREAD_SAFE_ENABLE #ifdef LX_THREAD_SAFE_ENABLE
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_defragment PORTABLE C */ /* _lx_nor_flash_defragment PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -75,6 +75,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_defragment(LX_NOR_FLASH *nor_flash) UINT _lx_nor_flash_defragment(LX_NOR_FLASH *nor_flash)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_driver_block_erase PORTABLE C */ /* _lx_nor_flash_driver_block_erase PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -74,6 +74,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_driver_block_erase(LX_NOR_FLASH *nor_flash, ULONG block, ULONG erase_count) UINT _lx_nor_flash_driver_block_erase(LX_NOR_FLASH *nor_flash, ULONG block, ULONG erase_count)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_extended_cache_read PORTABLE C */ /* _lx_nor_flash_extended_cache_read PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -75,6 +75,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_driver_read(LX_NOR_FLASH *nor_flash, ULONG *flash_address, ULONG *destination, ULONG words) UINT _lx_nor_flash_driver_read(LX_NOR_FLASH *nor_flash, ULONG *flash_address, ULONG *destination, ULONG words)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_driver_write PORTABLE C */ /* _lx_nor_flash_driver_write PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -75,6 +75,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_driver_write(LX_NOR_FLASH *nor_flash, ULONG *flash_address, ULONG *source, ULONG words) UINT _lx_nor_flash_driver_write(LX_NOR_FLASH *nor_flash, ULONG *flash_address, ULONG *source, ULONG words)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -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 */ /* 6.1.9 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -74,6 +74,16 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 12-31-2020 William E. Lamie Modified comment(s), */
/* fixed compiler warnings, */
/* resulting in version 6.1.3 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), and */
/* updated product constants */
/* 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)
@@ -129,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
@@ -141,6 +160,10 @@ ULONG *cache_memory;
return(LX_SUCCESS); return(LX_SUCCESS);
#else #else
LX_PARAMETER_NOT_USED(nor_flash);
LX_PARAMETER_NOT_USED(memory);
LX_PARAMETER_NOT_USED(size);
/* Return disabled error message. */ /* Return disabled error message. */
return(LX_DISABLED); return(LX_DISABLED);
#endif #endif
+3 -1
View File
@@ -39,7 +39,7 @@ ULONG _lx_nor_flash_opened_count;
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_initialize PORTABLE C */ /* _lx_nor_flash_initialize PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -71,6 +71,8 @@ ULONG _lx_nor_flash_opened_count;
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_initialize(void) UINT _lx_nor_flash_initialize(void)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_logical_sector_find PORTABLE C */ /* _lx_nor_flash_logical_sector_find PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -83,6 +83,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_logical_sector_find(LX_NOR_FLASH *nor_flash, ULONG logical_sector, ULONG superceded_check, ULONG **physical_sector_map_entry, ULONG **physical_sector_address) UINT _lx_nor_flash_logical_sector_find(LX_NOR_FLASH *nor_flash, ULONG logical_sector, ULONG superceded_check, ULONG **physical_sector_map_entry, ULONG **physical_sector_address)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_next_block_to_erase_find PORTABLE C */ /* _lx_nor_flash_next_block_to_erase_find PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -79,6 +79,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_next_block_to_erase_find(LX_NOR_FLASH *nor_flash, ULONG *return_erase_block, ULONG *return_erase_count, ULONG *return_mapped_sectors, ULONG *return_obsolete_sectors) UINT _lx_nor_flash_next_block_to_erase_find(LX_NOR_FLASH *nor_flash, ULONG *return_erase_block, ULONG *return_erase_count, ULONG *return_mapped_sectors, ULONG *return_obsolete_sectors)
+15 -9
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_open PORTABLE C */ /* _lx_nor_flash_open PORTABLE C */
/* 6.1.2 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -86,6 +86,12 @@
/* 11-09-2020 William E. Lamie Modified comment(s), */ /* 11-09-2020 William E. Lamie Modified comment(s), */
/* fixed compiler warnings, */ /* fixed compiler warnings, */
/* resulting in version 6.1.2 */ /* resulting in version 6.1.2 */
/* 12-30-2020 William E. Lamie Modified comment(s), */
/* fixed compiler warnings, */
/* resulting in version 6.1.3 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), and */
/* updated product constants */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_open(LX_NOR_FLASH *nor_flash, CHAR *name, UINT (*nor_driver_initialize)(LX_NOR_FLASH *)) UINT _lx_nor_flash_open(LX_NOR_FLASH *nor_flash, CHAR *name, UINT (*nor_driver_initialize)(LX_NOR_FLASH *))
@@ -111,12 +117,12 @@ ULONG *sector_word_ptr;
ULONG sector_word; ULONG sector_word;
#endif #endif
LX_NOR_FLASH *tail_ptr; LX_NOR_FLASH *tail_ptr;
TX_INTERRUPT_SAVE_AREA LX_INTERRUPT_SAVE_AREA
LX_PARAMETER_NOT_USED(name); LX_PARAMETER_NOT_USED(name);
/* Clear the NOR flash control block. */ /* Clear the NOR flash control block. */
TX_MEMSET(nor_flash, 0, sizeof(LX_NOR_FLASH)); LX_MEMSET(nor_flash, 0, sizeof(LX_NOR_FLASH));
/* Call the flash driver's initialization function. */ /* Call the flash driver's initialization function. */
(nor_driver_initialize)(nor_flash); (nor_driver_initialize)(nor_flash);
@@ -751,7 +757,7 @@ TX_INTERRUPT_SAVE_AREA
/* Read the word directly. */ /* Read the word directly. */
sector_word = *(sector_word_ptr); sector_word = *(sector_word_ptr);
#else #else
status = _lx_nor_flash_driver_read((sector_word_ptr), &sector_word, 1); status = _lx_nor_flash_driver_read(nor_flash, (sector_word_ptr), &sector_word, 1);
/* Check for an error from flash driver. Drivers should never return an error.. */ /* Check for an error from flash driver. Drivers should never return an error.. */
if (status) if (status)
@@ -811,7 +817,7 @@ TX_INTERRUPT_SAVE_AREA
status = tx_mutex_create(&nor_flash -> lx_nor_flash_mutex, "NOR Flash Mutex", TX_NO_INHERIT); status = tx_mutex_create(&nor_flash -> lx_nor_flash_mutex, "NOR Flash Mutex", TX_NO_INHERIT);
/* Determine if the mutex creation encountered an error. */ /* Determine if the mutex creation encountered an error. */
if (status != TX_SUCCESS) if (status != LX_SUCCESS)
{ {
/* Call system error handler, since this should not happen. */ /* Call system error handler, since this should not happen. */
@@ -830,7 +836,7 @@ TX_INTERRUPT_SAVE_AREA
nor_flash -> lx_nor_flash_found_sector_search = 0; nor_flash -> lx_nor_flash_found_sector_search = 0;
/* Lockout interrupts. */ /* Lockout interrupts. */
TX_DISABLE LX_DISABLE
/* At this point, the NOR flash has been opened successfully. Place the /* At this point, the NOR flash has been opened successfully. Place the
NOR flash control block on the linked list of currently opened NOR flashes. */ NOR flash control block on the linked list of currently opened NOR flashes. */
@@ -869,7 +875,7 @@ TX_INTERRUPT_SAVE_AREA
_lx_nor_flash_opened_count++; _lx_nor_flash_opened_count++;
/* Restore interrupts. */ /* Restore interrupts. */
TX_RESTORE LX_RESTORE
/* Return a successful completion. */ /* Return a successful completion. */
return(LX_SUCCESS); return(LX_SUCCESS);
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_partial_defragment PORTABLE C */ /* _lx_nor_flash_partial_defragment PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -78,6 +78,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_partial_defragment(LX_NOR_FLASH *nor_flash, UINT max_blocks) UINT _lx_nor_flash_partial_defragment(LX_NOR_FLASH *nor_flash, UINT max_blocks)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_physical_sector_allocate PORTABLE C */ /* _lx_nor_flash_physical_sector_allocate PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -78,6 +78,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_physical_sector_allocate(LX_NOR_FLASH *nor_flash, ULONG logical_sector, ULONG **physical_sector_map_entry, ULONG **physical_sector_address) UINT _lx_nor_flash_physical_sector_allocate(LX_NOR_FLASH *nor_flash, ULONG logical_sector, ULONG **physical_sector_map_entry, ULONG **physical_sector_address)
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_sector_mapping_cache_invalidate PORTABLE C */ /* _lx_nor_flash_sector_mapping_cache_invalidate PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -74,6 +74,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
VOID _lx_nor_flash_sector_mapping_cache_invalidate(LX_NOR_FLASH *nor_flash, ULONG logical_sector) VOID _lx_nor_flash_sector_mapping_cache_invalidate(LX_NOR_FLASH *nor_flash, ULONG logical_sector)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_sector_read PORTABLE C */ /* _lx_nor_flash_sector_read PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -82,6 +82,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_sector_read(LX_NOR_FLASH *nor_flash, ULONG logical_sector, VOID *buffer) UINT _lx_nor_flash_sector_read(LX_NOR_FLASH *nor_flash, ULONG logical_sector, VOID *buffer)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_sector_release PORTABLE C */ /* _lx_nor_flash_sector_release PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -82,6 +82,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_sector_release(LX_NOR_FLASH *nor_flash, ULONG logical_sector) UINT _lx_nor_flash_sector_release(LX_NOR_FLASH *nor_flash, ULONG logical_sector)
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_sector_write PORTABLE C */ /* _lx_nor_flash_sector_write PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -85,6 +85,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
UINT _lx_nor_flash_sector_write(LX_NOR_FLASH *nor_flash, ULONG logical_sector, VOID *buffer) UINT _lx_nor_flash_sector_write(LX_NOR_FLASH *nor_flash, ULONG logical_sector, VOID *buffer)
-1
View File
@@ -23,7 +23,6 @@
/* Include necessary files. */ /* Include necessary files. */
#include "tx_api.h"
#include "lx_api.h" #include "lx_api.h"
/* Define constants for the NOR flash simulation. */ /* Define constants for the NOR flash simulation. */
+5 -3
View File
@@ -25,8 +25,8 @@
/* Disable ThreadX error checking. */ /* Disable ThreadX error checking. */
#ifndef TX_DISABLE_ERROR_CHECKING #ifndef LX_DISABLE_ERROR_CHECKING
#define TX_DISABLE_ERROR_CHECKING #define LX_DISABLE_ERROR_CHECKING
#endif #endif
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */ /* FUNCTION RELEASE */
/* */ /* */
/* _lx_nor_flash_system_error PORTABLE C */ /* _lx_nor_flash_system_error PORTABLE C */
/* 6.1 */ /* 6.1.7 */
/* AUTHOR */ /* AUTHOR */
/* */ /* */
/* William E. Lamie, Microsoft Corporation */ /* William E. Lamie, Microsoft Corporation */
@@ -73,6 +73,8 @@
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 05-19-2020 William E. Lamie Initial Version 6.0 */
/* 09-30-2020 William E. Lamie Modified comment(s), */ /* 09-30-2020 William E. Lamie Modified comment(s), */
/* resulting in version 6.1 */ /* resulting in version 6.1 */
/* 06-02-2021 Bhupendra Naphade Modified comment(s), */
/* resulting in version 6.1.7 */
/* */ /* */
/**************************************************************************/ /**************************************************************************/
VOID _lx_nor_flash_system_error(LX_NOR_FLASH *nor_flash, UINT error_code) VOID _lx_nor_flash_system_error(LX_NOR_FLASH *nor_flash, UINT error_code)
+16 -2
View File
@@ -40,20 +40,34 @@ FX_FILE my_file1;
/* Define ThreadX global data structures. */ /* Define ThreadX global data structures. */
#ifndef LX_STANDALONE_ENABLE
TX_THREAD thread_0; TX_THREAD thread_0;
#endif
ULONG thread_0_counter; ULONG thread_0_counter;
int main(void) int main(void)
{ {
/* Enter the ThreadX kernel. */ /* Enter the ThreadX kernel. */
#ifndef LX_STANDALONE_ENABLE
tx_kernel_enter(); tx_kernel_enter();
#else
/* Initialize NAND flash. */
lx_nand_flash_initialize();
/* Initialize FileX. */
fx_system_initialize();
thread_0_entry(0);
#endif
} }
/* Define what the initial system looks like. */ /* Define what the initial system looks like. */
#ifndef LX_STANDALONE_ENABLE
void tx_application_define(void *first_unused_memory) void tx_application_define(void *first_unused_memory)
{ {
@@ -72,7 +86,7 @@ void tx_application_define(void *first_unused_memory)
/* Initialize FileX. */ /* Initialize FileX. */
fx_system_initialize(); fx_system_initialize();
} }
#endif
void thread_0_entry(ULONG thread_input) void thread_0_entry(ULONG thread_input)
+16 -1
View File
@@ -39,20 +39,34 @@ FX_FILE my_file;
/* Define ThreadX global data structures. */ /* Define ThreadX global data structures. */
#ifndef LX_STANDALONE_ENABLE
TX_THREAD thread_0; TX_THREAD thread_0;
#endif
ULONG thread_0_counter; ULONG thread_0_counter;
int main(void) int main(void)
{ {
/* Enter the ThreadX kernel. */ /* Enter the ThreadX kernel. */
#ifndef LX_STANDALONE_ENABLE
tx_kernel_enter(); tx_kernel_enter();
#else
/* Initialize NAND flash. */
lx_nand_flash_initialize();
/* Initialize FileX. */
fx_system_initialize();
thread_0_entry(0);
#endif
} }
/* Define what the initial system looks like. */ /* Define what the initial system looks like. */
#ifndef LX_STANDALONE_ENABLE
void tx_application_define(void *first_unused_memory) void tx_application_define(void *first_unused_memory)
{ {
@@ -70,6 +84,7 @@ void tx_application_define(void *first_unused_memory)
/* Initialize FileX. */ /* Initialize FileX. */
fx_system_initialize(); fx_system_initialize();
} }
#endif