fsl_flexram.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. /*
  2. * Copyright 2017-2021 NXP
  3. * All rights reserved.
  4. *
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #ifndef _FSL_FLEXRAM_H_
  9. #define _FSL_FLEXRAM_H_
  10. #include "fsl_common.h"
  11. #include "fsl_flexram_allocate.h"
  12. /*!
  13. * @addtogroup flexram
  14. * @{
  15. */
  16. /******************************************************************************
  17. * Definitions.
  18. *****************************************************************************/
  19. /*! @name Driver version */
  20. /*@{*/
  21. /*! @brief Driver version 2.1.0. */
  22. #define FSL_FLEXRAM_DRIVER_VERSION (MAKE_VERSION(2U, 1U, 0U))
  23. /*@}*/
  24. /*! @brief Get ECC error detailed information. */
  25. #ifndef FLEXRAM_ECC_ERROR_DETAILED_INFO
  26. #define FLEXRAM_ECC_ERROR_DETAILED_INFO \
  27. 0U /* Define to zero means get raw ECC error information, which needs parse it by user. */
  28. #endif
  29. /*! @brief Flexram write/read selection. */
  30. enum
  31. {
  32. kFLEXRAM_Read = 0U, /*!< read */
  33. kFLEXRAM_Write = 1U, /*!< write */
  34. };
  35. /*! @brief Interrupt status flag mask */
  36. enum
  37. {
  38. kFLEXRAM_OCRAMAccessError = FLEXRAM_INT_STATUS_OCRAM_ERR_STATUS_MASK, /*!< OCRAM accesses unallocated address */
  39. kFLEXRAM_DTCMAccessError = FLEXRAM_INT_STATUS_DTCM_ERR_STATUS_MASK, /*!< DTCM accesses unallocated address */
  40. kFLEXRAM_ITCMAccessError = FLEXRAM_INT_STATUS_ITCM_ERR_STATUS_MASK, /*!< ITCM accesses unallocated address */
  41. #if defined(FSL_FEATURE_FLEXRAM_HAS_MAGIC_ADDR) && FSL_FEATURE_FLEXRAM_HAS_MAGIC_ADDR
  42. kFLEXRAM_OCRAMMagicAddrMatch = FLEXRAM_INT_STATUS_OCRAM_MAM_STATUS_MASK, /*!< OCRAM magic address match */
  43. kFLEXRAM_DTCMMagicAddrMatch = FLEXRAM_INT_STATUS_DTCM_MAM_STATUS_MASK, /*!< DTCM magic address match */
  44. kFLEXRAM_ITCMMagicAddrMatch = FLEXRAM_INT_STATUS_ITCM_MAM_STATUS_MASK, /*!< ITCM magic address match */
  45. #if defined(FSL_FEATURE_FLEXRAM_HAS_ECC) && FSL_FEATURE_FLEXRAM_HAS_ECC
  46. kFLEXRAM_OCRAMECCMultiError = FLEXRAM_INT_STATUS_OCRAM_ECC_ERRM_INT_MASK,
  47. kFLEXRAM_OCRAMECCSingleError = FLEXRAM_INT_STATUS_OCRAM_ECC_ERRS_INT_MASK,
  48. kFLEXRAM_ITCMECCMultiError = FLEXRAM_INT_STATUS_ITCM_ECC_ERRM_INT_MASK,
  49. kFLEXRAM_ITCMECCSingleError = FLEXRAM_INT_STATUS_ITCM_ECC_ERRS_INT_MASK,
  50. kFLEXRAM_D0TCMECCMultiError = FLEXRAM_INT_STATUS_D0TCM_ECC_ERRM_INT_MASK,
  51. kFLEXRAM_D0TCMECCSingleError = FLEXRAM_INT_STATUS_D0TCM_ECC_ERRS_INT_MASK,
  52. kFLEXRAM_D1TCMECCMultiError = FLEXRAM_INT_STATUS_D1TCM_ECC_ERRM_INT_MASK,
  53. kFLEXRAM_D1TCMECCSingleError = FLEXRAM_INT_STATUS_D1TCM_ECC_ERRS_INT_MASK,
  54. kFLEXRAM_InterruptStatusAll =
  55. FLEXRAM_INT_STATUS_OCRAM_ERR_STATUS_MASK | FLEXRAM_INT_STATUS_DTCM_ERR_STATUS_MASK |
  56. FLEXRAM_INT_STATUS_ITCM_ERR_STATUS_MASK | FLEXRAM_INT_STATUS_OCRAM_MAM_STATUS_MASK |
  57. FLEXRAM_INT_STATUS_DTCM_MAM_STATUS_MASK | FLEXRAM_INT_STATUS_ITCM_MAM_STATUS_MASK |
  58. FLEXRAM_INT_STATUS_OCRAM_ECC_ERRM_INT_MASK | FLEXRAM_INT_STATUS_OCRAM_ECC_ERRS_INT_MASK |
  59. FLEXRAM_INT_STATUS_ITCM_ECC_ERRM_INT_MASK | FLEXRAM_INT_STATUS_ITCM_ECC_ERRS_INT_MASK |
  60. FLEXRAM_INT_STATUS_D0TCM_ECC_ERRM_INT_MASK | FLEXRAM_INT_STATUS_D0TCM_ECC_ERRS_INT_MASK |
  61. FLEXRAM_INT_STATUS_D1TCM_ECC_ERRM_INT_MASK | FLEXRAM_INT_STATUS_D1TCM_ECC_ERRS_INT_MASK,
  62. #else
  63. kFLEXRAM_InterruptStatusAll = FLEXRAM_INT_STATUS_OCRAM_ERR_STATUS_MASK | FLEXRAM_INT_STATUS_DTCM_ERR_STATUS_MASK |
  64. FLEXRAM_INT_STATUS_ITCM_ERR_STATUS_MASK | FLEXRAM_INT_STATUS_OCRAM_MAM_STATUS_MASK |
  65. FLEXRAM_INT_STATUS_DTCM_MAM_STATUS_MASK | FLEXRAM_INT_STATUS_ITCM_MAM_STATUS_MASK,
  66. #endif /* FSL_FEATURE_FLEXRAM_HAS_ECC */
  67. /*!< all the interrupt status mask */
  68. #else
  69. kFLEXRAM_InterruptStatusAll = FLEXRAM_INT_STATUS_OCRAM_ERR_STATUS_MASK | FLEXRAM_INT_STATUS_DTCM_ERR_STATUS_MASK |
  70. FLEXRAM_INT_STATUS_ITCM_ERR_STATUS_MASK, /*!< all the interrupt status mask */
  71. #endif /* FSL_FEATURE_FLEXRAM_HAS_MAGIC_ADDR */
  72. };
  73. /*! @brief FLEXRAM TCM access mode.
  74. * Fast access mode expected to be finished in 1-cycle;
  75. * Wait access mode expected to be finished in 2-cycle.
  76. * Wait access mode is a feature of the flexram and it should be used when
  77. * the CPU clock is too fast to finish TCM access in 1-cycle.
  78. * Normally, fast mode is the default mode, the efficiency of the TCM access will better.
  79. */
  80. typedef enum _flexram_tcm_access_mode
  81. {
  82. kFLEXRAM_TCMAccessFastMode = 0U, /*!< fast access mode */
  83. kFLEXRAM_TCMAccessWaitMode = 1U, /*!< wait access mode */
  84. } flexram_tcm_access_mode_t;
  85. /*! @brief FLEXRAM TCM support size */
  86. enum
  87. {
  88. kFLEXRAM_TCMSize32KB = 32 * 1024U, /*!< TCM total size be 32KB */
  89. kFLEXRAM_TCMSize64KB = 64 * 1024U, /*!< TCM total size be 64KB */
  90. kFLEXRAM_TCMSize128KB = 128 * 1024U, /*!< TCM total size be 128KB */
  91. kFLEXRAM_TCMSize256KB = 256 * 1024U, /*!< TCM total size be 256KB */
  92. kFLEXRAM_TCMSize512KB = 512 * 1024U, /*!< TCM total size be 512KB */
  93. };
  94. #if (defined(FSL_FEATURE_FLEXRAM_HAS_ECC) && FSL_FEATURE_FLEXRAM_HAS_ECC)
  95. /*! @brief FLEXRAM ocram ecc single error information, including single error information, error address, error data */
  96. typedef struct _flexram_ocram_ecc_single_error_info
  97. {
  98. #if defined(FLEXRAM_ECC_ERROR_DETAILED_INFO) && FLEXRAM_ECC_ERROR_DETAILED_INFO
  99. uint8_t OcramSingleErrorECCCipher; /*!< OCRAM corresponding ECC cipher of OCRAM single-bit ECC error. */
  100. uint8_t OcramSingleErrorECCSyndrome; /*!< OCRAM corresponding ECC syndrome of OCRAM single-bit ECC error,
  101. which can be used to locate the Error bit using a look-up table. */
  102. #else
  103. uint32_t OcramSingleErrorInfo; /*!< Ocram single error information, user should parse it by themself. */
  104. #endif /*FLEXRAM_ECC_ERROR_DETAILED_INFO*/
  105. uint32_t OcramSingleErrorAddr; /*!< Ocram single error address */
  106. uint32_t OcramSingleErrorDataLSB; /*!< Ocram single error data LSB */
  107. uint32_t OcramSingleErrorDataMSB; /*!< Ocram single error data MSB */
  108. } flexram_ocram_ecc_single_error_info_t;
  109. /*! @brief FLEXRAM ocram ecc multiple error information, including multiple error information, error address, error data
  110. */
  111. typedef struct _flexram_ocram_ecc_multi_error_info
  112. {
  113. #if defined(FLEXRAM_ECC_ERROR_DETAILED_INFO) && FLEXRAM_ECC_ERROR_DETAILED_INFO
  114. uint8_t OcramMultiErrorECCCipher; /*!< OCRAM corresponding ECC cipher of OCRAM multi-bit ECC error. */
  115. #else
  116. uint32_t OcramMultiErrorInfo; /*!< Ocram single error information, user should parse it by themself. */
  117. #endif /*FLEXRAM_ECC_ERROR_DETAILED_INFO*/
  118. uint32_t OcramMultiErrorAddr; /*!< Ocram multiple error address */
  119. uint32_t OcramMultiErrorDataLSB; /*!< Ocram multiple error data LSB */
  120. uint32_t OcramMultiErrorDataMSB; /*!< Ocram multiple error data MSB */
  121. } flexram_ocram_ecc_multi_error_info_t;
  122. /*! @brief FLEXRAM itcm ecc single error information, including single error information, error address, error data */
  123. typedef struct _flexram_itcm_ecc_single_error_info
  124. {
  125. #if defined(FLEXRAM_ECC_ERROR_DETAILED_INFO) && FLEXRAM_ECC_ERROR_DETAILED_INFO
  126. uint8_t ItcmSingleErrorTCMWriteRead; /*!< itcm single-bit ECC error corresponding tcm_wr value, which is to tell
  127. whether it is a write access(0x01) or a read access(0x00). */
  128. uint8_t ItcmSingleErrorTCMAccessSize; /*!< itcm single-bit ECC error corresponding tcm access size,
  129. which should be 3 (64bit). */
  130. uint8_t ItcmSingleErrorTCMMaster; /*!< itcm single-bit ECC error corresponding tcm_master,
  131. which is to tell the requester of the current access. */
  132. uint8_t ItcmSingleErrorTCMPrivilege; /*!< itcm single-bit ECC error corresponding tcm_priv,
  133. which is to tell the privilege level of access. */
  134. uint8_t ItcmSingleErrorBitPostion; /*!< itcm single-bit ECC error corresponding bit postion. */
  135. #else
  136. uint32_t ItcmSingleErrorInfo; /*!< itcm single error information, user should parse it by themself. */
  137. #endif /*FLEXRAM_ECC_ERROR_DETAILED_INFO*/
  138. uint32_t ItcmSingleErrorAddr; /*!< itcm single error address */
  139. uint32_t ItcmSingleErrorDataLSB; /*!< itcm single error data LSB */
  140. uint32_t ItcmSingleErrorDataMSB; /*!< itcm single error data MSB */
  141. } flexram_itcm_ecc_single_error_info_t;
  142. /*! @brief FLEXRAM itcm ecc multiple error information, including multiple error information, error address, error data
  143. */
  144. typedef struct _flexram_itcm_ecc_multi_error_info
  145. {
  146. #if defined(FLEXRAM_ECC_ERROR_DETAILED_INFO) && FLEXRAM_ECC_ERROR_DETAILED_INFO
  147. uint8_t ItcmMultiErrorTCMWriteRead; /*!< itcm multiple-bit ECC error corresponding tcm_wr value, which is to tell
  148. whether it is a write access(0x01) or a read access(0x00). */
  149. uint8_t ItcmMultiErrorTCMAccessSize; /*!< itcm multiple-bit ECC error corresponding tcm access size,
  150. which should be 3 (64bit). */
  151. uint8_t ItcmMultiErrorTCMMaster; /*!< itcm multiple-bit ECC error corresponding tcm_master,
  152. which is to tell the requester of the current access. */
  153. uint8_t ItcmMultiErrorTCMPrivilege; /*!< itcm multiple-bit ECC error corresponding tcm_priv,
  154. which is to tell the privilege level of access. */
  155. uint8_t ItcmMultiErrorECCSyndrome; /*!< itcm multiple-bit ECC error corresponding syndrome,
  156. which can not be used to locate the Error bit using a look-up table. */
  157. #else
  158. uint32_t ItcmMultiErrorInfo; /*!< itcm multiple error information, user should parse it by themself. */
  159. #endif /*FLEXRAM_ECC_ERROR_DETAILED_INFO*/
  160. uint32_t ItcmMultiErrorAddr; /*!< itcm multiple error address */
  161. uint32_t ItcmMultiErrorDataLSB; /*!< itcm multiple error data LSB */
  162. uint32_t ItcmMultiErrorDataMSB; /*!< itcm multiple error data MSB */
  163. } flexram_itcm_ecc_multi_error_info_t;
  164. /*! @brief FLEXRAM dtcm ecc single error information, including single error information, error address, error data */
  165. typedef struct _flexram_dtcm_ecc_single_error_info
  166. {
  167. #if defined(FLEXRAM_ECC_ERROR_DETAILED_INFO) && FLEXRAM_ECC_ERROR_DETAILED_INFO
  168. uint8_t DtcmSingleErrorTCMWriteRead; /*!< dtcm single-bit ECC error corresponding tcm_wr value, which is to tell
  169. whether it is a write access(0x01) or a read access(0x00). */
  170. uint8_t DtcmSingleErrorTCMAccessSize; /*!< dtcm single-bit ECC error corresponding tcm access size,
  171. which should be 2 (32bit). */
  172. uint8_t DtcmSingleErrorTCMMaster; /*!< dtcm single-bit ECC error corresponding tcm_master,
  173. which is to tell the requester of the current access. */
  174. uint8_t DtcmSingleErrorTCMPrivilege; /*!< dtcm single-bit ECC error corresponding tcm_priv,
  175. which is to tell the privilege level of access. */
  176. uint8_t DtcmSingleErrorBitPostion; /*!< dtcm single-bit ECC error corresponding bit postion. */
  177. #else
  178. uint32_t DtcmSingleErrorInfo; /*!< dtcm single error information, user should parse it by themself. */
  179. #endif /*FLEXRAM_ECC_ERROR_DETAILED_INFO*/
  180. uint32_t DtcmSingleErrorAddr; /*!< dtcm single error address */
  181. uint32_t DtcmSingleErrorData; /*!< dtcm single error data */
  182. } flexram_dtcm_ecc_single_error_info_t;
  183. /*! @brief FLEXRAM dtcm ecc multiple error information, including multiple error information, error address, error data
  184. */
  185. typedef struct _flexram_dtcm_ecc_multi_error_info
  186. {
  187. #if defined(FLEXRAM_ECC_ERROR_DETAILED_INFO) && FLEXRAM_ECC_ERROR_DETAILED_INFO
  188. uint8_t DtcmMultiErrorTCMWriteRead; /*!< dtcm multiple-bit ECC error corresponding tcm_wr value, which is to tell
  189. whether it is a write access(0x01) or a read access(0x00). */
  190. uint8_t DtcmMultiErrorTCMAccessSize; /*!< dtcm multiple-bit ECC error corresponding tcm access size,
  191. which should be 3 (64bit). */
  192. uint8_t DtcmMultiErrorTCMMaster; /*!< dtcm multiple-bit ECC error corresponding tcm_master,
  193. which is to tell the requester of the current access. */
  194. uint8_t DtcmMultiErrorTCMPrivilege; /*!< dtcm multiple-bit ECC error corresponding tcm_priv,
  195. which is to tell the privilege level of access. */
  196. uint8_t DtcmMultiErrorECCSyndrome; /*!< dtcm multiple-bit ECC error corresponding syndrome,
  197. which can not be used to locate the Error bit using a look-up table. */
  198. #else
  199. uint32_t DtcmMultiErrorInfo; /*!< dtcm multiple error information, user should parse it by themself. */
  200. #endif /*FLEXRAM_ECC_ERROR_DETAILED_INFO*/
  201. uint32_t DtcmMultiErrorAddr; /*!< dtcm multiple error address */
  202. uint32_t DtcmMultiErrorData; /*!< dtcm multiple error data */
  203. } flexram_dtcm_ecc_multi_error_info_t;
  204. #endif /* FSL_FEATURE_FLEXRAM_HAS_ECC */
  205. /*******************************************************************************
  206. * APIs
  207. ******************************************************************************/
  208. #if defined(__cplusplus)
  209. extern "C" {
  210. #endif
  211. /*!
  212. * @name Initialization and de-initialization
  213. * @{
  214. */
  215. /*!
  216. * @brief FLEXRAM module initialization function.
  217. *
  218. * @param base FLEXRAM base address.
  219. */
  220. void FLEXRAM_Init(FLEXRAM_Type *base);
  221. /*!
  222. * @brief De-initializes the FLEXRAM.
  223. *
  224. */
  225. void FLEXRAM_Deinit(FLEXRAM_Type *base);
  226. /* @} */
  227. /*!
  228. * @name Status
  229. * @{
  230. */
  231. /*!
  232. * @brief FLEXRAM module gets interrupt status.
  233. *
  234. * @param base FLEXRAM base address.
  235. */
  236. static inline uint32_t FLEXRAM_GetInterruptStatus(FLEXRAM_Type *base)
  237. {
  238. return base->INT_STATUS & (uint32_t)kFLEXRAM_InterruptStatusAll;
  239. }
  240. /*!
  241. * @brief FLEXRAM module clears interrupt status.
  242. *
  243. * @param base FLEXRAM base address.
  244. * @param status Status to be cleared.
  245. */
  246. static inline void FLEXRAM_ClearInterruptStatus(FLEXRAM_Type *base, uint32_t status)
  247. {
  248. base->INT_STATUS |= status;
  249. }
  250. /*!
  251. * @brief FLEXRAM module enables interrupt status.
  252. *
  253. * @param base FLEXRAM base address.
  254. * @param status Status to be enabled.
  255. */
  256. static inline void FLEXRAM_EnableInterruptStatus(FLEXRAM_Type *base, uint32_t status)
  257. {
  258. base->INT_STAT_EN |= status;
  259. }
  260. /*!
  261. * @brief FLEXRAM module disable interrupt status.
  262. *
  263. * @param base FLEXRAM base address.
  264. * @param status Status to be disabled.
  265. */
  266. static inline void FLEXRAM_DisableInterruptStatus(FLEXRAM_Type *base, uint32_t status)
  267. {
  268. base->INT_STAT_EN &= ~status;
  269. }
  270. /* @} */
  271. /*!
  272. * @name Interrupts
  273. * @{
  274. */
  275. /*!
  276. * @brief FLEXRAM module enables interrupt.
  277. *
  278. * @param base FLEXRAM base address.
  279. * @param status Status interrupt to be enabled.
  280. */
  281. static inline void FLEXRAM_EnableInterruptSignal(FLEXRAM_Type *base, uint32_t status)
  282. {
  283. base->INT_SIG_EN |= status;
  284. }
  285. /*!
  286. * @brief FLEXRAM module disables interrupt.
  287. *
  288. * @param base FLEXRAM base address.
  289. * @param status Status interrupt to be disabled.
  290. */
  291. static inline void FLEXRAM_DisableInterruptSignal(FLEXRAM_Type *base, uint32_t status)
  292. {
  293. base->INT_SIG_EN &= ~status;
  294. }
  295. /* @} */
  296. /*!
  297. * @brief FLEXRAM module sets TCM read access mode
  298. *
  299. * @param base FLEXRAM base address.
  300. * @param mode Access mode.
  301. */
  302. static inline void FLEXRAM_SetTCMReadAccessMode(FLEXRAM_Type *base, flexram_tcm_access_mode_t mode)
  303. {
  304. base->TCM_CTRL &= ~FLEXRAM_TCM_CTRL_TCM_RWAIT_EN_MASK;
  305. base->TCM_CTRL |= (uint32_t)mode;
  306. }
  307. /*!
  308. * @brief FLEXRAM module set TCM write access mode
  309. *
  310. * @param base FLEXRAM base address.
  311. * @param mode Access mode.
  312. */
  313. static inline void FLEXRAM_SetTCMWriteAccessMode(FLEXRAM_Type *base, flexram_tcm_access_mode_t mode)
  314. {
  315. base->TCM_CTRL &= ~FLEXRAM_TCM_CTRL_TCM_WWAIT_EN_MASK;
  316. base->TCM_CTRL |= (uint32_t)mode;
  317. }
  318. /*!
  319. * @brief FLEXRAM module force ram clock on
  320. *
  321. * @param base FLEXRAM base address.
  322. * @param enable Enable or disable clock force on.
  323. */
  324. static inline void FLEXRAM_EnableForceRamClockOn(FLEXRAM_Type *base, bool enable)
  325. {
  326. if (enable)
  327. {
  328. base->TCM_CTRL |= FLEXRAM_TCM_CTRL_FORCE_CLK_ON_MASK;
  329. }
  330. else
  331. {
  332. base->TCM_CTRL &= ~FLEXRAM_TCM_CTRL_FORCE_CLK_ON_MASK;
  333. }
  334. }
  335. #if defined(FSL_FEATURE_FLEXRAM_HAS_MAGIC_ADDR) && FSL_FEATURE_FLEXRAM_HAS_MAGIC_ADDR
  336. /*!
  337. * @brief FLEXRAM OCRAM magic addr configuration.
  338. * When read/write access hit magic address, it will generate interrupt.
  339. * @param base FLEXRAM base address.
  340. * @param magicAddr Magic address, the actual address bits [18:3] is corresponding to the register field [16:1].
  341. * @param rwSel Read/write selection. 0 for read access while 1 for write access.
  342. */
  343. static inline void FLEXRAM_SetOCRAMMagicAddr(FLEXRAM_Type *base, uint16_t magicAddr, uint32_t rwSel)
  344. {
  345. base->OCRAM_MAGIC_ADDR = FLEXRAM_OCRAM_MAGIC_ADDR_OCRAM_WR_RD_SEL(rwSel) |
  346. FLEXRAM_OCRAM_MAGIC_ADDR_OCRAM_MAGIC_ADDR((uint32_t)magicAddr >> 3);
  347. }
  348. /*!
  349. * @brief FLEXRAM DTCM magic addr configuration.
  350. * When read/write access hits magic address, it will generate interrupt.
  351. * @param base FLEXRAM base address.
  352. * @param magicAddr Magic address, the actual address bits [18:3] is corresponding to the register field [16:1].
  353. * @param rwSel Read/write selection. 0 for read access while 1 write access.
  354. */
  355. static inline void FLEXRAM_SetDTCMMagicAddr(FLEXRAM_Type *base, uint16_t magicAddr, uint32_t rwSel)
  356. {
  357. base->DTCM_MAGIC_ADDR = FLEXRAM_DTCM_MAGIC_ADDR_DTCM_WR_RD_SEL(rwSel) |
  358. FLEXRAM_DTCM_MAGIC_ADDR_DTCM_MAGIC_ADDR((uint32_t)magicAddr >> 3);
  359. }
  360. /*!
  361. * @brief FLEXRAM ITCM magic addr configuration.
  362. * When read/write access hits magic address, it will generate interrupt.
  363. * @param base FLEXRAM base address.
  364. * @param magicAddr Magic address, the actual address bits [18:3] is corresponding to the register field [16:1].
  365. * @param rwSel Read/write selection. 0 for read access while 1 for write access.
  366. */
  367. static inline void FLEXRAM_SetITCMMagicAddr(FLEXRAM_Type *base, uint16_t magicAddr, uint32_t rwSel)
  368. {
  369. base->ITCM_MAGIC_ADDR = FLEXRAM_ITCM_MAGIC_ADDR_ITCM_WR_RD_SEL(rwSel) |
  370. FLEXRAM_ITCM_MAGIC_ADDR_ITCM_MAGIC_ADDR((uint32_t)magicAddr >> 3);
  371. }
  372. #endif /* FSL_FEATURE_FLEXRAM_HAS_MAGIC_ADDR */
  373. #if (defined(FSL_FEATURE_FLEXRAM_HAS_ECC) && FSL_FEATURE_FLEXRAM_HAS_ECC)
  374. /*!
  375. * @brief FLEXRAM get ocram ecc single error information.
  376. * @param base FLEXRAM base address.
  377. * @param OcramECCEnable ocram ecc enablement.
  378. * @param TcmECCEnable tcm(itcm/d0tcm/d1tcm) ecc enablement.
  379. */
  380. void FLEXRAM_EnableECC(FLEXRAM_Type *base, bool OcramECCEnable, bool TcmECCEnable);
  381. /*!
  382. * @brief FLEXRAM get ocram ecc single error information.
  383. * @param base FLEXRAM base address.
  384. * @param info ecc error information.
  385. */
  386. void FLEXRAM_GetOcramSingleErroInfo(FLEXRAM_Type *base, flexram_ocram_ecc_single_error_info_t *info);
  387. /*!
  388. * @brief FLEXRAM get ocram ecc multiple error information.
  389. * @param base FLEXRAM base address.
  390. * @param info ecc error information.
  391. */
  392. void FLEXRAM_GetOcramMultiErroInfo(FLEXRAM_Type *base, flexram_ocram_ecc_multi_error_info_t *info);
  393. /*!
  394. * @brief FLEXRAM get itcm ecc single error information.
  395. * @param base FLEXRAM base address.
  396. * @param info ecc error information.
  397. */
  398. void FLEXRAM_GetItcmSingleErroInfo(FLEXRAM_Type *base, flexram_itcm_ecc_single_error_info_t *info);
  399. /*!
  400. * @brief FLEXRAM get itcm ecc multiple error information.
  401. * @param base FLEXRAM base address.
  402. * @param info ecc error information.
  403. */
  404. void FLEXRAM_GetItcmMultiErroInfo(FLEXRAM_Type *base, flexram_itcm_ecc_multi_error_info_t *info);
  405. /*!
  406. * @brief FLEXRAM get d0tcm ecc single error information.
  407. * @param base FLEXRAM base address.
  408. * @param info ecc error information.
  409. * @param bank DTCM bank, 0 is D0TCM, 1 is D1TCM.
  410. */
  411. void FLEXRAM_GetDtcmSingleErroInfo(FLEXRAM_Type *base, flexram_dtcm_ecc_single_error_info_t *info, uint8_t bank);
  412. /*!
  413. * @brief FLEXRAM get d0tcm ecc multiple error information.
  414. * @param base FLEXRAM base address.
  415. * @param info ecc error information.
  416. * @param bank DTCM bank, 0 is D0TCM, 1 is D1TCM.
  417. */
  418. void FLEXRAM_GetDtcmMultiErroInfo(FLEXRAM_Type *base, flexram_dtcm_ecc_multi_error_info_t *info, uint8_t bank);
  419. #endif /* FSL_FEATURE_FLEXRAM_HAS_ECC */
  420. #if defined(__cplusplus)
  421. }
  422. #endif
  423. /*! @}*/
  424. #endif