1 /*
2  * Copyright 2017-2019 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  */
8 
9 #ifndef FSL_FTFX_FEATURES_H
10 #define FSL_FTFX_FEATURES_H
11 
12 #if (defined(BL_TARGET_FLASH) || defined(BL_TARGET_ROM) || defined(BL_TARGET_RAM))
13 #include <assert.h>
14 #include <string.h>
15 #include "fsl_device_registers.h"
16 #include "bootloader_common.h"
17 #else
18 #include "fsl_common.h"
19 #endif
20 
21 #include "fsl_ftfx_adapter.h"
22 
23 /*!
24  * @addtogroup ftfx_feature
25  * @{
26  */
27 /*******************************************************************************
28  * Definitions
29  ******************************************************************************/
30 
31 /*!
32  * @name FTFx configuration
33  * @{
34  */
35 /*! @brief Flash driver location. */
36 #if !defined(FTFx_DRIVER_IS_FLASH_RESIDENT)
37 #if (!defined(BL_TARGET_ROM) && !defined(BL_TARGET_RAM))
38 #define FTFx_DRIVER_IS_FLASH_RESIDENT 1U /*!< Used for the flash resident application. */
39 #else
40 #define FTFx_DRIVER_IS_FLASH_RESIDENT 0U /*!< Used for the non-flash resident application. */
41 #endif
42 #endif
43 
44 /*! @brief Flash Driver Export option */
45 #if !defined(FTFx_DRIVER_IS_EXPORTED)
46 #if defined(BL_TARGET_ROM)
47 #define FTFx_DRIVER_IS_EXPORTED 1U /*!< Used for the ROM bootloader. */
48 #else
49 #define FTFx_DRIVER_IS_EXPORTED 0U /*!< Used for the MCUXpresso SDK application. */
50 #endif
51 #endif
52 /*@}*/
53 
54 /*! @brief Indicates whether the secondary flash is supported in the Flash driver */
55 #if defined(FSL_FEATURE_FLASH_HAS_MULTIPLE_FLASH) || defined(FSL_FEATURE_FLASH_PFLASH_1_START_ADDRESS)
56 #define FTFx_DRIVER_HAS_FLASH1_SUPPORT (1U)
57 #define FTFx_FLASH_COUNT               (2U)
58 #else
59 #define FTFx_DRIVER_HAS_FLASH1_SUPPORT (0U)
60 #define FTFx_FLASH_COUNT               (1U)
61 #endif
62 
63 /*!
64  * @name Secondary flash configuration
65  * @{
66  */
67 /*! @brief Indicates whether the secondary flash has its own protection register in flash module. */
68 #if defined(FSL_FEATURE_FLASH_HAS_MULTIPLE_FLASH) && defined(FTFE_FPROTS_PROTS_MASK)
69 #define FTFx_FLASH1_HAS_PROT_CONTROL (1U)
70 #else
71 #define FTFx_FLASH1_HAS_PROT_CONTROL (0U)
72 #endif
73 
74 /*! @brief Indicates whether the secondary flash has its own Execute-Only access register in flash module. */
75 #if defined(FSL_FEATURE_FLASH_HAS_MULTIPLE_FLASH) && defined(FTFE_FACSSS_SGSIZE_S_MASK)
76 #define FTFx_FLASH1_HAS_XACC_CONTROL (1U)
77 #else
78 #define FTFx_FLASH1_HAS_XACC_CONTROL (0U)
79 #endif
80 /*@}*/
81 
82 #if FTFx_FLASH1_HAS_XACC_CONTROL || FTFx_FLASH1_HAS_PROT_CONTROL
83 #define FTFx_FLASH1_IS_INDEPENDENT_BLOCK (1U)
84 #else
85 #define FTFx_FLASH1_IS_INDEPENDENT_BLOCK (0U)
86 #endif
87 
88 /*! @}*/
89 
90 #endif /* FSL_FTFX_FEATURES_H */
91