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_erased_verify           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 verify the block was erased.      */
50 /*                                                                        */
51 /*  INPUT                                                                 */
52 /*                                                                        */
53 /*    nand_flash                            NAND flash instance           */
54 /*    block                                 Block number                  */
55 /*    page                                  Page number                   */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    Completion Status                                                   */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*    (lx_nand_flash_driver_block_erased_verify)                          */
64 /*                                          Driver verify page erased     */
65 /*                                                                        */
66 /*  CALLED BY                                                             */
67 /*                                                                        */
68 /*    Internal LevelX                                                     */
69 /*                                                                        */
70 /*  RELEASE HISTORY                                                       */
71 /*                                                                        */
72 /*    DATE              NAME                      DESCRIPTION             */
73 /*                                                                        */
74 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
75 /*  09-30-2020     William E. Lamie         Modified comment(s),          */
76 /*                                            resulting in version 6.1    */
77 /*  06-02-2021     Bhupendra Naphade        Modified comment(s),          */
78 /*                                            resulting in version 6.1.7  */
79 /*  03-08-2023     Xiuwen Cai               Modified comment(s),          */
80 /*                                            added new driver interface, */
81 /*                                            resulting in version 6.2.1 */
82 /*                                                                        */
83 /**************************************************************************/
_lx_nand_flash_driver_block_erased_verify(LX_NAND_FLASH * nand_flash,ULONG block)84 UINT  _lx_nand_flash_driver_block_erased_verify(LX_NAND_FLASH *nand_flash, ULONG block)
85 {
86 
87 UINT    status;
88 
89     /* Increment the block erased verify count.  */
90     nand_flash -> lx_nand_flash_diagnostic_block_erased_verifies++;
91 
92     /* Call driver block erased verify function.  */
93 #ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE
94     status =  (nand_flash -> lx_nand_flash_driver_block_erased_verify)(nand_flash, block);
95 #else
96     status =  (nand_flash -> lx_nand_flash_driver_block_erased_verify)(block);
97 #endif
98     /* Return status.  */
99     return(status);
100 }
101 
102 
103