Data Structures | 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"`

Go to the source code of this file.

## Data Structures
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)
#define | HAL_QSPI_ERROR_TIMEOUT ((uint32_t)0x00000001)
#define | HAL_QSPI_ERROR_TRANSFER ((uint32_t)0x00000002)
#define | HAL_QSPI_ERROR_DMA ((uint32_t)0x00000004)
#define | HAL_QSPI_ERROR_INVALID_PARAM ((uint32_t)0x00000008)
#define | QSPI_CLOCK_MODE_0 (LL_SSI_SCPOL_LOW | LL_SSI_SCPHA_1EDGE)
#define | QSPI_CLOCK_MODE_1 (LL_SSI_SCPOL_LOW | LL_SSI_SCPHA_2EDGE)
#define | QSPI_CLOCK_MODE_2 (LL_SSI_SCPOL_HIGH | LL_SSI_SCPHA_1EDGE)
#define | QSPI_CLOCK_MODE_3 (LL_SSI_SCPOL_HIGH | LL_SSI_SCPHA_2EDGE)
#define | QSPI_DATA_MODE_SPI LL_SSI_FRF_SPI
#define | QSPI_DATA_MODE_DUALSPI LL_SSI_FRF_DUALSPI
#define | QSPI_DATA_MODE_QUADSPI LL_SSI_FRF_QUADSPI
#define | QSPI_INSTSIZE_00_BITS LL_SSI_INSTSIZE_0BIT
#define | QSPI_INSTSIZE_04_BITS LL_SSI_INSTSIZE_4BIT
#define | QSPI_INSTSIZE_08_BITS LL_SSI_INSTSIZE_8BIT
#define | QSPI_INSTSIZE_16_BITS LL_SSI_INSTSIZE_16BIT
#define | QSPI_ADDRSIZE_00_BITS LL_SSI_ADDRSIZE_0BIT
#define | QSPI_ADDRSIZE_04_BITS LL_SSI_ADDRSIZE_4BIT
#define | QSPI_ADDRSIZE_08_BITS LL_SSI_ADDRSIZE_8BIT
#define | QSPI_ADDRSIZE_12_BITS LL_SSI_ADDRSIZE_12BIT
#define | QSPI_ADDRSIZE_16_BITS LL_SSI_ADDRSIZE_16BIT
#define | QSPI_ADDRSIZE_20_BITS LL_SSI_ADDRSIZE_20BIT
#define | QSPI_ADDRSIZE_24_BITS LL_SSI_ADDRSIZE_24BIT
#define | QSPI_ADDRSIZE_28_BITS LL_SSI_ADDRSIZE_28BIT
#define | QSPI_ADDRSIZE_32_BITS LL_SSI_ADDRSIZE_32BIT
#define | QSPI_DATASIZE_04_BITS LL_SSI_DATASIZE_4BIT
#define | QSPI_DATASIZE_05_BITS LL_SSI_DATASIZE_5BIT
#define | QSPI_DATASIZE_06_BITS LL_SSI_DATASIZE_6BIT
#define | QSPI_DATASIZE_07_BITS LL_SSI_DATASIZE_7BIT
#define | QSPI_DATASIZE_08_BITS LL_SSI_DATASIZE_8BIT
#define | QSPI_DATASIZE_09_BITS LL_SSI_DATASIZE_9BIT
#define | QSPI_DATASIZE_10_BITS LL_SSI_DATASIZE_10BIT
#define | QSPI_DATASIZE_11_BITS LL_SSI_DATASIZE_11BIT
#define | QSPI_DATASIZE_12_BITS LL_SSI_DATASIZE_12BIT
#define | QSPI_DATASIZE_13_BITS LL_SSI_DATASIZE_13BIT
#define | QSPI_DATASIZE_14_BITS LL_SSI_DATASIZE_14BIT
#define | QSPI_DATASIZE_15_BITS LL_SSI_DATASIZE_15BIT
#define | QSPI_DATASIZE_16_BITS LL_SSI_DATASIZE_16BIT
#define | QSPI_DATASIZE_17_BITS LL_SSI_DATASIZE_17BIT
#define | QSPI_DATASIZE_18_BITS LL_SSI_DATASIZE_18BIT
#define | QSPI_DATASIZE_19_BITS LL_SSI_DATASIZE_19BIT
#define | QSPI_DATASIZE_20_BITS LL_SSI_DATASIZE_20BIT
#define | QSPI_DATASIZE_21_BITS LL_SSI_DATASIZE_21BIT
#define | QSPI_DATASIZE_22_BITS LL_SSI_DATASIZE_22BIT
#define | QSPI_DATASIZE_23_BITS LL_SSI_DATASIZE_23BIT
#define | QSPI_DATASIZE_24_BITS LL_SSI_DATASIZE_24BIT
#define | QSPI_DATASIZE_25_BITS LL_SSI_DATASIZE_25BIT
#define | QSPI_DATASIZE_26_BITS LL_SSI_DATASIZE_26BIT
#define | QSPI_DATASIZE_27_BITS LL_SSI_DATASIZE_27BIT
#define | QSPI_DATASIZE_28_BITS LL_SSI_DATASIZE_28BIT
#define | QSPI_DATASIZE_29_BITS LL_SSI_DATASIZE_29BIT
#define | QSPI_DATASIZE_30_BITS LL_SSI_DATASIZE_30BIT
#define | QSPI_DATASIZE_31_BITS LL_SSI_DATASIZE_31BIT
#define | QSPI_DATASIZE_32_BITS LL_SSI_DATASIZE_32BIT
#define | QSPI_INST_ADDR_ALL_IN_SPI LL_SSI_INST_ADDR_ALL_IN_SPI
#define | QSPI_INST_IN_SPI_ADDR_IN_SPIFRF LL_SSI_INST_IN_SPI_ADDR_IN_SPIFRF
#define | QSPI_INST_ADDR_ALL_IN_SPIFRF LL_SSI_INST_ADDR_ALL_IN_SPIFRF
#define | QSPI_FLAG_DCOL LL_SSI_SR_DCOL
#define | QSPI_FLAG_TXE LL_SSI_SR_TXE
#define | QSPI_FLAG_RFF LL_SSI_SR_RFF
#define | QSPI_FLAG_RFNE LL_SSI_SR_RFNE
#define | QSPI_FLAG_TFE LL_SSI_SR_TFE
#define | QSPI_FLAG_TFNF LL_SSI_SR_TFNF
#define | QSPI_FLAG_BUSY LL_SSI_SR_BUSY
#define | QSPI_IT_MST LL_SSI_IS_MST
#define | QSPI_IT_RXF LL_SSI_IS_RXF
#define | QSPI_IT_RXO LL_SSI_IS_RXO
#define | QSPI_IT_RXU LL_SSI_IS_RXU
#define | QSPI_IT_TXO LL_SSI_IS_TXO
#define | QSPI_IT_TXE LL_SSI_IS_TXE
#define | HAL_QSPI_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000)
#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.
typedef struct _qspi_handle | qspi_handle_t
| QSPI handle Structure definition.
typedef struct _qspi_command_t | qspi_command_t
| QSPI command Structure definition.
typedef struct _hal_qspi_callback | hal_qspi_callback_t
| HAL_QSPI Callback function definition.

## 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. This function must be used in conjunction with the hal_qspi_suspend_reg(). 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.