1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** LevelX Component */
16 /** */
17 /** NAND Flash */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define LX_SOURCE_CODE
23
24
25 /* Disable ThreadX error checking. */
26
27 #ifndef LX_DISABLE_ERROR_CHECKING
28 #define LX_DISABLE_ERROR_CHECKING
29 #endif
30
31
32 /* Include necessary system files. */
33
34 #include "lx_api.h"
35
36
37 /**************************************************************************/
38 /* */
39 /* FUNCTION RELEASE */
40 /* */
41 /* _lx_nand_flash_driver_block_status_get PORTABLE C */
42 /* 6.2.1 */
43 /* AUTHOR */
44 /* */
45 /* William E. Lamie, Microsoft Corporation */
46 /* */
47 /* DESCRIPTION */
48 /* */
49 /* This function calls the driver to get the block status and */
50 /* updates the internal cache. */
51 /* */
52 /* INPUT */
53 /* */
54 /* nand_flash NAND flash instance */
55 /* block Block number */
56 /* bad_block_flag Pointer to Bad block flag */
57 /* */
58 /* OUTPUT */
59 /* */
60 /* Completion Status */
61 /* */
62 /* CALLS */
63 /* */
64 /* (lx_nand_flash_driver_block_status_get) */
65 /* NAND flash block status get */
66 /* */
67 /* CALLED BY */
68 /* */
69 /* Internal LevelX */
70 /* */
71 /* RELEASE HISTORY */
72 /* */
73 /* DATE NAME DESCRIPTION */
74 /* */
75 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
76 /* 09-30-2020 William E. Lamie Modified comment(s), */
77 /* resulting in version 6.1 */
78 /* 06-02-2021 Bhupendra Naphade Modified comment(s), */
79 /* resulting in version 6.1.7 */
80 /* 03-08-2023 Xiuwen Cai Modified comment(s), */
81 /* removed cache support, */
82 /* added new driver interface, */
83 /* resulting in version 6.2.1 */
84 /* */
85 /**************************************************************************/
_lx_nand_flash_driver_block_status_get(LX_NAND_FLASH * nand_flash,ULONG block,UCHAR * bad_block_flag)86 UINT _lx_nand_flash_driver_block_status_get(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR *bad_block_flag)
87 {
88
89 UINT status;
90
91
92 /* Increment the block status get count. */
93 nand_flash -> lx_nand_flash_diagnostic_block_status_gets++;
94
95 /* Call driver block status get function. */
96 #ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE
97 status = (nand_flash -> lx_nand_flash_driver_block_status_get)(nand_flash, block, bad_block_flag);
98 #else
99 status = (nand_flash -> lx_nand_flash_driver_block_status_get)(block, bad_block_flag);
100 #endif
101
102 /* Return status. */
103 return(status);
104 }
105
106
107