fsl_flexram_allocate.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright 2019-2021 NXP
  3. * All rights reserved.
  4. *
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #ifndef _FSL_FLEXRAM_ALLOCATE_H_
  9. #define _FSL_FLEXRAM_ALLOCATE_H_
  10. #include "fsl_common.h"
  11. /*!
  12. * @addtogroup flexram
  13. * @{
  14. */
  15. /******************************************************************************
  16. * Definitions.
  17. *****************************************************************************/
  18. /*! @name Driver version */
  19. /*@{*/
  20. /*! @brief SOC_FLEXRAM_ALLOCATE driver version 2.0.2. */
  21. #define FSL_SOC_FLEXRAM_ALLOCATE_DRIVER_VERSION (MAKE_VERSION(2, 0, 2))
  22. /*@}*/
  23. /*! @brief FLEXRAM bank type */
  24. enum
  25. {
  26. kFLEXRAM_BankNotUsed = 0U, /*!< bank is not used */
  27. kFLEXRAM_BankOCRAM = 1U, /*!< bank is OCRAM */
  28. kFLEXRAM_BankDTCM = 2U, /*!< bank is DTCM */
  29. kFLEXRAM_BankITCM = 3U, /*!< bank is ITCM */
  30. };
  31. /*! @brief FLEXRAM bank allocate source */
  32. typedef enum _flexram_bank_allocate_src
  33. {
  34. kFLEXRAM_BankAllocateThroughHardwareFuse = 0U, /*!< allocate ram through hardware fuse value */
  35. kFLEXRAM_BankAllocateThroughBankCfg = 1U, /*!< allocate ram through FLEXRAM_BANK_CFG */
  36. } flexram_bank_allocate_src_t;
  37. /*! @brief FLEXRAM allocates OCRAM, ITCM, DTCM size. */
  38. typedef struct _flexram_allocate_ram
  39. {
  40. const uint8_t ocramBankNum; /*!< OCRAM banknumber which the SOC support. */
  41. const uint8_t dtcmBankNum; /*!< DTCM bank number to allocate, the number should be power of 2. */
  42. const uint8_t itcmBankNum; /*!< ITCM bank number to allocate, the number should be power of 2. */
  43. } flexram_allocate_ram_t;
  44. /*******************************************************************************
  45. * APIs
  46. ******************************************************************************/
  47. #if defined(__cplusplus)
  48. extern "C" {
  49. #endif
  50. /*!
  51. * @brief FLEXRAM allocates an on-chip ram for OCRAM, ITCM and DTCM.
  52. * This function is independent from FLEXRAM_Init, and can be called directly if ram re-allocate
  53. * is needed.
  54. * @param config Allocate configuration.
  55. * @retval #kStatus_InvalidArgument When the argument is invalid.
  56. * @retval #kStatus_Success Upon allocate success.
  57. */
  58. status_t FLEXRAM_AllocateRam(flexram_allocate_ram_t *config);
  59. /*!
  60. * @brief FLEXRAM set allocate on-chip ram source.
  61. * @param src Bank config source select value.
  62. */
  63. static inline void FLEXRAM_SetAllocateRamSrc(flexram_bank_allocate_src_t src)
  64. {
  65. IOMUXC_GPR->GPR16 &= ~IOMUXC_GPR_GPR16_FLEXRAM_BANK_CFG_SEL_MASK;
  66. IOMUXC_GPR->GPR16 |= IOMUXC_GPR_GPR16_FLEXRAM_BANK_CFG_SEL(src);
  67. }
  68. #if defined(__cplusplus)
  69. }
  70. #endif
  71. /*! @}*/
  72. #endif