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