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