MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
MEM Driver

Overview

Data Structures

struct  memory_interface_t
 Interface to memory operations. More...
 
struct  memory_region_interface_t
 Interface to memory operations for one region of memory. More...
 
struct  memory_map_entry_t
 Structure of a memory map entry. More...
 
union  standard_version_t
 Structure of version property. More...
 
struct  kp_api_init_param_t
 API initialization data structure. More...
 

Macros

#define DEVICE_ID_MASK   (0xffU)
 Bit mask for device ID. More...
 
#define DEVICE_ID_SHIFT   0U
 Bit position of device ID. More...
 
#define GROUP_ID_MASK   (0xf00U)
 Bit mask for group ID. More...
 
#define GROUP_ID_SHIFT   8U
 Bit position of group ID. More...
 
#define MAKE_MEMORYID(group, device)   ((((group) << GROUP_ID_SHIFT) & GROUP_ID_MASK) | (((device) << DEVICE_ID_SHIFT) & DEVICE_ID_MASK))
 Construct a memory ID from a given group ID and device ID. More...
 
#define GROUPID(memoryId)   (((memoryId)&GROUP_ID_MASK) >> GROUP_ID_SHIFT)
 Get group ID from a given memory ID. More...
 
#define DEVICEID(memoryId)   (((memoryId)&DEVICE_ID_MASK) >> DEVICE_ID_SHIFT)
 Get device ID from a given memory ID. More...
 

Enumerations

enum  {
  kMemoryGroup_Internal = 0U,
  kMemoryGroup_External = 1U
}
 Memory group definition. More...
 
enum  {
  kMemoryInternal = MAKE_MEMORYID(kMemoryGroup_Internal, 0U),
  kMemoryQuadSpi0 = MAKE_MEMORYID(kMemoryGroup_Internal, 1U),
  kMemoryIFR0,
  kMemoryFFR = MAKE_MEMORYID(kMemoryGroup_Internal, 5U),
  kMemorySemcNor = MAKE_MEMORYID(kMemoryGroup_Internal, 8U),
  kMemoryFlexSpiNor = MAKE_MEMORYID(kMemoryGroup_Internal, 9U),
  kMemorySpifiNor = MAKE_MEMORYID(kMemoryGroup_Internal, 0xAU),
  kMemoryFlashExecuteOnly = MAKE_MEMORYID(kMemoryGroup_Internal, 0x10U),
  kMemorySemcNand = MAKE_MEMORYID(kMemoryGroup_External, 0U),
  kMemorySpiNand = MAKE_MEMORYID(kMemoryGroup_External, 1U),
  kMemorySpiNorEeprom = MAKE_MEMORYID(kMemoryGroup_External, 0x10U),
  kMemoryI2cNorEeprom = MAKE_MEMORYID(kMemoryGroup_External, 0x11U),
  kMemorySDCard = MAKE_MEMORYID(kMemoryGroup_External, 0x20U),
  kMemoryMMCCard = MAKE_MEMORYID(kMemoryGroup_External, 0x21U)
}
 Memory device ID definition. More...
 
enum  {
  kStatusGroup_Bootloader = 100,
  kStatusGroup_MemoryInterface = 102
}
 Bootloader status group numbers. More...
 
enum  
 Memory interface status codes. More...
 
enum  
 Bootloader status codes. More...
 

Functions

status_t API_Init (api_core_context_t *coreCtx, const kp_api_init_param_t *param)
 Initialize the IAP API runtime environment.
 
status_t API_Deinit (api_core_context_t *coreCtx)
 Deinitialize the IAP API runtime environment.
 
status_t MEM_Init (api_core_context_t *coreCtx)
 Initialize memory interface. More...
 
status_t MEM_Config (api_core_context_t *coreCtx, uint32_t *config, uint32_t memoryId)
 Configure memory interface. More...
 
status_t MEM_Write (api_core_context_t *coreCtx, uint32_t start, uint32_t lengthInBytes, const uint8_t *buf, uint32_t memoryId)
 Write memory. More...
 
status_t MEM_Fill (api_core_context_t *coreCtx, uint32_t start, uint32_t lengthInBytes, uint32_t pattern, uint32_t memoryId)
 Fill memory with a word pattern. More...
 
status_t MEM_Flush (api_core_context_t *coreCtx)
 Flush memory. More...
 
status_t MEM_Erase (api_core_context_t *coreCtx, uint32_t start, uint32_t lengthInBytes, uint32_t memoryId)
 Erase memory. More...
 
status_t MEM_EraseAll (api_core_context_t *coreCtx, uint32_t memoryId)
 Erase entire memory based on memoryId. More...
 

Data Structure Documentation

struct memory_interface_t

This is the main abstract interface to all memory operations.

struct memory_region_interface_t
struct memory_map_entry_t
union standard_version_t

Data Fields

uint32_t version
 combined version numbers
 
uint8_t bugfix
 bugfix version [7:0]
 
uint8_t minor
 minor version [15:8]
 
uint8_t major
 major version [23:16]
 
char name
 name [31:24]
 
struct kp_api_init_param_t

Macro Definition Documentation

#define DEVICE_ID_MASK   (0xffU)
#define DEVICE_ID_SHIFT   0U
#define GROUP_ID_MASK   (0xf00U)
#define GROUP_ID_SHIFT   8U
#define MAKE_MEMORYID (   group,
  device 
)    ((((group) << GROUP_ID_SHIFT) & GROUP_ID_MASK) | (((device) << DEVICE_ID_SHIFT) & DEVICE_ID_MASK))
#define GROUPID (   memoryId)    (((memoryId)&GROUP_ID_MASK) >> GROUP_ID_SHIFT)
#define DEVICEID (   memoryId)    (((memoryId)&DEVICE_ID_MASK) >> DEVICE_ID_SHIFT)

Enumeration Type Documentation

anonymous enum
Enumerator
kMemoryGroup_Internal 

Memory belongs internal 4G memory region.

kMemoryGroup_External 

Memory belongs external memory region.

anonymous enum
Enumerator
kMemoryInternal 

Internal memory (include all on chip memory)

kMemoryQuadSpi0 

Qsuad SPI memory 0.

kMemoryIFR0 

Nonvolatile information register 0.

Only used by SB loader.

kMemoryFFR 

LPCc040hd flash FFR region.

kMemorySemcNor 

SEMC Nor memory.

kMemoryFlexSpiNor 

Flex SPI Nor memory.

kMemorySpifiNor 

SPIFI Nor memory.

kMemoryFlashExecuteOnly 

Execute-only region on internal Flash.

kMemorySemcNand 

SEMC NAND memory.

kMemorySpiNand 

SPI NAND memory.

kMemorySpiNorEeprom 

SPI NOR/EEPROM memory.

kMemoryI2cNorEeprom 

I2C NOR/EEPROM memory.

kMemorySDCard 

eSD, SD, SDHC, SDXC memory Card

kMemoryMMCCard 

MMC, eMMC memory Card.

anonymous enum
Enumerator
kStatusGroup_Bootloader 

Bootloader status group number (100).

kStatusGroup_MemoryInterface 

Memory interface status group number (102).

anonymous enum
anonymous enum

Function Documentation

status_t MEM_Init ( api_core_context_t coreCtx)
status_t MEM_Config ( api_core_context_t coreCtx,
uint32_t *  config,
uint32_t  memoryId 
)
Parameters
configA pointer to the storage for the driver runtime state.
memoryIdIndicates the index of the memory type. Please refer to "Memory group definition"
Return values
kStatus_Success
#kStatus_CommandUnsupported
kStatus_InvalidArgument
kStatus_FLASH_ModifyProtectedAreaDisallowed
#kStatusMemoryRangeInvalid
kStatus_Fail
kStatus_OutOfRange
kStatus_SPI_BaudrateNotSupport
status_t MEM_Write ( api_core_context_t coreCtx,
uint32_t  start,
uint32_t  lengthInBytes,
const uint8_t *  buf,
uint32_t  memoryId 
)
Parameters
addressThe start address of the desired flash memory to be programmed. For internal flash the address need to be 512bytes-aligned.
lengthNumber of bytes to be programmed.
bufferA pointer to the source buffer of data that is to be programmed into the flash.
memoryIdIndicates the index of the memory type. Please refer to "Memory group definition"
Return values
kStatus_Success
kStatus_Fail
#kStatusMemoryRangeInvalid
#kStatus_CommandUnsupported
kStatus_FLASH_AlignmentError
#kStatusMemoryCumulativeWrite
kStatus_FLASH_InvalidArgument
kStatus_FLASH_AddressError
kStatus_FLASH_ModifyProtectedAreaDisallowed
kStatus_FLASH_CommandFailure
kStatus_FLASH_CommandNotSupported
kStatus_FLASH_EccError
kStatus_FLASH_RegulationLoss
kStatus_FLASH_Success
kStatus_FLASH_ReadHidingAreaDisallowed
kStatus_FLASH_CompareError
#kStatusMemoryNotConfigured
#kStatusMemoryVerifyFailed
status_t MEM_Fill ( api_core_context_t coreCtx,
uint32_t  start,
uint32_t  lengthInBytes,
uint32_t  pattern,
uint32_t  memoryId 
)
Parameters
addressThe start address of the desired flash memory to be programmed. For internal flash the address need to be 512bytes-aligned.
lengthNumber of bytes to be programmed.
patternThe data to be written into the specified memory area.
Return values
#kStatus_CommandUnsupported
kStatus_Success
kStatus_FLASH_AlignmentError
#kStatusMemoryCumulativeWrite
kStatus_Fail
kStatus_FLASH_InvalidArgument
kStatus_FLASH_AddressError
kStatus_FLASH_Success
kStatus_FLASH_ModifyProtectedAreaDisallowed
kStatus_FLASH_CommandFailure
kStatus_FLASH_CommandNotSupported
kStatus_FLASH_EccError
kStatus_FLASH_RegulationLoss
kStatus_FLASH_ReadHidingAreaDisallowed
status_t MEM_Erase ( api_core_context_t coreCtx,
uint32_t  start,
uint32_t  lengthInBytes,
uint32_t  memoryId 
)
Parameters
addressThe start address of the desired flash memory to be erased.
lengthNumber of bytes to be read.
memoryIdIndicates the index of the memory type. Please refer to "Memory group definition"
Return values
kStatus_Success
#kStatusMemoryRangeInvalid
#kStatusMemoryAddressError
kStatus_FLASH_InvalidArgument
kStatus_FLASH_AlignmentError
kStatus_FLASH_Success
kStatus_FLASH_AddressError
kStatus_FLASH_EraseKeyError
kStatus_FLASH_ModifyProtectedAreaDisallowed
kStatus_Fail
kStatus_FLASH_CommandFailure
kStatus_FLASH_CommandNotSupported
kStatus_FLASH_EccError
kStatus_FLASH_RegulationLoss
#kStatusMemoryNotConfigured
#kStatusMemoryVerifyFailed
status_t MEM_EraseAll ( api_core_context_t coreCtx,
uint32_t  memoryId 
)