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

Overview

The MCUXpresso SDK provides a peripheral driver for the Flash Controller (FLASHC) module of MCUXpresso SDK devices.

Typical use case

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/flashc

Input Operation

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/flashc

Data Structures

struct  flashc_timing_config_t
 FLASHC timing configure structure. More...
 
struct  flashc_config_t
 FLASHC configure structure. More...
 

Enumerations

enum  flashc_config_selection_t {
  kFLASHC_HardwareConfig,
  kFLASHC_SoftwareConfig
}
 FLASHC configuration way selection. More...
 
enum  flashc_hw_cmd_t {
  kFLASHC_HardwareCmdNormalRead,
  kFLASHC_HardwareCmdFastRead,
  kFLASHC_HardwareCmdFastReadDualOutput,
  kFLASHC_HardwareCmdFastReadQuadOutput,
  kFLASHC_HardwareCmdFastReadDualIO,
  kFLASHC_HardwareCmdFastReadDualIOContinuous,
  kFLASHC_HardwareCmdFastReadQuadIO,
  kFLASHC_HardwareCmdFastReadQuadIOContinuous,
  kFLASHC_HardwareCmdWordReadQuadIO,
  kFLASHC_HardwareCmdWordReadQuadIOContinuous,
  kFLASHC_HardwareCmdOctalWordReadQuadIO,
  kFLASHC_HardwareCmdOctalWordReadQuadIOContinuous,
  kFLASHC_HardwareCmdExitFromDual,
  kFLASHC_HardwareCmdExitFromQuad
}
 FLASHC hardware configuration. More...
 
enum  flashc_data_pin_t {
  kFLASHC_DataPinSingle,
  kFLASHC_DataPinDual,
  kFLASHC_DataPinQuad
}
 FLASHC data pin. More...
 
enum  flashc_addr_pin_t {
  kFLASHC_AddrPinSingle,
  kFLASHC_AddrPinAsData
}
 FLASHC address pin. More...
 
enum  flashc_clock_phase_t {
  kFLASHC_ClockPhaseRising,
  kFLASHC_ClockPhaseFalling
}
 FLASHC clock phase. More...
 
enum  flashc_clock_polarity_t {
  kFLASHC_ClockPolarityLow,
  kFLASHC_ClockPolarityHigh
}
 FLASHC clock polarity. More...
 
enum  flashc_capture_edge_t {
  kFLASHC_CaptureEdgeFirst,
  kFLASHC_CaptureEdgeSecond
}
 FLASHC capture clock edge. More...
 
enum  flashc_transfer_length_t {
  kFLASHC_TransferLength1Byte,
  kFLASHC_TransferLength4Bytes
}
 FLASHC transfer length. More...
 
enum  flashc_clock_prescaler_t {
  kFLASHC_ClockDiv1 = 0x1,
  kFLASHC_ClockDiv2 = 0x2,
  kFLASHC_ClockDiv3 = 0x3,
  kFLASHC_ClockDiv4 = 0x4,
  kFLASHC_ClockDiv5 = 0x5,
  kFLASHC_ClockDiv6 = 0x6,
  kFLASHC_ClockDiv7 = 0x7,
  kFLASHC_ClockDiv8 = 0x8,
  kFLASHC_ClockDiv9 = 0x9,
  kFLASHC_ClockDiv10 = 0xA,
  kFLASHC_ClockDiv11 = 0xB,
  kFLASHC_ClockDiv12 = 0xC,
  kFLASHC_ClockDiv13 = 0xD,
  kFLASHC_ClockDiv14 = 0xE,
  kFLASHC_ClockDiv15 = 0xF,
  kFLASHC_ClockDiv16 = 0x18,
  kFLASHC_ClockDiv18 = 0x19,
  kFLASHC_ClockDiv20 = 0x1A,
  kFLASHC_ClockDiv22 = 0x1B,
  kFLASHC_ClockDiv24 = 0x1C,
  kFLASHC_ClockDiv26 = 0x1D,
  kFLASHC_ClockDiv28 = 0x1E,
  kFLASHC_ClockDiv30 = 0x1F
}
 FLASHC clock prescaler. More...
 
enum  flashc_instruction_count_t {
  kFLASHC_InstructionCnt0Byte,
  kFLASHC_InstructionCnt1Byte,
  kFLASHC_InstructionCnt2Byte
}
 FLASHC Instruction Count. More...
 
enum  flashc_address_count_t {
  kFLASHC_AddressCnt0Byte,
  kFLASHC_AddressCnt1Byte,
  kFLASHC_AddressCnt2Byte,
  kFLASHC_AddressCnt3Byte,
  kFLASHC_AddressCnt4Byte
}
 FLASHC Address Count. More...
 
enum  flashc_read_mode_count_t {
  kFLASHC_ReadModeCnt0Byte,
  kFLASHC_ReadModeCnt1Byte,
  kFLASHC_ReadModeCnt2Byte
}
 FLASHC Read Mode Count. More...
 
enum  flashc_dummy_count_t {
  kFLASHC_DummyCnt0Byte,
  kFLASHC_DummyCnt1Byte,
  kFLASHC_DummyCnt2Byte
}
 FLASHC Dummy Count. More...
 

Initialization and deinitialization

uint32_t FLASHC_GetInstance (FLASHC_Type *base)
 Get the instance number for FLASHC. More...
 
void FLASHC_Init (FLASHC_Type *base, flashc_config_t *config)
 Initializes FLASHC, it override the HW configuration (FCCR.CMD_TYPE) if it is enabled. More...
 
void FLASHC_Deinit (FLASHC_Type *base)
 De-initializes FLASHC. More...
 
void FLASHC_GetDefaultConfig (flashc_config_t *config)
 Gets default settings for FLASHC. More...
 
void FLASHC_SetTimingConfig (FLASHC_Type *base, flashc_timing_config_t *config)
 Configure the timing of the FLASHC. More...
 
status_t FLASHC_FlushCache (FLASHC_Type *base)
 Flush the Cache. More...
 
void FLASHC_EnableCacheHitCounter (FLASHC_Type *base, bool enable)
 Enable Flash Cache Hit Counters. More...
 
void FLASHC_EnableCacheMissCounter (FLASHC_Type *base, bool enable)
 Enable Flash Cache Miss Counters. More...
 
void FLASHC_GetCacheCounter (FLASHC_Type *base, uint32_t *hitCnt, uint32_t *missCnt)
 Enable Flash Cache Miss Counters. More...
 
void FLASHC_ResetCacheCounter (FLASHC_Type *base)
 Reset Flash Controller Cache Counters. More...
 
static void FLASHC_EnableCacheMode (FLASHC_Type *base)
 Enable the cache mode.
 
static void FLASHC_DisableCacheMode (FLASHC_Type *base)
 Disable the cache mode.
 
static void FLASHC_EnableSramMode (FLASHC_Type *base)
 Enable the sram mode.
 
static void FLASHC_DisableSramMode (FLASHC_Type *base)
 Disable the sram mode.
 
static void FLASHC_SetHardwareCommand (FLASHC_Type *base, flashc_hw_cmd_t command)
 Hardware command configuration for FLASHC. More...
 
static void FLASHC_SetConfigSelection (FLASHC_Type *base, flashc_config_selection_t cfgSel)
 Set selection hardware or software configuration for FLASHC. More...
 
static void FLASHC_DisableOffsetAddr (FLASHC_Type *base)
 do not use offset address for flash memory access. More...
 
void FLASHC_EnableOffsetAddr (FLASHC_Type *base, uint32_t address)
 Use offset address for flash memory access and set the offset address. More...
 
static bool FLASHC_GetExitContReadStatus (FLASHC_Type *base)
 Get exit continuous read mode status. More...
 
status_t FLASHC_ExitDualContReadMode (FLASHC_Type *base)
 Exit dual continuous read mode. More...
 
status_t FLASHC_ExitQuadContReadMode (FLASHC_Type *base)
 Exit quad continuous read mode. More...
 
status_t FLASHC_EnableQSPIPad (FLASHC_Type *base)
 Switch into QSPI from FLASHC. More...
 
void FLASHC_EnableFLASHCPad (FLASHC_Type *base, flashc_hw_cmd_t mode, uint32_t jedecID)
 Switch back FLASHC from QSPI. More...
 
void FLASH_SetQuadModeReadCmd (FLASHC_Type *base, uint32_t jedecID)
 Set quad mode read command. More...
 

Data Structure Documentation

struct flashc_timing_config_t

Data Fields

flashc_clock_phase_t clockPhase
 Serial Interface Clock Phase. More...
 
flashc_clock_polarity_t clockPolarity
 Serial Interface Clock Polarity. More...
 
flashc_clock_prescaler_t preScaler
 Configure FLASHC prescaler for serial interface.
 
flashc_capture_edge_t captEdge
 Configure FLASHC capture clock edge.
 
uint8_t clkOutDly
 Delay on the outgoing clock to flash.
 
uint8_t clkInDly
 Delay on the clock that capture read data from flash.
 
uint8_t dinDly
 Delay on the incoming data from flash.
 

Field Documentation

flashc_clock_phase_t flashc_timing_config_t::clockPhase
flashc_clock_polarity_t flashc_timing_config_t::clockPolarity
struct flashc_config_t

Data Fields

flashc_timing_config_t timingConfig
 Timing configuration.
 
flashc_data_pin_t dataPinMode
 Configure FLASHC data pin.
 
flashc_addr_pin_t addrPinMode
 Configure FLASHC addr pin.
 
flashc_transfer_length_t byteLen
 Configure FLASHC length each serial transfer.
 
flashc_dummy_count_t dummyCnt
 Dummy count.
 
flashc_read_mode_count_t readModeCnt
 read mode count
 
uint16_t readMode
 read mode
 
flashc_address_count_t addrCnt
 address count
 
flashc_instruction_count_t instrCnt
 instruction count
 
uint16_t instrucion
 instruction
 

Enumeration Type Documentation

Enumerator
kFLASHC_HardwareConfig 

Use hardware configuration.

kFLASHC_SoftwareConfig 

Use software configuration.

Enumerator
kFLASHC_HardwareCmdNormalRead 

read data(0x03)

kFLASHC_HardwareCmdFastRead 

fast read data(0x0B)

kFLASHC_HardwareCmdFastReadDualOutput 

fast read dual output (0x3B)

kFLASHC_HardwareCmdFastReadQuadOutput 

fast read quad output (0x6B)

kFLASHC_HardwareCmdFastReadDualIO 

fast read dual I/O (0xBB)

kFLASHC_HardwareCmdFastReadDualIOContinuous 

fast read dual I/O with continuous read (0xBB)

kFLASHC_HardwareCmdFastReadQuadIO 

fast read quad I/O (0xEB)

kFLASHC_HardwareCmdFastReadQuadIOContinuous 

fast read quad I/O with continuous read (0xEB)

kFLASHC_HardwareCmdWordReadQuadIO 

word read quad I/O (0xE7)

kFLASHC_HardwareCmdWordReadQuadIOContinuous 

word read quad I/O with continuous read(0xE7)

kFLASHC_HardwareCmdOctalWordReadQuadIO 

Octal word read quad I/O (0xE3)

kFLASHC_HardwareCmdOctalWordReadQuadIOContinuous 

Octal word read quad I/O with continuous read(0xE3)

kFLASHC_HardwareCmdExitFromDual 

exit from continuous read mode (dual)

kFLASHC_HardwareCmdExitFromQuad 

exit from continuous read mode (quad)

Enumerator
kFLASHC_DataPinSingle 

Use 1 serial interface pin.

kFLASHC_DataPinDual 

Use 2 serial interface pins.

kFLASHC_DataPinQuad 

Use 4 serial interface pins.

Enumerator
kFLASHC_AddrPinSingle 

Use 1 serial interface pin.

kFLASHC_AddrPinAsData 

Use the number of pins as indicated in DATA_PIN.

Enumerator
kFLASHC_ClockPhaseRising 

Data is latched on the rising edge of the serial clock.

kFLASHC_ClockPhaseFalling 

Data is latched on the falling edge of the serial clock.

Enumerator
kFLASHC_ClockPolarityLow 

Inactive state of serial clock is low.

kFLASHC_ClockPolarityHigh 

Inactive state of serial clock is high.

Enumerator
kFLASHC_CaptureEdgeFirst 

Input data is captured on the first edge of the serial clock.

kFLASHC_CaptureEdgeSecond 

Input data is captured on the second edge of the serial clock.

Enumerator
kFLASHC_TransferLength1Byte 

1 byte in each serial interface I/O transfer

kFLASHC_TransferLength4Bytes 

4 bytes in each serial interface I/O transfer

Enumerator
kFLASHC_ClockDiv1 

Serial interface clock prescaler is SPI clock / 1.

kFLASHC_ClockDiv2 

Serial interface clock prescaler is SPI clock / 2.

kFLASHC_ClockDiv3 

Serial interface clock prescaler is SPI clock / 3.

kFLASHC_ClockDiv4 

Serial interface clock prescaler is SPI clock / 4.

kFLASHC_ClockDiv5 

Serial interface clock prescaler is SPI clock / 5.

kFLASHC_ClockDiv6 

Serial interface clock prescaler is SPI clock / 6.

kFLASHC_ClockDiv7 

Serial interface clock prescaler is SPI clock / 7.

kFLASHC_ClockDiv8 

Serial interface clock prescaler is SPI clock / 8.

kFLASHC_ClockDiv9 

Serial interface clock prescaler is SPI clock / 9.

kFLASHC_ClockDiv10 

Serial interface clock prescaler is SPI clock / 10.

kFLASHC_ClockDiv11 

Serial interface clock prescaler is SPI clock / 11.

kFLASHC_ClockDiv12 

Serial interface clock prescaler is SPI clock / 12.

kFLASHC_ClockDiv13 

Serial interface clock prescaler is SPI clock / 13.

kFLASHC_ClockDiv14 

Serial interface clock prescaler is SPI clock / 14.

kFLASHC_ClockDiv15 

Serial interface clock prescaler is SPI clock / 15.

kFLASHC_ClockDiv16 

Serial interface clock prescaler is SPI clock / 16.

kFLASHC_ClockDiv18 

Serial interface clock prescaler is SPI clock / 18.

kFLASHC_ClockDiv20 

Serial interface clock prescaler is SPI clock / 20.

kFLASHC_ClockDiv22 

Serial interface clock prescaler is SPI clock / 22.

kFLASHC_ClockDiv24 

Serial interface clock prescaler is SPI clock / 24.

kFLASHC_ClockDiv26 

Serial interface clock prescaler is SPI clock / 26.

kFLASHC_ClockDiv28 

Serial interface clock prescaler is SPI clock / 28.

kFLASHC_ClockDiv30 

Serial interface clock prescaler is SPI clock / 30.

Enumerator
kFLASHC_InstructionCnt0Byte 

Instrution count: 0 byte.

kFLASHC_InstructionCnt1Byte 

Instrution count: 1 byte.

kFLASHC_InstructionCnt2Byte 

Instrution count: 2 bytes.

Enumerator
kFLASHC_AddressCnt0Byte 

Address count: 0 byte.

kFLASHC_AddressCnt1Byte 

Address count: 1 byte.

kFLASHC_AddressCnt2Byte 

Address count: 2 bytes.

kFLASHC_AddressCnt3Byte 

Address count: 3 bytes.

kFLASHC_AddressCnt4Byte 

Address count: 4 bytes.

Enumerator
kFLASHC_ReadModeCnt0Byte 

Read mode count: 0 byte.

kFLASHC_ReadModeCnt1Byte 

Read mode count: 1 byte.

kFLASHC_ReadModeCnt2Byte 

Read mode count: 2 bytes.

Enumerator
kFLASHC_DummyCnt0Byte 

Dummy count: 0 byte.

kFLASHC_DummyCnt1Byte 

Dummy count: 1 byte.

kFLASHC_DummyCnt2Byte 

Dummy count: 2 bytes.

Function Documentation

uint32_t FLASHC_GetInstance ( FLASHC_Type *  base)
Parameters
baseFLASHC base pointer.
void FLASHC_Init ( FLASHC_Type *  base,
flashc_config_t config 
)
Parameters
baseFLASHC base pointer.
configFLASHC configure.
void FLASHC_Deinit ( FLASHC_Type *  base)
Parameters
baseFLASHC base pointer.
void FLASHC_GetDefaultConfig ( flashc_config_t config)
Parameters
configFLASHC configuration structure.
void FLASHC_SetTimingConfig ( FLASHC_Type *  base,
flashc_timing_config_t config 
)
Parameters
baseFLASHC base pointer.
configFLASHC timing configure.
status_t FLASHC_FlushCache ( FLASHC_Type *  base)
Parameters
baseFLASHC base pointer.
Returns
return status.
void FLASHC_EnableCacheHitCounter ( FLASHC_Type *  base,
bool  enable 
)
Parameters
baseFLASHC base pointer.
enabletrue/false.
void FLASHC_EnableCacheMissCounter ( FLASHC_Type *  base,
bool  enable 
)
Parameters
baseFLASHC base pointer.
enabletrue/false.
void FLASHC_GetCacheCounter ( FLASHC_Type *  base,
uint32_t *  hitCnt,
uint32_t *  missCnt 
)
Parameters
baseFLASHC base pointer.
hitCntcache hit counter.
missCntcache miss counter.
void FLASHC_ResetCacheCounter ( FLASHC_Type *  base)
Parameters
baseFLASHC base pointer.
static void FLASHC_SetHardwareCommand ( FLASHC_Type *  base,
flashc_hw_cmd_t  command 
)
inlinestatic
Parameters
baseFLASHC base pointer.
commandFLASHC hardware command for read.
static void FLASHC_SetConfigSelection ( FLASHC_Type *  base,
flashc_config_selection_t  cfgSel 
)
inlinestatic
Parameters
baseFLASHC base pointer.
cfgSelFLASHC Configuration Override.
static void FLASHC_DisableOffsetAddr ( FLASHC_Type *  base)
inlinestatic
Parameters
baseFLASHC base pointer.
void FLASHC_EnableOffsetAddr ( FLASHC_Type *  base,
uint32_t  address 
)
Parameters
baseFLASHC base pointer.
addressoffset address.
static bool FLASHC_GetExitContReadStatus ( FLASHC_Type *  base)
inlinestatic
Parameters
baseFLASHC base pointer.
status_t FLASHC_ExitDualContReadMode ( FLASHC_Type *  base)
Parameters
baseFLASHC base pointer.
Returns
return status.
status_t FLASHC_ExitQuadContReadMode ( FLASHC_Type *  base)
Parameters
baseFLASHC base pointer.
Returns
return status.
status_t FLASHC_EnableQSPIPad ( FLASHC_Type *  base)
Parameters
baseFLASHC base pointer.
Returns
return status.
void FLASHC_EnableFLASHCPad ( FLASHC_Type *  base,
flashc_hw_cmd_t  mode,
uint32_t  jedecID 
)
Parameters
baseFLASHC base pointer.
modeFLASHC read mode.
jedecIDJEDEC ID.
void FLASH_SetQuadModeReadCmd ( FLASHC_Type *  base,
uint32_t  jedecID 
)
Parameters
baseFLASHC base pointer.
jedecIDJEDEC ID.