MCUXpresso SDK API Reference Manual  Rev 2.12.1
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
C40ESP3 Flash Driver

Overview

The flash provides the C40ESP3 Flash driver of Kinetis devices with the C40ESP3 Flash module inside. The flash driver provides general APIs to handle specific operations on C40ESP3 Flash module. The user can use those APIs directly in the application. In addition, it provides internal functions called by the driver. Although these functions are not meant to be called from the user's application directly, the APIs can still be used.

Data Structures

struct  flash_mem_desc_t
 Flash memory descriptor. More...
 
struct  flash_config_t
 Flash driver state information. More...
 

Flash version

enum  _flash_driver_version_constants {
  kFLASH_DriverVersionName = 'F',
  kFLASH_DriverVersionMajor = 1,
  kFLASH_DriverVersionMinor = 1,
  kFLASH_DriverVersionBugfix = 0,
  kFLASH_DriverVersionName = 'F',
  kFLASH_DriverVersionMajor = 2,
  kFLASH_DriverVersionMinor = 1,
  kFLASH_DriverVersionBugfix = 0
}
 Flash driver version for ROM. More...
 
enum  flash_property_tag_t {
  kFLASH_PropertyPflash0SectorSize = 0x00U,
  kFLASH_PropertyPflash0TotalSize = 0x01U,
  kFLASH_PropertyPflash0BlockSize = 0x02U,
  kFLASH_PropertyPflash0BlockCount = 0x03U,
  kFLASH_PropertyPflash0BlockBaseAddr = 0x04U,
  kFLASH_PropertyPflash0FacSupport = 0x05U,
  kFLASH_PropertyPflash0AccessSegmentSize = 0x06U,
  kFLASH_PropertyPflash0AccessSegmentCount = 0x07U,
  kFLASH_PropertyPflash1SectorSize = 0x10U,
  kFLASH_PropertyPflash1TotalSize = 0x11U,
  kFLASH_PropertyPflash1BlockSize = 0x12U,
  kFLASH_PropertyPflash1BlockCount = 0x13U,
  kFLASH_PropertyPflash1BlockBaseAddr = 0x14U,
  kFLASH_PropertyPflash1FacSupport = 0x15U,
  kFLASH_PropertyPflash1AccessSegmentSize = 0x16U,
  kFLASH_PropertyPflash1AccessSegmentCount = 0x17U,
  kFLASH_PropertyFlexRamBlockBaseAddr = 0x20U,
  kFLASH_PropertyFlexRamTotalSize = 0x21U,
  kFLASH_PropertyPflash0SectorSize = 0x00U,
  kFLASH_PropertyPflash0TotalSize = 0x01U,
  kFLASH_PropertyPflash0BlockSize = 0x02U,
  kFLASH_PropertyPflash0BlockCount = 0x03U,
  kFLASH_PropertyPflash0BlockBaseAddr = 0x04U,
  kFLASH_PropertyPflash0FacSupport = 0x05U,
  kFLASH_PropertyPflash0AccessSegmentSize = 0x06U,
  kFLASH_PropertyPflash0AccessSegmentCount = 0x07U,
  kFLASH_PropertyPflash1SectorSize = 0x10U,
  kFLASH_PropertyPflash1TotalSize = 0x11U,
  kFLASH_PropertyPflash1BlockSize = 0x12U,
  kFLASH_PropertyPflash1BlockCount = 0x13U,
  kFLASH_PropertyPflash1BlockBaseAddr = 0x14U,
  kFLASH_PropertyPflash1FacSupport = 0x15U,
  kFLASH_PropertyPflash1AccessSegmentSize = 0x16U,
  kFLASH_PropertyPflash1AccessSegmentCount = 0x17U,
  kFLASH_PropertyFlexRamBlockBaseAddr = 0x20U,
  kFLASH_PropertyFlexRamTotalSize = 0x21U
}
 Enumeration for various flash properties. More...
 
#define FSL_FLASH_DRIVER_VERSION   (MAKE_VERSION(2, 1, 1))
 Flash driver version for SDK. More...
 
#define FLASH_ADDR_MASK   0xEFFFFFFFu
 

Flash API key

enum  _flash_driver_api_keys {
  kFLASH_ApiEraseKey = FOUR_CHAR_CODE('l', 'f', 'e', 'k'),
  kFLASH_ApiEraseKey = FOUR_CHAR_CODE('l', 'f', 'e', 'k')
}
 Enumeration for Flash driver API keys. More...
 

Initialization

status_t FLASH_Init (flash_config_t *config)
 Initializes the global flash properties structure members. More...
 

Erasing

status_t FLASH_Erase (flash_config_t *config, FMU_Type *base, uint32_t start, uint32_t lengthInBytes, uint32_t key)
 Erases the flash sectors encompassed by parameters passed into function.
 
status_t FLASH_EraseAll (FMU_Type *base, uint32_t key)
 Erases entire flash and ifr.
 

Programming

status_t FLASH_Program (flash_config_t *config, FMU_Type *base, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
 Programs flash phrases with data at locations passed in through parameters.
 
status_t FLASH_ProgramPage (flash_config_t *config, FMU_Type *base, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
 Programs flash pages with data at locations passed in through parameters.
 

Verification

status_t FLASH_VerifyErasePhrase (flash_config_t *config, FMU_Type *base, uint32_t start, uint32_t lengthInBytes)
 Verify that the flash phrases are erased.
 
status_t FLASH_VerifyErasePage (flash_config_t *config, FMU_Type *base, uint32_t start, uint32_t lengthInBytes)
 Verify that the flash pages are erased.
 
status_t FLASH_VerifyEraseSector (flash_config_t *config, FMU_Type *base, uint32_t start, uint32_t lengthInBytes)
 Verify that the flash sectors are erased.
 
status_t FLASH_VerifyEraseAll (FMU_Type *base)
 Verify that all flash and IFR space is erased.
 
status_t FLASH_VerifyEraseBlock (flash_config_t *config, FMU_Type *base, uint32_t blockaddr)
 Verify that a flash block is erased.
 
status_t FLASH_VerifyEraseIFRPhrase (flash_config_t *config, FMU_Type *base, uint32_t start, uint32_t lengthInBytes)
 Verify that the ifr phrases are erased.
 
status_t FLASH_VerifyEraseIFRPage (flash_config_t *config, FMU_Type *base, uint32_t start, uint32_t lengthInBytes)
 Verify that the ifr pages are erased.
 
status_t FLASH_VerifyEraseIFRSector (flash_config_t *config, FMU_Type *base, uint32_t start, uint32_t lengthInBytes)
 Verify that the ifr sectors are erased.
 

Properties

status_t FLASH_GetProperty (flash_config_t *config, flash_property_tag_t whichProperty, uint32_t *value)
 Returns the desired flash property.
 

Read (Main Array or IFR) Into MISR

status_t Read_Into_MISR (flash_config_t *config, FMU_Type *base, uint32_t start, uint32_t ending, uint32_t *seed, uint32_t *signature)
 Read into MISR. More...
 
status_t Read_IFR_Into_MISR (flash_config_t *config, FMU_Type *base, uint32_t start, uint32_t ending, uint32_t *seed, uint32_t *signature)
 Read IFR into MISR. More...
 

Data Structure Documentation

struct flash_mem_desc_t

Data Fields

uint32_t blockBase
 A base address of the flash block. More...
 
uint32_t totalSize
 The size of the flash block. More...
 
uint32_t blockCount
 A number of flash blocks. More...
 

Field Documentation

uint32_t flash_mem_desc_t::blockBase

Base address of the flash block.

uint32_t flash_mem_desc_t::totalSize
uint32_t flash_mem_desc_t::blockCount
struct flash_config_t

An instance of this structure is allocated by the user of the flash driver and passed into each of the driver APIs.

Macro Definition Documentation

#define FSL_FLASH_DRIVER_VERSION   (MAKE_VERSION(2, 1, 1))

Version 2.1.1.

Enumeration Type Documentation

Enumerator
kFLASH_DriverVersionName 

Flash driver version name.

kFLASH_DriverVersionMajor 

Major flash driver version.

kFLASH_DriverVersionMinor 

Minor flash driver version.

kFLASH_DriverVersionBugfix 

Bugfix for flash driver version.

kFLASH_DriverVersionName 

Flash driver version name.

kFLASH_DriverVersionMajor 

Major flash driver version.

kFLASH_DriverVersionMinor 

Minor flash driver version.

kFLASH_DriverVersionBugfix 

Bugfix for flash driver version.

Enumerator
kFLASH_PropertyPflash0SectorSize 

Pflash sector size property.

kFLASH_PropertyPflash0TotalSize 

Pflash total size property.

kFLASH_PropertyPflash0BlockSize 

Pflash block size property.

kFLASH_PropertyPflash0BlockCount 

Pflash block count property.

kFLASH_PropertyPflash0BlockBaseAddr 

Pflash block base address property.

kFLASH_PropertyPflash0FacSupport 

Pflash fac support property.

kFLASH_PropertyPflash0AccessSegmentSize 

Pflash access segment size property.

kFLASH_PropertyPflash0AccessSegmentCount 

Pflash access segment count property.

kFLASH_PropertyPflash1SectorSize 

Pflash sector size property.

kFLASH_PropertyPflash1TotalSize 

Pflash total size property.

kFLASH_PropertyPflash1BlockSize 

Pflash block size property.

kFLASH_PropertyPflash1BlockCount 

Pflash block count property.

kFLASH_PropertyPflash1BlockBaseAddr 

Pflash block base address property.

kFLASH_PropertyPflash1FacSupport 

Pflash fac support property.

kFLASH_PropertyPflash1AccessSegmentSize 

Pflash access segment size property.

kFLASH_PropertyPflash1AccessSegmentCount 

Pflash access segment count property.

kFLASH_PropertyFlexRamBlockBaseAddr 

FlexRam block base address property.

kFLASH_PropertyFlexRamTotalSize 

FlexRam total size property.

kFLASH_PropertyPflash0SectorSize 

Pflash sector size property.

kFLASH_PropertyPflash0TotalSize 

Pflash total size property.

kFLASH_PropertyPflash0BlockSize 

Pflash block size property.

kFLASH_PropertyPflash0BlockCount 

Pflash block count property.

kFLASH_PropertyPflash0BlockBaseAddr 

Pflash block base address property.

kFLASH_PropertyPflash0FacSupport 

Pflash fac support property.

kFLASH_PropertyPflash0AccessSegmentSize 

Pflash access segment size property.

kFLASH_PropertyPflash0AccessSegmentCount 

Pflash access segment count property.

kFLASH_PropertyPflash1SectorSize 

Pflash sector size property.

kFLASH_PropertyPflash1TotalSize 

Pflash total size property.

kFLASH_PropertyPflash1BlockSize 

Pflash block size property.

kFLASH_PropertyPflash1BlockCount 

Pflash block count property.

kFLASH_PropertyPflash1BlockBaseAddr 

Pflash block base address property.

kFLASH_PropertyPflash1FacSupport 

Pflash fac support property.

kFLASH_PropertyPflash1AccessSegmentSize 

Pflash access segment size property.

kFLASH_PropertyPflash1AccessSegmentCount 

Pflash access segment count property.

kFLASH_PropertyFlexRamBlockBaseAddr 

FlexRam block base address property.

kFLASH_PropertyFlexRamTotalSize 

FlexRam total size property.

Note
The resulting value is built with a byte order such that the string being readable in expected order when viewed in a hex editor, if the value is treated as a 32-bit little endian value.
Enumerator
kFLASH_ApiEraseKey 

Key value used to validate all flash erase APIs.

kFLASH_ApiEraseKey 

Key value used to validate all flash erase APIs.

Function Documentation

status_t FLASH_Init ( flash_config_t config)

This function checks and initializes the Flash module for the other Flash APIs.

Parameters
configPointer to the storage for the driver runtime state.
Return values
kStatus_FLASH_SuccessAPI was executed successfully.
kStatus_FLASH_InvalidArgumentAn invalid argument is provided.
kStatus_FLASH_CommandFailureRun-time error during the command execution.
kStatus_FLASH_CommandNotSupportedFlash API is not supported.
status_t Read_Into_MISR ( flash_config_t config,
FMU_Type *  base,
uint32_t  start,
uint32_t  ending,
uint32_t *  seed,
uint32_t *  signature 
)

The Read into MISR operation generates a signature based on the contents of the selected flash memory using an embedded MISR.

status_t Read_IFR_Into_MISR ( flash_config_t config,
FMU_Type *  base,
uint32_t  start,
uint32_t  ending,
uint32_t *  seed,
uint32_t *  signature 
)

The Read IFR into MISR operation generates a signature based on the contents of the selected IFR space using an embedded MISR.