diff options
author | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
commit | dc90387ce7d8ba7b607d9c48540bf6d8b560f14d (patch) | |
tree | 4ccb8fa5886b66fa9d480edef74236c27f035e16 /lib/chibios-contrib/ext/mcux-sdk/devices/MIMXRT1052/drivers/fsl_flexram_allocate.h |
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MIMXRT1052/drivers/fsl_flexram_allocate.h')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/devices/MIMXRT1052/drivers/fsl_flexram_allocate.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MIMXRT1052/drivers/fsl_flexram_allocate.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMXRT1052/drivers/fsl_flexram_allocate.h new file mode 100644 index 000000000..e2310683a --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MIMXRT1052/drivers/fsl_flexram_allocate.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Copyright 2019-2020 NXP | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #ifndef _FSL_FLEXRAM_ALLOCATE_H_ | ||
10 | #define _FSL_FLEXRAM_ALLOCATE_H_ | ||
11 | |||
12 | #include "fsl_common.h" | ||
13 | |||
14 | /*! | ||
15 | * @addtogroup flexram | ||
16 | * @{ | ||
17 | */ | ||
18 | |||
19 | /****************************************************************************** | ||
20 | * Definitions. | ||
21 | *****************************************************************************/ | ||
22 | |||
23 | /*! @name Driver version */ | ||
24 | /*@{*/ | ||
25 | /*! @brief SOC_FLEXRAM_ALLOCATE driver version 2.0.1. */ | ||
26 | #define FSL_SOC_FLEXRAM_ALLOCATE_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) | ||
27 | /*@}*/ | ||
28 | |||
29 | /*! @brief FLEXRAM bank type */ | ||
30 | enum | ||
31 | { | ||
32 | kFLEXRAM_BankNotUsed = 0U, /*!< bank is not used */ | ||
33 | kFLEXRAM_BankOCRAM = 1U, /*!< bank is OCRAM */ | ||
34 | kFLEXRAM_BankDTCM = 2U, /*!< bank is DTCM */ | ||
35 | kFLEXRAM_BankITCM = 3U, /*!< bank is ITCM */ | ||
36 | }; | ||
37 | |||
38 | /*! @brief FLEXRAM bank allocate source */ | ||
39 | typedef enum _flexram_bank_allocate_src | ||
40 | { | ||
41 | kFLEXRAM_BankAllocateThroughHardwareFuse = 0U, /*!< allocate ram through hardware fuse value */ | ||
42 | kFLEXRAM_BankAllocateThroughBankCfg = 1U, /*!< allocate ram through FLEXRAM_BANK_CFG */ | ||
43 | } flexram_bank_allocate_src_t; | ||
44 | |||
45 | /*! @brief FLEXRAM allocate ocram, itcm, dtcm size */ | ||
46 | typedef struct _flexram_allocate_ram | ||
47 | { | ||
48 | const uint8_t ocramBankNum; /*!< ocram banknumber which the SOC support */ | ||
49 | const uint8_t dtcmBankNum; /*!< dtcm bank number to allocate, the number should be power of 2 */ | ||
50 | const uint8_t itcmBankNum; /*!< itcm bank number to allocate, the number should be power of 2 */ | ||
51 | } flexram_allocate_ram_t; | ||
52 | |||
53 | /******************************************************************************* | ||
54 | * APIs | ||
55 | ******************************************************************************/ | ||
56 | |||
57 | #if defined(__cplusplus) | ||
58 | extern "C" { | ||
59 | #endif | ||
60 | |||
61 | /*! | ||
62 | * @brief FLEXRAM allocate on-chip ram for OCRAM,ITCM,DTCM | ||
63 | * This function is independent of FLEXRAM_Init, it can be called directly if ram re-allocate | ||
64 | * is needed. | ||
65 | * @param config allocate configuration. | ||
66 | * @retval kStatus_InvalidArgument the argument is invalid | ||
67 | * kStatus_Success allocate success | ||
68 | */ | ||
69 | status_t FLEXRAM_AllocateRam(flexram_allocate_ram_t *config); | ||
70 | |||
71 | /*! | ||
72 | * @brief FLEXRAM set allocate on-chip ram source | ||
73 | * @param src bank config source select value. | ||
74 | */ | ||
75 | static inline void FLEXRAM_SetAllocateRamSrc(flexram_bank_allocate_src_t src) | ||
76 | { | ||
77 | IOMUXC_GPR->GPR16 &= ~IOMUXC_GPR_GPR16_FLEXRAM_BANK_CFG_SEL_MASK; | ||
78 | IOMUXC_GPR->GPR16 |= IOMUXC_GPR_GPR16_FLEXRAM_BANK_CFG_SEL(src); | ||
79 | } | ||
80 | |||
81 | /*! | ||
82 | * @brief FLEXRAM configure TCM size | ||
83 | * This function is used to set the TCM to the target size. If a odd bank number is used, | ||
84 | * a new banknumber will be used which is bigger than target value, application can set tcm | ||
85 | * size to the biggest bank number always, then boundary access error can be captured by flexram only. | ||
86 | * When access to the TCM memory boundary ,hardfault will raised by core. | ||
87 | * @param itcmBankNum itcm bank number to allocate | ||
88 | * @param dtcmBankNum dtcm bank number to allocate | ||
89 | * | ||
90 | */ | ||
91 | void FLEXRAM_SetTCMSize(uint8_t itcmBankNum, uint8_t dtcmBankNum); | ||
92 | |||
93 | #if defined(__cplusplus) | ||
94 | } | ||
95 | #endif | ||
96 | |||
97 | /*! @}*/ | ||
98 | |||
99 | #endif | ||