rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2006 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * flash_opt.h |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * Maui_Software |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * NOR flash related options |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | * Memory Device database last modified on 2011/7/8 |
| 55 | * |
| 56 | *============================================================================ |
| 57 | * HISTORY |
| 58 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 59 | *------------------------------------------------------------------------------ |
| 60 | * removed! |
| 61 | * removed! |
| 62 | * removed! |
| 63 | * |
| 64 | * removed! |
| 65 | * removed! |
| 66 | * removed! |
| 67 | * removed! |
| 68 | * |
| 69 | * removed! |
| 70 | * removed! |
| 71 | * removed! |
| 72 | * |
| 73 | * removed! |
| 74 | * removed! |
| 75 | * removed! |
| 76 | * |
| 77 | * removed! |
| 78 | * removed! |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * |
| 82 | * removed! |
| 83 | * removed! |
| 84 | * removed! |
| 85 | * |
| 86 | *------------------------------------------------------------------------------ |
| 87 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 88 | *============================================================================ |
| 89 | ****************************************************************************/ |
| 90 | |
| 91 | #include "custom_MemoryDevice.h" |
| 92 | #include "custom_FeatureConfig.h" |
| 93 | #include "flash_opt_gen.h" |
| 94 | #if defined(__SECURE_DATA_STORAGE__) |
| 95 | #include "custom_secure_config.h" |
| 96 | #endif |
| 97 | |
| 98 | /* |
| 99 | ******************************************************************************* |
| 100 | PART 1: |
| 101 | FLASH CONFIG Options Definition here |
| 102 | ******************************************************************************* |
| 103 | */ |
| 104 | |
| 105 | /* |
| 106 | * RAM Disk is enabled and replaces any other flash-type (e.g., NOR or NAND) disk on smartphone moden-only load |
| 107 | * NOTE. __SMART_PHONE_PLATFORM__ should be defined before (e.g., defined in flash_opt_gen.h) |
| 108 | */ |
| 109 | #if !(defined(__FUE__) || defined(__UBL__) || defined(__EXT_BOOTLOADER__)) // RAM Disk module is not necessary in Bootloader and FUE environment |
| 110 | #if defined(__FS_RAMDISK__) |
| 111 | #if !defined(__SMART_PHONE_PLATFORM__) |
| 112 | #error "RAM Disk is allowed in SP modem-only project only! Please make sure __SMART_PHONE_PLATFORM__ is defined before!" |
| 113 | #endif |
| 114 | #define __RAMDISK__ |
| 115 | #endif |
| 116 | #endif |
| 117 | |
| 118 | /* |
| 119 | ******************************************************************************* |
| 120 | PART 2: |
| 121 | FLASH FDM FEATURE CONFIG PARAMETERS translated from Manual custom_Memorydevice.h |
| 122 | ******************************************************************************* |
| 123 | */ |
| 124 | #ifndef NOR_PARAMETER_SYSTEM_DRIVE_RESERVED_BLOCK |
| 125 | #define NOR_SYSTEM_DRIVE_RESERVED_BLOCK (3) |
| 126 | #else |
| 127 | #define NOR_SYSTEM_DRIVE_RESERVED_BLOCK (NOR_PARAMETER_SYSTEM_DRIVE_RESERVED_BLOCK) |
| 128 | #endif |
| 129 | |
| 130 | |
| 131 | |
| 132 | /* |
| 133 | ******************************************************************************* |
| 134 | PART 3: |
| 135 | FLASH GEOMETRY translated from MEMORY DEVICE DATABASE |
| 136 | ******************************************************************************* |
| 137 | */ |
| 138 | |
| 139 | |
| 140 | /* |
| 141 | ******************************************************************************* |
| 142 | PART 4: |
| 143 | FLASH FAT CONFIG translated from Manual custom_Memorydevice.h |
| 144 | ******************************************************************************* |
| 145 | */ |
| 146 | #if defined(__NANDFDM_MULTI_INSTANCE__) |
| 147 | #define NAND_DISK_NUM (NAND_BOOTING_NAND_FS_DISK_NUMBER) |
| 148 | #else // defined(__NANDFDM_MULTI_INSTANCE__) |
| 149 | #define NAND_DISK_NUM (0) |
| 150 | #endif // defined(__NANDFDM_MULTI_INSTANCE__) |
| 151 | #if defined(__RAMDISK__) |
| 152 | #include "ramdisk_gprot.h" |
| 153 | #ifndef RAM_FS_SIZE |
| 154 | #error "Error! Please assign RAM_FS_SIZE in ramdisk_gprot.h for RAM Disk!" |
| 155 | #else |
| 156 | #define RAM_FS_SIZE_INT (RAM_FS_SIZE) |
| 157 | #endif |
| 158 | #ifdef RAM_FS_FIRST_DRIVE_SECTORS |
| 159 | #define RAM_FS_FIRST_DRIVE_SECTORS_INT (RAM_FS_FIRST_DRIVE_SECTORS) |
| 160 | #else |
| 161 | #define RAM_FS_FIRST_DRIVE_SECTORS_INT (0) |
| 162 | #endif |
| 163 | #endif // defined(__NANDFDM_MULTI_INSTANCE__) |
| 164 | |
| 165 | #if defined(__EMMC_BOOTING__) |
| 166 | |
| 167 | #ifndef EMMC_BOOTING_GP1_PARTITION_SIZE |
| 168 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign EMMC_BOOTING_GP1_PARTITION_SIZE in custom_Memorydevice.h for EMMC Booting!" |
| 169 | #else |
| 170 | #define EMMC_CODE_PARTITION_SIZE (EMMC_BOOTING_GP1_PARTITION_SIZE) |
| 171 | #endif /* !EMMC_BOOTING_GP1_PARTITION_SIZE */ |
| 172 | |
| 173 | #ifndef EMMC_BOOTING_UP_FS_BASE_ADDRESS |
| 174 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign EMMC_BOOTING_UP_FS_BASE_ADDRESS in custom_Memorydevice.h for EMMC Booting!" |
| 175 | #else |
| 176 | #define EMMC_FS_BASE_ADDRESS (EMMC_BOOTING_UP_FS_BASE_ADDRESS) |
| 177 | #endif /* !EMMC_BOOTING_UP_FS_BASE_ADDRESS */ |
| 178 | |
| 179 | #ifndef EMMC_BOOTING_UP_FS_SIZE |
| 180 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign EMMC_BOOTING_UP_FS_SIZE in custom_Memorydevice.h for EMMC Booting!" |
| 181 | #else |
| 182 | #define EMMC_FS_SIZE (EMMC_BOOTING_UP_FS_SIZE) |
| 183 | #endif /* !EMMC_BOOTING_UP_FS_SIZE */ |
| 184 | |
| 185 | #ifndef EMMC_BOOTING_UP_FS_SYSTEM_DRIVE_SIZE |
| 186 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign EMMC_BOOTING_UP_FS_SYSTEM_DRIVE_SIZE in custom_Memorydevice.h for EMMC Booting!" |
| 187 | #else |
| 188 | #define EMMC_FS_SYSTEM_DRIVE_SIZE (EMMC_BOOTING_UP_FS_SYSTEM_DRIVE_SIZE) |
| 189 | #endif /* !EMMC_BOOTING_UP_FS_SYSTEM_DRIVE_SIZE */ |
| 190 | |
| 191 | #elif defined(_NAND_FLASH_BOOTING_) |
| 192 | |
| 193 | |
| 194 | /*----------------------------------------------------------------------------------------- |
| 195 | * FS base address is automatically adjusted with update package storage size as |
| 196 | * NAND_BOOTING_NAND_FS_BASE_ADDRESS + FOTA_PACKAGE_STORAGE_SIZE (defined in custom_img_config.h) |
| 197 | *-----------------------------------------------------------------------------------------*/ |
| 198 | |
| 199 | #ifndef NAND_BOOTING_NAND_FS_BASE_ADDRESS |
| 200 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign NAND_BOOTING_NAND_FS_BASE_ADDRESS in custom_Memorydevice.h for NAND-Flash Booting!" |
| 201 | #else |
| 202 | #define NAND_FLASH_BASE_ADDRESS (NAND_BOOTING_NAND_FS_BASE_ADDRESS + FOTA_DM_FS_OFFSET) |
| 203 | #endif /* !NAND_BOOTING_FLASH_BASE_ADDRESS */ |
| 204 | |
| 205 | /*----------------------------------------------------------------------------------------- |
| 206 | * FS size is automatically decreased by update package storage size as |
| 207 | * NAND_BOOTING_NAND_FS_SIZE - FOTA_PACKAGE_STORAGE_SIZE (defined in custom_img_config.h) |
| 208 | *-----------------------------------------------------------------------------------------*/ |
| 209 | |
| 210 | #ifndef NAND_BOOTING_NAND_FS_SIZE |
| 211 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign NAND_BOOTING_NAND_FS_SIZE in custom_Memorydevice.h for NAND-Flash Booting!" |
| 212 | #else |
| 213 | #if defined(__SECURE_DATA_STORAGE__) |
| 214 | #define NAND_ALLOCATED_FAT_SPACE (NAND_BOOTING_NAND_FS_SIZE - FOTA_DM_FS_OFFSET - SDS_TOTAL_SIZE) |
| 215 | #else |
| 216 | #define NAND_ALLOCATED_FAT_SPACE (NAND_BOOTING_NAND_FS_SIZE - FOTA_DM_FS_OFFSET) |
| 217 | #endif |
| 218 | #endif /* !NAND_BOOTING_ALLOCATED_FAT_SPACE */ |
| 219 | |
| 220 | /*----------------------------------------------------------------------------------------- |
| 221 | * FS first drive size is automatically decreased by update package storage size as |
| 222 | * NAND_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS - FOTA_PACKAGE_STORAGE_SIZE / 512 (defined in custom_img_config.h) |
| 223 | *-----------------------------------------------------------------------------------------*/ |
| 224 | |
| 225 | #ifndef NAND_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS |
| 226 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign NAND_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS in custom_Memorydevice.h for NAND-Flash Booting!" |
| 227 | #else |
| 228 | #if defined(__NANDFDM_MULTI_INSTANCE__) |
| 229 | #define NAND_PARTITION_SECTORS (0) |
| 230 | #else /* __NANDFDM_MULTI_INSTANCE__ */ |
| 231 | #define NAND_PARTITION_SECTORS (NAND_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS - FOTA_DM_FS_SECTOR_OFFSET) |
| 232 | #endif /* __NANDFDM_MULTI_INSTANCE__ */ |
| 233 | #endif /* !NAND_FAT_PARTITION_SECTORS */ |
| 234 | |
| 235 | |
| 236 | #elif defined(__FS_SYSDRV_ON_NAND__ ) |
| 237 | |
| 238 | #define NOR_FLASH_BASE_ADDRESS (NOR_FLASH_BASE_ADDRESS_DEFAULT) |
| 239 | #define NOR_ALLOCATED_FAT_SPACE (NOR_ALLOCATED_FAT_SPACE_DEFAULT) |
| 240 | |
| 241 | /*----------------------------------------------------------------------------------------- |
| 242 | * FS base address is automatically adjusted with update package storage size as |
| 243 | * NOR_BOOTING_NAND_FS_BASE_ADDRESS + FOTA_PACKAGE_STORAGE_SIZE (defined in custom_img_config.h) |
| 244 | *-----------------------------------------------------------------------------------------*/ |
| 245 | |
| 246 | #ifndef NOR_BOOTING_NAND_FS_BASE_ADDRESS |
| 247 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign NOR_BOOTING_NAND_FS_BASE_ADDRESS in custom_Memorydevice.h for System Drive on NAND!" |
| 248 | #else |
| 249 | #define NAND_FLASH_BASE_ADDRESS (NOR_BOOTING_NAND_FS_BASE_ADDRESS + FOTA_DM_FS_OFFSET) |
| 250 | #endif /* !NAND_BOOTING_FLASH_BASE_ADDRESS */ |
| 251 | |
| 252 | /*----------------------------------------------------------------------------------------- |
| 253 | * FS size is automatically decreased by update package storage size as |
| 254 | * NOR_BOOTING_NAND_FS_SIZE - FOTA_PACKAGE_STORAGE_SIZE (defined in custom_img_config.h) |
| 255 | *-----------------------------------------------------------------------------------------*/ |
| 256 | |
| 257 | #ifndef NOR_BOOTING_NAND_FS_SIZE |
| 258 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign NOR_BOOTING_NAND_FS_SIZE in custom_Memorydevice.h for System Drive on NAND!" |
| 259 | #else |
| 260 | #define NAND_ALLOCATED_FAT_SPACE (NOR_BOOTING_NAND_FS_SIZE - FOTA_DM_FS_OFFSET) |
| 261 | #endif /* !NAND_BOOTING_ALLOCATED_FAT_SPACE */ |
| 262 | |
| 263 | /*----------------------------------------------------------------------------------------- |
| 264 | * FS first drive size is automatically decreased by update package storage size as |
| 265 | * NOR_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS - FOTA_PACKAGE_STORAGE_SIZE / 512 (defined in custom_img_config.h) |
| 266 | *-----------------------------------------------------------------------------------------*/ |
| 267 | |
| 268 | #ifndef NOR_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS |
| 269 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign NOR_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS in custom_Memorydevice.h for System Drive on NAND!" |
| 270 | #else |
| 271 | #if defined(__NANDFDM_MULTI_INSTANCE__) |
| 272 | #define NAND_PARTITION_SECTORS (0) |
| 273 | #else /* __NANDFDM_MULTI_INSTANCE__ */ |
| 274 | #define NAND_PARTITION_SECTORS (NOR_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS - FOTA_DM_FS_SECTOR_OFFSET) |
| 275 | #endif /* __NANDFDM_MULTI_INSTANCE__ */ |
| 276 | #endif /* !NAND_FAT_PARTITION_SECTORS */ |
| 277 | |
| 278 | #else /* Generic NOR-XIP Case */ |
| 279 | |
| 280 | #if defined(__UP_PKG_ON_NAND__) && defined(NAND_SUPPORT) |
| 281 | |
| 282 | #ifndef NOR_BOOTING_NOR_FS_BASE_ADDRESS |
| 283 | #define NOR_FLASH_BASE_ADDRESS (NOR_FLASH_BASE_ADDRESS_DEFAULT) |
| 284 | #else |
| 285 | #define NOR_FLASH_BASE_ADDRESS (NOR_BOOTING_NOR_FS_BASE_ADDRESS) |
| 286 | #endif /* !NOR_FLASH_BASE_ADDRESS */ |
| 287 | |
| 288 | #ifndef NOR_BOOTING_NOR_FS_SIZE |
| 289 | #if defined(__SECURE_DATA_STORAGE__) |
| 290 | #define NOR_ALLOCATED_FAT_SPACE (NOR_ALLOCATED_FAT_SPACE_DEFAULT - SDS_TOTAL_SIZE) |
| 291 | #else |
| 292 | #define NOR_ALLOCATED_FAT_SPACE (NOR_ALLOCATED_FAT_SPACE_DEFAULT) |
| 293 | #endif |
| 294 | #else |
| 295 | #if defined(__SECURE_DATA_STORAGE__) |
| 296 | #define NOR_ALLOCATED_FAT_SPACE (NOR_BOOTING_NOR_FS_SIZE - SDS_TOTAL_SIZE) |
| 297 | #else |
| 298 | #define NOR_ALLOCATED_FAT_SPACE (NOR_BOOTING_NOR_FS_SIZE) |
| 299 | #endif |
| 300 | #endif /* !NOR_ALLOCATED_FAT_SPACE */ |
| 301 | |
| 302 | #ifndef NOR_BOOTING_NOR_FS_FIRST_DRIVE_SECTORS |
| 303 | #define NOR_PARTITION_SECTORS (0) |
| 304 | #else |
| 305 | #define NOR_PARTITION_SECTORS (NOR_BOOTING_NOR_FS_FIRST_DRIVE_SECTORS) |
| 306 | #endif /* !NOR_FAT_PARTITION_SECTORS */ |
| 307 | |
| 308 | /*----------------------------------------------------------------------------------------- |
| 309 | * FS base address is automatically adjusted with update package storage size as |
| 310 | * NOR_BOOTING_NAND_FS_BASE_ADDRESS + FOTA_PACKAGE_STORAGE_SIZE (defined in custom_img_config.h) |
| 311 | *-----------------------------------------------------------------------------------------*/ |
| 312 | |
| 313 | #ifndef NOR_BOOTING_NAND_FS_BASE_ADDRESS |
| 314 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign NOR_BOOTING_NAND_FS_BASE_ADDRESS in custom_Memorydevice.h for FOTA Update Package on NAND!" |
| 315 | #else |
| 316 | #define NAND_FLASH_BASE_ADDRESS (NOR_BOOTING_NAND_FS_BASE_ADDRESS + FOTA_DM_FS_OFFSET) |
| 317 | #endif /* !NAND_BOOTING_FLASH_BASE_ADDRESS */ |
| 318 | |
| 319 | /*----------------------------------------------------------------------------------------- |
| 320 | * FS size is automatically decreased by update package storage size as |
| 321 | * NOR_BOOTING_NAND_FS_SIZE - FOTA_PACKAGE_STORAGE_SIZE (defined in custom_img_config.h) |
| 322 | *-----------------------------------------------------------------------------------------*/ |
| 323 | |
| 324 | #ifndef NOR_BOOTING_NAND_FS_SIZE |
| 325 | #error "custom\system\{project}\custom_MemoryDevice.h: Error! Please Manually Assign NOR_BOOTING_NAND_FS_SIZE in custom_Memorydevice.h for FOTA Update Package on NAND!" |
| 326 | #else |
| 327 | #define NAND_ALLOCATED_FAT_SPACE (NOR_BOOTING_NAND_FS_SIZE - FOTA_DM_FS_OFFSET) |
| 328 | #endif /* !NAND_BOOTING_ALLOCATED_FAT_SPACE */ |
| 329 | |
| 330 | /* All NAND flash space is treated as one public drive */ |
| 331 | #define NAND_PARTITION_SECTORS (0) |
| 332 | |
| 333 | #else /* !__UP_PKG_ON_NAND__ || !NAND_SUPPORT */ |
| 334 | |
| 335 | /*----------------------------------------------------------------------------------------- |
| 336 | * FS base address is automatically adjusted with update package storage size as |
| 337 | * NOR_BOOTING_NOR_FS_BASE_ADDRESS + FOTA_PACKAGE_STORAGE_SIZE (defined in custom_img_config.h) |
| 338 | *-----------------------------------------------------------------------------------------*/ |
| 339 | |
| 340 | #ifndef NOR_BOOTING_NOR_FS_BASE_ADDRESS |
| 341 | #define NOR_FLASH_BASE_ADDRESS (NOR_FLASH_BASE_ADDRESS_DEFAULT + FOTA_DM_FS_OFFSET) |
| 342 | #else |
| 343 | #define NOR_FLASH_BASE_ADDRESS (NOR_BOOTING_NOR_FS_BASE_ADDRESS + FOTA_DM_FS_OFFSET) |
| 344 | #endif /* !NOR_FLASH_BASE_ADDRESS */ |
| 345 | |
| 346 | /*----------------------------------------------------------------------------------------- |
| 347 | * FS size is automatically decreased by update package storage size as |
| 348 | * NOR_BOOTING_NOR_FS_SIZE - FOTA_PACKAGE_STORAGE_SIZE (defined in custom_img_config.h) |
| 349 | *-----------------------------------------------------------------------------------------*/ |
| 350 | |
| 351 | #ifndef NOR_BOOTING_NOR_FS_SIZE |
| 352 | #if defined(__SECURE_DATA_STORAGE__) |
| 353 | #define NOR_ALLOCATED_FAT_SPACE (NOR_ALLOCATED_FAT_SPACE_DEFAULT - FOTA_DM_FS_OFFSET - SDS_TOTAL_SIZE) |
| 354 | #else |
| 355 | #define NOR_ALLOCATED_FAT_SPACE (NOR_ALLOCATED_FAT_SPACE_DEFAULT - FOTA_DM_FS_OFFSET) |
| 356 | #endif |
| 357 | #else |
| 358 | #if defined(__SECURE_DATA_STORAGE__) |
| 359 | #define NOR_ALLOCATED_FAT_SPACE (NOR_BOOTING_NOR_FS_SIZE - FOTA_DM_FS_OFFSET - SDS_TOTAL_SIZE) |
| 360 | #else |
| 361 | #define NOR_ALLOCATED_FAT_SPACE (NOR_BOOTING_NOR_FS_SIZE - FOTA_DM_FS_OFFSET) |
| 362 | #endif |
| 363 | #endif /* !NOR_ALLOCATED_FAT_SPACE */ |
| 364 | |
| 365 | /*----------------------------------------------------------------------------------------- |
| 366 | * FS first drive size is automatically decreased by update package storage size as |
| 367 | * NOR_BOOTING_NOR_FS_FIRST_DRIVE_SECTORS - FOTA_PACKAGE_STORAGE_SIZE / 512 (defined in custom_img_config.h) |
| 368 | *-----------------------------------------------------------------------------------------*/ |
| 369 | |
| 370 | #ifndef NOR_BOOTING_NOR_FS_FIRST_DRIVE_SECTORS |
| 371 | #define NOR_PARTITION_SECTORS (0) |
| 372 | #else |
| 373 | #define NOR_PARTITION_SECTORS (NOR_BOOTING_NOR_FS_FIRST_DRIVE_SECTORS - FOTA_DM_FS_SECTOR_OFFSET) |
| 374 | #endif /* !NOR_FAT_PARTITION_SECTORS */ |
| 375 | |
| 376 | /* If NAND_SUPPORT is enabled, all NAND flash space is treated as one public drive */ |
| 377 | #define NAND_PARTITION_SECTORS (0) |
| 378 | |
| 379 | #endif /* __UP_PKG_ON_NAND__ && NAND_SUPPORT */ |
| 380 | |
| 381 | |
| 382 | #endif /* _NAND_FLASH_BOOTING_ || __EMMC_BOOTING__ */ |
| 383 | |
| 384 | /* |
| 385 | * Define __PUBLIC_DRIVE_AVAILABLE__ if public drive is available. |
| 386 | * This definition will be referenced by File System. Please inform FS owner if any changes. |
| 387 | */ |
| 388 | #if defined(__NANDFDM_MULTI_INSTANCE__) |
| 389 | #ifndef __PUBLIC_DRIVE_AVAILABLE__ |
| 390 | #define __PUBLIC_DRIVE_AVAILABLE__ // NAND FDM Multi-Instance always has public drive |
| 391 | #endif |
| 392 | #endif |
| 393 | |
| 394 | #if defined(NOR_PARTITION_SECTORS) // NOR flash has public drive |
| 395 | #if (NOR_PARTITION_SECTORS > 0) |
| 396 | #if ((NOR_BOOTING_NOR_FS_FIRST_DRIVE_SECTORS - 0) < 21) |
| 397 | #error "custom\system\{project}\custom_MemoryDevice.h: NOR_BOOTING_NOR_FS_FIRST_DRIVE_SECTORS should be zero Or (NOR_BOOTING_NOR_FS_FIRST_DRIVE_SECTORS - 0) should be more than 20 sectors." |
| 398 | #endif |
| 399 | |
| 400 | #ifndef __PUBLIC_DRIVE_AVAILABLE__ |
| 401 | #define __PUBLIC_DRIVE_AVAILABLE__ |
| 402 | #endif |
| 403 | #endif |
| 404 | #endif |
| 405 | |
| 406 | #if defined(NAND_PARTITION_SECTORS) // NAND flash has public drive (including __FS_SYSDRV_ON_NAND__) |
| 407 | #if (NAND_PARTITION_SECTORS > 0) |
| 408 | #ifndef __PUBLIC_DRIVE_AVAILABLE__ |
| 409 | #define __PUBLIC_DRIVE_AVAILABLE__ |
| 410 | #endif |
| 411 | #endif |
| 412 | #endif |
| 413 | |
| 414 | #if defined(__EMMC_BOOTING__) // EMMC has public drive |
| 415 | #ifndef __PUBLIC_DRIVE_AVAILABLE__ |
| 416 | #define __PUBLIC_DRIVE_AVAILABLE__ |
| 417 | #endif |
| 418 | #endif |
| 419 | |
| 420 | #if !defined(_NAND_FLASH_BOOTING_) && !defined(__EMMC_BOOTING__) && !defined(__FS_SYSDRV_ON_NAND__) && defined(NAND_SUPPORT) |
| 421 | /* |
| 422 | * NOR booting / System drive on NOR / NAND flash is existed |
| 423 | * NAND_PARTITION_SECTORS is 0 but all NAND flash space is treated as one public drive |
| 424 | * |
| 425 | * Note. Please ensure NAND_SUPPORT is correctly DISABLED if NAND flash is NOT existed, |
| 426 | * otherwise __PUBLIC_DRIVE_AVAILABLE__ will be incorrectly defined but public drive is not existed! |
| 427 | */ |
| 428 | #ifndef __PUBLIC_DRIVE_AVAILABLE__ |
| 429 | #define __PUBLIC_DRIVE_AVAILABLE__ |
| 430 | #endif |
| 431 | |
| 432 | #ifndef __PUBLIC_DRIVE_2_AVAILABLE__ |
| 433 | #define __PUBLIC_DRIVE_2_AVAILABLE__ |
| 434 | #endif |
| 435 | #endif |
| 436 | |
| 437 | /* |
| 438 | ******************************************************************************* |
| 439 | PART 5: |
| 440 | FLASH TYPE CATEGORY below to configure flash memory command |
| 441 | ******************************************************************************* |
| 442 | */ |
| 443 | #ifdef NOR_FLASH_TYPE_INTEL_SERIES |
| 444 | #define __INTEL_SERIES_NOR__ |
| 445 | #endif |
| 446 | |
| 447 | #ifdef NOR_FLASH_TYPE_INTEL |
| 448 | #define __INTEL_SERIES_NOR__ |
| 449 | #endif |
| 450 | |
| 451 | #ifdef NOR_FLASH_TYPE_RENESAS_SERIES |
| 452 | #define __RENESAS_SERIES_NOR__ |
| 453 | #endif |
| 454 | |
| 455 | #ifdef NOR_FLASH_TYPE_RENESAS |
| 456 | #define __RENESAS_SERIES_NOR__ |
| 457 | #endif |
| 458 | |
| 459 | #ifdef NOR_FLASH_TYPE_INTEL_SIBLEY |
| 460 | #define __INTEL_SERIES_NOR__ |
| 461 | #define __INTEL_SIBLEY__ |
| 462 | |
| 463 | #endif |
| 464 | |
| 465 | #ifdef NOR_FLASH_TYPE_SST |
| 466 | #define __AMD_SERIES_NOR__ |
| 467 | #define __SST_NOR__ |
| 468 | #endif |
| 469 | |
| 470 | #ifdef NOR_FLASH_TYPE_ST_AMD_LIKE |
| 471 | #define __AMD_SERIES_NOR__ |
| 472 | #endif |
| 473 | |
| 474 | #ifdef NOR_FLASH_TYPE_ST_INTEL_LIKE |
| 475 | #define __INTEL_SERIES_NOR__ |
| 476 | #endif |
| 477 | |
| 478 | #ifdef NOR_FLASH_TYPE_AMD_SERIES |
| 479 | #define __AMD_SERIES_NOR__ |
| 480 | #endif |
| 481 | |
| 482 | #ifdef NOR_FLASH_TYPE_SPANSION_PL_J |
| 483 | #define __AMD_SERIES_NOR__ |
| 484 | #define NOR_SUSPEND_LATENCY (35) |
| 485 | #endif |
| 486 | |
| 487 | #ifdef NOR_FLASH_TYPE_SPANSION_PL_N |
| 488 | #define __AMD_SERIES_NOR__ |
| 489 | #define __SPANSION_PL_N__ |
| 490 | #define NOR_SUSPEND_LATENCY (20) |
| 491 | #endif |
| 492 | |
| 493 | #ifdef NOR_FLASH_TYPE_SPANSION_WS_N |
| 494 | #define __AMD_SERIES_NOR__ |
| 495 | #define __SPANSION_WS_N__ |
| 496 | #define __SPANSION_PL_N__ |
| 497 | #define NOR_SUSPEND_LATENCY (20) |
| 498 | #endif |
| 499 | |
| 500 | #ifdef NOR_FLASH_TYPE_SPANSION_WS_P |
| 501 | #define __AMD_SERIES_NOR__ |
| 502 | #define __SPANSION_WS_P__ |
| 503 | #define NOR_SUSPEND_LATENCY (40) |
| 504 | #define NOR_RESUME_SUSPEND_INTERVAL (40) |
| 505 | #endif |
| 506 | |
| 507 | #ifdef NOR_FLASH_TYPE_SPANSION_GL_A |
| 508 | #define __AMD_SERIES_NOR__ |
| 509 | #define __SPANSION_GL_A__ |
| 510 | #endif |
| 511 | |
| 512 | #ifdef NOR_FLASH_TYPE_SPANSION_GL_N |
| 513 | #define __AMD_SERIES_NOR__ |
| 514 | #define __SPANSION_GL_N__ |
| 515 | #define NOR_SUSPEND_LATENCY (20) |
| 516 | #endif |
| 517 | |
| 518 | #ifdef NOR_FLASH_TYPE_SPANSION_NS_N |
| 519 | #define __AMD_SERIES_NOR__ |
| 520 | #define __SPANSION_NS_N__ |
| 521 | #define NOR_SUSPEND_LATENCY (35) |
| 522 | #define NOR_RESUME_SUSPEND_INTERVAL (30) |
| 523 | #endif |
| 524 | |
| 525 | #ifdef NOR_FLASH_TYPE_SPANSION_NS_P |
| 526 | #define __AMD_SERIES_NOR__ |
| 527 | #define __SPANSION_NS_N__ |
| 528 | #define NOR_SUSPEND_LATENCY (20) |
| 529 | #define NOR_RESUME_SUSPEND_INTERVAL (30) |
| 530 | #endif |
| 531 | |
| 532 | #ifdef NOR_FLASH_TYPE_SPANSION_NS_J |
| 533 | #define __AMD_SERIES_NOR__ |
| 534 | #define __SPANSION_NS_J__ |
| 535 | #define NOR_SUSPEND_LATENCY (35) |
| 536 | #endif |
| 537 | |
| 538 | #ifdef NOR_FLASH_TYPE_TOSHIBA |
| 539 | #define __AMD_SERIES_NOR__ |
| 540 | #endif |
| 541 | |
| 542 | #ifdef NOR_FLASH_TYPE_TOSHIBA_TV |
| 543 | #define __AMD_SERIES_NOR__ |
| 544 | #define __TOSHIBA_TV__ |
| 545 | #endif |
| 546 | |
| 547 | #ifdef NOR_FLASH_TYPE_TOSHIBA_TY |
| 548 | #define __AMD_SERIES_NOR__ |
| 549 | #define __TOSHIBA_TY__ |
| 550 | #endif |
| 551 | |
| 552 | #ifdef NOR_FLASH_TYPE_SILICON7 |
| 553 | #define __RENESAS_SERIES_NOR__ |
| 554 | #endif |
| 555 | |
| 556 | #ifdef NOR_FLASH_TYPE_SAMSUNG_SPANSION_NS_J_LIKE |
| 557 | #define __AMD_SERIES_NOR__ |
| 558 | #define __SAMSUNG_SPANSION_NS_J_LIKE__ |
| 559 | #define NOR_SUSPEND_LATENCY (20) |
| 560 | #define NOR_RESUME_SUSPEND_INTERVAL (30) |
| 561 | #endif |
| 562 | |
| 563 | #ifdef NOR_FLASH_TYPE_SPANSION_VS_R |
| 564 | #define __AMD_SERIES_NOR__ |
| 565 | #define __SPANSION_VS_R__ |
| 566 | #define NOR_SUSPEND_LATENCY (30) |
| 567 | #define NOR_RESUME_SUSPEND_INTERVAL (30) |
| 568 | #define __NOR_FDM_4_FLIPPING_TOLERABLE__ |
| 569 | #endif |
| 570 | |
| 571 | #ifdef NOR_FLASH_TYPE_SPANSION_VS_R64 |
| 572 | #define __AMD_SERIES_NOR__ |
| 573 | #define __SPANSION_VS_R64__ |
| 574 | #define __SPANSION_NS_N__ |
| 575 | #define NOR_SUSPEND_LATENCY (30) |
| 576 | #define __NOR_FDM_4_FLIPPING_TOLERABLE__ |
| 577 | #endif |
| 578 | |
| 579 | #ifdef NOR_FLASH_TYPE_SPANSION_WS_R |
| 580 | #define __AMD_SERIES_NOR__ |
| 581 | #define __SPANSION_WS_R__ |
| 582 | #define NOR_SUSPEND_LATENCY (30) |
| 583 | #define NOR_RESUME_SUSPEND_INTERVAL (30) |
| 584 | #define __NOR_FDM_4_FLIPPING_TOLERABLE__ |
| 585 | #endif |
| 586 | |
| 587 | /* |
| 588 | ******************************************************************************* |
| 589 | PART 6: |
| 590 | FOTA UPDATABLE FLASH AREA |
| 591 | ******************************************************************************* |
| 592 | */ |
| 593 | #ifdef __FOTA_DM__ |
| 594 | #ifndef CONFIG_FOTA_UE_FLASH_SPACE |
| 595 | #error "custom\system\{project}\custom_FeatureConfig.h: Error! Please define CONFIG_FOTA_UE_FLASH_SPACE in custom_FeatureConfig.h!" |
| 596 | #endif /* CONFIG_FOTA_UE_FLASH_SPACE */ |
| 597 | |
| 598 | #ifndef CONFIG_FOTA_PACKAGE_BLOCK_NUMBER |
| 599 | #error "custom\system\{project}\custom_FeatureConfig.h: Error! Please define CONFIG_FOTA_PACKAGE_BLOCK_NUMBER in custom_FeatureConfig.h!" |
| 600 | #endif /* CONFIG_FOTA_PACKAGE_BLOCK_NUMBER */ |
| 601 | #endif /* __FOTA_DM__ */ |
| 602 | |
| 603 | |