MG32F157 Standard Peripherals Firmware Library
Functions
QSPI_Private_Functions

Functions

void QSPI_StructInit (QSPI_InitTypeDef *QSPI_InitStruct)
 Fills each QSPI_InitStruct member with its default value. More...
 
void QSPI_ComConfig_StructInit (QSPI_ComConfig_InitTypeDef *QSPI_ComConfig_InitStruct)
 Fills each QSPI_ComConfig_InitStruct member with its default value. More...
 
void QSPI_Init (QSPI_InitTypeDef *QSPI_InitStruct)
 Initializes the QSPI peripheral according to the specified parameters in the QSPI_InitStruct. 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_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_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...
 
uint32_t QSPI_GetFMode (void)
 Returns the QSPI functional mode. 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...
 
void QSPI_DualFlashMode_Cmd (FunctionalState NewState)
 Enables or disables QSPI Dual Flash Mode. More...
 

Detailed Description

Function Documentation

◆ QSPI_AbortRequest()

void QSPI_AbortRequest ( void  )

Abort the on-going command sequence.

Parameters
None
Returns
None

◆ QSPI_AutoPollingMode_Config()

void QSPI_AutoPollingMode_Config ( uint32_t  QSPI_Match,
uint32_t  QSPI_Mask,
uint32_t  QSPI_Match_Mode 
)

Configure the QSPI Automatic Polling Mode.

Parameters
QSPI_MatchValue to be compared with the masked status register to get a match. This parameter can be any value between 0x00000000 and 0xFFFFFFFF.
QSPI_MaskMask to be applied to the status bytes received in polling mode.. This parameter can be any value between 0x00000000 and 0xFFFFFFFF.
QSPI_Match_Modeindicates which method should be used for determining a match during automatic polling mode. This parameter can be any value of :
  • QSPI_PMM_AND: AND match mode- SMF is set if all the unmasked bits received from the flash match the corresponding bits in the match register
  • QSPI_PMM_OR: OR match mode- SMF is set if any one of the unmasked bits received from the flash matches its corresponding bit in the match register.
Note
This function is used only in Automatic Polling Mode
Returns
None

◆ QSPI_AutoPollingMode_SetInterval()

void QSPI_AutoPollingMode_SetInterval ( uint32_t  QSPI_Interval)

Sets the number of CLK cycle between two read during automatic polling phases.

Parameters
QSPI_IntervalThe number of CLK cycle between two read during automatic polling phases. This parameter can be any value of between 0x0000 and 0xFFFF
Note
This function is used only in Automatic Polling Mode
Returns
None

◆ QSPI_AutoPollingModeStopCmd()

void QSPI_AutoPollingModeStopCmd ( FunctionalState  NewState)

Enables or disables Automatic Polling Mode Stop when a match occurs.

Parameters
NewStatenew state of the Automatic Polling Mode Stop. This parameter can be: ENABLE or DISABLE.
Note
This function is used only in Automatic Polling Mode.
Returns
None

◆ QSPI_ClearFlag()

void QSPI_ClearFlag ( uint32_t  QSPI_FLAG)

Clears the QSPI flag.

Parameters
QSPI_FLAGspecifies the QSPI flag to clear. This parameter can be one of the following values:
  • QSPI_FLAG_TO: Timeout interrupt flag
  • QSPI_FLAG_SM: Status Match interrupt flag
  • QSPI_FLAG_TC: Transfer Complete flag
  • QSPI_FLAG_TE: Transfer Error flag
Returns
None

◆ QSPI_ClearITPendingBit()

void QSPI_ClearITPendingBit ( uint32_t  QSPI_IT)

Clears the QSPI's interrupt pending bits.

Parameters
QSPI_ITspecifies the QSPI pending bit to clear. This parameter can be one of the following values:
  • QSPI_IT_TO: Timeout interrupt
  • QSPI_IT_SM: Status Match interrupt
  • QSPI_IT_TC: Transfer Complete
  • QSPI_IT_TE: Transfer Error
Returns
None

◆ QSPI_Cmd()

void QSPI_Cmd ( FunctionalState  NewState)

Enables or disables QSPI peripheral.

Parameters
NewStatenew state of the QSPI peripheral. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ QSPI_ComConfig_Init()

void QSPI_ComConfig_Init ( QSPI_ComConfig_InitTypeDef QSPI_ComConfig_InitStruct)

Initializes the QSPI CCR according to the specified parameters in the QSPI_ComConfig_InitStruct.

Parameters
QSPI_ComConfig_InitStructpointer to a QSPI_ComConfig_InitTypeDef structure that contains the communication configuration informations about QSPI peripheral.
Returns
None

◆ QSPI_ComConfig_StructInit()

void QSPI_ComConfig_StructInit ( QSPI_ComConfig_InitTypeDef QSPI_ComConfig_InitStruct)

Fills each QSPI_ComConfig_InitStruct member with its default value.

Parameters
QSPI_ComConfig_InitStructpointer to a QSPI_ComConfig_InitTypeDef structure which will be initialized.
Returns
None

◆ QSPI_DMACmd()

void QSPI_DMACmd ( FunctionalState  NewState)

Enables or disables DMA for Indirect Mode.

Parameters
NewStatenew state of the Timeout Counter. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ QSPI_DualFlashMode_Cmd()

void QSPI_DualFlashMode_Cmd ( FunctionalState  NewState)

Enables or disables QSPI Dual Flash Mode.

Parameters
NewStatenew state of the QSPI Dual Flash Mode. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ QSPI_GetFIFOLevel()

uint32_t QSPI_GetFIFOLevel ( void  )

Returns the current QSPI FIFO filled level.

Parameters
None
Returns
Number of valid bytes which are being held in the FIFO. 0x00 : FIFO is empty 0x1F : FIFO is full

◆ QSPI_GetFlagStatus()

FlagStatus QSPI_GetFlagStatus ( uint32_t  QSPI_FLAG)

Checks whether the specified QSPI flag is set or not.

Parameters
QSPI_FLAGspecifies the QSPI flag to check. This parameter can be one of the following values:
  • QSPI_FLAG_TO: Timeout interrupt flag
  • QSPI_FLAG_SM: Status Match interrupt flag
  • QSPI_FLAG_FT: FIFO Threshold flag
  • QSPI_FLAG_TC: Transfer Complete flag
  • QSPI_FLAG_TE: Transfer Error flag
  • QSPI_FLAG_BUSY: Busy flag
Returns
The new state of QSPI_FLAG (SET or RESET).

◆ QSPI_GetFMode()

uint32_t QSPI_GetFMode ( void  )

Returns the QSPI functional mode.

Parameters
None
Returns
QSPI Functional Mode .The returned value can be one of the following:
  • 0x00000000: QSPI_FMode_Indirect_Write
  • 0x04000000: QSPI_FMode_Indirect_Read
  • 0x08000000: QSPI_FMode_AutoPolling
  • 0x0C000000: QSPI_FMode_MemoryMapped

◆ QSPI_GetITStatus()

ITStatus QSPI_GetITStatus ( uint32_t  QSPI_IT)

Checks whether the specified QSPI interrupt has occurred or not.

Parameters
QSPI_ITspecifies the QSPI interrupt source to check. This parameter can be one of the following values:
  • QSPI_IT_TO: Timeout interrupt
  • QSPI_IT_SM: Status Match interrupt
  • QSPI_IT_FT: FIFO Threshold
  • QSPI_IT_TC: Transfer Complete
  • QSPI_IT_TE: Transfer Error
Returns
The new state of QSPI_IT (SET or RESET).

◆ QSPI_Init()

void QSPI_Init ( QSPI_InitTypeDef QSPI_InitStruct)

Initializes the QSPI peripheral according to the specified parameters in the QSPI_InitStruct.

Parameters
QSPI_InitStructpointer to a QSPI_InitTypeDef structure that contains the configuration information for the specified QSPI peripheral.
Returns
None

◆ QSPI_ITConfig()

void QSPI_ITConfig ( uint32_t  QSPI_IT,
FunctionalState  NewState 
)

Enables or disables the specified QSPI interrupts.

Parameters
QSPI_ITspecifies the QSPI interrupt source to be enabled or disabled. This parameter can be any combination of the following values:
  • QSPI_IT_TO: Timeout interrupt
  • QSPI_IT_SM: Status Match interrupt
  • QSPI_IT_FT: FIFO Threshold
  • QSPI_IT_TC: Transfer Complete
  • QSPI_IT_TE: Transfer Error
NewStatenew state of the specified QSPI interrupt. This parameter can be: ENABLE or DISABLE.
Returns
None

◆ QSPI_MemoryMappedMode_SetTimeout()

void QSPI_MemoryMappedMode_SetTimeout ( uint32_t  QSPI_Timeout)

Sets the value of the Timeout in Memory Mapped mode.

Parameters
QSPI_TimeoutThis field indicates how many CLK cycles QSPI waits after the FIFO becomes full until it raises nCS, putting the flash memory in a lowerconsumption state. This parameter can be any value of between 0x0000 and 0xFFFF
Note
This function is used only in Memory Mapped Mode
Returns
None

◆ QSPI_ReceiveData16()

uint16_t QSPI_ReceiveData16 ( void  )

Returns the most recent received 16bit data by the QSPI peripheral.

Parameters
None
Returns
The value of the received data.

◆ QSPI_ReceiveData32()

uint32_t QSPI_ReceiveData32 ( void  )

Returns the most recent received 32bit data by the QSPI peripheral.

Parameters
None
Returns
The value of the received data.

◆ QSPI_ReceiveData8()

uint8_t QSPI_ReceiveData8 ( void  )

Returns the most recent received 8bit data by the QSPI peripheral.

Parameters
None
Returns
The value of the received data.

◆ QSPI_SendData16()

void QSPI_SendData16 ( uint16_t  Data)

Transmits a 16bit Data through the QSPI peripheral.

Parameters
DataData to be transmitted.
Returns
None

◆ QSPI_SendData32()

void QSPI_SendData32 ( uint32_t  Data)

Transmits a 32bit Data through the QSPI peripheral.

Parameters
DataData to be transmitted.
Returns
None

◆ QSPI_SendData8()

void QSPI_SendData8 ( uint8_t  Data)

Transmits a 8bit Data through the QSPI peripheral.

Parameters
DataData to be transmitted.
Returns
None

◆ QSPI_SetAddress()

void QSPI_SetAddress ( uint32_t  QSPI_Address)

Sets the value of the Address.

Parameters
QSPI_AddressAddress to be send to the external flash memory.

This parameter can be any value of between 0x00000000 and 0xFFFFFFFF

Note
This function is used only in Indirect Mode
Returns
None

◆ QSPI_SetAlternateByte()

void QSPI_SetAlternateByte ( uint32_t  QSPI_AlternateByte)

Sets the value of the Alternate Bytes.

Parameters
QSPI_AlternateByteOptional data to be send to the external QSPI device right after the address. This parameter can be any value of between 0x00000000 and 0xFFFFFFFF
Note
This function is used only in Indirect Mode
Returns
None

◆ QSPI_SetDataLength()

void QSPI_SetDataLength ( uint32_t  QSPI_DataLength)

Sets number of Bytes to be transferred.

Parameters
QSPI_DataLengthNumber of data to be retrieved (value+1) in indirect and status-polling modes. A value no greater than 3 (indicating 4 bytes) should be used for status-polling mode. All 1s in indirect mode means undefined length, where QSPI will continue until the end of memory, as defined by FSIZE This parameter can be any value of between 0x00000000 and 0xFFFFFFFF 0x0000_0000: 1 byte is to be transferred 0x0000_0001: 2 bytes are to be transferred 0x0000_0002: 3 bytes are to be transferred 0x0000_0003: 4 bytes are to be transferred ... 0xFFFF_FFFD: 4,294,967,294 (4G-2) bytes are to be transferred 0xFFFF_FFFE: 4,294,967,295 (4G-1) bytes are to be transferred 0xFFFF_FFFF: undefined length – all bytes until the end of flash memory (as defined by FSIZE) are to be transferred
Note
This function is not used in Memory Mapped Mode.
Returns
None

◆ QSPI_SetFIFOThreshold()

void QSPI_SetFIFOThreshold ( uint32_t  QSPI_FIFOThreshold)

Sets the FIFO Threshold.

Parameters
QSPI_FIFOThresDefines, in indirect mode, the threshold number of bytes in the FIFO which will cause the FIFO Threshold Flag FTF to be set. This parameter can be any value of between 0x00 and 0x0F
Returns
None

◆ QSPI_StructInit()

void QSPI_StructInit ( QSPI_InitTypeDef QSPI_InitStruct)

Fills each QSPI_InitStruct member with its default value.

Parameters
QSPI_InitStructpointer to a QSPI_InitTypeDef structure which will be initialized.
Returns
None

◆ QSPI_TimeoutCounterCmd()

void QSPI_TimeoutCounterCmd ( FunctionalState  NewState)

Enables or disables The Timeout Counter.

Parameters
NewStatenew state of the Timeout Counter. This parameter can be: ENABLE or DISABLE.
Note
This function is used only in Memory Mapped Mode.
Returns
None