LPCOpen Platform for LPC18XX/43XX microcontrollers: LPCSPIFILIB device driver API functions

| LPCOpen Platform for LPC18XX/43XX microcontrollers 18XX43XX LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Macros | Typedefs | Enumerations
LPCSPIFILIB device driver API functions
LPC SPI Flash Interface (SPIFI) Library

## Detailed Description

## Data Structures
struct | SPIFI_FAM_NODE_T
| LPCSPIFILIB family data. More...
struct | SPIFI_FAM_DESC_T
| LPCSPIFILIB family descriptor, used to describe devices to non-device specific functions. More...
struct | SPIFI_DEV_NODE_T
| Register device data node. More...
struct | SPIFI_FAM_FX_T
| Device specific function pointers. More...
struct | SPIFI_DEVICE_ID_T
| Device identification data. More...
struct | SPIFI_DEVICE_DATA_T
| Register device data. More...
struct | SPIFI_HANDLE_T
| LPCSPIFILIB device handle, used with all device and info functions. More...
struct | SPIFI_INFODATA_T
| Common data applicable to all devices. More...
struct | SPIFI_DEV_ENUMERATOR_T
| Context for enumerating devices. More...

## Macros
#define | SPIFI_CAP_DUAL_READ (1 << 0)
| Possible device capabilities returned from getInfo() More...
#define | SPIFI_CAP_DUAL_WRITE (1 << 1)
#define | SPIFI_CAP_QUAD_READ (1 << 2)
#define | SPIFI_CAP_QUAD_WRITE (1 << 3)
#define | SPIFI_CAP_FULLLOCK (1 << 4)
#define | SPIFI_CAP_BLOCKLOCK (1 << 5)
#define | SPIFI_CAP_SUBBLKERASE (1 << 6)
#define | SPIFI_CAP_4BYTE_ADDR (1 << 7)
#define | SPIFI_CAP_NOBLOCK (1 << 16)
#define | SPIFI_OPT_USE_DUAL (3 << 0)
| Possible driver options, may not be supported by all drivers. More...
#define | SPIFI_OPT_USE_QUAD (3 << 2)
#define | SPIFI_OPT_NOBLOCK (1 << 16)
#define | SPIFI_STAT_BUSY (1 << 0)
| Possible device statuses returned from getInfo() More...
#define | SPIFI_STAT_ISWP (1 << 1)
#define | SPIFI_STAT_FULLLOCK (1 << 2)
#define | SPIFI_STAT_PARTLOCK (1 << 3)
#define | SPIFI_STAT_PROGERR (1 << 4)
#define | SPIFI_STAT_ERASEERR (1 << 5)
#define | SPIFI_INFO_QUADREAD_CLOCK SPIFI_INFO_MAX_HSREAD_CLOCK
| SPIFI_INFO_QUADREAD_CLOCK Depricated! Do NOT use for new development. More...
#define | SPIFI_INFO_QUADPROG_CLOCK SPIFI_INFO_MAX_HSPROG_CLOCK
| SPIFI_INFO_QUADPROG_CLOCK Depricated! Do NOT use for new development. More...

## Typedefs
typedef SPIFI_ERR_T(* | deviceInitDeInitFx )(const struct SPIFI_HANDLE *, uint32_t)
typedef void(* | devClearStatusFx )(const struct SPIFI_HANDLE *)
typedef uint32_t(* | devGetStatusFx )(const struct SPIFI_HANDLE *)
typedef void(* | devSetStatusFx )(const struct SPIFI_HANDLE *, uint32_t)
typedef SPIFI_ERR_T(* | devSetOptsFx )(const struct SPIFI_HANDLE *, uint32_t, uint32_t)
typedef void(* | devGetReadCmdFx )(const struct SPIFI_HANDLE *, uint8_t, uint32_t *, uint32_t *)
typedef void(* | devGetWriteCmdFx )(const struct SPIFI_HANDLE *, uint32_t *)

## Enumerations
enum | SPIFI_ERR_T { SPIFI_ERR_NONE = 0, SPIFI_ERR_BUSY, SPIFI_ERR_GEN, SPIFI_ERR_NOTSUPPORTED, SPIFI_ERR_ALIGNERR, SPIFI_ERR_LOCKED, SPIFI_ERR_PROGERR, SPIFI_ERR_ERASEERR, SPIFI_ERR_NOTBLANK, SPIFI_ERR_PAGESIZE, SPIFI_ERR_VAL, SPIFI_ERR_RANGE, SPIFI_ERR_MEMMODE }
| Possible error codes that can be returned from functions. More...
enum | SPIFI_INFO_ID_T { SPIFI_INFO_BASE_ADDRESS = 0, SPIFI_INFO_DEVSIZE, SPIFI_INFO_ERASE_BLOCKS, SPIFI_INFO_ERASE_BLOCKSIZE, SPIFI_INFO_ERASE_SUBBLOCKS, SPIFI_INFO_ERASE_SUBBLOCKSIZE, SPIFI_INFO_PAGESIZE, SPIFI_INFO_MAXREADSIZE, SPIFI_INFO_MAXCLOCK, SPIFI_INFO_MAX_READ_CLOCK, SPIFI_INFO_MAX_HSREAD_CLOCK, SPIFI_INFO_MAX_PROG_CLOCK, SPIFI_INFO_MAX_HSPROG_CLOCK, SPIFI_INFO_CAPS, SPIFI_INFO_STATUS, SPIFI_INFO_STATUS_RETAIN, SPIFI_INFO_OPTIONS, SPIFI_INFO_LASTINDEX }
| Possible info lookup requests. More...
enum | SPIFI_PCMD_LOCK_UNLOCK_T { SPIFI_PCMD_UNLOCK_DEVICE = 0, SPIFI_PCMD_LOCK_DEVICE, SPIFI_PCMD_UNLOCK_BLOCK, SPIFI_PCMD_LOCK_BLOCK }
| Possible device specific lock / un-lock commands. More...
enum | SPIFI_PCMD_SUBBLK_T { SPIFI_PCMD_ADDR_TO_SUB_BLOCK = 0, SPIFI_PCMD_SUB_BLOCK_TO_ADDR, SPIFI_PCMD_BLOCK_TO_SUB_BLOCK }
| Possible device specific sub-block commands. More...
enum | SPIFI_DEVFX_T { FX_spifiDeviceDataInitDeinit = 0, FX_spifiDeviceDataInitDeinitS25FL164K, FX_spifiDeviceDataClearStatusNone, FX_spifiDeviceDataClearStatusS25FL032P, FX_spifiDeviceDataGetStatusS25FL032P, FX_spifiDeviceDataGetStatusS25FL164K, FX_spifiDeviceDataGetStatusMX25L3235E, FX_spifiDeviceDataGetStatusW25Q80BV, FX_spifiDeviceDataSetStatusS25FL032P, FX_spifiDeviceDataSetStatusS25FL164K, FX_spifiDeviceDataSetStatusMX25L3235E, FX_spifiDeviceDataSetOptsQuadModeBit9, FX_spifiDeviceDataSetOptsQuadModeBit6, FX_spifiDeviceInitReadCommand, FX_spifiDevice4BInitReadCommand, FX_spifiDeviceInitWriteCommand, FX_spifiDevice4BInitWriteCommand, FX_spifiDeviceInitWriteCommandMacronix }
| Enumeration of device specific functions. More...

## Macro Definition Documentation

#define SPIFI_CAP_4BYTE_ADDR (1 << 7)

Supports 4 Byte addressing

Definition at line 86 of file spifilib_dev.h.

#define SPIFI_CAP_BLOCKLOCK (1 << 5)

Individual block device lock supported

Definition at line 84 of file spifilib_dev.h.

#define SPIFI_CAP_DUAL_READ (1 << 0)

Possible device capabilities returned from getInfo()

Supports DUAL read mode

Definition at line 79 of file spifilib_dev.h.

#define SPIFI_CAP_DUAL_WRITE (1 << 1)

Supports DUAL write mode

Definition at line 80 of file spifilib_dev.h.

#define SPIFI_CAP_FULLLOCK (1 << 4)

Full device lock supported

Definition at line 83 of file spifilib_dev.h.

#define SPIFI_CAP_NOBLOCK (1 << 16)

Non-blocking mode supported

Definition at line 87 of file spifilib_dev.h.

#define SPIFI_CAP_QUAD_READ (1 << 2)

Supports QUAD read mode

Definition at line 81 of file spifilib_dev.h.

#define SPIFI_CAP_QUAD_WRITE (1 << 3)

Supports QUAD write mode

Definition at line 82 of file spifilib_dev.h.

#define SPIFI_CAP_SUBBLKERASE (1 << 6)

Sub-block erase supported

Definition at line 85 of file spifilib_dev.h.

#define SPIFI_INFO_QUADPROG_CLOCK SPIFI_INFO_MAX_HSPROG_CLOCK

SPIFI_INFO_QUADPROG_CLOCK Depricated! Do NOT use for new development.

Definition at line 139 of file spifilib_dev.h.

#define SPIFI_INFO_QUADREAD_CLOCK SPIFI_INFO_MAX_HSREAD_CLOCK

SPIFI_INFO_QUADREAD_CLOCK Depricated! Do NOT use for new development.

Definition at line 134 of file spifilib_dev.h.

#define SPIFI_OPT_NOBLOCK (1 << 16)

Will not block on program and erase operations, poll device status manually

Definition at line 94 of file spifilib_dev.h.

#define SPIFI_OPT_USE_DUAL (3 << 0)

Possible driver options, may not be supported by all drivers.

Enable DUAL read / write if option is supported

Definition at line 92 of file spifilib_dev.h.

#define SPIFI_OPT_USE_QUAD (3 << 2)

Enable QUAD read / write if option is supported

Definition at line 93 of file spifilib_dev.h.

#define SPIFI_STAT_BUSY (1 << 0)

Possible device statuses returned from getInfo()

Device is busy erasing or programming

Definition at line 99 of file spifilib_dev.h.

#define SPIFI_STAT_ERASEERR (1 << 5)

Device status shows a erase error (non-blocking mode only)

Definition at line 104 of file spifilib_dev.h.

#define SPIFI_STAT_FULLLOCK (1 << 2)

Device is fully locked

Definition at line 101 of file spifilib_dev.h.

#define SPIFI_STAT_ISWP (1 << 1)

Device is write protected (software or hardware)

Definition at line 100 of file spifilib_dev.h.

#define SPIFI_STAT_PARTLOCK (1 << 3)

Device is partially locked (device specific)

Definition at line 102 of file spifilib_dev.h.

#define SPIFI_STAT_PROGERR (1 << 4)

Device status shows a program error (non-blocking mode only)

Definition at line 103 of file spifilib_dev.h.

## Typedef Documentation

typedef void(* devClearStatusFx)(const struct SPIFI_HANDLE *)

Fx* to clear status

Definition at line 238 of file spifilib_dev.h.

typedef void(* devGetReadCmdFx)(const struct SPIFI_HANDLE *, uint8_t, uint32_t *, uint32_t *)

Fx* to return read commandReg value

Definition at line 246 of file spifilib_dev.h.

typedef uint32_t(* devGetStatusFx)(const struct SPIFI_HANDLE *)

Fx* to get status

Definition at line 240 of file spifilib_dev.h.

typedef void(* devGetWriteCmdFx)(const struct SPIFI_HANDLE *, uint32_t *)

Fx* to return write commandReg value

Definition at line 248 of file spifilib_dev.h.

typedef SPIFI_ERR_T(* deviceInitDeInitFx)(const struct SPIFI_HANDLE *, uint32_t)

Fx* to handle init / de-init

Definition at line 236 of file spifilib_dev.h.

typedef SPIFI_ERR_T(* devSetOptsFx)(const struct SPIFI_HANDLE *, uint32_t, uint32_t)

Fx* to set options

Definition at line 244 of file spifilib_dev.h.

typedef void(* devSetStatusFx)(const struct SPIFI_HANDLE *, uint32_t)

Fx* to set status

Definition at line 242 of file spifilib_dev.h.

## Enumeration Type Documentation

enum SPIFI_DEVFX_T

Enumeration of device specific functions.

Enumerator
FX_spifiDeviceDataInitDeinit | Generic device init / de-init function
FX_spifiDeviceDataInitDeinitS25FL164K | S25FL164K specific device init / de-init function
FX_spifiDeviceDataClearStatusNone | General do nothing I.e no status bits to clear
FX_spifiDeviceDataClearStatusS25FL032P | S25FL032P (and similar) clear status bits function
FX_spifiDeviceDataGetStatusS25FL032P | S25FL032P (and similar) get status function
FX_spifiDeviceDataGetStatusS25FL164K | S25FL164K (and similar) get status function
FX_spifiDeviceDataGetStatusMX25L3235E | MX25L3235E (and similar) get status function
FX_spifiDeviceDataGetStatusW25Q80BV | W25Q80BV (and similar) get status function
FX_spifiDeviceDataSetStatusS25FL032P | S25FL032P (and similar) set status function
FX_spifiDeviceDataSetStatusS25FL164K | S25FL164K (and similar) set status function
FX_spifiDeviceDataSetStatusMX25L3235E | MX25L3235E (and similar) set sttus function
FX_spifiDeviceDataSetOptsQuadModeBit9 | Set bit 9 when enabling Quad mode
FX_spifiDeviceDataSetOptsQuadModeBit6 | Set bit 6 when enabling Quad mode
FX_spifiDeviceInitReadCommand | General return cmdReg value for read
FX_spifiDevice4BInitReadCommand | General return cmdReg value for read w/ 4Byte address
FX_spifiDeviceInitWriteCommand | General return cmdReg value for write
FX_spifiDevice4BInitWriteCommand | General return cmdReg value for write w/ 4Byte address
FX_spifiDeviceInitWriteCommandMacronix | Macronix return cmdReg value for write

Definition at line 164 of file spifilib_dev.h.

enum SPIFI_ERR_T

Possible error codes that can be returned from functions.

Enumerator
SPIFI_ERR_NONE | No error
SPIFI_ERR_BUSY | Device is busy
SPIFI_ERR_GEN | General error
SPIFI_ERR_NOTSUPPORTED | Capability not supported
SPIFI_ERR_ALIGNERR | Attempted to do an operation on an unaligned section of the device
SPIFI_ERR_LOCKED | Device was locked and a program/erase operation was attempted
SPIFI_ERR_PROGERR | Error programming device (blocking mode only)
SPIFI_ERR_ERASEERR | Erase error (blocking mode only)
SPIFI_ERR_NOTBLANK | Program operation on block that is not blank
SPIFI_ERR_PAGESIZE | PageProgram write size exceeds page size
SPIFI_ERR_VAL | Program operation failed validation or readback compare
SPIFI_ERR_RANGE | Range error, bad block number, address out of range, etc.
SPIFI_ERR_MEMMODE | Library calls not allowed while in memory mode.

Definition at line 57 of file spifilib_dev.h.

enum SPIFI_INFO_ID_T

Possible info lookup requests.

Enumerator
SPIFI_INFO_BASE_ADDRESS | Device physical memory address
SPIFI_INFO_DEVSIZE | Device size in Bytes
SPIFI_INFO_ERASE_BLOCKS | Number of erase blocks
SPIFI_INFO_ERASE_BLOCKSIZE | Size of erase blocks
SPIFI_INFO_ERASE_SUBBLOCKS | Number of erase sub-blocks
SPIFI_INFO_ERASE_SUBBLOCKSIZE | Size of erase sub-blocks
SPIFI_INFO_PAGESIZE | Size of a page, page write size limit
SPIFI_INFO_MAXREADSIZE | Maximum read size, read size limit in bytes
SPIFI_INFO_MAXCLOCK | Maximum device speed in Hz
SPIFI_INFO_MAX_READ_CLOCK | Maximum device speed for read cmd in Hz
SPIFI_INFO_MAX_HSREAD_CLOCK | Maximum device speed for quad / dual read cmd in Hz
SPIFI_INFO_MAX_PROG_CLOCK | Maximum device speed for program cmd in Hz
SPIFI_INFO_MAX_HSPROG_CLOCK | Maximum device speed for quad program cmd in Hz
SPIFI_INFO_CAPS | Device capabilities, OR'ed SPIFI_CAP_* values
SPIFI_INFO_STATUS | Or'ed SPIFI_STAT_xxx values. Any persistent hardware bits will be cleared
SPIFI_INFO_STATUS_RETAIN | Or'ed SPIFI_STAT_xxx values. Any persistent hardware bits will be retained
SPIFI_INFO_OPTIONS | Device capabilities, Or'ed SPIFI_OPT_* values
SPIFI_INFO_LASTINDEX |

Definition at line 109 of file spifilib_dev.h.

enum SPIFI_PCMD_LOCK_UNLOCK_T

Possible device specific lock / un-lock commands.

Enumerator
SPIFI_PCMD_UNLOCK_DEVICE | unlock device
SPIFI_PCMD_LOCK_DEVICE | lock device
SPIFI_PCMD_UNLOCK_BLOCK | unlock specified block
SPIFI_PCMD_LOCK_BLOCK | lock specified block

Definition at line 143 of file spifilib_dev.h.

enum SPIFI_PCMD_SUBBLK_T

Possible device specific sub-block commands.

Enumerator
SPIFI_PCMD_ADDR_TO_SUB_BLOCK | Convert address to a sub-block
SPIFI_PCMD_SUB_BLOCK_TO_ADDR | Convert sub-block to address
SPIFI_PCMD_BLOCK_TO_SUB_BLOCK | Convert block to sub-block

Definition at line 154 of file spifilib_dev.h.