mirror of
https://github.com/eclipse-threadx/levelx.git
synced 2026-09-14 12:37:01 +08:00
Updated copyright headers and removed trailing whitespace
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2024 Microsoft Corporation
|
||||
*
|
||||
* Copyright (c) 2024 Microsoft Corporation
|
||||
* Copyright (c) 2026-present Eclipse ThreadX contributors
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the MIT License which is available at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/**************************************************************************/
|
||||
/** */
|
||||
/** LevelX Component */
|
||||
/** */
|
||||
/** LevelX Component */
|
||||
/** */
|
||||
/** NAND Flash */
|
||||
/** */
|
||||
@@ -34,49 +35,43 @@
|
||||
#include "lx_api.h"
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _lx_nand_flash_sector_read PORTABLE C */
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION RELEASE */
|
||||
/* */
|
||||
/* _lx_nand_flash_sector_read PORTABLE C */
|
||||
/* 6.2.1 */
|
||||
/* AUTHOR */
|
||||
/* */
|
||||
/* Xiuwen Cai, Microsoft Corporation */
|
||||
/* */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* This function reads a logical sector from NAND flash. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* nand_flash NAND flash instance */
|
||||
/* logical_sector Logical sector number */
|
||||
/* buffer Pointer to buffer to read into*/
|
||||
/* (the size is number of */
|
||||
/* bytes in a page) */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* return status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _lx_nand_flash_block_find Find the mapped block */
|
||||
/* lx_nand_flash_driver_pages_read Read pages */
|
||||
/* _lx_nand_flash_system_error Internal system error handler */
|
||||
/* tx_mutex_get Get thread protection */
|
||||
/* tx_mutex_put Release thread protection */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/* RELEASE HISTORY */
|
||||
/* */
|
||||
/* DATE NAME DESCRIPTION */
|
||||
/* DESCRIPTION */
|
||||
/* */
|
||||
/* 03-08-2023 Xiuwen Cai Initial Version 6.2.1 */
|
||||
/* This function reads a logical sector from NAND flash. */
|
||||
/* */
|
||||
/* INPUT */
|
||||
/* */
|
||||
/* nand_flash NAND flash instance */
|
||||
/* logical_sector Logical sector number */
|
||||
/* buffer Pointer to buffer to read into*/
|
||||
/* (the size is number of */
|
||||
/* bytes in a page) */
|
||||
/* */
|
||||
/* OUTPUT */
|
||||
/* */
|
||||
/* return status */
|
||||
/* */
|
||||
/* CALLS */
|
||||
/* */
|
||||
/* _lx_nand_flash_block_find Find the mapped block */
|
||||
/* lx_nand_flash_driver_pages_read Read pages */
|
||||
/* _lx_nand_flash_system_error Internal system error handler */
|
||||
/* tx_mutex_get Get thread protection */
|
||||
/* tx_mutex_put Release thread protection */
|
||||
/* */
|
||||
/* CALLED BY */
|
||||
/* */
|
||||
/* Application Code */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
UINT _lx_nand_flash_sector_read(LX_NAND_FLASH *nand_flash, ULONG logical_sector, VOID *buffer)
|
||||
@@ -126,7 +121,7 @@ LONG page;
|
||||
/* Determine if the block is mapped. */
|
||||
if (block != LX_NAND_BLOCK_UNMAPPED)
|
||||
{
|
||||
|
||||
|
||||
/* Setup spare buffer pointer. */
|
||||
spare_buffer_ptr = (UCHAR*)nand_flash -> lx_nand_flash_page_buffer;
|
||||
|
||||
@@ -162,7 +157,7 @@ LONG page;
|
||||
/* Return an error. */
|
||||
return(LX_ERROR);
|
||||
}
|
||||
|
||||
|
||||
/* Get the logical sector number from spare bytes, and check if it matches the addressed sector number. */
|
||||
if ((LX_UTILITY_LONG_GET(&spare_buffer_ptr[nand_flash -> lx_nand_flash_spare_data1_offset]) & LX_NAND_PAGE_TYPE_USER_DATA_MASK) == logical_sector)
|
||||
{
|
||||
@@ -240,14 +235,14 @@ LONG page;
|
||||
|
||||
/* Setup pointer to users buffer. */
|
||||
word_ptr = (ULONG *) buffer;
|
||||
|
||||
|
||||
/* Put all ones in he buffer. */
|
||||
for (i = 0; i < nand_flash -> lx_nand_flash_words_per_page; i++)
|
||||
{
|
||||
|
||||
|
||||
/* Copy a word. */
|
||||
*word_ptr++ = LX_ALL_ONES;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the status to success. */
|
||||
status = LX_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user