The MCUXpresso SDK provides a driver for the flexram module of MCUXpresso SDK devices.
The flexram module intergrate ITCM , DTCM and OCRAM controller, support parameterized ram array and ram array portioning.
This example code shows how to allocate ram using the FLEXRAM driver.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/flexram
|
enum | _flexram_wr_rd_sel {
kFLEXRAM_Read = 0U,
kFLEXRAM_Write = 1U
} |
| flexram write read sel More...
|
|
enum | _flexram_interrupt_status {
kFLEXRAM_OCRAMAccessError = FLEXRAM_INT_STATUS_OCRAM_ERR_STATUS_MASK,
kFLEXRAM_DTCMAccessError = FLEXRAM_INT_STATUS_DTCM_ERR_STATUS_MASK,
kFLEXRAM_ITCMAccessError = FLEXRAM_INT_STATUS_ITCM_ERR_STATUS_MASK,
kFLEXRAM_OCRAMMagicAddrMatch = FLEXRAM_INT_STATUS_OCRAM_MAM_STATUS_MASK,
kFLEXRAM_DTCMMagicAddrMatch = FLEXRAM_INT_STATUS_DTCM_MAM_STATUS_MASK,
kFLEXRAM_ITCMMagicAddrMatch = FLEXRAM_INT_STATUS_ITCM_MAM_STATUS_MASK,
kFLEXRAM_InterruptStatusAll = 0x3FU
} |
| Interrupt status flag mask. More...
|
|
enum | flexram_tcm_access_mode_t {
kFLEXRAM_TCMAccessFastMode = 0U,
kFLEXRAM_TCMAccessWaitMode = 1U
} |
| FLEXRAM TCM access mode Fast access mode expected to be finished in 1-cycle Wait access mode expected to be finished in 2-cycle Wait access mode is a feature of the flexram and it should be used when the cpu clock too fast to finish tcm access in 1-cycle. More...
|
|
enum | _flexram_bank_type {
kFLEXRAM_BankNotUsed = 0U,
kFLEXRAM_BankOCRAM = 1U,
kFLEXRAM_BankDTCM = 2U,
kFLEXRAM_BankITCM = 3U
} |
| FLEXRAM bank type. More...
|
|
enum | _flexram_tcm_size {
kFLEXRAM_TCMSize32KB = 32 * 1024U,
kFLEXRAM_TCMSize64KB = 64 * 1024U,
kFLEXRAM_TCMSize128KB = 128 * 1024U,
kFLEXRAM_TCMSize256KB = 256 * 1024U,
kFLEXRAM_TCMSize512KB = 512 * 1024U
} |
| FLEXRAM tcm support size. More...
|
|
enum | flexram_bank_allocate_src_t {
kFLEXRAM_BankAllocateThroughHardwareFuse = 0U,
kFLEXRAM_BankAllocateThroughBankCfg = 1U
} |
| FLEXRAM bank allocate source. More...
|
|
|
static void | FLEXRAM_SetTCMReadAccessMode (FLEXRAM_Type *base, flexram_tcm_access_mode_t mode) |
| FLEXRAM module set TCM read access mode. More...
|
|
static void | FLEXRAM_SetTCMWriteAccessMode (FLEXRAM_Type *base, flexram_tcm_access_mode_t mode) |
| FLEXRAM module set TCM write access mode. More...
|
|
static void | FLEXRAM_EnableForceRamClockOn (FLEXRAM_Type *base, bool enable) |
| FLEXRAM module force ram clock on. More...
|
|
static void | FLEXRAM_SetOCRAMMagicAddr (FLEXRAM_Type *base, uint16_t magicAddr, uint32_t rwSel) |
| FLEXRAM OCRAM magic addr configuration When read/write access hit magic address, it will generate interrupt. More...
|
|
static void | FLEXRAM_SetDTCMMagicAddr (FLEXRAM_Type *base, uint16_t magicAddr, uint32_t rwSel) |
| FLEXRAM DTCM magic addr configuration When read/write access hit magic address, it will generate interrupt. More...
|
|
static void | FLEXRAM_SetITCMMagicAddr (FLEXRAM_Type *base, uint16_t magicAddr, uint32_t rwSel) |
| FLEXRAM ITCM magic addr configuration When read/write access hit magic address, it will generate interrupt. More...
|
|
status_t | FLEXRAM_AllocateRam (flexram_allocate_ram_t *config) |
| 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. More...
|
|
static void | FLEXRAM_SetAllocateRamSrc (flexram_bank_allocate_src_t src) |
| FLEXRAM set allocate on-chip ram source. More...
|
|
struct flexram_allocate_ram_t |
Data Fields |
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
|
|
#define FSL_FLEXRAM_DRIVER_VERSION (MAKE_VERSION(2U, 0U, 1U)) |
Enumerator |
---|
kFLEXRAM_Read |
read
|
kFLEXRAM_Write |
write
|
Enumerator |
---|
kFLEXRAM_OCRAMAccessError |
ocram access unallocated address
|
kFLEXRAM_DTCMAccessError |
dtcm access unallocated address
|
kFLEXRAM_ITCMAccessError |
itcm access unallocated address
|
kFLEXRAM_OCRAMMagicAddrMatch |
ocram maigc address match
|
kFLEXRAM_DTCMMagicAddrMatch |
dtcm maigc address match
|
kFLEXRAM_ITCMMagicAddrMatch |
itcm maigc address match
|
kFLEXRAM_InterruptStatusAll |
all the interrupt status mask
|
Normally, fast mode is the default mode, the efficiency of the tcm access will better.
Enumerator |
---|
kFLEXRAM_TCMAccessFastMode |
fast access mode
|
kFLEXRAM_TCMAccessWaitMode |
wait access mode
|
Enumerator |
---|
kFLEXRAM_BankNotUsed |
bank is not used
|
kFLEXRAM_BankOCRAM |
bank is OCRAM
|
kFLEXRAM_BankDTCM |
bank is DTCM
|
kFLEXRAM_BankITCM |
bank is ITCM
|
Enumerator |
---|
kFLEXRAM_TCMSize32KB |
TCM total size 32KB.
|
kFLEXRAM_TCMSize64KB |
TCM total size 64KB.
|
kFLEXRAM_TCMSize128KB |
TCM total size 128KB.
|
kFLEXRAM_TCMSize256KB |
TCM total size 256KB.
|
kFLEXRAM_TCMSize512KB |
TCM total size 512KB.
|
Enumerator |
---|
kFLEXRAM_BankAllocateThroughHardwareFuse |
allocate ram through hardware fuse value
|
kFLEXRAM_BankAllocateThroughBankCfg |
allocate ram through FLEXRAM_BANK_CFG
|
void FLEXRAM_Init |
( |
FLEXRAM_Type * |
base | ) |
|
- Parameters
-
base | FLEXRAM base address. |
static uint32_t FLEXRAM_GetInterruptStatus |
( |
FLEXRAM_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | FLEXRAM base address. |
static void FLEXRAM_ClearInterruptStatus |
( |
FLEXRAM_Type * |
base, |
|
|
uint32_t |
status |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | FLEXRAM base address. |
status | status to clear. |
static void FLEXRAM_EnableInterruptStatus |
( |
FLEXRAM_Type * |
base, |
|
|
uint32_t |
status |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | FLEXRAM base address. |
status | status to enable. |
static void FLEXRAM_DisableInterruptStatus |
( |
FLEXRAM_Type * |
base, |
|
|
uint32_t |
status |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | FLEXRAM base address. |
status | status to disable. |
static void FLEXRAM_EnableInterruptSignal |
( |
FLEXRAM_Type * |
base, |
|
|
uint32_t |
status |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | FLEXRAM base address. |
status | status interrupt to enable. |
static void FLEXRAM_DisableInterruptSignal |
( |
FLEXRAM_Type * |
base, |
|
|
uint32_t |
status |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | FLEXRAM base address. |
status | status interrupt to disable. |
- Parameters
-
base | FLEXRAM base address. |
mode | access mode. |
- Parameters
-
base | FLEXRAM base address. |
mode | access mode. |
static void FLEXRAM_EnableForceRamClockOn |
( |
FLEXRAM_Type * |
base, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | FLEXRAM base address. |
enable | enable or disable clock force on. |
static void FLEXRAM_SetOCRAMMagicAddr |
( |
FLEXRAM_Type * |
base, |
|
|
uint16_t |
magicAddr, |
|
|
uint32_t |
rwSel |
|
) |
| |
|
inlinestatic |
- Parameters
-
magicAddr | magic address. |
rwsel | read write select, 0 read access , 1 write access |
static void FLEXRAM_SetDTCMMagicAddr |
( |
FLEXRAM_Type * |
base, |
|
|
uint16_t |
magicAddr, |
|
|
uint32_t |
rwSel |
|
) |
| |
|
inlinestatic |
- Parameters
-
magicAddr | magic address. |
rwsel | read write select, 0 read access , 1 write access |
static void FLEXRAM_SetITCMMagicAddr |
( |
FLEXRAM_Type * |
base, |
|
|
uint16_t |
magicAddr, |
|
|
uint32_t |
rwSel |
|
) |
| |
|
inlinestatic |
- Parameters
-
magicAddr | magic address. |
rwsel | read write select, 0 read access , 1 write access |
- Parameters
-
config | allocate configuration. |
- Return values
-
kStatus_InvalidArgument | the argument is invalid kStatus_Success allocate success |
- Parameters
-
src | bank config source select value. |