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

Overview

Files

file  fsl_iap.h
 

Enumerations

enum  {
  kStatus_IAP_Success = kStatus_Success,
  kStatus_IAP_InvalidCommand = MAKE_STATUS(kStatusGroup_IAP, 1U),
  kStatus_IAP_SrcAddrError = MAKE_STATUS(kStatusGroup_IAP, 2U),
  kStatus_IAP_DstAddrError,
  kStatus_IAP_SrcAddrNotMapped,
  kStatus_IAP_DstAddrNotMapped,
  kStatus_IAP_CountError,
  kStatus_IAP_InvalidSector,
  kStatus_IAP_SectorNotblank = MAKE_STATUS(kStatusGroup_IAP, 8U),
  kStatus_IAP_NotPrepared,
  kStatus_IAP_CompareError,
  kStatus_IAP_Busy = MAKE_STATUS(kStatusGroup_IAP, 11U),
  kStatus_IAP_ParamError,
  kStatus_IAP_AddrError = MAKE_STATUS(kStatusGroup_IAP, 13U),
  kStatus_IAP_AddrNotMapped = MAKE_STATUS(kStatusGroup_IAP, 14U),
  kStatus_IAP_NoPower = MAKE_STATUS(kStatusGroup_IAP, 24U),
  kStatus_IAP_NoClock = MAKE_STATUS(kStatusGroup_IAP, 27U),
  kStatus_IAP_ReinvokeISPConfig = MAKE_STATUS(kStatusGroup_IAP, 0x1CU)
}
 iap status codes. More...
 
enum  _iap_commands {
  kIapCmd_IAP_ReadFactorySettings = 40U,
  kIapCmd_IAP_PrepareSectorforWrite = 50U,
  kIapCmd_IAP_CopyRamToFlash = 51U,
  kIapCmd_IAP_EraseSector = 52U,
  kIapCmd_IAP_BlankCheckSector = 53U,
  kIapCmd_IAP_ReadPartId = 54U,
  kIapCmd_IAP_Read_BootromVersion = 55U,
  kIapCmd_IAP_Compare = 56U,
  kIapCmd_IAP_ReinvokeISP = 57U,
  kIapCmd_IAP_ReadUid = 58U,
  kIapCmd_IAP_ErasePage = 59U,
  kIapCmd_IAP_ReadSignature = 70U,
  kIapCmd_IAP_ExtendedReadSignature = 73U,
  kIapCmd_IAP_ReadEEPROMPage = 80U,
  kIapCmd_IAP_WriteEEPROMPage = 81U
}
 iap command codes. More...
 

Driver version

#define FSL_IAP_DRIVER_VERSION   (MAKE_VERSION(2, 0, 3))
 Version 2.0.3. More...
 

Basic operations

status_t IAP_ReadPartID (uint32_t *partID)
 Read part identification number. More...
 
status_t IAP_ReadBootCodeVersion (uint32_t *bootCodeVersion)
 Read boot code version number. More...
 
void IAP_ReinvokeISP (uint8_t ispType, uint32_t *status)
 Reinvoke ISP. More...
 
status_t IAP_ReadUniqueID (uint32_t *uniqueID)
 Read unique identification. More...
 
status_t IAP_ReadFactorySettings (uint32_t dstRegAddr, uint32_t *factoryValue)
 Read factory settings. More...
 

Flash operations

status_t IAP_PrepareSectorForWrite (uint32_t startSector, uint32_t endSector)
 Prepare sector for write operation. More...
 
status_t IAP_CopyRamToFlash (uint32_t dstAddr, uint32_t *srcAddr, uint32_t numOfBytes, uint32_t systemCoreClock)
 Copy RAM to flash. More...
 
status_t IAP_EraseSector (uint32_t startSector, uint32_t endSector, uint32_t systemCoreClock)
 Erase sector. More...
 
status_t IAP_ErasePage (uint32_t startPage, uint32_t endPage, uint32_t systemCoreClock)
 Erase page. More...
 
status_t IAP_BlankCheckSector (uint32_t startSector, uint32_t endSector)
 Blank check sector(s) More...
 
status_t IAP_Compare (uint32_t dstAddr, uint32_t *srcAddr, uint32_t numOfBytes)
 Compare memory contents of flash with ram. More...
 

Macro Definition Documentation

#define FSL_IAP_DRIVER_VERSION   (MAKE_VERSION(2, 0, 3))

Enumeration Type Documentation

anonymous enum
Enumerator
kStatus_IAP_Success 

Api is executed successfully.

kStatus_IAP_InvalidCommand 

Invalid command.

kStatus_IAP_SrcAddrError 

Source address is not on word boundary.

kStatus_IAP_DstAddrError 

Destination address is not on a correct boundary.

kStatus_IAP_SrcAddrNotMapped 

Source address is not mapped in the memory map.

kStatus_IAP_DstAddrNotMapped 

Destination address is not mapped in the memory map.

kStatus_IAP_CountError 

Byte count is not multiple of 4 or is not a permitted value.

kStatus_IAP_InvalidSector 

Sector/page number is invalid or end sector/page number is greater than start sector/page number.

kStatus_IAP_SectorNotblank 

One or more sectors are not blank.

kStatus_IAP_NotPrepared 

Command to prepare sector for write operation has not been executed.

kStatus_IAP_CompareError 

Destination and source memory contents do not match.

kStatus_IAP_Busy 

Flash programming hardware interface is busy.

kStatus_IAP_ParamError 

Insufficient number of parameters or invalid parameter.

kStatus_IAP_AddrError 

Address is not on word boundary.

kStatus_IAP_AddrNotMapped 

Address is not mapped in the memory map.

kStatus_IAP_NoPower 

Flash memory block is powered down.

kStatus_IAP_NoClock 

Flash memory block or controller is not clocked.

kStatus_IAP_ReinvokeISPConfig 

Reinvoke configuration error.

Enumerator
kIapCmd_IAP_ReadFactorySettings 

Read the factory settings.

kIapCmd_IAP_PrepareSectorforWrite 

Prepare Sector for write.

kIapCmd_IAP_CopyRamToFlash 

Copy RAM to flash.

kIapCmd_IAP_EraseSector 

Erase Sector.

kIapCmd_IAP_BlankCheckSector 

Blank check sector.

kIapCmd_IAP_ReadPartId 

Read part id.

kIapCmd_IAP_Read_BootromVersion 

Read bootrom version.

kIapCmd_IAP_Compare 

Compare.

kIapCmd_IAP_ReinvokeISP 

Reinvoke ISP.

kIapCmd_IAP_ReadUid 

Read Uid.

kIapCmd_IAP_ErasePage 

Erase Page.

kIapCmd_IAP_ReadSignature 

Read Signature.

kIapCmd_IAP_ExtendedReadSignature 

Extended Read Signature.

kIapCmd_IAP_ReadEEPROMPage 

Read EEPROM page.

kIapCmd_IAP_WriteEEPROMPage 

Write EEPROM page.

Function Documentation

status_t IAP_ReadPartID ( uint32_t *  partID)

This function is used to read the part identification number.

Parameters
partIDAddress to store the part identification number.
Return values
kStatus_IAP_SuccessApi has been executed successfully.
status_t IAP_ReadBootCodeVersion ( uint32_t *  bootCodeVersion)

This function is used to read the boot code version number.

Parameters
bootCodeVersionAddress to store the boot code version.
Return values
kStatus_IAP_SuccessApi has been executed successfully.

note Boot code version is two 32-bit words. Word 0 is the major version, word 1 is the minor version.

void IAP_ReinvokeISP ( uint8_t  ispType,
uint32_t *  status 
)

This function is used to invoke the boot loader in ISP mode. It maps boot vectors and configures the peripherals for ISP.

Parameters
ispTyoeISP type selection.
statusstore the possible status.
Return values
kStatus_IAP_ReinvokeISPConfigreinvoke configuration error.

note The error response will be returned when IAP is disabled or an invalid ISP type selection appears. The call won't return unless an error occurs, so there can be no status code.

status_t IAP_ReadUniqueID ( uint32_t *  uniqueID)

This function is used to read the unique id.

Parameters
uniqueIDstore the uniqueID.
Return values
kStatus_IAP_SuccessApi has been executed successfully.
status_t IAP_ReadFactorySettings ( uint32_t  dstRegAddr,
uint32_t *  factoryValue 
)

This function reads the factory settings for calibration registers.

Parameters
dstRegAddrAddress of the targeted calibration register.
factoryValueStore the factory value
Return values
kStatus_IAP_SuccessApi has been executed successfully.
kStatus_IAP_ParamErrorParam0 is not one of the supported calibration registers.
status_t IAP_PrepareSectorForWrite ( uint32_t  startSector,
uint32_t  endSector 
)

This function prepares sector(s) for write/erase operation. This function must be called before calling the IAP_CopyRamToFlash() or IAP_EraseSector() or IAP_ErasePage() function. The end sector number must be greater than or equal to the start sector number.

Parameters
startSectorStart sector number.
endSectorEnd sector number.
Return values
kStatus_IAP_SuccessApi has been executed successfully.
kStatus_IAP_NoPowerFlash memory block is powered down.
kStatus_IAP_NoClockFlash memory block or controller is not clocked.
kStatus_IAP_InvalidSectorSector number is invalid or end sector number is greater than start sector number.
kStatus_IAP_BusyFlash programming hardware interface is busy.
status_t IAP_CopyRamToFlash ( uint32_t  dstAddr,
uint32_t *  srcAddr,
uint32_t  numOfBytes,
uint32_t  systemCoreClock 
)

This function programs the flash memory. Corresponding sectors must be prepared via IAP_PrepareSectorForWrite before calling this function. The addresses should be a 256 byte boundary and the number of bytes should be 256 | 512 | 1024 | 4096.

Parameters
dstAddrDestination flash address where data bytes are to be written.
srcAddrSource ram address from where data bytes are to be read.
numOfBytesNumber of bytes to be written.
systemCoreClockSystemCoreClock in Hz. It is converted to KHz before calling the rom IAP function. When the flash controller has a fixed reference clock, this parameter is bypassed.
Return values
kStatus_IAP_SuccessApi has been executed successfully.
kStatus_IAP_NoPowerFlash memory block is powered down.
kStatus_IAP_NoClockFlash memory block or controller is not clocked.
kStatus_IAP_SrcAddrErrorSource address is not on word boundary.
kStatus_IAP_DstAddrErrorDestination address is not on a correct boundary.
kStatus_IAP_SrcAddrNotMappedSource address is not mapped in the memory map.
kStatus_IAP_DstAddrNotMappedDestination address is not mapped in the memory map.
kStatus_IAP_CountErrorByte count is not multiple of 4 or is not a permitted value.
kStatus_IAP_NotPreparedCommand to prepare sector for write operation has not been executed.
kStatus_IAP_BusyFlash programming hardware interface is busy.
status_t IAP_EraseSector ( uint32_t  startSector,
uint32_t  endSector,
uint32_t  systemCoreClock 
)

This function erases sector(s). The end sector number must be greater than or equal to the start sector number.

Parameters
startSectorStart sector number.
endSectorEnd sector number.
systemCoreClockSystemCoreClock in Hz. It is converted to KHz before calling the rom IAP function. When the flash controller has a fixed reference clock, this parameter is bypassed.
Return values
kStatus_IAP_SuccessApi has been executed successfully.
kStatus_IAP_NoPowerFlash memory block is powered down.
kStatus_IAP_NoClockFlash memory block or controller is not clocked.
kStatus_IAP_InvalidSectorSector number is invalid or end sector number is greater than start sector number.
kStatus_IAP_NotPreparedCommand to prepare sector for write operation has not been executed.
kStatus_IAP_BusyFlash programming hardware interface is busy.
status_t IAP_ErasePage ( uint32_t  startPage,
uint32_t  endPage,
uint32_t  systemCoreClock 
)

This function erases page(s). The end page number must be greater than or equal to the start page number.

Parameters
startPageStart page number.
endPageEnd page number.
systemCoreClockSystemCoreClock in Hz. It is converted to KHz before calling the rom IAP function. When the flash controller has a fixed reference clock, this parameter is bypassed.
Return values
kStatus_IAP_SuccessApi has been executed successfully.
kStatus_IAP_NoPowerFlash memory block is powered down.
kStatus_IAP_NoClockFlash memory block or controller is not clocked.
kStatus_IAP_InvalidSectorPage number is invalid or end page number is greater than start page number.
kStatus_IAP_NotPreparedCommand to prepare sector for write operation has not been executed.
kStatus_IAP_BusyFlash programming hardware interface is busy.
status_t IAP_BlankCheckSector ( uint32_t  startSector,
uint32_t  endSector 
)

Blank check single or multiples sectors of flash memory. The end sector number must be greater than or equal to the start sector number. It can be used to verify the sector erasure after IAP_EraseSector call.

Parameters
startSectorStart sector number.
endSectorEnd sector number.
Return values
kStatus_IAP_SuccessOne or more sectors are in erased state.
kStatus_IAP_NoPowerFlash memory block is powered down.
kStatus_IAP_NoClockFlash memory block or controller is not clocked.
kStatus_IAP_SectorNotblankOne or more sectors are not blank.
status_t IAP_Compare ( uint32_t  dstAddr,
uint32_t *  srcAddr,
uint32_t  numOfBytes 
)

This function compares the contents of flash and ram. It can be used to verify the flash memory contents after IAP_CopyRamToFlash call.

Parameters
dstAddrDestination flash address.
srcAddrSource ram address.
numOfBytesNumber of bytes to be compared.
Return values
kStatus_IAP_SuccessContents of flash and ram match.
kStatus_IAP_NoPowerFlash memory block is powered down.
kStatus_IAP_NoClockFlash memory block or controller is not clocked.
kStatus_IAP_AddrErrorAddress is not on word boundary.
kStatus_IAP_AddrNotMappedAddress is not mapped in the memory map.
kStatus_IAP_CountErrorByte count is not multiple of 4 or is not a permitted value.
kStatus_IAP_CompareErrorDestination and source memory contents do not match.