mirror of
https://github.com/eclipse-threadx/levelx.git
synced 2026-09-14 20:48:51 +08:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f639bac26 | ||
|
|
9075ca321b | ||
|
|
c53a6c6bca | ||
|
|
bbab2bbf6b | ||
|
|
79cefa16a4 | ||
|
|
e848ac3db2 | ||
|
|
fdf7799991 | ||
|
|
61f92c00c7 |
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
|
||||
|
||||
# Set up the project
|
||||
project(levelx
|
||||
VERSION 6.0.0
|
||||
LANGUAGES C ASM
|
||||
)
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ Azure RTOS provides OEMs with components to secure communication and to create c
|
||||
|
||||
# Licensing
|
||||
|
||||
License terms for using Azure RTOS are defined in the LICENSE.txt file of this repo. Please refer to this file for all definitive licensing information. No additional license fees are required for deploying Azure RTOS on hardware defined in the LICENSED-HARDWARE.txt file. If you are using hardware not defined in the LICENSED-HARDWARE.txt file or have licensing questions in general, please contact Microsoft directly at https://azure-rtos.ms-iot-contact.com/
|
||||
License terms for using Azure RTOS are defined in the LICENSE.txt file of this repo. Please refer to this file for all definitive licensing information. No additional license fees are required for deploying Azure RTOS on hardware defined in the LICENSED-HARDWARE.txt file. If you are using hardware not defined in the LICENSED-HARDWARE.txt file or have licensing questions in general, please contact Microsoft directly at https://aka.ms/azrtos-license.
|
||||
|
||||
# Contribution, feedback, issues, and professional support
|
||||
|
||||
@@ -81,11 +81,14 @@ Professional support plans (https://azure.microsoft.com/en-us/support/options/)
|
||||
# Additional Resources
|
||||
|
||||
The following are references to additional Azure RTOS and Azure IoT in general:
|
||||
| | |
|
||||
| Content | Link |
|
||||
|---|---|
|
||||
| Azure RTOS Documenation and Guides: | https://docs.microsoft.com/azure/rtos |
|
||||
| TraceX Installer | https://aka.ms/azrtos-tracex-installer |
|
||||
| Azure RTOS Documentation and Guides: | https://docs.microsoft.com/azure/rtos |
|
||||
| Azure RTOS Website: | https://azure.microsoft.com/services/rtos/ |
|
||||
| Azure RTOS Sales Questions: | https://azure-rtos.ms-iot-contact.com/ |
|
||||
| For technical questions check out Microsoft Q/A for Azure IoT: | https://aka.ms/QnA/azure-rtos |
|
||||
| Internet of Things Show for latest announcements and online training: | https://aka.ms/iotshow |
|
||||
| IoT Tech Community: | https://aka.ms/community/azure-rtos |
|
||||
| Azure RTOS Sales Questions: | https://aka.ms/azrtos-license |
|
||||
| Azure RTOS Product Support Policy | https://aka.ms/azrtos/lts |
|
||||
| Azure RTOS Functional Safety Artifacts | https://aka.ms/azrtos/tuv |
|
||||
| For technical questions check out Microsoft Q/A for Azure IoT | https://aka.ms/QnA/azure-rtos |
|
||||
| Internet of Things Show for latest announcements and online training | https://aka.ms/iotshow |
|
||||
| IoT Tech Community | https://aka.ms/community/azure-rtos |
|
||||
|
||||
+29
-8
@@ -26,7 +26,7 @@
|
||||
/* APPLICATION INTERFACE DEFINITION RELEASE */
|
||||
/* */
|
||||
/* lx_api.h PORTABLE C */
|
||||
/* 6.1.7 */
|
||||
/* 6.1.12 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -55,6 +55,23 @@
|
||||
/* 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 */
|
||||
/* 04-25-2022 William E. Lamie Modified comment(s), and */
|
||||
/* updated product constants, */
|
||||
/* resulting in version 6.1.11 */
|
||||
/* 07-29-2022 William E. Lamie Modified comment(s), and */
|
||||
/* updated product constants, */
|
||||
/* resulting in version 6.1.12 */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
@@ -72,12 +89,6 @@ extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
/* Include necessary system files. */
|
||||
|
||||
#ifndef LX_STANDALONE_ENABLE
|
||||
#include "tx_api.h"
|
||||
#endif
|
||||
|
||||
/* Determine if the optional LevelX user define file should be used. */
|
||||
|
||||
#ifdef LX_INCLUDE_USER_DEFINE_FILE
|
||||
@@ -89,6 +100,12 @@ extern "C" {
|
||||
#include "lx_user.h"
|
||||
#endif
|
||||
|
||||
/* Include the ThreadX api file. */
|
||||
|
||||
#ifndef LX_STANDALONE_ENABLE
|
||||
#include "tx_api.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LX_STANDALONE_ENABLE
|
||||
|
||||
@@ -159,7 +176,7 @@ typedef unsigned long long ULONG64;
|
||||
#define AZURE_RTOS_LEVELX
|
||||
#define LEVELX_MAJOR_VERSION 6
|
||||
#define LEVELX_MINOR_VERSION 1
|
||||
#define LEVELX_PATCH_VERSION 7
|
||||
#define LEVELX_PATCH_VERSION 12
|
||||
|
||||
|
||||
/* Define general LevelX Constants. */
|
||||
@@ -251,6 +268,10 @@ typedef unsigned long long ULONG64;
|
||||
#define LX_NAND_ERASE_COUNT_WRITE_SIZE (nand_flash -> lx_nand_flash_pages_per_block + 1)
|
||||
#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
|
||||
into 4 entry pieces that are indexed by the formula:
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _lx_nand_flash_block_obsoleted_check PORTABLE C */
|
||||
/* 6.1.7 */
|
||||
/* 6.1.9 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -86,6 +86,10 @@
|
||||
/* 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)
|
||||
@@ -316,22 +320,11 @@ UINT status;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
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. */
|
||||
if (status)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _lx_nand_flash_block_reclaim PORTABLE C */
|
||||
/* 6.1.7 */
|
||||
/* 6.1.9 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -88,6 +88,13 @@
|
||||
/* 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)
|
||||
@@ -131,7 +138,7 @@ UINT status;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
@@ -215,22 +222,11 @@ UINT status;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
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. */
|
||||
if (status)
|
||||
{
|
||||
@@ -575,22 +571,11 @@ UINT status;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
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. */
|
||||
if (status)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _lx_nand_flash_open PORTABLE C */
|
||||
/* 6.1.7 */
|
||||
/* 6.1.9 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -94,6 +94,10 @@
|
||||
/* 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 *))
|
||||
@@ -282,22 +286,11 @@ LX_INTERRUPT_SAVE_AREA
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
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. */
|
||||
if (status)
|
||||
{
|
||||
@@ -498,18 +491,9 @@ LX_INTERRUPT_SAVE_AREA
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Write the initial 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;
|
||||
status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, LX_NAND_ERASE_COUNT_WRITE_SIZE);
|
||||
}
|
||||
/* Write the final erase count for the block. */
|
||||
page_word_ptr[0] = max_erased_count;
|
||||
status = _lx_nand_flash_driver_write(nand_flash, block, 0, page_word_ptr, 1);
|
||||
|
||||
/* Check for an error from flash driver. */
|
||||
if (status)
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#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 */
|
||||
|
||||
|
||||
/* 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:
|
||||
|
||||
@@ -169,7 +168,13 @@ UINT _lx_nand_flash_simulator_write(ULONG block, ULONG page, ULONG *source, ULO
|
||||
{
|
||||
|
||||
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. */
|
||||
nand_block_diag[block].page_writes[page]++;
|
||||
@@ -192,6 +197,41 @@ ULONG *flash_address;
|
||||
*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);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _lx_nor_flash_extended_cache_enable PORTABLE C */
|
||||
/* 6.1.7 */
|
||||
/* 6.1.9 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* William E. Lamie, Microsoft Corporation */
|
||||
@@ -80,6 +80,10 @@
|
||||
/* 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)
|
||||
@@ -135,7 +139,16 @@ ULONG *cache_memory;
|
||||
}
|
||||
|
||||
/* Save the number of cache entries. */
|
||||
nor_flash -> lx_nor_flash_extended_cache_entries = i;
|
||||
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;
|
||||
}
|
||||
|
||||
#ifdef LX_THREAD_SAFE_ENABLE
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ int main(void)
|
||||
tx_kernel_enter();
|
||||
#else
|
||||
|
||||
/* Initialize NAND flash. */
|
||||
lx_nand_flash_initialize();
|
||||
/* Initialize NOR flash. */
|
||||
lx_nor_flash_initialize();
|
||||
|
||||
/* Initialize FileX. */
|
||||
fx_system_initialize();
|
||||
|
||||
Reference in New Issue
Block a user