1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Portion 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 |
|
|
/** NOR 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 |
|
|
/* FUNCTION RELEASE */ |
40 |
|
|
/* */ |
41 |
|
|
/* _lx_nor_flash_open PORTABLE C */ |
42 |
|
|
/* 6.3.0 */ |
43 |
|
|
/* AUTHOR */ |
44 |
|
|
/* */ |
45 |
|
|
/* William E. Lamie, Microsoft Corporation */ |
46 |
|
|
/* */ |
47 |
|
|
/* DESCRIPTION */ |
48 |
|
|
/* */ |
49 |
|
|
/* This function opens a NOR flash instance and ensures the NOR flash */ |
50 |
|
|
/* is in a coherent state. */ |
51 |
|
|
/* */ |
52 |
|
|
/* INPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* nor_flash NOR flash instance */ |
55 |
|
|
/* name Name of NOR flash instance */ |
56 |
|
|
/* nor_driver_initialize Driver initialize */ |
57 |
|
|
/* */ |
58 |
|
|
/* OUTPUT */ |
59 |
|
|
/* */ |
60 |
|
|
/* return status */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLS */ |
63 |
|
|
/* lx_nor_flash_open_extended() */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLED BY */ |
66 |
|
|
/* */ |
67 |
|
|
/* Application Code */ |
68 |
|
|
/* */ |
69 |
|
|
/* RELEASE HISTORY */ |
70 |
|
|
/* */ |
71 |
|
|
/* DATE NAME DESCRIPTION */ |
72 |
|
|
/* */ |
73 |
|
|
/* 05-19-2020 William E. Lamie Initial Version 6.0 */ |
74 |
|
|
/* 09-30-2020 William E. Lamie Modified comment(s), */ |
75 |
|
|
/* resulting in version 6.1 */ |
76 |
|
|
/* 11-09-2020 William E. Lamie Modified comment(s), */ |
77 |
|
|
/* fixed compiler warnings, */ |
78 |
|
|
/* resulting in version 6.1.2 */ |
79 |
|
|
/* 12-30-2020 William E. Lamie Modified comment(s), */ |
80 |
|
|
/* fixed compiler warnings, */ |
81 |
|
|
/* resulting in version 6.1.3 */ |
82 |
|
|
/* 06-02-2021 Bhupendra Naphade Modified comment(s), and */ |
83 |
|
|
/* updated product constants */ |
84 |
|
|
/* resulting in version 6.1.7 */ |
85 |
|
|
/* 03-08-2023 Xiuwen Cai Modified comment(s), */ |
86 |
|
|
/* added new driver interface, */ |
87 |
|
|
/* resulting in version 6.2.1 */ |
88 |
|
|
/* 10-31-2023 Xiuwen Cai Modified comment(s), */ |
89 |
|
|
/* added count for minimum */ |
90 |
|
|
/* erased blocks, added */ |
91 |
|
|
/* obsolete count cache, */ |
92 |
|
|
/* avoided clearing user */ |
93 |
|
|
/* extension in flash control */ |
94 |
|
|
/* block, */ |
95 |
|
|
/* resulting in version 6.3.0 */ |
96 |
|
|
/* 10-21-2025 Modified comment(s) */ |
97 |
|
|
/* call the extended equivalent */ |
98 |
|
|
/* API */ |
99 |
|
|
|
100 |
|
19 |
UINT _lx_nor_flash_open(LX_NOR_FLASH *nor_flash, CHAR *name, UINT (*nor_driver_initialize)(LX_NOR_FLASH *)) |
101 |
|
|
{ |
102 |
|
19 |
UINT status = LX_ERROR; |
103 |
|
|
|
104 |
|
19 |
status = _lx_nor_flash_open_extended(nor_flash, name, nor_driver_initialize, NULL); |
105 |
|
|
|
106 |
|
19 |
return status; |
107 |
|
|
} |