1 /*
2  * Copyright (c) 2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2019 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef _FSL_FMC_H_
10 #define _FSL_FMC_H_
11 
12 #include "fsl_common.h"
13 
14 /*!
15  * @addtogroup fmc
16  * @{
17  */
18 
19 /******************************************************************************
20  * Definitions.
21  *****************************************************************************/
22 
23 /*! @name Driver version */
24 /*@{*/
25 /*! @brief Driver version 2.0.2. */
26 #define FSL_FMC_DRIVER_VERSION (MAKE_VERSION(2U, 0U, 2U))
27 /*@}*/
28 
29 /*!
30  * @addtogroup fmc_driver
31  * @{
32  */
33 
34 /*!
35  * @brief fmc peripheral flag.
36  *
37  */
38 enum
39 {
40     kFMC_SignatureGenerationDoneFlag = FMC_FMSTAT_SIG_DONE_MASK, /*!< Flash signature generation done. */
41 };
42 
43 /*! @brief Defines the generated 128-bit signature. */
44 typedef struct _fmc_flash_signature
45 {
46     uint32_t word0; /* Signature bits [31:0]. */
47     uint32_t word1; /* Signature bits [63:32]. */
48     uint32_t word2; /* Signature bits [95:64]. */
49     uint32_t word3; /* Signature bits [127:96]. */
50 } fmc_flash_signature_t;
51 
52 /*! @brief fmc config structure. */
53 typedef struct _fmc_config
54 {
55     uint8_t waitStates; /* flash timing value for flash signature generation. */
56 } fmc_config_t;
57 
58 /*! @} */
59 
60 /*******************************************************************************
61  * API
62  *******************************************************************************/
63 
64 #if defined(__cplusplus)
65 extern "C" {
66 #endif
67 
68 /*!
69  * @brief Initialize FMC module.
70  *
71  * This function initialize FMC module with user configuration
72  *
73  * @param base The FMC peripheral base address.
74  * @param config pointer to user configuration structure.
75  */
76 void FMC_Init(FMC_Type *base, fmc_config_t *config);
77 
78 /*!
79  * @brief Deinit FMC module.
80  *
81  * This function De-initialize FMC module.
82  *
83  * @param base The FMC peripheral base address.
84  */
85 void FMC_Deinit(FMC_Type *base);
86 
87 /*!
88  * @brief Provides default configuration for fmc module.
89  *
90  * This function provides default configuration for fmc module, the default wait states value is
91  * 5.
92  *
93  * @param config pointer to user configuration structure.
94  */
95 void FMC_GetDefaultConfig(fmc_config_t *config);
96 
97 /*!
98  * @brief Generate hardware flash signature.
99  *
100  * This function generates hardware flash signature for specified address range.
101  *
102  * @note This function needs to be excuted out of flash memory.
103  * @param base The FMC peripheral base address.
104  * @param startAddress Flash start address for signature generation.
105  * @param length Length of address range.
106  * @param flashSignature Pointer which stores the generated flash signarue.
107  */
108 void FMC_GenerateFlashSignature(FMC_Type *base,
109                                 uint32_t startAddress,
110                                 uint32_t length,
111                                 fmc_flash_signature_t *flashSignature);
112 
113 #if defined(__cplusplus)
114 }
115 #endif
116 
117 /*! @}*/
118 
119 #endif
120