QSPIEMLIB
Detailed Description
QSPI Octal-SPI Controller API.
These QSPI functions provide basic support for using the QSPI peripheral in the following configurations:
- Direct Read/Write, used for memory mapped access to external memory.
- STIG Command, used for configuring and executing commands on the external memory device.
Indirect read/write, PHY configuration, and Execute-In-Place (XIP) configurations are not supported.
The example below shows how to set up the QSPI for direct read and write operation:
To configure an external flash, commands can be set up and executed using the Software Triggered Instruction Generator (STIG) function of the QSPI, as shown in the example below:
Data Structures |
|
struct | QSPI_DelayConfig_TypeDef |
struct | QSPI_Init_TypeDef |
struct | QSPI_ReadConfig_TypeDef |
struct | QSPI_StigCmd_TypeDef |
struct | QSPI_WriteConfig_TypeDef |
Macros |
|
#define | QSPI_INIT_DEFAULT |
#define | QSPI_READCONFIG_DEFAULT |
#define | QSPI_WRITECONFIG_DEFAULT |
Enumerations |
|
enum |
QSPI_TransferType_TypeDef
{
qspiTransferSingle = 0, qspiTransferDual = 1, qspiTransferQuad = 2, qspiTransferOctal = 3 } |
Functions |
|
__STATIC_INLINE void | QSPI_Enable (QSPI_TypeDef *qspi, bool enable) |
Enable/disable Quad SPI.
|
|
void | QSPI_ExecStigCmd (QSPI_TypeDef *qspi, const QSPI_StigCmd_TypeDef *stigCmd) |
Execute a STIG command.
|
|
__STATIC_INLINE uint16_t | QSPI_GetReadLevel (QSPI_TypeDef *qspi) |
Get the fill level of the read partition of the QSPI internal SRAM.
|
|
__STATIC_INLINE uint16_t | QSPI_GetWriteLevel (QSPI_TypeDef *qspi) |
Get the fill level of the write partition of the QSPI internal SRAM.
|
|
void | QSPI_Init (QSPI_TypeDef *qspi, const QSPI_Init_TypeDef *init) |
Initialize QSPI.
|
|
__STATIC_INLINE void | QSPI_IntClear (QSPI_TypeDef *qspi, uint32_t flags) |
Clear interrupt flags.
|
|
__STATIC_INLINE void | QSPI_IntDisable (QSPI_TypeDef *qspi, uint32_t flags) |
Disable interrupts.
|
|
__STATIC_INLINE void | QSPI_IntEnable (QSPI_TypeDef *qspi, uint32_t flags) |
Enable interrupts.
|
|
__STATIC_INLINE uint32_t | QSPI_IntGet (QSPI_TypeDef *qspi) |
Get the current interrupt flags.
|
|
void | QSPI_ReadConfig (QSPI_TypeDef *qspi, const QSPI_ReadConfig_TypeDef *config) |
Configure Read Operations.
|
|
__STATIC_INLINE void | QSPI_WaitForIdle (QSPI_TypeDef *qspi) |
Wait for the QSPI to go into idle state.
|
|
void | QSPI_WriteConfig (QSPI_TypeDef *qspi, const QSPI_WriteConfig_TypeDef *config) |
Configure Write Operations.
|
|
Macro Definition Documentation
#define QSPI_INIT_DEFAULT |
Default configuration for QSPI_Init_TypeDef structure.
Definition at line
199
of file
em_qspi.h
.
#define QSPI_READCONFIG_DEFAULT |
Default Read Configuration Structure.
Definition at line
101
of file
em_qspi.h
.
#define QSPI_WRITECONFIG_DEFAULT |
Default Write Configuration Structure.
Definition at line
139
of file
em_qspi.h
.
Enumeration Type Documentation
Transfer type.
Definition at line
64
of file
em_qspi.h
.
Function Documentation
__STATIC_INLINE void QSPI_Enable | ( | QSPI_TypeDef * |
qspi,
|
bool |
enable
|
||
) |
Enable/disable Quad SPI.
- Parameters
-
[in] qspi
Pointer to QSPI peripheral register block. [in] enable
true to enable quad spi, false to disable quad spi.
Definition at line
271
of file
em_qspi.h
.
References BUS_RegBitWrite() .
Referenced by QSPI_Init() .
void QSPI_ExecStigCmd | ( | QSPI_TypeDef * |
qspi,
|
const QSPI_StigCmd_TypeDef * |
stigCmd
|
||
) |
Execute a STIG command.
STIG is used when the application needs to access status registers, configuration registers or perform erase functions. STIG commands can be used to perform any instruction that the flash device supports.
- Parameters
-
[in] qspi
A pointer to the QSPI peripheral register block. [in] stigCmd
A pointer to a structure that describes the STIG command.
Definition at line
206
of file
em_qspi.c
.
References QSPI_StigCmd_TypeDef::address , QSPI_StigCmd_TypeDef::addrSize , QSPI_StigCmd_TypeDef::cmdOpcode , QSPI_StigCmd_TypeDef::dummyCycles , QSPI_StigCmd_TypeDef::modeBitEnable , QSPI_WaitForIdle() , QSPI_StigCmd_TypeDef::readBuffer , QSPI_StigCmd_TypeDef::readDataSize , QSPI_StigCmd_TypeDef::writeBuffer , and QSPI_StigCmd_TypeDef::writeDataSize .
__STATIC_INLINE uint16_t QSPI_GetReadLevel | ( | QSPI_TypeDef * |
qspi
|
) |
Get the fill level of the read partition of the QSPI internal SRAM.
- Parameters
-
[in] qspi
Pointer to QSPI peripheral register block.
- Returns
- SRAM fill level of the read partition. The value is the number of 4 byte words in the read partition.
Definition at line
255
of file
em_qspi.h
.
__STATIC_INLINE uint16_t QSPI_GetWriteLevel | ( | QSPI_TypeDef * |
qspi
|
) |
Get the fill level of the write partition of the QSPI internal SRAM.
- Parameters
-
[in] qspi
Pointer to QSPI peripheral register block.
- Returns
- SRAM fill level of the write partition. The value is the number of 4 byte words in the write partition.
Definition at line
238
of file
em_qspi.h
.
void QSPI_Init | ( | QSPI_TypeDef * |
qspi,
|
const QSPI_Init_TypeDef * |
init
|
||
) |
Initialize QSPI.
- Parameters
-
[in] qspi
A pointer to the QSPI peripheral register block. [in] init
A pointer to the initialization structure used to configure QSPI.
Definition at line
134
of file
em_qspi.c
.
References QSPI_Init_TypeDef::divisor , QSPI_Init_TypeDef::enable , and QSPI_Enable() .
__STATIC_INLINE void QSPI_IntClear | ( | QSPI_TypeDef * |
qspi,
|
uint32_t |
flags
|
||
) |
Clear interrupt flags.
- Parameters
-
[in] qspi
Pointer to QSPI peripheral register block. [in] flags
The interrupt flags to clear.
Definition at line
301
of file
em_qspi.h
.
__STATIC_INLINE void QSPI_IntDisable | ( | QSPI_TypeDef * |
qspi,
|
uint32_t |
flags
|
||
) |
Disable interrupts.
- Parameters
-
[in] qspi
Pointer to QSPI peripheral register block. [in] flags
The interrupt flags to disable.
Definition at line
331
of file
em_qspi.h
.
__STATIC_INLINE void QSPI_IntEnable | ( | QSPI_TypeDef * |
qspi,
|
uint32_t |
flags
|
||
) |
Enable interrupts.
- Parameters
-
[in] qspi
Pointer to QSPI peripheral register block. [in] flags
The interrupt flags to enable.
Definition at line
316
of file
em_qspi.h
.
__STATIC_INLINE uint32_t QSPI_IntGet | ( | QSPI_TypeDef * |
qspi
|
) |
Get the current interrupt flags.
- Parameters
-
[in] qspi
Pointer to QSPI peripheral register block.
- Returns
- This functions returns the current interrupt flags that are set.
Definition at line
286
of file
em_qspi.h
.
void QSPI_ReadConfig | ( | QSPI_TypeDef * |
qspi,
|
const QSPI_ReadConfig_TypeDef * |
config
|
||
) |
Configure Read Operations.
- Parameters
-
[in] qspi
A pointer to the QSPI peripheral register block. [in] config
A pointer to the configuration structure for QSPI read operations.
Definition at line
156
of file
em_qspi.c
.
References QSPI_ReadConfig_TypeDef::addrTransfer , QSPI_ReadConfig_TypeDef::dataTransfer , QSPI_ReadConfig_TypeDef::dummyCycles , QSPI_ReadConfig_TypeDef::instTransfer , QSPI_ReadConfig_TypeDef::opCode , and QSPI_WaitForIdle() .
__STATIC_INLINE void QSPI_WaitForIdle | ( | QSPI_TypeDef * |
qspi
|
) |
Wait for the QSPI to go into idle state.
- Parameters
-
[in] qspi
Pointer to QSPI peripheral register block.
Definition at line
221
of file
em_qspi.h
.
Referenced by QSPI_ExecStigCmd() , QSPI_ReadConfig() , and QSPI_WriteConfig() .
void QSPI_WriteConfig | ( | QSPI_TypeDef * |
qspi,
|
const QSPI_WriteConfig_TypeDef * |
config
|
||
) |
Configure Write Operations.
- Parameters
-
[in] qspi
A pointer to the QSPI peripheral register block. [in] config
A pointer to the configuration structure for QSPI write operations.
Definition at line
178
of file
em_qspi.c
.
References QSPI_WriteConfig_TypeDef::addrTransfer , QSPI_WriteConfig_TypeDef::autoWEL , QSPI_WriteConfig_TypeDef::dataTransfer , QSPI_WriteConfig_TypeDef::dummyCycles , QSPI_WriteConfig_TypeDef::opCode , and QSPI_WaitForIdle() .