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 /**   User Specific                                                       */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  PORT SPECIFIC C INFORMATION                            RELEASE        */
26 /*                                                                        */
27 /*    lx_user.h                                           PORTABLE C      */
28 /*                                                           6.3.0        */
29 /*                                                                        */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    William E. Lamie, Microsoft Corporation                             */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file contains user defines for configuring LevelX in specific  */
37 /*    ways. This file will have an effect only if the application and     */
38 /*    LevelX library are built with LX_INCLUDE_USER_DEFINE_FILE defined.  */
39 /*    Note that all the defines in this file may also be made on the      */
40 /*    command line when building LevelX library and application objects.  */
41 /*                                                                        */
42 /*  RELEASE HISTORY                                                       */
43 /*                                                                        */
44 /*    DATE              NAME                      DESCRIPTION             */
45 /*                                                                        */
46 /*  11-09-2020     William E. Lamie         Initial Version 6.1.2         */
47 /*  06-02-2021     Bhupendra Naphade        Modified comment(s), and      */
48 /*                                            added standalone support,   */
49 /*                                            resulting in version 6.1.7  */
50 /*  03-08-2023     Xiuwen Cai               Modified comment(s), and      */
51 /*                                            added new NAND options,     */
52 /*                                            resulting in version 6.2.1  */
53 /*  10-31-2023     Xiuwen Cai               Modified comment(s),          */
54 /*                                            added options for mapping , */
55 /*                                            bitmap cache and obsolete   */
56 /*                                            count cache,                */
57 /*                                            resulting in version 6.3.0  */
58 /*                                                                        */
59 /**************************************************************************/
60 
61 #ifndef LX_USER_H
62 #define LX_USER_H
63 
64 
65 
66 /* Defined, this option bypasses the NOR flash driver read routine in favor or reading
67    the NOR memory directly, resulting in a significant performance increase.
68 */
69 /*
70 #define LX_DIRECT_READ
71 */
72 
73 
74 /* Defined, this causes the LevelX NOR instance open logic to verify free NOR
75    sectors are all ones.
76 */
77 /*
78 #define LX_FREE_SECTOR_DATA_VERIFY
79 */
80 
81 /* By default this value is 4, which represents a maximum of 4 blocks that
82    can be allocated for metadata.
83 */
84 /*
85 #define LX_NAND_FLASH_MAX_METADATA_BLOCKS 4
86 */
87 
88 /* Defined, this disabled the extended NOR cache.  */
89 /*
90 #define LX_NOR_DISABLE_EXTENDED_CACHE
91 */
92 
93 /* By default this value is 8, which represents a maximum of 8 sectors that
94    can be cached in a NOR instance.
95 */
96 /*
97 #define LX_NOR_EXTENDED_CACHE_SIZE   8
98 */
99 
100 
101 /* By default this value is 16 and defines the logical sector mapping cache size.
102    Large values improve performance, but cost memory. The minimum size is 8 and all
103    values must be a power of 2.
104 */
105 /*
106 #define LX_NOR_SECTOR_MAPPING_CACHE_SIZE   16
107 */
108 
109 /* Defined, this makes LevelX thread-safe by using a ThreadX mutex object
110    throughout the API.
111 */
112 /*
113 #define LX_THREAD_SAFE_ENABLE
114 */
115 
116 /* Defined, LevelX will be used in standalone mode (without Azure RTOS ThreadX) */
117 
118 /* #define LX_STANDALONE_ENABLE */
119 
120 /* Define user extension for NOR flash control block. User extension is placed at the end of flash control block and it is not cleared on opening flash. */
121 /*
122 #define LX_NOR_FLASH_USER_EXTENSION    ????
123 */
124 
125 /* Define user extension for NAND flash control block. User extension is placed at the end of flash control block and it is not cleared on opening flash.  */
126 /*
127 #define LX_NAND_FLASH_USER_EXTENSION   ????
128 */
129 
130 /* Determine if logical sector mapping bitmap should be enabled in extended cache.
131    Cache memory will be allocated to sector mapping bitmap first. One bit can be allocated for each physical sector.  */
132 /*
133 #define LX_NOR_ENABLE_MAPPING_BITMAP
134 */
135 
136 /* Determine if obsolete count cache should be enabled in extended cache.
137    Cache memory will be allocated to obsolete count cache after the mapping bitmap if enabled,
138    and the rest of the cache memory is allocated to sector cache.  */
139 /*
140 #define LX_NOR_ENABLE_OBSOLETE_COUNT_CACHE
141 */
142 
143 /* Defines obsolete count cache element size. If number of sectors per block is greater than 256, use USHORT instead of UCHAR.  */
144 /*
145 #define LX_NOR_OBSOLETE_COUNT_CACHE_TYPE            UCHAR
146 */
147 
148 /* Define the logical sector size for NOR flash. The sector size is in units of 32-bit words.
149    This sector size should match the sector size used in file system.  */
150 /*
151 #define LX_NOR_SECTOR_SIZE                          (512/sizeof(ULONG))
152 */
153 
154 #endif
155 
156