fsl_fmc.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Copyright (c) 2016, Freescale Semiconductor, Inc.
  3. * Copyright 2016-2017 NXP
  4. *
  5. * Redistribution and use in source and binary forms, with or without modification,
  6. * are permitted provided that the following conditions are met:
  7. *
  8. * o Redistributions of source code must retain the above copyright notice, this list
  9. * of conditions and the following disclaimer.
  10. *
  11. * o Redistributions in binary form must reproduce the above copyright notice, this
  12. * list of conditions and the following disclaimer in the documentation and/or
  13. * other materials provided with the distribution.
  14. *
  15. * o Neither the name of the copyright holder nor the names of its
  16. * contributors may be used to endorse or promote products derived from this
  17. * software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  23. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  26. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #ifndef _FSL_FMC_H_
  31. #define _FSL_FMC_H_
  32. #include "fsl_common.h"
  33. /*!
  34. * @addtogroup fmc
  35. * @{
  36. */
  37. /******************************************************************************
  38. * Definitions.
  39. *****************************************************************************/
  40. /*! @name Driver version */
  41. /*@{*/
  42. /*! @brief Driver version 2.0.0. */
  43. #define FSL_FMC_DRIVER_VERSION (MAKE_VERSION(2U, 0U, 0U))
  44. /*@}*/
  45. /*!
  46. * @addtogroup fmc_driver
  47. * @{
  48. */
  49. /*!
  50. * @brief fmc peripheral flag.
  51. *
  52. */
  53. enum _fmc_flags
  54. {
  55. kFMC_SignatureGenerationDoneFlag = FMC_FMSTAT_SIG_DONE_MASK, /*!< Flash signature generation done. */
  56. };
  57. /*! @brief Defines the generated 128-bit signature. */
  58. typedef struct _fmc_flash_signature
  59. {
  60. uint32_t word0; /* Signature bits [31:0]. */
  61. uint32_t word1; /* Signature bits [63:32]. */
  62. uint32_t word2; /* Signature bits [95:64]. */
  63. uint32_t word3; /* Signature bits [127:96]. */
  64. } fmc_flash_signature_t;
  65. /*! @brief fmc config structure. */
  66. typedef struct _fmc_config
  67. {
  68. uint8_t waitStates; /* flash timing value for flash signature generation. */
  69. } fmc_config_t;
  70. /*! @} */
  71. /*******************************************************************************
  72. * API
  73. *******************************************************************************/
  74. #if defined(__cplusplus)
  75. extern "C" {
  76. #endif
  77. /*!
  78. * @brief Initialize FMC module.
  79. *
  80. * This function initialize FMC module with user configuration
  81. *
  82. * @param base The FMC peripheral base address.
  83. * @param config pointer to user configuration structure.
  84. */
  85. void FMC_Init(FMC_Type *base, fmc_config_t *config);
  86. /*!
  87. * @brief Deinit FMC module.
  88. *
  89. * This function De-initialize FMC module.
  90. *
  91. * @param base The FMC peripheral base address.
  92. */
  93. void FMC_Deinit(FMC_Type *base);
  94. /*!
  95. * @brief Provides default configuration for fmc module.
  96. *
  97. * This function provides default configuration for fmc module, the default wait states value is
  98. * 5.
  99. *
  100. * @param config pointer to user configuration structure.
  101. */
  102. void FMC_GetDefaultConfig(fmc_config_t *config);
  103. /*!
  104. * @brief Generate hardware flash signature.
  105. *
  106. * This function generates hardware flash signature for specified address range.
  107. *
  108. * @note This function needs to be excuted out of flash memory.
  109. * @param base The FMC peripheral base address.
  110. * @param startAddress Flash start address for signature generation.
  111. * @param length Length of address range.
  112. * @param flashSignature Pointer which stores the generated flash signarue.
  113. */
  114. void FMC_GenerateFlashSignature(FMC_Type *base,
  115. uint32_t startAddress,
  116. uint32_t length,
  117. fmc_flash_signature_t *flashSignature);
  118. #if defined(__cplusplus)
  119. }
  120. #endif
  121. /*! @}*/
  122. #endif