MG32F157 Standard Peripherals Firmware Library
Data Structures | Macros | Functions
mg32f157_qspi.h File Reference

This file contains all the functions prototypes for the QSPI firmware library. More...

#include "mg32f157.h"

Go to the source code of this file.

Data Structures

struct  QSPI_ComConfig_InitTypeDef
 QSPI Communication Configuration Init structure definition. More...
 
struct  QSPI_InitTypeDef
 QSPI Init structure definition. More...
 

Macros

#define QSPI_SShift_NoShift   ((uint32_t)0x00000000)
 
#define QSPI_SShift_HalfCycleShift   ((uint32_t)QUADSPI_CR_SSHIFT)
 
#define IS_QSPI_SSHIFT(SSHIFT)   (((SSHIFT) == QSPI_SShift_NoShift) || ((SSHIFT) == QSPI_SShift_HalfCycleShift))
 
#define QUADSPI_CR_SSHIFT_0   QUADSPI_CR_SSHIFT /* Legacy Defines */
 
#define IS_QSPI_PRESCALER(PRESCALER)   (((PRESCALER) <= 0xFF))
 
#define QSPI_CKMode_Mode0   ((uint32_t)0x00000000)
 
#define QSPI_CKMode_Mode3   ((uint32_t)QUADSPI_DCR_CKMODE)
 
#define IS_QSPI_CKMODE(CKMode)   (((CKMode) == QSPI_CKMode_Mode0) || ((CKMode) == QSPI_CKMode_Mode3))
 
#define QSPI_CSHTime_1Cycle   ((uint32_t)0x00000000)
 
#define QSPI_CSHTime_2Cycle   ((uint32_t)QUADSPI_DCR_CSHT_0)
 
#define QSPI_CSHTime_3Cycle   ((uint32_t)QUADSPI_DCR_CSHT_1)
 
#define QSPI_CSHTime_4Cycle   ((uint32_t)QUADSPI_DCR_CSHT_0 | QUADSPI_DCR_CSHT_1)
 
#define QSPI_CSHTime_5Cycle   ((uint32_t)QUADSPI_DCR_CSHT_2)
 
#define QSPI_CSHTime_6Cycle   ((uint32_t)QUADSPI_DCR_CSHT_2 | QUADSPI_DCR_CSHT_0)
 
#define QSPI_CSHTime_7Cycle   ((uint32_t)QUADSPI_DCR_CSHT_2 | QUADSPI_DCR_CSHT_1)
 
#define QSPI_CSHTime_8Cycle   ((uint32_t)QUADSPI_DCR_CSHT)
 
#define IS_QSPI_CSHTIME(CSHTIME)
 
#define IS_QSPI_FSIZE(FSIZE)   (((FSIZE) <= 0x1F))
 
#define QSPI_FSelect_1   ((uint32_t)0x00000000)
 
#define QSPI_FSelect_2   ((uint32_t)QUADSPI_CR_FSEL)
 
#define IS_QSPI_FSEL(FLA)   (((FLA) == QSPI_FSelect_1) || ((FLA) == QSPI_FSelect_2))
 
#define QSPI_DFlash_Disable   ((uint32_t)0x00000000)
 
#define QSPI_DFlash_Enable   ((uint32_t)QUADSPI_CR_DFM)
 
#define IS_QSPI_DFM(FLA)   (((FLA) == QSPI_DFlash_Enable) || ((FLA) == QSPI_DFlash_Disable))
 
#define QSPI_ComConfig_FMode_Indirect_Write   ((uint32_t)0x00000000)
 
#define QSPI_ComConfig_FMode_Indirect_Read   ((uint32_t)QUADSPI_CCR_FMODE_0)
 
#define QSPI_ComConfig_FMode_Auto_Polling   ((uint32_t)QUADSPI_CCR_FMODE_1)
 
#define QSPI_ComConfig_FMode_Memory_Mapped   ((uint32_t)QUADSPI_CCR_FMODE)
 
#define IS_QSPI_FMODE(FMODE)
 
#define QSPI_ComConfig_DDRMode_Disable   ((uint32_t)0x00000000)
 
#define QSPI_ComConfig_DDRMode_Enable   ((uint32_t)QUADSPI_CCR_DDRM)
 
#define IS_QSPI_DDRMODE(DDRMODE)
 
#define QSPI_ComConfig_DHHC_Disable   ((uint32_t)0x00000000)
 
#define QSPI_ComConfig_DHHC_Enable   ((uint32_t)QUADSPI_CCR_DHHC)
 
#define IS_QSPI_DHHC(DHHC)
 
#define QSPI_ComConfig_SIOOMode_Disable   ((uint32_t)0x00000000)
 
#define QSPI_ComConfig_SIOOMode_Enable   ((uint32_t)QUADSPI_CCR_SIOO)
 
#define IS_QSPI_SIOOMODE(SIOOMODE)
 
#define QSPI_ComConfig_DMode_NoData   ((uint32_t)0x00000000)
 
#define QSPI_ComConfig_DMode_1Line   ((uint32_t)QUADSPI_CCR_DMODE_0)
 
#define QSPI_ComConfig_DMode_2Line   ((uint32_t)QUADSPI_CCR_DMODE_1)
 
#define QSPI_ComConfig_DMode_4Line   ((uint32_t)QUADSPI_CCR_DMODE)
 
#define IS_QSPI_DMODE(DMODE)
 
#define QSPI_ComConfig_ABSize_8bit   ((uint32_t)0x00000000)
 
#define QSPI_ComConfig_ABSize_16bit   ((uint32_t)QUADSPI_CCR_ABSIZE_0)
 
#define QSPI_ComConfig_ABSize_24bit   ((uint32_t)QUADSPI_CCR_ABSIZE_1)
 
#define QSPI_ComConfig_ABSize_32bit   ((uint32_t)QUADSPI_CCR_ABSIZE)
 
#define IS_QSPI_ABSIZE(ABSIZE)
 
#define QSPI_ComConfig_ABMode_NoAlternateByte   ((uint32_t)0x00000000)
 
#define QSPI_ComConfig_ABMode_1Line   ((uint32_t)QUADSPI_CCR_ABMODE_0)
 
#define QSPI_ComConfig_ABMode_2Line   ((uint32_t)QUADSPI_CCR_ABMODE_1)
 
#define QSPI_ComConfig_ABMode_4Line   ((uint32_t)QUADSPI_CCR_ABMODE)
 
#define IS_QSPI_ABMODE(ABMODE)
 
#define QSPI_ComConfig_ADSize_8bit   ((uint32_t)0x00000000)
 
#define QSPI_ComConfig_ADSize_16bit   ((uint32_t)QUADSPI_CCR_ADSIZE_0)
 
#define QSPI_ComConfig_ADSize_24bit   ((uint32_t)QUADSPI_CCR_ADSIZE_1)
 
#define QSPI_ComConfig_ADSize_32bit   ((uint32_t)QUADSPI_CCR_ADSIZE)
 
#define IS_QSPI_ADSIZE(ADSIZE)
 
#define QSPI_ComConfig_ADMode_NoAddress   ((uint32_t)0x00000000)
 
#define QSPI_ComConfig_ADMode_1Line   ((uint32_t)QUADSPI_CCR_ADMODE_0)
 
#define QSPI_ComConfig_ADMode_2Line   ((uint32_t)QUADSPI_CCR_ADMODE_1)
 
#define QSPI_ComConfig_ADMode_4Line   ((uint32_t)QUADSPI_CCR_ADMODE)
 
#define IS_QSPI_ADMODE(ADMODE)
 
#define QSPI_ComConfig_IMode_NoInstruction   ((uint32_t)0x00000000)
 
#define QSPI_ComConfig_IMode_1Line   ((uint32_t)QUADSPI_CCR_IMODE_0)
 
#define QSPI_ComConfig_IMode_2Line   ((uint32_t)QUADSPI_CCR_IMODE_1)
 
#define QSPI_ComConfig_IMode_4Line   ((uint32_t)QUADSPI_CCR_IMODE)
 
#define IS_QSPI_IMODE(IMODE)
 
#define IS_QSPI_INSTRUCTION(INSTRUCTION)   ((INSTRUCTION) <= 0xFF)
 
#define QSPI_IT_TO   (uint32_t)(QUADSPI_CR_TOIE | QUADSPI_SR_TOF)
 
#define QSPI_IT_SM   (uint32_t)(QUADSPI_CR_SMIE | QUADSPI_SR_SMF)
 
#define QSPI_IT_FT   (uint32_t)(QUADSPI_CR_FTIE | QUADSPI_SR_FTF)
 
#define QSPI_IT_TC   (uint32_t)(QUADSPI_CR_TCIE | QUADSPI_SR_TCF)
 
#define QSPI_IT_TE   (uint32_t)(QUADSPI_CR_TEIE | QUADSPI_SR_TEF)
 
#define IS_QSPI_IT(IT)   ((((IT) & 0xFFE0FFE0) == 0) && ((IT) != 0))
 
#define IS_QSPI_CLEAR_IT(IT)   ((((IT) & 0xFFE4FFE4) == 0) && ((IT) != 0))
 
#define QSPI_FLAG_TO   QUADSPI_SR_TOF
 
#define QSPI_FLAG_SM   QUADSPI_SR_SMF
 
#define QSPI_FLAG_FT   QUADSPI_SR_FTF
 
#define QSPI_FLAG_TC   QUADSPI_SR_TCF
 
#define QSPI_FLAG_TE   QUADSPI_SR_TEF
 
#define QSPI_FLAG_BUSY   QUADSPI_SR_BUSY
 
#define IS_QSPI_GET_FLAG(FLAG)
 
#define IS_QSPI_CLEAR_FLAG(FLAG)
 
#define QSPI_PMM_AND   ((uint32_t)0x00000000)
 
#define QSPI_PMM_OR   ((uint32_t)QUADSPI_CR_PMM)
 
#define IS_QSPI_PMM(PMM)   (((PMM) == QSPI_PMM_AND) || ((PMM) == QSPI_PMM_OR))
 
#define IS_QSPI_PIR(PIR)   ((PIR) <= QUADSPI_PIR_INTERVAL)
 
#define IS_QSPI_TIMEOUT(TIMEOUT)   ((TIMEOUT) <= QUADSPI_LPTR_TIMEOUT)
 
#define IS_QSPI_DCY(DCY)   ((DCY) <= 0x1F)
 
#define IS_QSPI_FIFOTHRESHOLD(FIFOTHRESHOLD)   ((FIFOTHRESHOLD) <= 0x0F)
 

Functions

void QSPI_DeInit (void)
 
void QSPI_Init (QSPI_InitTypeDef *QSPI_InitStruct)
 Initializes the QSPI peripheral according to the specified parameters in the QSPI_InitStruct. More...
 
void QSPI_StructInit (QSPI_InitTypeDef *QSPI_InitStruct)
 Fills each QSPI_InitStruct member with its default value. More...
 
void QSPI_ComConfig_Init (QSPI_ComConfig_InitTypeDef *QSPI_ComConfig_InitStruct)
 Initializes the QSPI CCR according to the specified parameters in the QSPI_ComConfig_InitStruct. More...
 
void QSPI_ComConfig_StructInit (QSPI_ComConfig_InitTypeDef *QSPI_ComConfig_InitStruct)
 Fills each QSPI_ComConfig_InitStruct member with its default value. More...
 
void QSPI_Cmd (FunctionalState NewState)
 Enables or disables QSPI peripheral. More...
 
void QSPI_AutoPollingMode_Config (uint32_t QSPI_Match, uint32_t QSPI_Mask, uint32_t QSPI_Match_Mode)
 Configure the QSPI Automatic Polling Mode. More...
 
void QSPI_AutoPollingMode_SetInterval (uint32_t QSPI_Interval)
 Sets the number of CLK cycle between two read during automatic polling phases. More...
 
void QSPI_MemoryMappedMode_SetTimeout (uint32_t QSPI_Timeout)
 Sets the value of the Timeout in Memory Mapped mode. More...
 
void QSPI_SetAddress (uint32_t QSPI_Address)
 Sets the value of the Address. More...
 
void QSPI_SetAlternateByte (uint32_t QSPI_AlternateByte)
 Sets the value of the Alternate Bytes. More...
 
void QSPI_SetFIFOThreshold (uint32_t QSPI_FIFOThreshold)
 Sets the FIFO Threshold. More...
 
void QSPI_SetDataLength (uint32_t QSPI_DataLength)
 Sets number of Bytes to be transferred. More...
 
void QSPI_TimeoutCounterCmd (FunctionalState NewState)
 Enables or disables The Timeout Counter. More...
 
void QSPI_AutoPollingModeStopCmd (FunctionalState NewState)
 Enables or disables Automatic Polling Mode Stop when a match occurs. More...
 
void QSPI_AbortRequest (void)
 Abort the on-going command sequence. More...
 
void QSPI_DualFlashMode_Cmd (FunctionalState NewState)
 Enables or disables QSPI Dual Flash Mode. More...
 
void QSPI_SendData8 (uint8_t Data)
 Transmits a 8bit Data through the QSPI peripheral. More...
 
void QSPI_SendData16 (uint16_t Data)
 Transmits a 16bit Data through the QSPI peripheral. More...
 
void QSPI_SendData32 (uint32_t Data)
 Transmits a 32bit Data through the QSPI peripheral. More...
 
uint8_t QSPI_ReceiveData8 (void)
 Returns the most recent received 8bit data by the QSPI peripheral. More...
 
uint16_t QSPI_ReceiveData16 (void)
 Returns the most recent received 16bit data by the QSPI peripheral. More...
 
uint32_t QSPI_ReceiveData32 (void)
 Returns the most recent received 32bit data by the QSPI peripheral. More...
 
void QSPI_DMACmd (FunctionalState NewState)
 Enables or disables DMA for Indirect Mode. More...
 
void QSPI_ITConfig (uint32_t QSPI_IT, FunctionalState NewState)
 Enables or disables the specified QSPI interrupts. More...
 
uint32_t QSPI_GetFIFOLevel (void)
 Returns the current QSPI FIFO filled level. More...
 
FlagStatus QSPI_GetFlagStatus (uint32_t QSPI_FLAG)
 Checks whether the specified QSPI flag is set or not. More...
 
void QSPI_ClearFlag (uint32_t QSPI_FLAG)
 Clears the QSPI flag. More...
 
ITStatus QSPI_GetITStatus (uint32_t QSPI_IT)
 Checks whether the specified QSPI interrupt has occurred or not. More...
 
void QSPI_ClearITPendingBit (uint32_t QSPI_IT)
 Clears the QSPI's interrupt pending bits. More...
 
uint32_t QSPI_GetFMode (void)
 Returns the QSPI functional mode. More...
 

Detailed Description

This file contains all the functions prototypes for the QSPI firmware library.

Author
MegawinTech Application Team
Version
V0.0.4
Date
16-June-2023