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

Overview

Data Structures

struct  lpspi_flash_driver_interface_t
 Interface for the external flash driver via SPI NOR/EEPROM. More...
 

Macros

#define kROM_StatusGroup_LPSPI   4
 ROM Group number for LPSPI status codes. More...
 

Enumerations

enum  {
  kStatus_ROM_LPSPI_Busy = MAKE_STATUS(kROM_StatusGroup_LPSPI, 0),
  kStatus_ROM_LPSPI_Error = MAKE_STATUS(kROM_StatusGroup_LPSPI, 1),
  kStatus_ROM_LPSPI_Idle = MAKE_STATUS(kROM_StatusGroup_LPSPI, 2),
  kStatus_ROM_LPSPI_OutOfRange = MAKE_STATUS(kROM_StatusGroup_LPSPI, 3)
}
 Status for the LPSPI driver. More...
 
enum  {
  EepormCmd_GeneralRead = false,
  EepormCmd_FastRead = true
}
 The type of Read eeprom command. More...
 
enum  eraseOptions_t {
  kSize_ErasePage = 0x1,
  kSize_Erase4K = 0x2
}
 The length, given in bytes to be erased. More...
 

Functions

status_t SPI_EepromInit (uint32_t baudRate)
 Initialize SPI NOR/EEPROM. More...
 
status_t SPI_EepromRead (uint8_t *dest, uint32_t length, uint32_t address, bool requestFastRead)
 Read data via SPI NOR/EEPROM. More...
 
status_t SPI_EepromWrite (uint8_t *data, uint32_t length, uint32_t address)
 Write data via SPI NOR/EEPROM. More...
 
status_t SPI_EepromErase (uint32_t address, eraseOptions_t option)
 Erase data via SPI NOR/EEPROM. More...
 
void SPI_EepromFinalize (void)
 De-initialize LPSPI.
 

Data Structure Documentation

struct lpspi_flash_driver_interface_t

Macro Definition Documentation

#define kROM_StatusGroup_LPSPI   4

Enumeration Type Documentation

anonymous enum
Enumerator
kStatus_ROM_LPSPI_Busy 

LPSPI transfer is busy.

kStatus_ROM_LPSPI_Error 

LPSPI driver error.

kStatus_ROM_LPSPI_Idle 

LPSPI is idle.

kStatus_ROM_LPSPI_OutOfRange 

LPSPI transfer out Of range.

anonymous enum
Enumerator
EepormCmd_GeneralRead 

Use the general Read command to read eeprom.

EepormCmd_FastRead 

Use Fast Read command to read data from eeprom.

Enumerator
kSize_ErasePage 

A page data of eeprom will be erased.

kSize_Erase4K 

4*1024 bytes data of eeprom will be erased.

Function Documentation

status_t SPI_EepromInit ( uint32_t  baudRate)
Parameters
baudRateConfig baudrate for SPI.
Return values
kStatus_FailEEPROM initialization failed.
kStatus_InvalidArgumentInvalid input parameter.
kStatus_ROM_LPSPI_BusyLPSPI transfer is busy.
kStatus_SuccessThe eeprom is initialized successfully.
status_t SPI_EepromRead ( uint8_t *  dest,
uint32_t  length,
uint32_t  address,
bool  requestFastRead 
)
Parameters
destA pointer to the buffer of data that is to be read from eeprom.
lengthThe length, given in bytes to be read.
addressThe start address of the desired eeprom memory to be read.
requestFastReadThe type of Read eeprom command. FALSE: Use the general Read command to read eeprom TRUE: Use Fast Read command to read data from eeprom.
Return values
kStatus_FailFailed to read data from eeprom.
kStatus_SuccessRead data from eeprom successfully.
kStatus_InvalidArgumentInvalid input parameter.
kStatus_ROM_LPSPI_BusyLPSPI transfer is busy.
status_t SPI_EepromWrite ( uint8_t *  data,
uint32_t  length,
uint32_t  address 
)
Parameters
dataA pointer to the source buffer of data that is to be programmed into the eeprom.
lengthThe length, given in bytes to be programmed.
addressThe start address of the desired eeprom memory to be programed.
Return values
kStatus_FailFailed to write data to eeprom.
kStatus_SuccessSuccessfully write data to eeprom.
kStatus_InvalidArgumentInvalid input parameter.
kStatus_ROM_LPSPI_BusyLPSPI transfer is busy.
status_t SPI_EepromErase ( uint32_t  address,
eraseOptions_t  option 
)
Parameters
addressThe start address of the desired eeprom memory to be erased.
optionThe length, given in bytes to be erased.
Return values
kStatus_FailFailed to erase data frome the eeprom.
kStatus_SuccessErase data from eeprom successfully.
kStatus_InvalidArgumentInvalid input parameter.
kStatus_ROM_LPSPI_BusyLPSPI transfer is busy.