1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
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_open PORTABLE C */ |
43 |
|
|
/* 6.3.0 */ |
44 |
|
|
/* AUTHOR */ |
45 |
|
|
/* */ |
46 |
|
|
/* Xiuwen Cai, Microsoft Corporation */ |
47 |
|
|
/* */ |
48 |
|
|
/* DESCRIPTION */ |
49 |
|
|
/* */ |
50 |
|
|
/* This function opens a NAND flash instance and ensures the */ |
51 |
|
|
/* NAND flash is in a coherent state. */ |
52 |
|
|
/* */ |
53 |
|
|
/* INPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* nand_flash NAND flash instance */ |
56 |
|
|
/* name Name of NAND flash instance */ |
57 |
|
|
/* nand_driver_initialize Driver initialize */ |
58 |
|
|
/* nand_driver_info_ptr User data pointer */ |
59 |
|
|
/* memory_ptr Pointer to memory used by the */ |
60 |
|
|
/* LevelX for this NAND. */ |
61 |
|
|
/* memory_size Size of memory - must at least*/ |
62 |
|
|
/* 7 * total block count + */ |
63 |
|
|
/* 2 * page size */ |
64 |
|
|
/* */ |
65 |
|
|
/* OUTPUT */ |
66 |
|
|
/* */ |
67 |
|
|
/* return status */ |
68 |
|
|
/* */ |
69 |
|
|
/* CALLS */ |
70 |
|
|
/* */ |
71 |
|
|
/* lx_nand_flash_open_extended Pass NULL as driver_info_ptr */ |
72 |
|
|
/* */ |
73 |
|
|
/* CALLED BY */ |
74 |
|
|
/* */ |
75 |
|
|
/* Application Code */ |
76 |
|
|
/* */ |
77 |
|
|
/**************************************************************************/ |
78 |
|
5 |
UINT _lx_nand_flash_open(LX_NAND_FLASH *nand_flash, CHAR *name, UINT (*nand_driver_initialize)(LX_NAND_FLASH *), |
79 |
|
|
ULONG* memory_ptr, UINT memory_size) |
80 |
|
|
{ |
81 |
|
5 |
UINT status = LX_ERROR; |
82 |
|
|
|
83 |
|
5 |
status = _lx_nand_flash_open_extended(nand_flash, name, nand_driver_initialize, NULL, memory_ptr, memory_size); |
84 |
|
|
|
85 |
|
5 |
return status; |
86 |
|
|
} |