lx_nand_flash_format.c
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************************************************** | ||
| 2 | * Copyright (c) 2024 Microsoft Corporation | ||
| 3 | * Copyright (c) 2026-present Eclipse ThreadX contributors | ||
| 4 | * Copyright (c) 2025 STMicroelectronics | ||
| 5 | * | ||
| 6 | * This program and the accompanying materials are made available under the | ||
| 7 | * terms of the MIT License which is available at | ||
| 8 | * https://opensource.org/licenses/MIT. | ||
| 9 | * | ||
| 10 | * SPDX-License-Identifier: MIT | ||
| 11 | **************************************************************************/ | ||
| 12 | |||
| 13 | |||
| 14 | /**************************************************************************/ | ||
| 15 | /**************************************************************************/ | ||
| 16 | /** */ | ||
| 17 | /** LevelX Component */ | ||
| 18 | /** */ | ||
| 19 | /** NAND Flash */ | ||
| 20 | /** */ | ||
| 21 | /**************************************************************************/ | ||
| 22 | /**************************************************************************/ | ||
| 23 | |||
| 24 | #define LX_SOURCE_CODE | ||
| 25 | |||
| 26 | |||
| 27 | /* Disable ThreadX error checking. */ | ||
| 28 | |||
| 29 | #ifndef LX_DISABLE_ERROR_CHECKING | ||
| 30 | #define LX_DISABLE_ERROR_CHECKING | ||
| 31 | #endif | ||
| 32 | |||
| 33 | |||
| 34 | /* Include necessary system files. */ | ||
| 35 | |||
| 36 | #include "lx_api.h" | ||
| 37 | |||
| 38 | |||
| 39 | /**************************************************************************/ | ||
| 40 | /* */ | ||
| 41 | /* FUNCTION RELEASE */ | ||
| 42 | /* */ | ||
| 43 | /* _lx_nand_flash_format PORTABLE C */ | ||
| 44 | /* */ | ||
| 45 | /* AUTHOR */ | ||
| 46 | /* */ | ||
| 47 | /* Xiuwen Cai, Microsoft Corporation */ | ||
| 48 | /* */ | ||
| 49 | /* DESCRIPTION */ | ||
| 50 | /* */ | ||
| 51 | /* This function erases and formats a NAND flash. */ | ||
| 52 | /* */ | ||
| 53 | /* INPUT */ | ||
| 54 | /* */ | ||
| 55 | /* nand_flash NAND flash instance */ | ||
| 56 | /* name Name of NAND flash instance */ | ||
| 57 | /* nand_driver_initialize Driver initialize */ | ||
| 58 | /* memory_ptr Pointer to memory used by the */ | ||
| 59 | /* LevelX for this NAND. */ | ||
| 60 | /* memory_size Size of memory - must at least*/ | ||
| 61 | /* 7 * total block count + */ | ||
| 62 | /* 2 * page size */ | ||
| 63 | /* */ | ||
| 64 | /* OUTPUT */ | ||
| 65 | /* */ | ||
| 66 | /* return status */ | ||
| 67 | /* */ | ||
| 68 | /* CALLS */ | ||
| 69 | /* _lx_nand_flash_format_extended */ | ||
| 70 | /* */ | ||
| 71 | /* CALLED BY */ | ||
| 72 | /* */ | ||
| 73 | /* Application Code */ | ||
| 74 | /* */ | ||
| 75 | /**************************************************************************/ | ||
| 76 | 40 | UINT _lx_nand_flash_format(LX_NAND_FLASH* nand_flash, CHAR* name, | |
| 77 | UINT(*nand_driver_initialize)(LX_NAND_FLASH*), | ||
| 78 | ULONG* memory_ptr, UINT memory_size) | ||
| 79 | { | ||
| 80 | |||
| 81 | UINT status; | ||
| 82 | |||
| 83 | 40 | status = _lx_nand_flash_format_extended(nand_flash, name, nand_driver_initialize, NULL, memory_ptr, memory_size); | |
| 84 | |||
| 85 | 40 | return status; | |
| 86 | } | ||
| 87 |