app_qspi_dma.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file app_qspi_dma.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of QSPI app library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup PERIPHERAL Peripheral Driver
39 * @{
40 */
41
42 /** @addtogroup APP_DRIVER APP DRIVER
43 * @{
44 */
45
46 /** @defgroup APP_QSPI QSPI
47 * @brief QSPI APP module driver.
48 * @{
49 */
50
51
52 #ifndef __APP_QSPI_DMA_H__
53 #define __APP_QSPI_DMA_H__
54
55 #include <stdbool.h>
56 #include "grx_hal.h"
57 #include "app_io.h"
58 #include "app_qspi.h"
59 #include "app_drv_error.h"
60 #include "app_drv_config.h"
61 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)
62 #include "app_qspi_user_config.h"
63 #endif
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67
68 #ifdef HAL_QSPI_MODULE_ENABLED
69
70 /* Exported functions --------------------------------------------------------*/
71 /** @addtogroup HAL_APP_QSPI_DRIVER_FUNCTIONS Functions
72 * @{
73 */
74 /**
75 ****************************************************************************************
76 * @brief Initialize the APP QSPI DRIVER according to the specified parameters
77 * in the app_qspi_params_t and app_qspi_evt_handler_t.
78 * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode
79 * is set, you can't use interrupt mode.
80 *
81 * @param[in] p_params: Pointer to app_qspi_params_t parameter which contains the
82 * configuration information for the specified QSPI module.
83 *
84 * @return Result of initialization.
85 ****************************************************************************************
86 */
87 uint16_t app_qspi_dma_init(app_qspi_params_t *p_params);
88
89 /**
90 ****************************************************************************************
91 * @brief De-initialize the APP QSPI DRIVER peripheral.
92 *
93 * @param[in] id: De-initialize for a specific ID.
94 *
95 * @return Result of De-initialization.
96 ****************************************************************************************
97 */
98 uint16_t app_qspi_dma_deinit(app_qspi_id_t id);
99
100 /**
101 ****************************************************************************************
102 * @brief Receive an amount of data with the specified instruction, address and dummy cycles in non-blocking mode with Interrupt.
103 * @note This function is used only in Indirect Read Mode.
104 * @param[in] id: which QSPI module want to receive.
105 * @param[in] p_cmd: Pointer to a app_qspi_command_t structure that contains the instruction and address for data transfer.
106 * @param[out] p_data: Pointer to data buffer
107 *
108 * @return Result of operation.
109 ****************************************************************************************
110 */
111 uint16_t app_qspi_dma_command_receive_async(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint8_t *p_data);
112
113 /**
114 ****************************************************************************************
115 * @brief Receive an amount of data with the specified instruction, address and dummy cycles in non-blocking mode with Interrupt.
116 * @note This function is used only in Indirect Read Mode.
117 * @param[in] id: which QSPI module want to transmit.
118 * @param[in] p_cmd: Pointer to a app_qspi_command_t structure that contains the instruction and address for data transfer.
119 * @param[out] p_data: Pointer to data buffer
120 *
121 * @return Result of operation.
122 ****************************************************************************************
123 */
124 uint16_t app_qspi_dma_command_transmit_async(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint8_t *p_data);
125
126 /**
127 ****************************************************************************************
128 * @brief Transmit instruction in non-blocking mode with Interrupt.
129 * @note This function is used only in Indirect Write Mode.
130 * @param[in] id: which QSPI module want to transmit command.
131 * @param[in] p_cmd: Pointer to a app_qspi_command_t structure that contains the instruction and address for data transfer.
132 *
133 * @return Result of operation.
134 ****************************************************************************************
135 */
136 uint16_t app_qspi_dma_command_async(app_qspi_id_t id, app_qspi_command_t *p_cmd);
137
138 /**
139 ****************************************************************************************
140 * @brief Transmit data without command, support std/dual/quad mode
141 *
142 * @param[in] id : QSPI module ID.
143 * @param[in] qspi_mode : @ref QSPI_DATA_MODE_SPI
144 * @ref QSPI_DATA_MODE_DUALSPI
145 * @ref QSPI_DATA_MODE_QUADSPI
146 * @param[in] data_width :@ref QSPI_DATASIZE_08_BITS
147 * @ref QSPI_DATASIZE_16_BITS
148 * @ref QSPI_DATASIZE_32_BITS
149 * @param[in] p_data : data Pointer to transmit
150 * @param[in] length : byte length of data
151 *
152 * @return true/false
153 ****************************************************************************************
154 */
155 uint16_t app_qspi_dma_transmit_async_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length);
156
157 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X)
158 /**
159 ****************************************************************************************
160 * @brief Transmit an amount of data in non-blocking mode at standard SPI with Interrupt.
161 * @note This function is used only in Indirect Write Mode.
162 * @param[in] id: which QSPI module want to transmit.
163 * @param[in] p_data: Pointer to data buffer
164 * @param[in] length: Amount of data to be sent in bytes
165 *
166 * @return Result of operation.
167 ****************************************************************************************
168 */
169 uint16_t app_qspi_dma_transmit_async(app_qspi_id_t id, uint8_t *p_data, uint32_t length);
170 #endif
171
172 /**
173 ****************************************************************************************
174 * @brief Receive data without command, support std/dual/quad mode
175 *
176 * @param[in] id : QSPI module ID.
177 * @param[in] qspi_mode : @ref QSPI_DATA_MODE_SPI
178 * @ref QSPI_DATA_MODE_DUALSPI
179 * @ref QSPI_DATA_MODE_QUADSPI
180 * @param[in] data_width :@ref QSPI_DATASIZE_08_BITS
181 * @ref QSPI_DATASIZE_16_BITS
182 * @ref QSPI_DATASIZE_32_BITS
183 * @param[in] p_data : data Pointer to transmit
184 * @param[in] length : byte length of data
185 *
186 * @return true/false
187 ****************************************************************************************
188 */
189 uint16_t app_qspi_dma_receive_async_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length);
190
191 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X)
192 /**
193 ****************************************************************************************
194 * @brief Receive an amount of data in non-blocking mode at standard SPI with Interrupt.
195 * @note This function is used only in Indirect Read Mode.
196 * @param[in] id: which QSPI module want to receive.
197 * @param[out] p_data: Pointer to data buffer
198 * @param[in] length: Amount of data to be received in bytes
199 *
200 * @return Result of operation.
201 ****************************************************************************************
202 */
203 uint16_t app_qspi_dma_receive_async(app_qspi_id_t id, uint8_t *p_data, uint32_t length);
204 #endif
205
206 #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X)
207 /**
208 ****************************************************************************************
209 * @brief Transmit an amount of data in QPI mode (Async Mode).
210 * @param[in] id: Which QSPI module want to Transmit.
211 * @param[in] data_width: Just support @ref QSPI_DATASIZE_08_BITS @ref QSPI_DATASIZE_16_BITS @ref QSPI_DATASIZE_32_BITS
212 * @param[in] p_data: Pointer to data buffer
213 * @param[in] length: Amount of data to be transmitted in bytes
214 *
215 * @return Result of operation.
216 ****************************************************************************************
217 */
218 uint16_t app_qspi_dma_transmit_in_qpi_async(app_qspi_id_t id, uint32_t data_width, uint8_t *p_data, uint32_t length);
219 #endif
220
221 /** @} */
222
223 #endif
224
225 #ifdef __cplusplus
226 }
227 #endif
228
229 #endif
230
231 /** @} */
232
233 /** @} */
234
235 /** @} */
app_qspi_dma_receive_async
uint16_t app_qspi_dma_receive_async(app_qspi_id_t id, uint8_t *p_data, uint32_t length)
Receive an amount of data in non-blocking mode at standard SPI with Interrupt.
app_qspi_dma_transmit_async_ex
uint16_t app_qspi_dma_transmit_async_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length)
Transmit data without command, support std/dual/quad mode.
app_qspi_dma_command_async
uint16_t app_qspi_dma_command_async(app_qspi_id_t id, app_qspi_command_t *p_cmd)
Transmit instruction in non-blocking mode with Interrupt.
app_qspi_dma_deinit
uint16_t app_qspi_dma_deinit(app_qspi_id_t id)
De-initialize the APP QSPI DRIVER peripheral.
_qspi_command_t
QSPI command Structure definition.
Definition: gr55xx_hal_qspi.h:166
app_qspi_dma_transmit_in_qpi_async
uint16_t app_qspi_dma_transmit_in_qpi_async(app_qspi_id_t id, uint32_t data_width, uint8_t *p_data, uint32_t length)
Transmit an amount of data in QPI mode (Async Mode).
app_qspi_dma_command_transmit_async
uint16_t app_qspi_dma_command_transmit_async(app_qspi_id_t id, app_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 mo...
app_qspi_id_t
app_qspi_id_t
QSPI module Enumerations definition.
Definition: app_qspi.h:155
app_io.h
Header file containing functions prototypes of GPIO app library.
app_qspi_user_config.h
grx_hal.h
This file contains all the functions prototypes for the HAL module driver.
app_qspi_dma_transmit_async
uint16_t app_qspi_dma_transmit_async(app_qspi_id_t id, uint8_t *p_data, uint32_t length)
Transmit an amount of data in non-blocking mode at standard SPI with Interrupt.
app_qspi.h
Header file containing functions prototypes of QSPI app library.
app_qspi_dma_init
uint16_t app_qspi_dma_init(app_qspi_params_t *p_params)
Initialize the APP QSPI DRIVER according to the specified parameters in the app_qspi_params_t and app...
app_drv_error.h
Header file of app driver error code.
app_drv_config.h
Header file of app driver config code.
app_qspi_dma_command_receive_async
uint16_t app_qspi_dma_command_receive_async(app_qspi_id_t id, app_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 mo...
app_qspi_dma_receive_async_ex
uint16_t app_qspi_dma_receive_async_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length)
Receive data without command, support std/dual/quad mode.
app_qspi_params_t
QSPI parameters structure definition.
Definition: app_qspi.h:581