| M480 BSP V3.05.001 The Board Support Package for M480 Series

Macros | Functions
QSPI Exported Functions
Standard Driver » QSPI Driver

## Macros
#define | QSPI_CLR_UNIT_TRANS_INT_FLAG(qspi)
| Clear the unit transfer interrupt flag. More...
#define | QSPI_TRIGGER_RX_PDMA(qspi)
| Trigger RX PDMA function. More...
#define | QSPI_TRIGGER_TX_PDMA(qspi)
| Trigger TX PDMA function. More...
#define | QSPI_TRIGGER_TX_RX_PDMA(qspi)
| Trigger TX and RX PDMA function. More...
#define | QSPI_DISABLE_RX_PDMA(qspi)
| Disable RX PDMA transfer. More...
#define | QSPI_DISABLE_TX_PDMA(qspi)
| Disable TX PDMA transfer. More...
#define | QSPI_DISABLE_TX_RX_PDMA(qspi)
| Disable TX and RX PDMA transfer. More...
#define | QSPI_GET_RX_FIFO_COUNT(qspi)
| Get the count of available data in RX FIFO. More...
#define | QSPI_GET_RX_FIFO_EMPTY_FLAG(qspi)
| Get the RX FIFO empty flag. More...
#define | QSPI_GET_TX_FIFO_EMPTY_FLAG(qspi)
| Get the TX FIFO empty flag. More...
#define | QSPI_GET_TX_FIFO_FULL_FLAG(qspi)
| Get the TX FIFO full flag. More...
#define | QSPI_READ_RX(qspi)
| Get the datum read from RX register. More...
#define | QSPI_WRITE_TX(qspi, u32TxData)
| Write datum to TX register. More...
#define | QSPI_SET_SS_HIGH(qspi)
| Set QSPIx_SS pin to high state. More...
#define | QSPI_SET_SS_LOW(qspi)
| Set QSPIx_SS pin to low state. More...
#define | QSPI_ENABLE_BYTE_REORDER(qspi)
| Enable Byte Reorder function. More...
#define | QSPI_DISABLE_BYTE_REORDER(qspi)
| Disable Byte Reorder function. More...
#define | QSPI_SET_SUSPEND_CYCLE(qspi, u32SuspCycle)
| Set the length of suspend interval. More...
#define | QSPI_SET_LSB_FIRST(qspi)
| Set the QSPI transfer sequence with LSB first. More...
#define | QSPI_SET_MSB_FIRST(qspi)
| Set the QSPI transfer sequence with MSB first. More...
#define | QSPI_SET_DATA_WIDTH(qspi, u32Width)
| Set the data width of a QSPI transaction. More...
#define | QSPI_IS_BUSY(qspi)
| Get the QSPI busy state. More...
#define | QSPI_ENABLE(qspi)
| Enable QSPI controller. More...
#define | QSPI_DISABLE(qspi)
| Disable QSPI controller. More...
#define | QSPI_DISABLE_DUAL_MODE(qspi)
| Disable QSPI Dual IO function. More...
#define | QSPI_ENABLE_DUAL_INPUT_MODE(qspi)
| Enable Dual IO function and set QSPI Dual IO direction to input. More...
#define | QSPI_ENABLE_DUAL_OUTPUT_MODE(qspi)
| Enable Dual IO function and set QSPI Dual IO direction to output. More...
#define | QSPI_DISABLE_QUAD_MODE(qspi)
| Disable QSPI Dual IO function. More...
#define | QSPI_ENABLE_QUAD_INPUT_MODE(qspi)
| Set QSPI Quad IO direction to input. More...
#define | QSPI_ENABLE_QUAD_OUTPUT_MODE(qspi)
| Set QSPI Quad IO direction to output. More...

## Functions
uint32_t | QSPI_Open (QSPI_T *qspi, uint32_t u32MasterSlave, uint32_t u32QSPIMode, uint32_t u32DataWidth, uint32_t u32BusClock)
| This function make QSPI module be ready to transfer. More...
void | QSPI_Close (QSPI_T *qspi)
| Disable QSPI controller. More...
void | QSPI_ClearRxFIFO (QSPI_T *qspi)
| Clear RX FIFO buffer. More...
void | QSPI_ClearTxFIFO (QSPI_T *qspi)
| Clear TX FIFO buffer. More...
void | QSPI_DisableAutoSS (QSPI_T *qspi)
| Disable the automatic slave selection function. More...
void | QSPI_EnableAutoSS (QSPI_T *qspi, uint32_t u32SSPinMask, uint32_t u32ActiveLevel)
| Enable the automatic slave selection function. More...
uint32_t | QSPI_SetBusClock (QSPI_T *qspi, uint32_t u32BusClock)
| Set the QSPI bus clock. More...
void | QSPI_SetFIFO (QSPI_T *qspi, uint32_t u32TxThreshold, uint32_t u32RxThreshold)
| Configure FIFO threshold setting. More...
uint32_t | QSPI_GetBusClock (QSPI_T *qspi)
| Get the actual frequency of QSPI bus clock. Only available in Master mode. More...
void | QSPI_EnableInt (QSPI_T *qspi, uint32_t u32Mask)
| Enable interrupt function. More...
void | QSPI_DisableInt (QSPI_T *qspi, uint32_t u32Mask)
| Disable interrupt function. More...
uint32_t | QSPI_GetIntFlag (QSPI_T *qspi, uint32_t u32Mask)
| Get interrupt flag. More...
void | QSPI_ClearIntFlag (QSPI_T *qspi, uint32_t u32Mask)
| Clear interrupt flag. More...
uint32_t | QSPI_GetStatus (QSPI_T *qspi, uint32_t u32Mask)
| Get QSPI status. More...

## Detailed Description

## Macro Definition Documentation

## ◆ QSPI_CLR_UNIT_TRANS_INT_FLAG

#define QSPI_CLR_UNIT_TRANS_INT_FLAG | ( |  | qspi | ) |

Clear the unit transfer interrupt flag.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Write 1 to UNITIF bit of QSPI_STATUS register to clear the unit transfer interrupt flag.

Definition at line 78 of file qspi.h.

## ◆ QSPI_DISABLE

#define QSPI_DISABLE | ( |  | qspi | ) |

Disable QSPI controller.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Clear QSPIEN (QSPI_CTL[0]) to disable QSPI controller.

Definition at line 293 of file qspi.h.

## ◆ QSPI_DISABLE_BYTE_REORDER

#define QSPI_DISABLE_BYTE_REORDER | ( |  | qspi | ) |

Disable Byte Reorder function.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Clear REORDER bit field of QSPI_CTL register to disable Byte Reorder function.

Definition at line 226 of file qspi.h.

## ◆ QSPI_DISABLE_DUAL_MODE

#define QSPI_DISABLE_DUAL_MODE | ( |  | qspi | ) |

Disable QSPI Dual IO function.

Parameters

  [in] | qspi | is the base address of QSPI module.

Returns
  none

Definition at line 301 of file qspi.h.

## ◆ QSPI_DISABLE_QUAD_MODE

#define QSPI_DISABLE_QUAD_MODE | ( |  | qspi | ) |

Disable QSPI Dual IO function.

Parameters

  [in] | qspi | is the base address of QSPI module.

Returns
  none

Definition at line 325 of file qspi.h.

## ◆ QSPI_DISABLE_RX_PDMA

#define QSPI_DISABLE_RX_PDMA | ( |  | qspi | ) |

Disable RX PDMA transfer.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Clear RXPDMAEN bit of QSPI_PDMACTL register to disable RX PDMA transfer function.

Definition at line 114 of file qspi.h.

## ◆ QSPI_DISABLE_TX_PDMA

#define QSPI_DISABLE_TX_PDMA | ( |  | qspi | ) |

Disable TX PDMA transfer.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Clear TXPDMAEN bit of QSPI_PDMACTL register to disable TX PDMA transfer function.

Definition at line 123 of file qspi.h.

## ◆ QSPI_DISABLE_TX_RX_PDMA

#define QSPI_DISABLE_TX_RX_PDMA | ( |  | qspi | ) |

Disable TX and RX PDMA transfer.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Clear TXPDMAEN bit and RXPDMAEN bit of QSPI_PDMACTL register to disable TX and RX PDMA transfer function.

Definition at line 132 of file qspi.h.

## ◆ QSPI_ENABLE

#define QSPI_ENABLE | ( |  | qspi | ) |

Enable QSPI controller.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Set QSPIEN (QSPI_CTL[0]) to enable QSPI controller.

Definition at line 284 of file qspi.h.

## ◆ QSPI_ENABLE_BYTE_REORDER

#define QSPI_ENABLE_BYTE_REORDER | ( |  | qspi | ) |

Enable Byte Reorder function.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Enable Byte Reorder function. The suspend interval depends on the setting of SUSPITV (QSPI_CTL[7:4]).

Definition at line 217 of file qspi.h.

## ◆ QSPI_ENABLE_DUAL_INPUT_MODE

#define QSPI_ENABLE_DUAL_INPUT_MODE | ( |  | qspi | ) |

Enable Dual IO function and set QSPI Dual IO direction to input.

Parameters

  [in] | qspi | is the base address of QSPI module.

Returns
  none

Definition at line 309 of file qspi.h.

## ◆ QSPI_ENABLE_DUAL_OUTPUT_MODE

#define QSPI_ENABLE_DUAL_OUTPUT_MODE | ( |  | qspi | ) |

Enable Dual IO function and set QSPI Dual IO direction to output.

Parameters

  [in] | qspi | is the base address of QSPI module.

Returns
  none

Definition at line 317 of file qspi.h.

## ◆ QSPI_ENABLE_QUAD_INPUT_MODE

#define QSPI_ENABLE_QUAD_INPUT_MODE | ( |  | qspi | ) |

Set QSPI Quad IO direction to input.

Parameters

  [in] | qspi | is the base address of QSPI module.

Returns
  none

Definition at line 333 of file qspi.h.

## ◆ QSPI_ENABLE_QUAD_OUTPUT_MODE

#define QSPI_ENABLE_QUAD_OUTPUT_MODE | ( |  | qspi | ) |

Set QSPI Quad IO direction to output.

Parameters

  [in] | qspi | is the base address of QSPI module.

Returns
  none

Definition at line 341 of file qspi.h.

## ◆ QSPI_GET_RX_FIFO_COUNT

#define QSPI_GET_RX_FIFO_COUNT | ( |  | qspi | ) |

Get the count of available data in RX FIFO.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  The count of available data in RX FIFO.

Read RXCNT (QSPI_STATUS[27:24]) to get the count of available data in RX FIFO.

Definition at line 141 of file qspi.h.

## ◆ QSPI_GET_RX_FIFO_EMPTY_FLAG

#define QSPI_GET_RX_FIFO_EMPTY_FLAG | ( |  | qspi | ) |

Get the RX FIFO empty flag.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Return values

  0 | RX FIFO is not empty.
  1 | RX FIFO is empty.

Read RXEMPTY bit of QSPI_STATUS register to get the RX FIFO empty flag.

Definition at line 151 of file qspi.h.

## ◆ QSPI_GET_TX_FIFO_EMPTY_FLAG

#define QSPI_GET_TX_FIFO_EMPTY_FLAG | ( |  | qspi | ) |

Get the TX FIFO empty flag.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Return values

  0 | TX FIFO is not empty.
  1 | TX FIFO is empty.

Read TXEMPTY bit of QSPI_STATUS register to get the TX FIFO empty flag.

Definition at line 161 of file qspi.h.

## ◆ QSPI_GET_TX_FIFO_FULL_FLAG

#define QSPI_GET_TX_FIFO_FULL_FLAG | ( |  | qspi | ) |

Get the TX FIFO full flag.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Return values

  0 | TX FIFO is not full.
  1 | TX FIFO is full.

Read TXFULL bit of QSPI_STATUS register to get the TX FIFO full flag.

Definition at line 171 of file qspi.h.

## ◆ QSPI_IS_BUSY

#define QSPI_IS_BUSY | ( |  | qspi | ) |

Get the QSPI busy state.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Return values

  0 | QSPI controller is not busy.
  1 | QSPI controller is busy.

This macro will return the busy state of QSPI controller.

Definition at line 275 of file qspi.h.

## ◆ QSPI_READ_RX

#define QSPI_READ_RX | ( |  | qspi | ) |

Get the datum read from RX register.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  Data in RX register.

Read QSPI_RX register to get the received datum.

Definition at line 180 of file qspi.h.

## ◆ QSPI_SET_DATA_WIDTH

#define QSPI_SET_DATA_WIDTH | ( |  | qspi,
|  |  | u32Width
| ) |  |

Set the data width of a QSPI transaction.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32Width | The bit width of one transaction.

Returns
  None.

The data width can be 8 ~ 32 bits.

Definition at line 265 of file qspi.h.

## ◆ QSPI_SET_LSB_FIRST

#define QSPI_SET_LSB_FIRST | ( |  | qspi | ) |

Set the QSPI transfer sequence with LSB first.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Set LSB bit of QSPI_CTL register to set the QSPI transfer sequence with LSB first.

Definition at line 246 of file qspi.h.

## ◆ QSPI_SET_MSB_FIRST

#define QSPI_SET_MSB_FIRST | ( |  | qspi | ) |

Set the QSPI transfer sequence with MSB first.

Parameters

  [in] | qspi | The pointer of the specified SPI module.

Returns
  None.

Clear LSB bit of QSPI_CTL register to set the QSPI transfer sequence with MSB first.

Definition at line 255 of file qspi.h.

## ◆ QSPI_SET_SS_HIGH

#define QSPI_SET_SS_HIGH | ( |  | qspi | ) |

Set QSPIx_SS pin to high state.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Disable automatic slave selection function and set QSPIx_SS pin to high state.

Definition at line 199 of file qspi.h.

## ◆ QSPI_SET_SS_LOW

#define QSPI_SET_SS_LOW | ( |  | qspi | ) |

Set QSPIx_SS pin to low state.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Disable automatic slave selection function and set QSPIx_SS pin to low state.

Definition at line 208 of file qspi.h.

## ◆ QSPI_SET_SUSPEND_CYCLE

#define QSPI_SET_SUSPEND_CYCLE | ( |  | qspi,
|  |  | u32SuspCycle
| ) |  |

Set the length of suspend interval.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32SuspCycle | Decides the length of suspend interval. It could be 0 ~ 15.

Returns
  None.

Set the length of suspend interval according to u32SuspCycle. The length of suspend interval is ((u32SuspCycle + 0.5) * the length of one QSPI bus clock cycle).

Definition at line 237 of file qspi.h.

## ◆ QSPI_TRIGGER_RX_PDMA

#define QSPI_TRIGGER_RX_PDMA | ( |  | qspi | ) |

Trigger RX PDMA function.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Set RXPDMAEN bit of QSPI_PDMACTL register to enable RX PDMA transfer function.

Definition at line 87 of file qspi.h.

## ◆ QSPI_TRIGGER_TX_PDMA

#define QSPI_TRIGGER_TX_PDMA | ( |  | qspi | ) |

Trigger TX PDMA function.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Set TXPDMAEN bit of QSPI_PDMACTL register to enable TX PDMA transfer function.

Definition at line 96 of file qspi.h.

## ◆ QSPI_TRIGGER_TX_RX_PDMA

#define QSPI_TRIGGER_TX_RX_PDMA | ( |  | qspi | ) |

Trigger TX and RX PDMA function.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None.

Set TXPDMAEN bit and RXPDMAEN bit of QSPI_PDMACTL register to enable TX and RX PDMA transfer function.

Definition at line 105 of file qspi.h.

## ◆ QSPI_WRITE_TX

#define QSPI_WRITE_TX | ( |  | qspi,
|  |  | u32TxData
| ) |  |

Write datum to TX register.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32TxData | The datum which user attempt to transfer through QSPI bus.

Returns
  None.

Write u32TxData to QSPI_TX register.

Definition at line 190 of file qspi.h.

## Function Documentation

## ◆ QSPI_ClearIntFlag()

void QSPI_ClearIntFlag | ( | QSPI_T * | qspi,
|  | uint32_t | u32Mask
| ) |  |

Clear interrupt flag.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32Mask | The combination of all related interrupt sources. Each bit corresponds to a interrupt source. This parameter decides which interrupt flags will be cleared. It could be the combination of: QSPI_UNIT_INT_MASK QSPI_SSACT_INT_MASK QSPI_SSINACT_INT_MASK QSPI_SLVUR_INT_MASK QSPI_SLVBE_INT_MASK QSPI_TXUF_INT_MASK QSPI_FIFO_RXOV_INT_MASK QSPI_FIFO_RXTO_INT_MASK

Returns
  None

Clear QSPI related interrupt flags specified by u32Mask parameter.

Definition at line 724 of file qspi.c.

## ◆ QSPI_ClearRxFIFO()

void QSPI_ClearRxFIFO | ( | QSPI_T * | qspi | ) |

Clear RX FIFO buffer.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None

This function will clear QSPI RX FIFO buffer. The RXEMPTY (QSPI_STATUS[8]) will be set to 1.

Definition at line 213 of file qspi.c.

## ◆ QSPI_ClearTxFIFO()

void QSPI_ClearTxFIFO | ( | QSPI_T * | qspi | ) |

Clear TX FIFO buffer.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None

This function will clear QSPI TX FIFO buffer. The TXEMPTY (QSPI_STATUS[16]) will be set to 1.

Note
  The TX shift register will not be cleared.

Definition at line 225 of file qspi.c.

## ◆ QSPI_Close()

void QSPI_Close | ( | QSPI_T * | qspi | ) |

Disable QSPI controller.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None

This function will reset QSPI controller.

Definition at line 192 of file qspi.c.

## ◆ QSPI_DisableAutoSS()

void QSPI_DisableAutoSS | ( | QSPI_T * | qspi | ) |

Disable the automatic slave selection function.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  None

This function will disable the automatic slave selection function and set slave selection signal to inactive state.

Definition at line 236 of file qspi.c.

## ◆ QSPI_DisableInt()

void QSPI_DisableInt | ( | QSPI_T * | qspi,
|  | uint32_t | u32Mask
| ) |  |

Disable interrupt function.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32Mask | The combination of all related interrupt enable bits. Each bit corresponds to a interrupt bit. This parameter decides which interrupts will be disabled. It is combination of: QSPI_UNIT_INT_MASK QSPI_SSACT_INT_MASK QSPI_SSINACT_INT_MASK QSPI_SLVUR_INT_MASK QSPI_SLVBE_INT_MASK QSPI_TXUF_INT_MASK QSPI_FIFO_TXTH_INT_MASK QSPI_FIFO_RXTH_INT_MASK QSPI_FIFO_RXOV_INT_MASK QSPI_FIFO_RXTO_INT_MASK

Returns
  None

Disable QSPI related interrupts specified by u32Mask parameter.

Definition at line 546 of file qspi.c.

## ◆ QSPI_EnableAutoSS()

void QSPI_EnableAutoSS | ( | QSPI_T * | qspi,
|  | uint32_t | u32SSPinMask,
|  | uint32_t | u32ActiveLevel
| ) |  |

Enable the automatic slave selection function.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32SSPinMask | Specifies slave selection pins. (QSPI_SS)
  [in] | u32ActiveLevel | Specifies the active level of slave selection signal. (QSPI_SS_ACTIVE_HIGH, QSPI_SS_ACTIVE_LOW)

Returns
  None

This function will enable the automatic slave selection function. Only available in Master mode. The slave selection pin and the active level will be set in this function.

Definition at line 250 of file qspi.c.

## ◆ QSPI_EnableInt()

void QSPI_EnableInt | ( | QSPI_T * | qspi,
|  | uint32_t | u32Mask
| ) |  |

Enable interrupt function.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32Mask | The combination of all related interrupt enable bits. Each bit corresponds to a interrupt enable bit. This parameter decides which interrupts will be enabled. It is combination of: QSPI_UNIT_INT_MASK QSPI_SSACT_INT_MASK QSPI_SSINACT_INT_MASK QSPI_SLVUR_INT_MASK QSPI_SLVBE_INT_MASK QSPI_TXUF_INT_MASK QSPI_FIFO_TXTH_INT_MASK QSPI_FIFO_RXTH_INT_MASK QSPI_FIFO_RXOV_INT_MASK QSPI_FIFO_RXTO_INT_MASK

Returns
  None

Enable QSPI related interrupts specified by u32Mask parameter.

Definition at line 463 of file qspi.c.

## ◆ QSPI_GetBusClock()

uint32_t QSPI_GetBusClock | ( | QSPI_T * | qspi | ) |

Get the actual frequency of QSPI bus clock. Only available in Master mode.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.

Returns
  Actual QSPI bus clock frequency in Hz.

This function will calculate the actual QSPI bus clock rate according to the QSPInSEL and DIVIDER settings. Only available in Master mode.

Definition at line 389 of file qspi.c.

## ◆ QSPI_GetIntFlag()

uint32_t QSPI_GetIntFlag | ( | QSPI_T * | qspi,
|  | uint32_t | u32Mask
| ) |  |

Get interrupt flag.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32Mask | The combination of all related interrupt sources. Each bit corresponds to a interrupt source. This parameter decides which interrupt flags will be read. It is combination of: QSPI_UNIT_INT_MASK QSPI_SSACT_INT_MASK QSPI_SSINACT_INT_MASK QSPI_SLVUR_INT_MASK QSPI_SLVBE_INT_MASK QSPI_TXUF_INT_MASK QSPI_FIFO_TXTH_INT_MASK QSPI_FIFO_RXTH_INT_MASK QSPI_FIFO_RXOV_INT_MASK QSPI_FIFO_RXTO_INT_MASK

Returns
  Interrupt flags of selected sources.

Get QSPI related interrupt flags specified by u32Mask parameter.

Definition at line 629 of file qspi.c.

## ◆ QSPI_GetStatus()

uint32_t QSPI_GetStatus | ( | QSPI_T * | qspi,
|  | uint32_t | u32Mask
| ) |  |

Get QSPI status.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32Mask | The combination of all related sources. Each bit corresponds to a source. This parameter decides which flags will be read. It is combination of: QSPI_BUSY_MASK QSPI_RX_EMPTY_MASK QSPI_RX_FULL_MASK QSPI_TX_EMPTY_MASK QSPI_TX_FULL_MASK QSPI_TXRX_RESET_MASK QSPI_QSPIEN_STS_MASK QSPI_SSLINE_STS_MASK

Returns
  Flags of selected sources.

Get QSPI related status specified by u32Mask parameter.

Definition at line 785 of file qspi.c.

## ◆ QSPI_Open()

uint32_t QSPI_Open | ( | QSPI_T * | qspi,
|  | uint32_t | u32MasterSlave,
|  | uint32_t | u32QSPIMode,
|  | uint32_t | u32DataWidth,
|  | uint32_t | u32BusClock
| ) |  |

This function make QSPI module be ready to transfer.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32MasterSlave | Decides the QSPI module is operating in master mode or in slave mode. (QSPI_SLAVE, QSPI_MASTER)
  [in] | u32QSPIMode | Decides the transfer timing. (QSPI_MODE_0, QSPI_MODE_1, QSPI_MODE_2, QSPI_MODE_3)
  [in] | u32DataWidth | Decides the data width of a QSPI transaction.
  [in] | u32BusClock | The expected frequency of QSPI bus clock in Hz.

Returns
  Actual frequency of QSPI peripheral clock.

By default, the QSPI transfer sequence is MSB first, the slave selection signal is active low and the automatic slave selection function is disabled. In Slave mode, the u32BusClock shall be NULL and the QSPI clock divider setting will be 0. The actual clock rate may be different from the target QSPI clock rate. For example, if the QSPI source clock rate is 12 MHz and the target QSPI bus clock rate is 7 MHz, the actual QSPI clock rate will be 6MHz.

Note
  If u32BusClock = 0, DIVIDER setting will be set to the maximum value.
  If u32BusClock >= system clock frequency, QSPI peripheral clock source will be set to APB clock and DIVIDER will be set to 0.
  If u32BusClock >= QSPI peripheral clock source, DIVIDER will be set to 0.
  In slave mode, the QSPI peripheral clock rate will be equal to APB clock rate.

Definition at line 43 of file qspi.c.

## ◆ QSPI_SetBusClock()

uint32_t QSPI_SetBusClock | ( | QSPI_T * | qspi,
|  | uint32_t | u32BusClock
| ) |  |

Set the QSPI bus clock.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32BusClock | The expected frequency of QSPI bus clock in Hz.

Returns
  Actual frequency of QSPI bus clock.

This function is only available in Master mode. The actual clock rate may be different from the target QSPI bus clock rate. For example, if the QSPI source clock rate is 12 MHz and the target QSPI bus clock rate is 7 MHz, the actual QSPI bus clock rate will be 6 MHz.

Note
  If u32BusClock = 0, DIVIDER setting will be set to the maximum value.
  If u32BusClock >= system clock frequency, QSPI peripheral clock source will be set to APB clock and DIVIDER will be set to 0.
  If u32BusClock >= QSPI peripheral clock source, DIVIDER will be set to 0.

Definition at line 267 of file qspi.c.

## ◆ QSPI_SetFIFO()

void QSPI_SetFIFO | ( | QSPI_T * | qspi,
|  | uint32_t | u32TxThreshold,
|  | uint32_t | u32RxThreshold
| ) |  |

Configure FIFO threshold setting.

Parameters

  [in] | qspi | The pointer of the specified QSPI module.
  [in] | u32TxThreshold | Decides the TX FIFO threshold. It could be 0 ~ 7.
  [in] | u32RxThreshold | Decides the RX FIFO threshold. It could be 0 ~ 7.

Returns
  None

Set TX FIFO threshold and RX FIFO threshold configurations.

Definition at line 376 of file qspi.c.