Classes | Macros | Typedefs | Enumerations | Functions
gr55xx_hal_qspi.h File Reference

Header file containing functions prototypes of QSPI HAL library. More...

`#include "gr55xx_ll_spi.h"`
`#include "gr55xx_hal_def.h"`
Include dependency graph for gr55xx_hal_qspi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | _qspi_init_t
| QSPI init Structure definition. More...
struct | _qspi_handle
| QSPI handle Structure definition. More...
struct | _qspi_command_t
| QSPI command Structure definition. More...
struct | _hal_qspi_callback
| HAL_QSPI Callback function definition. More...

## Macros
#define | HAL_QSPI_ERROR_NONE ((uint32_t)0x00000000)
| No error More...
#define | HAL_QSPI_ERROR_TIMEOUT ((uint32_t)0x00000001)
| Timeout error More...
#define | HAL_QSPI_ERROR_TRANSFER ((uint32_t)0x00000002)
| Transfer error More...
#define | HAL_QSPI_ERROR_DMA ((uint32_t)0x00000004)
| DMA transfer error More...
#define | HAL_QSPI_ERROR_INVALID_PARAM ((uint32_t)0x00000008)
| Invalid parameter error. More...
#define | QSPI_CLOCK_MODE_0 (LL_SSI_SCPOL_LOW | LL_SSI_SCPHA_1EDGE)
| Inactive state of CLK is low; CLK toggles at the start of the first data bit More...
#define | QSPI_CLOCK_MODE_1 (LL_SSI_SCPOL_LOW | LL_SSI_SCPHA_2EDGE)
| Inactive state of CLK is low; CLK toggles in the middle of the first data bit More...
#define | QSPI_CLOCK_MODE_2 (LL_SSI_SCPOL_HIGH | LL_SSI_SCPHA_1EDGE)
| Inactive state of CLK is high; CLK toggles at the start of the first data bit More...
#define | QSPI_CLOCK_MODE_3 (LL_SSI_SCPOL_HIGH | LL_SSI_SCPHA_2EDGE)
| Inactive state of CLK is high; CLK toggles in the middle of the first data bit More...
#define | QSPI_DATA_MODE_SPI LL_SSI_FRF_SPI
| Standard SPI Frame Format More...
#define | QSPI_DATA_MODE_DUALSPI LL_SSI_FRF_DUALSPI
| Dual SPI Frame Format More...
#define | QSPI_DATA_MODE_QUADSPI LL_SSI_FRF_QUADSPI
| Quad SPI Frame Format More...
#define | QSPI_INSTSIZE_00_BITS LL_SSI_INSTSIZE_0BIT
| 0-bit (No Instruction) More...
#define | QSPI_INSTSIZE_04_BITS LL_SSI_INSTSIZE_4BIT
| 4-bit Instruction More...
#define | QSPI_INSTSIZE_08_BITS LL_SSI_INSTSIZE_8BIT
| 8-bit Instruction More...
#define | QSPI_INSTSIZE_16_BITS LL_SSI_INSTSIZE_16BIT
| 16-bit Instruction More...
#define | QSPI_ADDRSIZE_00_BITS LL_SSI_ADDRSIZE_0BIT
| 0-bit address More...
#define | QSPI_ADDRSIZE_04_BITS LL_SSI_ADDRSIZE_4BIT
| 4-bit address More...
#define | QSPI_ADDRSIZE_08_BITS LL_SSI_ADDRSIZE_8BIT
| 8-bit address More...
#define | QSPI_ADDRSIZE_12_BITS LL_SSI_ADDRSIZE_12BIT
| 12-bit address More...
#define | QSPI_ADDRSIZE_16_BITS LL_SSI_ADDRSIZE_16BIT
| 16-bit address More...
#define | QSPI_ADDRSIZE_20_BITS LL_SSI_ADDRSIZE_20BIT
| 20-bit address More...
#define | QSPI_ADDRSIZE_24_BITS LL_SSI_ADDRSIZE_24BIT
| 24-bit address More...
#define | QSPI_ADDRSIZE_28_BITS LL_SSI_ADDRSIZE_28BIT
| 28-bit address More...
#define | QSPI_ADDRSIZE_32_BITS LL_SSI_ADDRSIZE_32BIT
| 32-bit address More...
#define | QSPI_DATASIZE_04_BITS LL_SSI_DATASIZE_4BIT
| Data length for SPI transfer: 4 bits. More...
#define | QSPI_DATASIZE_05_BITS LL_SSI_DATASIZE_5BIT
| Data length for SPI transfer: 5 bits. More...
#define | QSPI_DATASIZE_06_BITS LL_SSI_DATASIZE_6BIT
| Data length for SPI transfer: 6 bits. More...
#define | QSPI_DATASIZE_07_BITS LL_SSI_DATASIZE_7BIT
| Data length for SPI transfer: 7 bits. More...
#define | QSPI_DATASIZE_08_BITS LL_SSI_DATASIZE_8BIT
| Data length for SPI transfer: 8 bits. More...
#define | QSPI_DATASIZE_09_BITS LL_SSI_DATASIZE_9BIT
| Data length for SPI transfer: 9 bits. More...
#define | QSPI_DATASIZE_10_BITS LL_SSI_DATASIZE_10BIT
| Data length for SPI transfer: 10 bits. More...
#define | QSPI_DATASIZE_11_BITS LL_SSI_DATASIZE_11BIT
| Data length for SPI transfer: 11 bits. More...
#define | QSPI_DATASIZE_12_BITS LL_SSI_DATASIZE_12BIT
| Data length for SPI transfer: 12 bits. More...
#define | QSPI_DATASIZE_13_BITS LL_SSI_DATASIZE_13BIT
| Data length for SPI transfer: 13 bits. More...
#define | QSPI_DATASIZE_14_BITS LL_SSI_DATASIZE_14BIT
| Data length for SPI transfer: 14 bits. More...
#define | QSPI_DATASIZE_15_BITS LL_SSI_DATASIZE_15BIT
| Data length for SPI transfer: 15 bits. More...
#define | QSPI_DATASIZE_16_BITS LL_SSI_DATASIZE_16BIT
| Data length for SPI transfer: 16 bits. More...
#define | QSPI_DATASIZE_17_BITS LL_SSI_DATASIZE_17BIT
| Data length for SPI transfer: 17 bits. More...
#define | QSPI_DATASIZE_18_BITS LL_SSI_DATASIZE_18BIT
| Data length for SPI transfer: 18 bits. More...
#define | QSPI_DATASIZE_19_BITS LL_SSI_DATASIZE_19BIT
| Data length for SPI transfer: 19 bits. More...
#define | QSPI_DATASIZE_20_BITS LL_SSI_DATASIZE_20BIT
| Data length for SPI transfer: 20 bits. More...
#define | QSPI_DATASIZE_21_BITS LL_SSI_DATASIZE_21BIT
| Data length for SPI transfer: 21 bits. More...
#define | QSPI_DATASIZE_22_BITS LL_SSI_DATASIZE_22BIT
| Data length for SPI transfer: 22 bits. More...
#define | QSPI_DATASIZE_23_BITS LL_SSI_DATASIZE_23BIT
| Data length for SPI transfer: 23 bits. More...
#define | QSPI_DATASIZE_24_BITS LL_SSI_DATASIZE_24BIT
| Data length for SPI transfer: 24 bits. More...
#define | QSPI_DATASIZE_25_BITS LL_SSI_DATASIZE_25BIT
| Data length for SPI transfer: 25 bits. More...
#define | QSPI_DATASIZE_26_BITS LL_SSI_DATASIZE_26BIT
| Data length for SPI transfer: 26 bits. More...
#define | QSPI_DATASIZE_27_BITS LL_SSI_DATASIZE_27BIT
| Data length for SPI transfer: 27 bits. More...
#define | QSPI_DATASIZE_28_BITS LL_SSI_DATASIZE_28BIT
| Data length for SPI transfer: 28 bits. More...
#define | QSPI_DATASIZE_29_BITS LL_SSI_DATASIZE_29BIT
| Data length for SPI transfer: 29 bits. More...
#define | QSPI_DATASIZE_30_BITS LL_SSI_DATASIZE_30BIT
| Data length for SPI transfer: 30 bits. More...
#define | QSPI_DATASIZE_31_BITS LL_SSI_DATASIZE_31BIT
| Data length for SPI transfer: 31 bits. More...
#define | QSPI_DATASIZE_32_BITS LL_SSI_DATASIZE_32BIT
| Data length for SPI transfer: 32 bits. More...
#define | QSPI_INST_ADDR_ALL_IN_SPI LL_SSI_INST_ADDR_ALL_IN_SPI
| Instruction and address are sent in SPI mode. More...
#define | QSPI_INST_IN_SPI_ADDR_IN_SPIFRF LL_SSI_INST_IN_SPI_ADDR_IN_SPIFRF
| Instruction is sent in SPI mode, and address is sent in Daul/Quad SPI mode. More...
#define | QSPI_INST_ADDR_ALL_IN_SPIFRF LL_SSI_INST_ADDR_ALL_IN_SPIFRF
| Instruction and address are sent in Daul/Quad SPI mode. More...
#define | QSPI_FLAG_DCOL LL_SSI_SR_DCOL
| Data collision error flag More...
#define | QSPI_FLAG_TXE LL_SSI_SR_TXE
| Transmission error flag More...
#define | QSPI_FLAG_RFF LL_SSI_SR_RFF
| Rx FIFO full flag More...
#define | QSPI_FLAG_RFNE LL_SSI_SR_RFNE
| Rx FIFO not empty flag More...
#define | QSPI_FLAG_TFE LL_SSI_SR_TFE
| Tx FIFO empty flag More...
#define | QSPI_FLAG_TFNF LL_SSI_SR_TFNF
| Tx FIFO not full flag More...
#define | QSPI_FLAG_BUSY LL_SSI_SR_BUSY
| Busy flag More...
#define | QSPI_IT_MST LL_SSI_IS_MST
| Multi-Master Contention Interrupt flag. More...
#define | QSPI_IT_RXF LL_SSI_IS_RXF
| Receive FIFO Full Interrupt flag More...
#define | QSPI_IT_RXO LL_SSI_IS_RXO
| Receive FIFO Overflow Interrupt flag More...
#define | QSPI_IT_RXU LL_SSI_IS_RXU
| Receive FIFO Underflow Interrupt flag More...
#define | QSPI_IT_TXO LL_SSI_IS_TXO
| Transmit FIFO Overflow Interrupt flag More...
#define | QSPI_IT_TXE LL_SSI_IS_TXE
| Transmit FIFO Empty Interrupt flag More...
#define | HAL_QSPI_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000)
| 5s More...
#define | __HAL_QSPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_QSPI_STATE_RESET)
| Reset QSPI handle states. More...
#define | __HAL_QSPI_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->SSI_EN, SSI_SSIEN_EN)
| Enable the specified QSPI peripheral. More...
#define | __HAL_QSPI_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->SSI_EN, SSI_SSIEN_EN)
| Disable the specified QSPI peripheral. More...
#define | __HAL_QSPI_ENABLE_DMATX(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_TDMAE)
| Enable the QSPI DMA TX Request. More...
#define | __HAL_QSPI_ENABLE_DMARX(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_RDMAE)
| Enable the QSPI DMA RX Request. More...
#define | __HAL_QSPI_DISABLE_DMATX(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_TDMAE)
| Disable the QSPI DMA TX Request. More...
#define | __HAL_QSPI_DISABLE_DMARX(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_RDMAE)
| Disable the QSPI DMA RX Request. More...
#define | __HAL_QSPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->INTMASK, (__INTERRUPT__))
| Enable the specified QSPI interrupts. More...
#define | __HAL_QSPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->INTMASK, (__INTERRUPT__))
| Disable the specified QSPI interrupts. More...
#define | __HAL_QSPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (READ_BITS((__HANDLE__)->p_instance->INTSTAT, (__INTERRUPT__)) == (__INTERRUPT__))
| Check whether the specified QSPI interrupt source is enabled or not. More...
#define | __HAL_QSPI_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0) ? SET : RESET)
| Check whether the specified QSPI flag is set or not. More...
#define | __HAL_QSPI_CLEAR_FLAG(__HANDLE__, __FLAG__) READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__))
| Clear the specified QSPI flag. More...
#define | IS_QSPI_CLOCK_PRESCALER(__PRESCALER__) ((__PRESCALER__) <= 0xFFFF)
| Check if QSPI Clock Prescaler is valid. More...
#define | IS_QSPI_FIFO_THRESHOLD(__THR__) (((__THR__) >= 0) && ((__THR__) <= 7))
| Check if QSPI FIFO Threshold is valid. More...
#define | IS_QSPI_CLOCK_MODE(__CLKMODE__)
| Check if QSPI Clock Mode is valid. More...
#define | IS_QSPI_INSTRUCTION_SIZE(__INST_SIZE__)
| Check if QSPI Instruction Size is valid. More...
#define | IS_QSPI_ADDRESS_SIZE(__ADDR_SIZE__)
| Check if QSPI Address Size is valid. More...
#define | IS_QSPI_DUMMY_CYCLES(__DCY__) ((__DCY__) <= 31)
| Check if QSPI Dummy Cycle is valid. More...
#define | IS_QSPI_INSTADDR_MODE(__MODE__)
| Check if QSPI Instruction and Address Mode is valid. More...
#define | IS_QSPI_DATA_MODE(__MODE__)
| Check if QSPI Data Mode is valid. More...

## Typedefs
typedef struct _qspi_init_t | qspi_init_t
| QSPI init Structure definition. More...
typedef struct _qspi_handle | qspi_handle_t
| QSPI handle Structure definition. More...
typedef struct _qspi_command_t | qspi_command_t
| QSPI command Structure definition. More...
typedef struct _hal_qspi_callback | hal_qspi_callback_t
| HAL_QSPI Callback function definition. More...

## Enumerations
enum | hal_qspi_state_t { HAL_QSPI_STATE_RESET = 0x00, HAL_QSPI_STATE_READY = 0x01, HAL_QSPI_STATE_BUSY = 0x02, HAL_QSPI_STATE_BUSY_INDIRECT_TX = 0x12, HAL_QSPI_STATE_BUSY_INDIRECT_RX = 0x22, HAL_QSPI_STATE_ABORT = 0x08, HAL_QSPI_STATE_ERROR = 0x04 }
| HAL QSPI State Enumerations definition. More...

## Functions
hal_status_t | hal_qspi_init (qspi_handle_t *p_qspi)
| Initialize the QSPI according to the specified parameters in the qspi_init_t and initialize the associated handle. More...
hal_status_t | hal_qspi_deinit (qspi_handle_t *p_qspi)
| De-initialize the QSPI peripheral. More...
void | hal_qspi_msp_init (qspi_handle_t *p_qspi)
| Initialize the QSPI MSP. More...
void | hal_qspi_msp_deinit (qspi_handle_t *p_qspi)
| De-initialize the QSPI MSP. More...
hal_status_t | hal_qspi_command_transmit (qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data, uint32_t timeout)
| Transmit an amount of data with the specified instruction and address in blocking mode. More...
hal_status_t | hal_qspi_command_receive (qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data, uint32_t timeout)
| Receive an amount of data with the specified instruction, address and dummy cycles in blocking mode. More...
hal_status_t | hal_qspi_command (qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint32_t timeout)
| Transmit only instruction in blocking mode. More...
hal_status_t | hal_qspi_transmit (qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length, uint32_t timeout)
| Transmit an amount of data in blocking mode with standard SPI. More...
hal_status_t | hal_qspi_receive (qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length, uint32_t timeout)
| Receive an amount of data in blocking mode with standard SPI. More...
hal_status_t | hal_qspi_command_transmit_it (qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data)
| Transmit an amount of data with the specified instruction and address in non-blocking mode with Interrupt. More...
hal_status_t | hal_qspi_command_receive_it (qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data)
| Receive an amount of data with the specified instruction, address and dummy cycles in non-blocking mode with Interrupt. More...
hal_status_t | hal_qspi_command_it (qspi_handle_t *p_qspi, qspi_command_t *p_cmd)
| Transmit instruction in non-blocking mode with Interrupt. More...
hal_status_t | hal_qspi_transmit_it (qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length)
| Transmit an amount of data in non-blocking mode at standard SPI with Interrupt. More...
hal_status_t | hal_qspi_receive_it (qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length)
| Receive an amount of data in non-blocking mode at standard SPI with Interrupt. More...
hal_status_t | hal_qspi_command_transmit_dma (qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data)
| Transmit an amount of data with the specified instruction and address in non-blocking mode with DMA . More...
hal_status_t | hal_qspi_command_receive_dma (qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data)
| Receive an amount of data with the specified instruction, address and dummy cycles in non-blocking mode with DMA . More...
hal_status_t | hal_qspi_command_dma (qspi_handle_t *p_qspi, qspi_command_t *p_cmd)
| Transmit instruction in non-blocking mode with DMA. More...
hal_status_t | hal_qspi_transmit_dma (qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length)
| Transmit an amount of data in non-blocking mode at standard SPI with DMA. More...
hal_status_t | hal_qspi_receive_dma (qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length)
| Receive an amount of data in non-blocking mode at standard SPI with DMA. More...
hal_status_t | hal_qspi_abort (qspi_handle_t *p_qspi)
| Abort the current transmission. More...
hal_status_t | hal_qspi_abort_it (qspi_handle_t *p_qspi)
| Abort the current transmission (non-blocking function) More...
void | hal_qspi_irq_handler (qspi_handle_t *p_qspi)
| Handle QSPI interrupt request. More...
void | hal_qspi_tx_cplt_callback (qspi_handle_t *p_qspi)
| Tx Transfer completed callback. More...
void | hal_qspi_rx_cplt_callback (qspi_handle_t *p_qspi)
| Rx Transfer completed callback. More...
void | hal_qspi_error_callback (qspi_handle_t *p_qspi)
| QSPI error callback. More...
void | hal_qspi_abort_cplt_callback (qspi_handle_t *p_qspi)
| QSPI Abort Complete callback. More...
void | hal_qspi_fifo_threshold_callback (qspi_handle_t *p_qspi)
| FIFO Threshold callback. More...
hal_qspi_state_t | hal_qspi_get_state (qspi_handle_t *p_qspi)
| Return the QSPI handle state. More...
uint32_t | hal_qspi_get_error (qspi_handle_t *p_qspi)
| Return the QSPI error code. More...
void | hal_qspi_set_timeout (qspi_handle_t *p_qspi, uint32_t timeout)
| Set the QSPI internal process timeout value. More...
hal_status_t | hal_qspi_set_tx_fifo_threshold (qspi_handle_t *p_qspi, uint32_t threshold)
| Set the TX FIFO threshold. More...
hal_status_t | hal_qspi_set_rx_fifo_threshold (qspi_handle_t *p_qspi, uint32_t threshold)
| Set the RX FIFO threshold. More...
uint32_t | hal_qspi_get_tx_fifo_threshold (qspi_handle_t *p_qspi)
| Get the TX FIFO threshold. More...
uint32_t | hal_qspi_get_rx_fifo_threshold (qspi_handle_t *p_qspi)
| Get the RX FIFO threshold. More...
hal_status_t | hal_qspi_suspend_reg (qspi_handle_t *p_qspi)
| Suspend some registers related to QSPI configuration before sleep. More...
hal_status_t | hal_qspi_resume_reg (qspi_handle_t *p_qspi)
| Restore some registers related to QSPI configuration after sleep. More...

## Detailed Description

Header file containing functions prototypes of QSPI HAL library.

Author
  BLE Driver Team

Attention

  ##### Copyright (c) 2019 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file gr55xx_hal_qspi.h.