MCUXpresso SDK API Reference Manual  Rev 2.16.100
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
FLEXRAM: on-chip RAM manager

Overview

The MCUXpresso SDK provides a driver for the FLEXRAM module of MCUXpresso SDK devices.

The FLEXRAM module intergrates the ITCM, DTCM, and OCRAM controllers, and supports 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.

Data Structures

struct  _flexram_allocate_ram
 FLEXRAM allocates OCRAM, ITCM, DTCM size. More...
 
struct  _flexram_ecc_error_type
 FLEXRAM error type, such as single bit error position, multi-bit error position. More...
 
struct  _flexram_ocram_ecc_single_error_info
 FLEXRAM ocram ecc single error information, including single error information, error address, error data. More...
 
struct  _flexram_ocram_ecc_multi_error_info
 FLEXRAM ocram ecc multiple error information, including multiple error information, error address, error data. More...
 
struct  _flexram_itcm_ecc_single_error_info
 FLEXRAM itcm ecc single error information, including single error information, error address, error data. More...
 
struct  _flexram_itcm_ecc_multi_error_info
 FLEXRAM itcm ecc multiple error information, including multiple error information, error address, error data. More...
 
struct  _flexram_dtcm_ecc_single_error_info
 FLEXRAM dtcm ecc single error information, including single error information, error address, error data. More...
 
struct  _flexram_dtcm_ecc_multi_error_info
 FLEXRAM dtcm ecc multiple error information, including multiple error information, error address, error data. More...
 

Macros

#define FLEXRAM_ECC_ERROR_DETAILED_INFO   0U /* Define to zero means get raw ECC error information, which needs parse it by user. */
 Get ECC error detailed information. More...
 

Typedefs

typedef enum
_flexram_bank_allocate_src 
flexram_bank_allocate_src_t
 FLEXRAM bank allocate source.
 
typedef struct
_flexram_allocate_ram 
flexram_allocate_ram_t
 FLEXRAM allocates OCRAM, ITCM, DTCM size. More...
 
typedef enum
_flexram_tcm_access_mode 
flexram_tcm_access_mode_t
 FLEXRAM TCM access mode. More...
 
typedef enum _flexram_memory_type flexram_memory_type_t
 FLEXRAM memory type, such as OCRAM/ITCM/D0TCM/D1TCM.
 
typedef struct
_flexram_ecc_error_type 
flexram_ecc_error_type_t
 FLEXRAM error type, such as single bit error position, multi-bit error position.
 
typedef struct
_flexram_ocram_ecc_single_error_info 
flexram_ocram_ecc_single_error_info_t
 FLEXRAM ocram ecc single error information, including single error information, error address, error data.
 
typedef struct
_flexram_ocram_ecc_multi_error_info 
flexram_ocram_ecc_multi_error_info_t
 FLEXRAM ocram ecc multiple error information, including multiple error information, error address, error data.
 
typedef struct
_flexram_itcm_ecc_single_error_info 
flexram_itcm_ecc_single_error_info_t
 FLEXRAM itcm ecc single error information, including single error information, error address, error data.
 
typedef struct
_flexram_itcm_ecc_multi_error_info 
flexram_itcm_ecc_multi_error_info_t
 FLEXRAM itcm ecc multiple error information, including multiple error information, error address, error data.
 
typedef struct
_flexram_dtcm_ecc_single_error_info 
flexram_dtcm_ecc_single_error_info_t
 FLEXRAM dtcm ecc single error information, including single error information, error address, error data.
 
typedef struct
_flexram_dtcm_ecc_multi_error_info 
flexram_dtcm_ecc_multi_error_info_t
 FLEXRAM dtcm ecc multiple error information, including multiple error information, error address, error data.
 

Enumerations

enum  {
  kFLEXRAM_BankNotUsed = 0U,
  kFLEXRAM_BankOCRAM = 1U,
  kFLEXRAM_BankDTCM = 2U,
  kFLEXRAM_BankITCM = 3U
}
 FLEXRAM bank type. More...
 
enum  _flexram_bank_allocate_src {
  kFLEXRAM_BankAllocateThroughHardwareFuse = 0U,
  kFLEXRAM_BankAllocateThroughBankCfg = 1U
}
 FLEXRAM bank allocate source. More...
 
enum  {
  kFLEXRAM_Read = 0U,
  kFLEXRAM_Write = 1U
}
 Flexram write/read selection. More...
 
enum  {
  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
}
 Interrupt status flag mask. More...
 
enum  _flexram_tcm_access_mode {
  kFLEXRAM_TCMAccessFastMode = 0U,
  kFLEXRAM_TCMAccessWaitMode = 1U
}
 FLEXRAM TCM access mode. More...
 
enum  {
  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_memory_type {
  kFLEXRAM_OCRAM = 0U,
  kFLEXRAM_ITCM = 1U,
  kFLEXRAM_D0TCM = 2U,
  kFLEXRAM_D1TCM = 3U
}
 FLEXRAM memory type, such as OCRAM/ITCM/D0TCM/D1TCM. More...
 

Functions

status_t FLEXRAM_AllocateRam (flexram_allocate_ram_t *config)
 FLEXRAM allocates an on-chip ram for OCRAM, ITCM and DTCM. More...
 
static void FLEXRAM_SetAllocateRamSrc (flexram_bank_allocate_src_t src)
 FLEXRAM set allocate on-chip ram source. More...
 
static void FLEXRAM_SetTCMReadAccessMode (FLEXRAM_Type *base, flexram_tcm_access_mode_t mode)
 FLEXRAM module sets 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. More...
 
static void FLEXRAM_SetDTCMMagicAddr (FLEXRAM_Type *base, uint16_t magicAddr, uint32_t rwSel)
 FLEXRAM DTCM magic addr configuration. More...
 
static void FLEXRAM_SetITCMMagicAddr (FLEXRAM_Type *base, uint16_t magicAddr, uint32_t rwSel)
 FLEXRAM ITCM magic addr configuration. More...
 
void FLEXRAM_EnableECC (FLEXRAM_Type *base, bool OcramECCEnable, bool TcmECCEnable)
 FLEXRAM get ocram ecc single error information. More...
 
void FLEXRAM_GetOcramSingleErroInfo (FLEXRAM_Type *base, flexram_ocram_ecc_single_error_info_t *info)
 FLEXRAM get ocram ecc single error information. More...
 
void FLEXRAM_GetOcramMultiErroInfo (FLEXRAM_Type *base, flexram_ocram_ecc_multi_error_info_t *info)
 FLEXRAM get ocram ecc multiple error information. More...
 
void FLEXRAM_GetItcmSingleErroInfo (FLEXRAM_Type *base, flexram_itcm_ecc_single_error_info_t *info)
 FLEXRAM get itcm ecc single error information. More...
 
void FLEXRAM_GetItcmMultiErroInfo (FLEXRAM_Type *base, flexram_itcm_ecc_multi_error_info_t *info)
 FLEXRAM get itcm ecc multiple error information. More...
 
void FLEXRAM_GetDtcmSingleErroInfo (FLEXRAM_Type *base, flexram_dtcm_ecc_single_error_info_t *info, uint8_t bank)
 FLEXRAM get d0tcm ecc single error information. More...
 
void FLEXRAM_GetDtcmMultiErroInfo (FLEXRAM_Type *base, flexram_dtcm_ecc_multi_error_info_t *info, uint8_t bank)
 FLEXRAM get d0tcm ecc multiple error information. More...
 

Driver version

#define FSL_SOC_FLEXRAM_ALLOCATE_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))
 SOC_FLEXRAM_ALLOCATE driver version 2.0.2. More...
 

Driver version

#define FSL_FLEXRAM_DRIVER_VERSION   (MAKE_VERSION(2U, 3U, 0U))
 Driver version. More...
 

Initialization and de-initialization

void FLEXRAM_Init (FLEXRAM_Type *base)
 FLEXRAM module initialization function. More...
 
void FLEXRAM_Deinit (FLEXRAM_Type *base)
 De-initializes the FLEXRAM.
 

Status

static uint32_t FLEXRAM_GetInterruptStatus (FLEXRAM_Type *base)
 FLEXRAM module gets interrupt status. More...
 
static void FLEXRAM_ClearInterruptStatus (FLEXRAM_Type *base, uint32_t status)
 FLEXRAM module clears interrupt status. More...
 
static void FLEXRAM_EnableInterruptStatus (FLEXRAM_Type *base, uint32_t status)
 FLEXRAM module enables interrupt status. More...
 
static void FLEXRAM_DisableInterruptStatus (FLEXRAM_Type *base, uint32_t status)
 FLEXRAM module disable interrupt status. More...
 

Interrupts

static void FLEXRAM_EnableInterruptSignal (FLEXRAM_Type *base, uint32_t status)
 FLEXRAM module enables interrupt. More...
 
static void FLEXRAM_DisableInterruptSignal (FLEXRAM_Type *base, uint32_t status)
 FLEXRAM module disables interrupt. More...
 

Data Structure Documentation

struct _flexram_allocate_ram

Data Fields

const uint8_t ocramBankNum
 OCRAM banknumber which the SOC support. More...
 
const uint8_t dtcmBankNum
 DTCM bank number to allocate, the number should be power of 2. More...
 
const uint8_t itcmBankNum
 ITCM bank number to allocate, the number should be power of 2. More...
 

Field Documentation

const uint8_t _flexram_allocate_ram::ocramBankNum
const uint8_t _flexram_allocate_ram::dtcmBankNum
const uint8_t _flexram_allocate_ram::itcmBankNum
struct _flexram_ecc_error_type

Data Fields

uint8_t SingleBitPos
 Bit position of the bit to inject ECC Error. More...
 
uint8_t SecondBitPos
 Bit position of the second bit to inject multi-bit ECC Error.
 
bool Fource1BitDataInversion
 Force One 1-Bit Data Inversion (single-bit ECC error) on memory write access.
 
bool FourceOneNCDataInversion
 Force One Non-correctable Data Inversion(multi-bit ECC error) on memory write access.
 
bool FourceConti1BitDataInversion
 Force Continuous 1-Bit Data Inversions (single-bit ECC error) on memory write access.
 
bool FourceContiNCDataInversion
 Force Continuous Non-correctable Data Inversions (multi-bit ECC error) on memory write access.
 

Field Documentation

uint8_t _flexram_ecc_error_type::SingleBitPos
struct _flexram_ocram_ecc_single_error_info

Data Fields

uint32_t OcramSingleErrorInfo
 Ocram single error information, user should parse it by themself. More...
 
uint32_t OcramSingleErrorAddr
 Ocram single error address.
 
uint32_t OcramSingleErrorDataLSB
 Ocram single error data LSB.
 
uint32_t OcramSingleErrorDataMSB
 Ocram single error data MSB.
 

Field Documentation

uint32_t _flexram_ocram_ecc_single_error_info::OcramSingleErrorInfo
struct _flexram_ocram_ecc_multi_error_info

Data Fields

uint32_t OcramMultiErrorInfo
 Ocram single error information, user should parse it by themself. More...
 
uint32_t OcramMultiErrorAddr
 Ocram multiple error address.
 
uint32_t OcramMultiErrorDataLSB
 Ocram multiple error data LSB.
 
uint32_t OcramMultiErrorDataMSB
 Ocram multiple error data MSB.
 

Field Documentation

uint32_t _flexram_ocram_ecc_multi_error_info::OcramMultiErrorInfo
struct _flexram_itcm_ecc_single_error_info

Data Fields

uint32_t ItcmSingleErrorInfo
 itcm single error information, user should parse it by themself. More...
 
uint32_t ItcmSingleErrorAddr
 itcm single error address
 
uint32_t ItcmSingleErrorDataLSB
 itcm single error data LSB
 
uint32_t ItcmSingleErrorDataMSB
 itcm single error data MSB
 

Field Documentation

uint32_t _flexram_itcm_ecc_single_error_info::ItcmSingleErrorInfo
struct _flexram_itcm_ecc_multi_error_info

Data Fields

uint32_t ItcmMultiErrorInfo
 itcm multiple error information, user should parse it by themself. More...
 
uint32_t ItcmMultiErrorAddr
 itcm multiple error address
 
uint32_t ItcmMultiErrorDataLSB
 itcm multiple error data LSB
 
uint32_t ItcmMultiErrorDataMSB
 itcm multiple error data MSB
 

Field Documentation

uint32_t _flexram_itcm_ecc_multi_error_info::ItcmMultiErrorInfo
struct _flexram_dtcm_ecc_single_error_info

Data Fields

uint32_t DtcmSingleErrorInfo
 dtcm single error information, user should parse it by themself. More...
 
uint32_t DtcmSingleErrorAddr
 dtcm single error address
 
uint32_t DtcmSingleErrorData
 dtcm single error data
 

Field Documentation

uint32_t _flexram_dtcm_ecc_single_error_info::DtcmSingleErrorInfo
struct _flexram_dtcm_ecc_multi_error_info

Data Fields

uint32_t DtcmMultiErrorInfo
 dtcm multiple error information, user should parse it by themself. More...
 
uint32_t DtcmMultiErrorAddr
 dtcm multiple error address
 
uint32_t DtcmMultiErrorData
 dtcm multiple error data
 

Field Documentation

uint32_t _flexram_dtcm_ecc_multi_error_info::DtcmMultiErrorInfo

Macro Definition Documentation

#define FSL_SOC_FLEXRAM_ALLOCATE_DRIVER_VERSION   (MAKE_VERSION(2, 0, 2))
#define FSL_FLEXRAM_DRIVER_VERSION   (MAKE_VERSION(2U, 3U, 0U))
#define FLEXRAM_ECC_ERROR_DETAILED_INFO   0U /* Define to zero means get raw ECC error information, which needs parse it by user. */

Typedef Documentation

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 is too fast to finish TCM access in 1-cycle. Normally, fast mode is the default mode, the efficiency of the TCM access will better.

Enumeration Type Documentation

anonymous enum
Enumerator
kFLEXRAM_BankNotUsed 

bank is not used

kFLEXRAM_BankOCRAM 

bank is OCRAM

kFLEXRAM_BankDTCM 

bank is DTCM

kFLEXRAM_BankITCM 

bank is ITCM

Enumerator
kFLEXRAM_BankAllocateThroughHardwareFuse 

allocate ram through hardware fuse value

kFLEXRAM_BankAllocateThroughBankCfg 

allocate ram through FLEXRAM_BANK_CFG

anonymous enum
Enumerator
kFLEXRAM_Read 

read

kFLEXRAM_Write 

write

anonymous enum
Enumerator
kFLEXRAM_OCRAMAccessError 

OCRAM accesses unallocated address.

kFLEXRAM_DTCMAccessError 

DTCM accesses unallocated address.

kFLEXRAM_ITCMAccessError 

ITCM accesses unallocated address.

kFLEXRAM_OCRAMMagicAddrMatch 

OCRAM magic address match.

kFLEXRAM_DTCMMagicAddrMatch 

DTCM magic address match.

kFLEXRAM_ITCMMagicAddrMatch 

ITCM magic address match.

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 is too fast to finish TCM access in 1-cycle. 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

anonymous enum
Enumerator
kFLEXRAM_TCMSize32KB 

TCM total size be 32KB.

kFLEXRAM_TCMSize64KB 

TCM total size be 64KB.

kFLEXRAM_TCMSize128KB 

TCM total size be 128KB.

kFLEXRAM_TCMSize256KB 

TCM total size be 256KB.

kFLEXRAM_TCMSize512KB 

TCM total size be 512KB.

Enumerator
kFLEXRAM_OCRAM 

Memory type OCRAM.

kFLEXRAM_ITCM 

Memory type ITCM.

kFLEXRAM_D0TCM 

Memory type D0TCM.

kFLEXRAM_D1TCM 

Memory type D1TCM.

Function Documentation

status_t FLEXRAM_AllocateRam ( flexram_allocate_ram_t config)

This function is independent from FLEXRAM_Init, and can be called directly if ram re-allocate is needed.

Parameters
configAllocate configuration.
Return values
kStatus_InvalidArgumentWhen the argument is invalid.
kStatus_SuccessUpon allocate success.
static void FLEXRAM_SetAllocateRamSrc ( flexram_bank_allocate_src_t  src)
inlinestatic
Parameters
srcBank config source select value.
void FLEXRAM_Init ( FLEXRAM_Type *  base)
Parameters
baseFLEXRAM base address.
static uint32_t FLEXRAM_GetInterruptStatus ( FLEXRAM_Type *  base)
inlinestatic
Parameters
baseFLEXRAM base address.
static void FLEXRAM_ClearInterruptStatus ( FLEXRAM_Type *  base,
uint32_t  status 
)
inlinestatic
Parameters
baseFLEXRAM base address.
statusStatus to be cleared.
static void FLEXRAM_EnableInterruptStatus ( FLEXRAM_Type *  base,
uint32_t  status 
)
inlinestatic
Parameters
baseFLEXRAM base address.
statusStatus to be enabled.
static void FLEXRAM_DisableInterruptStatus ( FLEXRAM_Type *  base,
uint32_t  status 
)
inlinestatic
Parameters
baseFLEXRAM base address.
statusStatus to be disabled.
static void FLEXRAM_EnableInterruptSignal ( FLEXRAM_Type *  base,
uint32_t  status 
)
inlinestatic
Parameters
baseFLEXRAM base address.
statusStatus interrupt to be enabled.
static void FLEXRAM_DisableInterruptSignal ( FLEXRAM_Type *  base,
uint32_t  status 
)
inlinestatic
Parameters
baseFLEXRAM base address.
statusStatus interrupt to be disabled.
static void FLEXRAM_SetTCMReadAccessMode ( FLEXRAM_Type *  base,
flexram_tcm_access_mode_t  mode 
)
inlinestatic
Parameters
baseFLEXRAM base address.
modeAccess mode.
static void FLEXRAM_SetTCMWriteAccessMode ( FLEXRAM_Type *  base,
flexram_tcm_access_mode_t  mode 
)
inlinestatic
Parameters
baseFLEXRAM base address.
modeAccess mode.
static void FLEXRAM_EnableForceRamClockOn ( FLEXRAM_Type *  base,
bool  enable 
)
inlinestatic
Parameters
baseFLEXRAM base address.
enableEnable or disable clock force on.
static void FLEXRAM_SetOCRAMMagicAddr ( FLEXRAM_Type *  base,
uint16_t  magicAddr,
uint32_t  rwSel 
)
inlinestatic

When read/write access hit magic address, it will generate interrupt.

Parameters
baseFLEXRAM base address.
magicAddrMagic address, the actual address bits [18:3] is corresponding to the register field [16:1].
rwSelRead/write selection. 0 for read access while 1 for write access.
static void FLEXRAM_SetDTCMMagicAddr ( FLEXRAM_Type *  base,
uint16_t  magicAddr,
uint32_t  rwSel 
)
inlinestatic

When read/write access hits magic address, it will generate interrupt.

Parameters
baseFLEXRAM base address.
magicAddrMagic address, the actual address bits [18:3] is corresponding to the register field [16:1].
rwSelRead/write selection. 0 for read access while 1 write access.
static void FLEXRAM_SetITCMMagicAddr ( FLEXRAM_Type *  base,
uint16_t  magicAddr,
uint32_t  rwSel 
)
inlinestatic

When read/write access hits magic address, it will generate interrupt.

Parameters
baseFLEXRAM base address.
magicAddrMagic address, the actual address bits [18:3] is corresponding to the register field [16:1].
rwSelRead/write selection. 0 for read access while 1 for write access.
void FLEXRAM_EnableECC ( FLEXRAM_Type *  base,
bool  OcramECCEnable,
bool  TcmECCEnable 
)
Parameters
baseFLEXRAM base address.
OcramECCEnableocram ecc enablement.
TcmECCEnabletcm(itcm/d0tcm/d1tcm) ecc enablement.
void FLEXRAM_GetOcramSingleErroInfo ( FLEXRAM_Type *  base,
flexram_ocram_ecc_single_error_info_t info 
)
Parameters
baseFLEXRAM base address.
infoecc error information.
void FLEXRAM_GetOcramMultiErroInfo ( FLEXRAM_Type *  base,
flexram_ocram_ecc_multi_error_info_t info 
)
Parameters
baseFLEXRAM base address.
infoecc error information.
void FLEXRAM_GetItcmSingleErroInfo ( FLEXRAM_Type *  base,
flexram_itcm_ecc_single_error_info_t info 
)
Parameters
baseFLEXRAM base address.
infoecc error information.
void FLEXRAM_GetItcmMultiErroInfo ( FLEXRAM_Type *  base,
flexram_itcm_ecc_multi_error_info_t info 
)
Parameters
baseFLEXRAM base address.
infoecc error information.
void FLEXRAM_GetDtcmSingleErroInfo ( FLEXRAM_Type *  base,
flexram_dtcm_ecc_single_error_info_t info,
uint8_t  bank 
)
Parameters
baseFLEXRAM base address.
infoecc error information.
bankDTCM bank, 0 is D0TCM, 1 is D1TCM.
void FLEXRAM_GetDtcmMultiErroInfo ( FLEXRAM_Type *  base,
flexram_dtcm_ecc_multi_error_info_t info,
uint8_t  bank 
)
Parameters
baseFLEXRAM base address.
infoecc error information.
bankDTCM bank, 0 is D0TCM, 1 is D1TCM.