1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
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_driver_block_status_set PORTABLE C */
43 /* 6.2.1 */
44 /* AUTHOR */
45 /* */
46 /* William E. Lamie, Microsoft Corporation */
47 /* */
48 /* DESCRIPTION */
49 /* */
50 /* This function calls the driver to set the block status and */
51 /* updates the internal cache. */
52 /* */
53 /* INPUT */
54 /* */
55 /* nand_flash NAND flash instance */
56 /* block Block number */
57 /* bad_block_flag Bad block flag */
58 /* */
59 /* OUTPUT */
60 /* */
61 /* Completion Status */
62 /* */
63 /* CALLS */
64 /* */
65 /* (lx_nand_flash_driver_block_status_set) */
66 /* NAND flash block status set */
67 /* */
68 /* CALLED BY */
69 /* */
70 /* Internal LevelX */
71 /* */
72 /* RELEASE HISTORY */
73 /* */
74 /* DATE NAME DESCRIPTION */
75 /* */
76 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
77 /* 09-30-2020 William E. Lamie Modified comment(s), */
78 /* resulting in version 6.1 */
79 /* 06-02-2021 Bhupendra Naphade Modified comment(s), */
80 /* resulting in version 6.1.7 */
81 /* 03-08-2023 Xiuwen Cai Modified comment(s), */
82 /* removed cache support, */
83 /* added new driver interface, */
84 /* resulting in version 6.2.1 */
85 /* */
86 /**************************************************************************/
_lx_nand_flash_driver_block_status_set(LX_NAND_FLASH * nand_flash,ULONG block,UCHAR bad_block_flag)87 UINT _lx_nand_flash_driver_block_status_set(LX_NAND_FLASH *nand_flash, ULONG block, UCHAR bad_block_flag)
88 {
89
90 UINT status;
91
92
93 /* Increment the block status set count. */
94 nand_flash -> lx_nand_flash_diagnostic_block_status_sets++;
95
96 /* Call driver block status set function. */
97 #ifdef LX_NAND_ENABLE_CONTROL_BLOCK_FOR_DRIVER_INTERFACE
98 status = (nand_flash -> lx_nand_flash_driver_block_status_set)(nand_flash, block, bad_block_flag);
99 #else
100 status = (nand_flash -> lx_nand_flash_driver_block_status_set)(block, bad_block_flag);
101 #endif
102
103 /* Return status. */
104 return(status);
105 }
106
107
108