fsl_ftfx_features.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * The Clear BSD License
  3. * Copyright 2017-2018 NXP
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted (subject to the limitations in the
  8. * disclaimer below) provided that the following conditions are met:
  9. *
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. *
  13. * * Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in the
  15. * documentation and/or other materials provided with the distribution.
  16. *
  17. * * Neither the name of the copyright holder nor the names of its
  18. * contributors may be used to endorse or promote products derived from
  19. * this software without specific prior written permission.
  20. *
  21. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  22. * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
  23. * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
  24. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  25. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  27. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  30. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  31. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  32. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  33. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. */
  36. #ifndef _FSL_FTFX_FEATURES_H_
  37. #define _FSL_FTFX_FEATURES_H_
  38. #if (defined(BL_TARGET_FLASH) || defined(BL_TARGET_ROM) || defined(BL_TARGET_RAM))
  39. #include <assert.h>
  40. #include <string.h>
  41. #include "fsl_device_registers.h"
  42. #include "bootloader_common.h"
  43. #else
  44. #include "fsl_common.h"
  45. #endif
  46. #include "fsl_ftfx_adapter.h"
  47. /*******************************************************************************
  48. * Definitions
  49. ******************************************************************************/
  50. /*!
  51. * @name FTFx configuration
  52. * @{
  53. */
  54. /*! @brief Flash driver location. */
  55. #if !defined(FTFx_DRIVER_IS_FLASH_RESIDENT)
  56. #if (!defined(BL_TARGET_ROM) && !defined(BL_TARGET_RAM))
  57. #define FTFx_DRIVER_IS_FLASH_RESIDENT 1 /*!< Used for the flash resident application. */
  58. #else
  59. #define FTFx_DRIVER_IS_FLASH_RESIDENT 0 /*!< Used for the non-flash resident application. */
  60. #endif
  61. #endif
  62. /*! @brief Flash Driver Export option */
  63. #if !defined(FTFx_DRIVER_IS_EXPORTED)
  64. #if defined(BL_TARGET_ROM)
  65. #define FTFx_DRIVER_IS_EXPORTED 1 /*!< Used for the ROM bootloader. */
  66. #else
  67. #define FTFx_DRIVER_IS_EXPORTED 0 /*!< Used for the MCUXpresso SDK application. */
  68. #endif
  69. #endif
  70. /*@}*/
  71. /*! @brief Indicates whether the secondary flash is supported in the Flash driver */
  72. #if defined(FSL_FEATURE_FLASH_HAS_MULTIPLE_FLASH) || defined(FSL_FEATURE_FLASH_PFLASH_1_START_ADDRESS)
  73. #define FTFx_DRIVER_HAS_FLASH1_SUPPORT (1)
  74. #define FTFx_FLASH_COUNT (2)
  75. #else
  76. #define FTFx_DRIVER_HAS_FLASH1_SUPPORT (0)
  77. #define FTFx_FLASH_COUNT (1)
  78. #endif
  79. /*!
  80. * @name Secondary flash configuration
  81. * @{
  82. */
  83. /*! @brief Indicates whether the secondary flash has its own protection register in flash module. */
  84. #if defined(FSL_FEATURE_FLASH_HAS_MULTIPLE_FLASH) && defined(FTFE_FPROTS_PROTS_MASK)
  85. #define FTFx_FLASH1_HAS_PROT_CONTROL (1)
  86. #else
  87. #define FTFx_FLASH1_HAS_PROT_CONTROL (0)
  88. #endif
  89. /*! @brief Indicates whether the secondary flash has its own Execute-Only access register in flash module. */
  90. #if defined(FSL_FEATURE_FLASH_HAS_MULTIPLE_FLASH) && defined(FTFE_FACSSS_SGSIZE_S_MASK)
  91. #define FTFx_FLASH1_HAS_XACC_CONTROL (1)
  92. #else
  93. #define FTFx_FLASH1_HAS_XACC_CONTROL (0)
  94. #endif
  95. /*@}*/
  96. #if FTFx_FLASH1_HAS_XACC_CONTROL || FTFx_FLASH1_HAS_PROT_CONTROL
  97. #define FTFx_FLASH1_IS_INDEPENDENT_BLOCK (1)
  98. #else
  99. #define FTFx_FLASH1_IS_INDEPENDENT_BLOCK (0)
  100. #endif
  101. #endif /* _FSL_FTFX_FEATURES_H_ */