gr55xx_hal_dspi.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file gr55xx_hal_dspi.h
5  * @author BLE Driver Team
6  * @brief Header file containing functions prototypes of DSPI HAL 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 HAL_DRIVER HAL Driver
43  * @{
44  */
45 
46 /** @defgroup HAL_DSPI DSPI
47  * @brief DSPI HAL module driver.
48  * @{
49  */
50 
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55xx_HAL_DSPI_H__
53 #define __GR55xx_HAL_DSPI_H__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx_ll_dspi.h"
61 #include "gr55xx_hal_def.h"
62 #include "gr55xx_hal_pwr_mgmt.h"
63 
64 /* Exported types ------------------------------------------------------------*/
65 /** @addtogroup HAL_DSPI_ENUMERATIONS Enumerations
66  * @{
67  */
68 
69 /**
70  * @brief HAL DSPI State Enumerations definition
71  */
72 typedef enum
73 {
74  HAL_DSPI_STATE_RESET = 0x00, /**< Peripheral not initialized */
75  HAL_DSPI_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */
76  HAL_DSPI_STATE_BUSY = 0x02, /**< Peripheral in indirect mode and busy */
77  HAL_DSPI_STATE_BUSY_INDIRECT_TX = 0x12, /**< Peripheral in indirect mode with transmission ongoing */
78  HAL_DSPI_STATE_ABORT = 0x08, /**< Peripheral with abort request ongoing */
79  HAL_DSPI_STATE_ERROR = 0x04 /**< Peripheral in error */
81 
82 /** @} */
83 
84 /** @addtogroup HAL_DSPI_STRUCTURES Structures
85  * @{
86  */
87 
88 /** @defgroup DSPI_Configuration DSPI Configuration
89  * @{
90  */
91 
92 /**
93  * @brief QSPI init Structure definition
94  */
95 typedef struct _dspi_init_t
96 {
97  uint32_t data_size; /**< Specifies the DSPI data width.
98  This parameter can be a value of @ref QSPI_Data_Size Data Width.*/
99 
100  uint32_t baud_rate; /**< Specifies the BaudRate prescaler value which will be used to configure the transmit and receive SCK clock.
101  This parameter can be one even value between 0 and 7 @ref DSPI_Clock_Sel Clock Select.*/
102 
103  uint32_t dspi_mode; /**< Specifies the DSPI interface mode.
104  This parameter can be a value of @ref DSPI_Interface_Mode DSPI Interface Mode.*/
106 
107 /** @} */
108 
109 /** @defgroup DSPI_handle DSPI handle
110  * @{
111  */
112 
113 /**
114  * @brief DSPI handle Structure definition
115  */
116 typedef struct _dspi_handle
117 {
118  dspi_regs_t *p_instance; /**< DSPI registers base address */
119 
120  dspi_init_t init; /**< DSPI communication parameters */
121 
122  uint8_t *p_tx_buffer; /**< Pointer to DSPI Tx transfer Buffer */
123 
124  __IO uint32_t tx_xfer_size; /**< DSPI Tx Transfer size */
125 
126  __IO uint32_t tx_xfer_count; /**< DSPI Tx Transfer Counter */
127 
128  void (*write_fifo)(struct _dspi_handle *p_dspi); /**< Pointer to DSPI Tx transfer FIFO write function */
129 
130  dma_handle_t *p_dmatx; /**< DSPI Tx DMA Handle parameters */
131 
132  __IO hal_lock_t lock; /**< Locking object */
133 
134  __IO hal_dspi_state_t state; /**< DSPI communication state */
135 
136  __IO uint32_t error_code; /**< DSPI Error code */
137 
138  uint32_t timeout; /**< Timeout for the DSPI memory access */
139 
140  periph_device_number_t dspi_number; /**< DSPI used for Sleep management */
141 
142  uint32_t retention[3]; /**< DSPI important register information. */
144 /** @} */
145 
146 /** @defgroup DSPI_Command DSPI command
147  * @{
148  */
149 
150 /**
151  * @brief DSPI command Structure definition
152  */
153 typedef struct _dspi_command_t
154 {
155  uint32_t instruction; /**< Specifies the Instruction to be sent.
156  This parameter can be a value (8-bit, 16bit, 32 bit). */
157 
158  uint32_t instruction_size; /**< Specifies the Instruction Size.
159  This parameter can be a value of @ref DSPI_Instruction_Size. */
160 
161  uint32_t data_size; /**< Specifies the DSPI data width.
162  This parameter can be a value of @ref QSPI_Data_Size. */
163 
164  uint32_t length; /**< Specifies the number of data to transfer. (This is the number of bytes).
165  This parameter can be any value between 0 and 0xFFFFFFFF (0 means undefined length
166  until end of memory). */
167 
169 /** @} */
170 
171 /** @} */
172 
173 /** @addtogroup HAL_DSPI_CALLBACK_STRUCTURES Callback Structures
174  * @{
175  */
176 
177 /**
178  * @brief HAL_DSPI Callback function definition
179  */
180 
181 typedef struct _dspi_callback
182 {
183  void (*dspi_msp_init)(dspi_handle_t *p_dspi); /**< DSPI init MSP callback */
184  void (*dspi_msp_deinit)(dspi_handle_t *p_dspi); /**< DSPI de-init MSP callback */
185  void (*dspi_abort_callback)(dspi_handle_t *p_dspi); /**< DSPI abort callback */
186  void (*dspi_error_callback)(dspi_handle_t *p_dspi); /**< DSPI error callback */
187  void (*dspi_tx_cplt_callback)(dspi_handle_t *p_dspi); /**< DSPI tx transfer completed callback */
189 
190 /** @} */
191 
192 /**
193  * @defgroup HAL_DSPI_MACRO Defines
194  * @{
195  */
196 
197 /* Exported constants --------------------------------------------------------*/
198 /** @defgroup DSPI_Exported_Constants DSPI Exported Constants
199  * @{
200  */
201 
202 /** @defgroup DSPI_Error_Code DSPI Error Code
203  * @{
204  */
205 #define HAL_DSPI_ERROR_NONE ((uint32_t)0x00000000) /**< No error */
206 #define HAL_DSPI_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */
207 #define HAL_DSPI_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */
208 #define HAL_DSPI_ERROR_DMA ((uint32_t)0x00000004) /**< DMA transfer error */
209 #define HAL_DSPI_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameter error */
210 /** @} */
211 
212 /** @defgroup DSPI_Clock_Sel Clock Select
213  * @{
214  */
215 #define DSPI_BAUD_RATE_2P1PCLK LL_DSPI_BAUD_RATE_2P1PCLK /**< DSPI Baud rate fPCLK / 2 */
216 #define DSPI_BAUD_RATE_4P1PCLK LL_DSPI_BAUD_RATE_4P1PCLK /**< DSPI Baud rate fPCLK / 4 */
217 #define DSPI_BAUD_RATE_8P1PCLK LL_DSPI_BAUD_RATE_8P1PCLK /**< DSPI Baud rate fPCLK / 8 */
218 #define DSPI_BAUD_RATE_16P1PCLK LL_DSPI_BAUD_RATE_16P1PCLK /**< DSPI Baud rate fPCLK / 16 */
219 #define DSPI_BAUD_RATE_32P1PCLK LL_DSPI_BAUD_RATE_32P1PCLK /**< DSPI Baud rate fPCLK / 32 */
220 #define DSPI_BAUD_RATE_64P1PCLK LL_DSPI_BAUD_RATE_64P1PCLK /**< DSPI Baud rate fPCLK / 64 */
221 #define DSPI_BAUD_RATE_128P1PCLK LL_DSPI_BAUD_RATE_128P1PCLK /**< DSPI Baud rate fPCLK / 128 */
222 #define DSPI_BAUD_RATE_256P1PCLK LL_DSPI_BAUD_RATE_256PCLK /**< DSPI Baud rate fPCLK / 256 */
223 
224 /** @} */
225 
226 /** @defgroup DSPI_Interface_Mode DSPI Interface mode
227  * @{
228  */
229 #define DSPI_PROT_MODE_3W1L LL_DSPI_PROT_MODE_3W1L /**< DSPI 3-Wire 1-Lane Interface */
230 #define DSPI_PROT_MODE_4W1L LL_DSPI_PROT_MODE_4W1L /**< DSPI 4-Wire 1-Lane Interface */
231 #define DSPI_PROT_MODE_4W2L LL_DSPI_PROT_MODE_4W2L /**< DSPI 4-Wire 2-Lane Interface */
232 /** @} */
233 
234 /** @defgroup DSPI_Instruction_Size DSPI Instruction Size
235  * @{
236  */
237 #define DSPI_INSTSIZE_08_BITS ((uint32_t)0x01) /**< 8-bit Instruction */
238 #define DSPI_INSTSIZE_16_BITS ((uint32_t)0x02) /**< 16-bit Instruction */
239 #define DSPI_INSTSIZE_32_BITS ((uint32_t)0x03) /**< 32-bit Instruction */
240 /** @} */
241 
242 /** @defgroup DSPI_Data_Size Data Width
243  * @{
244  */
245 #define DSPI_DATASIZE_04_BITS LL_DSPI_DATASIZE_4BIT /**< Data length for DSPI transfer: 4 bits */
246 #define DSPI_DATASIZE_05_BITS LL_DSPI_DATASIZE_5BIT /**< Data length for DSPI transfer: 5 bits */
247 #define DSPI_DATASIZE_06_BITS LL_DSPI_DATASIZE_6BIT /**< Data length for DSPI transfer: 6 bits */
248 #define DSPI_DATASIZE_07_BITS LL_DSPI_DATASIZE_7BIT /**< Data length for DSPI transfer: 7 bits */
249 #define DSPI_DATASIZE_08_BITS LL_DSPI_DATASIZE_8BIT /**< Data length for DSPI transfer: 8 bits */
250 #define DSPI_DATASIZE_09_BITS LL_DSPI_DATASIZE_9BIT /**< Data length for DSPI transfer: 9 bits */
251 #define DSPI_DATASIZE_10_BITS LL_DSPI_DATASIZE_10BIT /**< Data length for DSPI transfer: 10 bits */
252 #define DSPI_DATASIZE_11_BITS LL_DSPI_DATASIZE_11BIT /**< Data length for DSPI transfer: 11 bits */
253 #define DSPI_DATASIZE_12_BITS LL_DSPI_DATASIZE_12BIT /**< Data length for DSPI transfer: 12 bits */
254 #define DSPI_DATASIZE_13_BITS LL_DSPI_DATASIZE_13BIT /**< Data length for DSPI transfer: 13 bits */
255 #define DSPI_DATASIZE_14_BITS LL_DSPI_DATASIZE_14BIT /**< Data length for DSPI transfer: 14 bits */
256 #define DSPI_DATASIZE_15_BITS LL_DSPI_DATASIZE_15BIT /**< Data length for DSPI transfer: 15 bits */
257 #define DSPI_DATASIZE_16_BITS LL_DSPI_DATASIZE_16BIT /**< Data length for DSPI transfer: 16 bits */
258 #define DSPI_DATASIZE_17_BITS LL_DSPI_DATASIZE_17BIT /**< Data length for DSPI transfer: 17 bits */
259 #define DSPI_DATASIZE_18_BITS LL_DSPI_DATASIZE_18BIT /**< Data length for DSPI transfer: 18 bits */
260 #define DSPI_DATASIZE_19_BITS LL_DSPI_DATASIZE_19BIT /**< Data length for DSPI transfer: 19 bits */
261 #define DSPI_DATASIZE_20_BITS LL_DSPI_DATASIZE_20BIT /**< Data length for DSPI transfer: 20 bits */
262 #define DSPI_DATASIZE_21_BITS LL_DSPI_DATASIZE_21BIT /**< Data length for DSPI transfer: 21 bits */
263 #define DSPI_DATASIZE_22_BITS LL_DSPI_DATASIZE_22BIT /**< Data length for DSPI transfer: 22 bits */
264 #define DSPI_DATASIZE_23_BITS LL_DSPI_DATASIZE_23BIT /**< Data length for DSPI transfer: 23 bits */
265 #define DSPI_DATASIZE_24_BITS LL_DSPI_DATASIZE_24BIT /**< Data length for DSPI transfer: 24 bits */
266 #define DSPI_DATASIZE_25_BITS LL_DSPI_DATASIZE_25BIT /**< Data length for DSPI transfer: 25 bits */
267 #define DSPI_DATASIZE_26_BITS LL_DSPI_DATASIZE_26BIT /**< Data length for DSPI transfer: 26 bits */
268 #define DSPI_DATASIZE_27_BITS LL_DSPI_DATASIZE_27BIT /**< Data length for DSPI transfer: 27 bits */
269 #define DSPI_DATASIZE_28_BITS LL_DSPI_DATASIZE_28BIT /**< Data length for DSPI transfer: 28 bits */
270 #define DSPI_DATASIZE_29_BITS LL_DSPI_DATASIZE_29BIT /**< Data length for DSPI transfer: 29 bits */
271 #define DSPI_DATASIZE_30_BITS LL_DSPI_DATASIZE_30BIT /**< Data length for DSPI transfer: 30 bits */
272 #define DSPI_DATASIZE_31_BITS LL_DSPI_DATASIZE_31BIT /**< Data length for DSPI transfer: 31 bits */
273 #define DSPI_DATASIZE_32_BITS LL_DSPI_DATASIZE_32BIT /**< Data length for DSPI transfer: 32 bits */
274 
275 /** @} */
276 
277 /** @defgroup DSPI_Flags DSPI Flags
278  * @{
279  */
280 #define DSPI_FLAG_FFE LL_DSPI_SR_FFE /**< Frame format error flag */
281 #define DSPI_FLAG_OVR LL_DSPI_SR_OVR /**< Rx overrun flag */
282 #define DSPI_FLAG_MODE LL_DSPI_SR_MODF /**< Mode fault flag */
283 #define DSPI_FLAG_RFNE LL_DSPI_SR_RFNE /**< Rx FIFO not empty flag */
284 #define DSPI_FLAG_TFE LL_DSPI_SR_TFE /**< Tx FIFO empty flag */
285 #define DSPI_FLAG_BUSY LL_DSPI_SR_BUSY /**< Busy flag */
286 /** @} */
287 
288 /** @defgroup DSPI_Interrupts DSPI Interrupts
289  * @{
290  */
291 #define DSPI_IT_RXNE LL_DSPI_IM_RXNE /**< Receive FIFO not empty Interrupt */
292 #define DSPI_IT_ERR LL_DSPI_IM_ER /**< Error Interrupt */
293 #define DSPI_IT_TXE LL_DSPI_IM_TXE /**< Transmit FIFO Empty Interrupt */
294 /** @} */
295 
296 /** @defgroup DSPI_RX_FIFO_Threshold DSPI rx FIFO threshold
297  * @{
298  */
299 #define DSPI_RX_FIFO_TH_1P2 LL_DSPI_FRXTH_1P2 /**< FIFO level is 1/2 (8 bytes) */
300 #define DSPI_RX_FIFO_TH_1P4 LL_DSPI_FRXTH_1P4 /**< FIFO level is 1/4 (4 bytes) */
301 #define DSPI_RX_FIFO_TH_1P8 LL_DSPI_FRXTH_1P8 /**< FIFO level is 1/8 (2 bytes) */
302 #define DSPI_RX_FIFO_TH_1P16 LL_DSPI_FRXTH_1P16 /**< FIFO level is 1/16 (1 bytes) */
303 /** @} */
304 
305 
306 /** @defgroup DSPI_Data_mode DSPI Data mode
307  * @{
308  */
309 #define DSPI_TRANSPORT_DATA LL_DSPI_DCX_DATA /**< Transport data */
310 #define DSPI_TRANSPORT_CMD LL_DSPI_DCX_CMD /**< Transport cmd */
311 /** @} */
312 
313 
314 /** @defgroup DSPI_Timeout_definition DSPI Timeout_definition
315  * @{
316  */
317 #define HAL_DSPI_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000) /**< 5s */
318 /** @} */
319 
320 /** @} */
321 
322 /* Exported macro ------------------------------------------------------------*/
323 /** @defgroup DSPI_Exported_Macros DSPI Exported Macros
324  * @{
325  */
326 
327 /** @brief Reset DSPI handle states.
328  * @param __HANDLE__ DPI handle.
329  * @retval None
330  */
331 #define __HAL_DSPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_DSPI_STATE_RESET)
332 
333 /** @brief Enable the specified DSPI peripheral.
334  * @param __HANDLE__ Specifies the DSPI Handle.
335  * @retval None
336  */
337 #define __HAL_DSPI_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL1, DSPI_CR1_EN)
338 
339 /** @brief Disable the specified DSPI peripheral.
340  * @param __HANDLE__ Specifies the DSPI Handle.
341  * @retval None
342  */
343 #define __HAL_DSPI_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL1, DSPI_CR1_EN)
344 
345 /** @brief Enable the DSPI DMA TX Request.
346  * @param __HANDLE__ Specifies the DSPI Handle.
347  * @retval None
348  */
349 #define __HAL_DSPI_ENABLE_DMATX(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL2, DSPI_CR2_TXDMAEN)
350 
351 /** @brief Enable the DSPI DMA RX Request.
352  * @param __HANDLE__ Specifies the DSPI Handle.
353  * @retval None
354  */
355 #define __HAL_DSPI_ENABLE_DMARX(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL2, DSPI_CR2_RXDMAEN)
356 
357 /** @brief Disable the DSPI DMA TX Request.
358  * @param __HANDLE__ Specifies the DSPI Handle.
359  * @retval None
360  */
361 #define __HAL_DSPI_DISABLE_DMATX(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL2, DSPI_CR2_TXDMAEN)
362 
363 /** @brief Disable the DSPI DMA RX Request.
364  * @param __HANDLE__ Specifies the DSPI Handle.
365  * @retval None
366  */
367 #define __HAL_DSPI_DISABLE_DMARX(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL2, DSPI_CR2_RXDMAEN)
368 
369 /** @brief Enable the specified DSPI interrupts.
370  * @param __HANDLE__ Specifies the DSPI Handle.
371  * @param __INTERRUPT__ Specifies the interrupt source to enable.
372  * This parameter can be one of the following values:
373  * @arg @ref DSPI_IT_RXNE Receive FIFO not empty Interrupt enable
374  * @arg @ref DSPI_IT_TXE Transmit FIFO Empty Interrupt enable
375  * @arg @ref DSPI_IT_ERR Error Interrupt Interrupt enable
376  * @retval None
377  */
378 #define __HAL_DSPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->CTRL2, (__INTERRUPT__))
379 
380 /** @brief Disable the specified DSPI interrupts.
381  * @param __HANDLE__ Specifies the DSPI handle.
382  * @param __INTERRUPT__ Specifies the interrupt source to disable.
383  * This parameter can be one of the following values:
384  * @arg @ref DSPI_IT_RXNE Receive FIFO not empty Interrupt disable
385  * @arg @ref DSPI_IT_TXE Transmit FIFO Empty Interrupt disable
386  * @arg @ref DSPI_IT_ERR Error Interrupt Interrupt disable
387  * @retval None
388  */
389 #define __HAL_DSPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL2, (__INTERRUPT__))
390 
391 /** @brief Check whether the specified DSPI interrupt source is enabled or not.
392  * @param __HANDLE__ Specifies the DSPI Handle.
393  * @param __INTERRUPT__ Specifies the interrupt source to check.
394  * This parameter can be one of the following values:
395  * @arg @ref DSPI_IT_RXNE Receive FIFO not empty Interrupt disable
396  * @arg @ref DSPI_IT_TXE Transmit FIFO Empty Interrupt disable
397  * @arg @ref DSPI_IT_ERR Error Interrupt Interrupt disable
398  * @retval The new state of __IT__ (TRUE or FALSE).
399  */
400 #define __HAL_DSPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (READ_BITS((__HANDLE__)->p_instance->CTRL2, (__INTERRUPT__)) == (__INTERRUPT__))
401 
402 /** @brief Check whether the specified DSPI flag is set or not.
403  * @param __HANDLE__ Specifies the DSPI Handle.
404  * @param __FLAG__ Specifies the flag to check.
405  * This parameter can be one of the following values:
406  * @arg @ref DSPI_FLAG_FFE Frame format error flag
407  * @arg @ref DSPI_FLAG_OVR Rx overrun flag
408  * @arg @ref DSPI_FLAG_MODE spi mode flag
409  * @arg @ref DSPI_FLAG_RFNE Rx FIFO not empty flag
410  * @arg @ref DSPI_FLAG_TFE Tx FIFO empty flag
411  * @arg @ref DSPI_FLAG_BUSY Busy flag
412  * @retval The new state of __FLAG__ (TRUE or FALSE).
413  */
414 #define __HAL_DSPI_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0) ? SET : RESET)
415 
416 /** @brief Flush the DSPI receiver FIFO.
417  * @param __HANDLE__ Specifies the DSPI Handle.
418  * @retval None
419  */
420 #define __HAL_DSPI_FLUSH_FIFO(__HANDLE__) ll_dspi_flush_fifo((__HANDLE__)->p_instance)
421 
422 /** @brief Set the DSPI data transport type.
423  * @param __HANDLE__ Specifies the DSPI Handle.
424  * @param __TYPE__ Specifies the DSPI data transport type.
425  * @retval None
426  */
427 #define __HAL_DSPI_TRANSPORT_TYPE(__HANDLE__, __TYPE__) ll_dspi_set_dcx((__HANDLE__)->p_instance, (__TYPE__))
428 
429 /** @} */
430 
431 /* Private macros ------------------------------------------------------------*/
432 /** @defgroup DSPI_Private_Macro DSPI Private Macros
433  * @{
434  */
435 
436 /** @brief Check if DSPI Clock Prescaler is valid.
437  * @param __PRESCALER__ DSPI Clock Prescaler.
438  * @retval SET (__PRESCALER__ is valid) or RESET (__PRESCALER__ is invalid)
439  */
440 #define IS_DSPI_CLOCK_PRESCALER(__PRESCALER__) (((__PRESCALER__) == DSPI_BAUD_RATE_2P1PCLK) || \
441  ((__PRESCALER__) == DSPI_BAUD_RATE_4P1PCLK) || \
442  ((__PRESCALER__) == DSPI_BAUD_RATE_8P1PCLK) || \
443  ((__PRESCALER__) == DSPI_BAUD_RATE_16P1PCLK) || \
444  ((__PRESCALER__) == DSPI_BAUD_RATE_32P1PCLK) || \
445  ((__PRESCALER__) == DSPI_BAUD_RATE_64P1PCLK) || \
446  ((__PRESCALER__) == DSPI_BAUD_RATE_128P1PCLK) || \
447  ((__PRESCALER__) == DSPI_BAUD_RATE_256P1PCLK))
448 
449 /** @brief Check if DSPI Interface Mode is valid.
450  * @param __INTERFACEMODE__ QSPI Interface Mode.
451  * @retval SET (__INTERFACEMODE__ is valid) or RESET (__INTERFACEMODE__ is invalid)
452  */
453 #define IS_DSPI_INTERFACE_MODE(__INTERFACEMODE__) (((__INTERFACEMODE__) == DSPI_PROT_MODE_3W1L) || \
454  ((__INTERFACEMODE__) == DSPI_PROT_MODE_4W1L) || \
455  ((__INTERFACEMODE__) == DSPI_PROT_MODE_4W2L))
456 
457 /** @brief Check if DSPI Instruction Size is valid.
458  * @param __INST_SIZE__ DSPI Instruction Size.
459  * @retval SET (__INST_SIZE__ is valid) or RESET (__INST_SIZE__ is invalid)
460  */
461 #define IS_DSPI_INSTRUCTION_SIZE(__INST_SIZE__) (((__INST_SIZE__) == DSPI_INSTSIZE_08_BITS) || \
462  ((__INST_SIZE__) == DSPI_INSTSIZE_16_BITS) || \
463  ((__INST_SIZE__) == DSPI_INSTSIZE_32_BITS))
464 
465 /** @} */
466 
467 /** @} */
468 
469 
470 /* Exported functions --------------------------------------------------------*/
471 /** @addtogroup HAL_DSPI_DRIVER_FUNCTIONS Functions
472  * @{
473  */
474 
475 /** @defgroup DSPI_Exported_Functions_Group1 Initialization and de-initialization functions
476  * @brief Initialization and de-initialization functions
477  *
478 @verbatim
479  ===============================================================================
480  ##### Initialization and de-initialization functions #####
481  ===============================================================================
482  [..] This subsection provides a set of functions allowing to initialize and
483  de-initialize the DSPIx peripheral:
484 
485  (+) User must implement hal_dspi_msp_init() function in which he configures
486  all related peripherals resources (GPIO, DMA, IT and NVIC ).
487 
488  (+) Call the function hal_dspi_init() to configure the selected device with
489  the selected configuration:
490  (++) baudrate
491  (++) dspi mode
492 
493  (+) Call the function hal_dspi_deinit() to restore the default configuration
494  of the selected DSPIx peripheral.
495 
496 @endverbatim
497  * @{
498  */
499 
500 /**
501  ****************************************************************************************
502  * @brief Initialize the DSPI according to the specified parameters
503  * in the dspi_init_t and initialize the associated handle.
504  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
505  * @retval ::HAL_OK: Operation is OK.
506  * @retval ::HAL_ERROR: Parameter error or operation not supported.
507  * @retval ::HAL_BUSY: Driver is busy.
508  * @retval ::HAL_TIMEOUT: Timeout occurred.
509  ****************************************************************************************
510  */
512 
513 /**
514  ****************************************************************************************
515  * @brief De-initialize the DSPI peripheral.
516  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
517  * @retval ::HAL_OK: Operation is OK.
518  * @retval ::HAL_ERROR: Parameter error or operation not supported.
519  * @retval ::HAL_BUSY: Driver is busy.
520  * @retval ::HAL_TIMEOUT: Timeout occurred.
521  ****************************************************************************************
522  */
524 
525 /**
526  ****************************************************************************************
527  * @brief Initialize the DSPI MSP.
528  * @note This function should not be modified. When the callback is needed,
529  * the hal_dspi_msp_init can be implemented in the user file.
530  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
531  ****************************************************************************************
532  */
534 
535 /**
536  ****************************************************************************************
537  * @brief De-initialize the DSPI MSP.
538  * @note This function should not be modified. When the callback is needed,
539  * the hal_dspi_msp_deinit can be implemented in the user file.
540  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
541  ****************************************************************************************
542  */
544 
545 /** @} */
546 
547 /** @defgroup DSPI_Exported_Functions_Group2 DSPI operation functions
548  * @brief Data transfers functions
549  *
550 @verbatim
551  ==============================================================================
552  ##### DSPI operation functions #####
553  ===============================================================================
554  [..]
555  This subsection provides a set of functions allowing to manage the DSPI
556  data transfers.
557 
558  [..] The DSPI only supports master:
559 
560  (#) There are two modes of transfer:
561  (++) Blocking mode: The communication is performed in polling mode.
562  The HAL status of all data processing is returned by the same function
563  after finishing transfer.
564  (++) No-Blocking mode: The communication is performed using Interrupts.
565  or DMA, These APIs return the HAL status.
566  The end of the data processing will be indicated through the
567  dedicated DSPI IRQ when using Interrupt mode or the DMA IRQ when
568  using DMA mode.
569  The hal_dspi_tx_cplt_callback() user callbacks
570  will be executed respectively at the end of the transmit or Receive process.
571  The hal_dspi_error_callback() user callback will be executed when a communication error is detected
572 
573  (#) APIs provided for these 2 transfer modes (Blocking mode or Non blocking mode using either Interrupt or DMA)
574  exist for 1 Line (simplex) and 2 Lines (full duplex) modes.
575 
576 @endverbatim
577  * @{
578  */
579 
580 /**
581  ****************************************************************************************
582  * @brief Transmit an amount of data with the specified instruction in blocking mode.
583  * @note This function is used only in Indirect Write Mode.
584  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
585  * @param[in] p_cmd: Pointer to a dspi_command_t structure that contains the instruction and address for data transfer.
586  * @param[in] p_data: Pointer to data buffer
587  * @param[in] timeout: Timeout duration
588  * @retval ::HAL_OK: Operation is OK.
589  * @retval ::HAL_ERROR: Parameter error or operation not supported.
590  * @retval ::HAL_BUSY: Driver is busy.
591  * @retval ::HAL_TIMEOUT: Timeout occurred.
592  ****************************************************************************************
593  */
594 hal_status_t hal_dspi_command_transmit(dspi_handle_t *p_dspi, dspi_command_t *p_cmd, uint8_t *p_data, uint32_t timeout);
595 
596 /**
597  ****************************************************************************************
598  * @brief Transmit only instruction in blocking mode.
599  * @note This function is used only in Indirect Write Mode.
600  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
601  * @param[in] p_cmd: Pointer to a dspi_command_t structure that contains the instruction and address for data transfer.
602  * @param[in] timeout: Timeout duration
603  * @retval ::HAL_OK: Operation is OK.
604  * @retval ::HAL_ERROR: Parameter error or operation not supported.
605  * @retval ::HAL_BUSY: Driver is busy.
606  * @retval ::HAL_TIMEOUT: Timeout occurred.
607  ****************************************************************************************
608  */
609 hal_status_t hal_dspi_command(dspi_handle_t *p_dspi, dspi_command_t *p_cmd, uint32_t timeout);
610 
611 /**
612  ****************************************************************************************
613  * @brief Transmit an amount of data in blocking mode.
614  * @note This function is used only in Indirect Write Mode.
615  * @param[in] p_qspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
616  * @param[in] p_data: Pointer to data buffer
617  * @param[in] length: Amount of data to be sent in bytes
618  * @param[in] timeout: Timeout duration
619  * @retval ::HAL_OK: Operation is OK.
620  * @retval ::HAL_ERROR: Parameter error or operation not supported.
621  * @retval ::HAL_BUSY: Driver is busy.
622  * @retval ::HAL_TIMEOUT: Timeout occurred.
623  ****************************************************************************************
624  */
625 hal_status_t hal_dspi_transmit(dspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length, uint32_t timeout);
626 
627 /**
628  ****************************************************************************************
629  * @brief Transmit an amount of data with the specified instruction in non-blocking mode with Interrupt.
630  * @note This function is used only in Indirect Write Mode.
631  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
632  * @param[in] p_cmd: Pointer to a dspi_command_t structure that contains the instruction and address for data transfer.
633  * @param[in] p_data: Pointer to data buffer
634  * @retval ::HAL_OK: Operation is OK.
635  * @retval ::HAL_ERROR: Parameter error or operation not supported.
636  * @retval ::HAL_BUSY: Driver is busy.
637  * @retval ::HAL_TIMEOUT: Timeout occurred.
638  ****************************************************************************************
639  */
641 
642 /**
643  ****************************************************************************************
644  * @brief Transmit instruction in non-blocking mode with Interrupt.
645  * @note This function is used only in Indirect Write Mode.
646  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
647  * @param[in] p_cmd: Pointer to a dspi_command_t structure that contains the instruction and address for data transfer.
648  * @retval ::HAL_OK: Operation is OK.
649  * @retval ::HAL_ERROR: Parameter error or operation not supported.
650  * @retval ::HAL_BUSY: Driver is busy.
651  * @retval ::HAL_TIMEOUT: Timeout occurred.
652  ****************************************************************************************
653  */
655 
656 /**
657  ****************************************************************************************
658  * @brief Transmit an amount of data in non-blocking mode with Interrupt.
659  * @note This function is used only in Indirect Write Mode.
660  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
661  * @param[in] p_data: Pointer to data buffer
662  * @param[in] length: Amount of data to be sent in bytes
663  * @retval ::HAL_OK: Operation is OK.
664  * @retval ::HAL_ERROR: Parameter error or operation not supported.
665  * @retval ::HAL_BUSY: Driver is busy.
666  * @retval ::HAL_TIMEOUT: Timeout occurred.
667  ****************************************************************************************
668  */
669 hal_status_t hal_dspi_transmit_it(dspi_handle_t *p_dspi, uint8_t *p_data, uint32_t length);
670 
671 /**
672  ****************************************************************************************
673  * @brief Transmit an amount of data with the specified instruction in non-blocking mode with DMA .
674  * @note This function is used only in Indirect Write Mode.
675  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
676  * @param[in] p_cmd: Pointer to a dspi_command_t structure that contains the instruction and address for data transfer.
677  * @param[in] p_data: Pointer to data buffer
678  * @retval ::HAL_OK: Operation is OK.
679  * @retval ::HAL_ERROR: Parameter error or operation not supported.
680  * @retval ::HAL_BUSY: Driver is busy.
681  * @retval ::HAL_TIMEOUT: Timeout occurred.
682  ****************************************************************************************
683  */
685 
686 /**
687  ****************************************************************************************
688  * @brief Transmit an amount of data with the specified instruction in non-blocking mode with DMA SG or LLP.
689  * @note This function is used only in Indirect Write Mode.
690  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
691  * @param[in] p_cmd: Pointer to a dspi_command_t structure that contains the instruction and address for data transfer.
692  * @param[in] p_data: Pointer to data buffer
693  * @param[in] sg_llp_config: The config of source and destination's SG and LLP.
694  * @retval ::HAL_OK: Operation is OK.
695  * @retval ::HAL_ERROR: Parameter error or operation not supported.
696  * @retval ::HAL_BUSY: Driver is busy.
697  * @retval ::HAL_TIMEOUT: Timeout occurred.
698  ****************************************************************************************
699  */
701  dma_sg_llp_config_t *sg_llp_config);
702 
703 /**
704  ****************************************************************************************
705  * @brief Transmit instruction in non-blocking mode with DMA.
706  * @note This function is used only in Indirect Write Mode.
707  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
708  * @param[in] p_cmd: Pointer to a dspi_command_t structure that contains the instruction and address for data transfer.
709  * @retval ::HAL_OK: Operation is OK.
710  * @retval ::HAL_ERROR: Parameter error or operation not supported.
711  * @retval ::HAL_BUSY: Driver is busy.
712  * @retval ::HAL_TIMEOUT: Timeout occurred.
713  ****************************************************************************************
714  */
716 
717 /**
718  ****************************************************************************************
719  * @brief Transmit an amount of data in non-blocking mode with DMA.
720  * @note This function is used only in Indirect Write Mode.
721  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
722  * @param[in] p_data: Pointer to data buffer
723  * @param[in] length: Amount of data to be sent in bytes, ranging between 0 and 4095.
724  * @retval ::HAL_OK: Operation is OK.
725  * @retval ::HAL_ERROR: Parameter error or operation not supported.
726  * @retval ::HAL_BUSY: Driver is busy.
727  * @retval ::HAL_TIMEOUT: Timeout occurred.
728  ****************************************************************************************
729  */
730 hal_status_t hal_dspi_transmit_dma(dspi_handle_t *p_dspi, uint8_t *p_data, uint32_t length);
731 
732 /**
733  ****************************************************************************************
734  * @brief Transmit an amount of data in non-blocking mode with DMA SG or LLP.
735  * @note This function is used only in Indirect Write Mode.
736  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
737  * @param[in] p_data: Pointer to data buffer
738  * @param[in] length: Amount of data to be sent in bytes, ranging between 0 and 4095.
739  * @param[in] sg_llp_config: The config of source and destination's SG and LLP.
740  * @retval ::HAL_OK: Operation is OK.
741  * @retval ::HAL_ERROR: Parameter error or operation not supported.
742  * @retval ::HAL_BUSY: Driver is busy.
743  * @retval ::HAL_TIMEOUT: Timeout occurred.
744  ****************************************************************************************
745  */
746 hal_status_t hal_dspi_transmit_dma_sg_llp(dspi_handle_t *p_dspi, uint8_t *p_data, uint32_t length,
747  dma_sg_llp_config_t *sg_llp_config);
748 
749 /**
750  ****************************************************************************************
751  * @brief Abort the current transmission.
752  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
753  * @retval ::HAL_OK: Operation is OK.
754  * @retval ::HAL_ERROR: Parameter error or operation not supported.
755  * @retval ::HAL_BUSY: Driver is busy.
756  * @retval ::HAL_TIMEOUT: Timeout occurred.
757  ****************************************************************************************
758  */
760 
761 /**
762  ****************************************************************************************
763  * @brief Abort the current transmission (non-blocking function)
764  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
765  * @retval ::HAL_OK: Operation is OK.
766  * @retval ::HAL_ERROR: Parameter error or operation not supported.
767  * @retval ::HAL_BUSY: Driver is busy.
768  * @retval ::HAL_TIMEOUT: Timeout occurred.
769  ****************************************************************************************
770  */
772 
773 /** @} */
774 
775 /** @addtogroup DSPI_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
776  * @brief IRQ Handler and Callbacks functions
777  * @{
778  */
779 
780 /**
781  ****************************************************************************************
782  * @brief Handle DSPI interrupt request.
783  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
784  ****************************************************************************************
785  */
787 
788 /**
789  ****************************************************************************************
790  * @brief Tx Transfer completed callback.
791  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
792  ****************************************************************************************
793  */
795 
796 /**
797  ****************************************************************************************
798  * @brief DSPI error callback.
799  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
800  ****************************************************************************************
801  */
803 
804 /**
805  ****************************************************************************************
806  * @brief DSPI Abort callback.
807  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
808  ****************************************************************************************
809  */
811 
812 /** @} */
813 
814 /** @defgroup DSPI_Exported_Functions_Group3 Peripheral State and Errors functions
815  * @brief DSPI control functions
816  *
817 @verbatim
818  ===============================================================================
819  ##### Peripheral State and Errors functions #####
820  ===============================================================================
821  [..]
822  This subsection provides a set of functions allowing to control the DSPI.
823  (+) hal_dspi_get_state() API can be helpful to check in run-time the state of the DSPI peripheral.
824  (+) hal_dspi_get_error() check in run-time Errors occurring during communication.
825 @endverbatim
826  * @{
827  */
828 
829 /**
830  ****************************************************************************************
831  * @brief Return the DSPI handle state.
832  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
833  *
834  * @retval ::HAL_DSPI_STATE_RESET: Peripheral not initialized.
835  * @retval ::HAL_DSPI_STATE_READY: Peripheral initialized and ready for use.
836  * @retval ::HAL_DSPI_STATE_BUSY: Peripheral in indirect mode and busy.
837  * @retval ::HAL_DSPI_STATE_BUSY_INDIRECT_TX: Peripheral in indirect mode with transmission ongoing.
838  * @retval ::HAL_DSPI_STATE_ABORT: Peripheral with abort request ongoing.
839  * @retval ::HAL_DSPI_STATE_ERROR: Peripheral in error.
840  ****************************************************************************************
841  */
843 
844 /**
845  ****************************************************************************************
846  * @brief Return the DSPI error code.
847  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
848  *
849  * @return DSPI error code in bitmap format
850  ****************************************************************************************
851  */
853 
854 /**
855  ****************************************************************************************
856  * @brief Set the DSPI internal process timeout value.
857  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
858  * @param[in] timeout: Internal process timeout value.
859  *
860  * @retval ::HAL_OK: Operation is OK.
861  * @retval ::HAL_ERROR: Parameter error or operation not supported.
862  * @retval ::HAL_BUSY: Driver is busy.
863  * @retval ::HAL_TIMEOUT: Timeout occurred.
864  ****************************************************************************************
865  */
866 void hal_dspi_set_timeout(dspi_handle_t *p_dspi, uint32_t timeout);
867 
868 /**
869  ****************************************************************************************
870  * @brief Set the DSPI transmission mode.
871  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration information for the specified DSPI module.
872  * @param[in] mode: The DSPI transmission mode. This parameter can be one of the following values:
873  * @arg @ref DSPI_PROT_MODE_3W1L
874  * @arg @ref DSPI_PROT_MODE_4W1L
875  * @arg @ref DSPI_PROT_MODE_4W2L
876  *
877  * @retval ::HAL_OK: Operation is OK.
878  * @retval ::HAL_ERROR: Parameter error or operation not supported.
879  * @retval ::HAL_BUSY: Driver is busy.
880  * @retval ::HAL_TIMEOUT: Timeout occurred.
881  ****************************************************************************************
882  */
884 
885 /**
886  ****************************************************************************************
887  * @brief Suspend some registers related to DSPI configuration before sleep.
888  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration
889  * information for the specified DSPI module.
890  *
891  * @retval ::HAL_OK: Operation is OK.
892  * @retval ::HAL_ERROR: Parameter error or operation not supported.
893  * @retval ::HAL_BUSY: Driver is busy.
894  * @retval ::HAL_TIMEOUT: Timeout occurred.
895  ****************************************************************************************
896  */
898 
899 /**
900  ****************************************************************************************
901  * @brief Restore some registers related to DSPI configuration after sleep.
902  * This function must be used in conjunction with the hal_dspi_suspend_reg().
903  * @param[in] p_dspi: Pointer to a DSPI handle which contains the configuration
904  * information for the specified DSPI module.
905  *
906  * @retval ::HAL_OK: Operation is OK.
907  * @retval ::HAL_ERROR: Parameter error or operation not supported.
908  * @retval ::HAL_BUSY: Driver is busy.
909  * @retval ::HAL_TIMEOUT: Timeout occurred.
910  ****************************************************************************************
911  */
913 
914 /** @} */
915 
916 /** @} */
917 
918 #ifdef __cplusplus
919 }
920 #endif
921 
922 #endif /* __GR55xx_HAL_DSPI_H__ */
923 
924 /** @} */
925 
926 /** @} */
927 
928 /** @} */
HAL_DSPI_STATE_BUSY_INDIRECT_TX
@ HAL_DSPI_STATE_BUSY_INDIRECT_TX
Definition: gr55xx_hal_dspi.h:77
hal_dspi_state_t
hal_dspi_state_t
HAL DSPI State Enumerations definition.
Definition: gr55xx_hal_dspi.h:73
hal_dspi_msp_init
void hal_dspi_msp_init(dspi_handle_t *p_dspi)
Initialize the DSPI MSP.
_dspi_callback::dspi_msp_init
void(* dspi_msp_init)(dspi_handle_t *p_dspi)
Definition: gr55xx_hal_dspi.h:183
hal_dspi_transmit_dma_sg_llp
hal_status_t hal_dspi_transmit_dma_sg_llp(dspi_handle_t *p_dspi, uint8_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config)
Transmit an amount of data in non-blocking mode with DMA SG or LLP.
hal_dspi_error_callback
void hal_dspi_error_callback(dspi_handle_t *p_dspi)
DSPI error callback.
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
_dspi_handle::init
dspi_init_t init
Definition: gr55xx_hal_dspi.h:120
dspi_callback_t
struct _dspi_callback dspi_callback_t
HAL_DSPI Callback function definition.
_dspi_handle::retention
uint32_t retention[3]
Definition: gr55xx_hal_dspi.h:142
_dspi_command_t
DSPI command Structure definition.
Definition: gr55xx_hal_dspi.h:154
hal_dspi_command_dma
hal_status_t hal_dspi_command_dma(dspi_handle_t *p_dspi, dspi_command_t *p_cmd)
Transmit instruction in non-blocking mode with DMA.
_dspi_handle::error_code
__IO uint32_t error_code
Definition: gr55xx_hal_dspi.h:136
hal_dspi_command_transmit_it
hal_status_t hal_dspi_command_transmit_it(dspi_handle_t *p_dspi, dspi_command_t *p_cmd, uint8_t *p_data)
Transmit an amount of data with the specified instruction in non-blocking mode with Interrupt.
HAL_DSPI_STATE_ABORT
@ HAL_DSPI_STATE_ABORT
Definition: gr55xx_hal_dspi.h:78
HAL_DSPI_STATE_RESET
@ HAL_DSPI_STATE_RESET
Definition: gr55xx_hal_dspi.h:74
_dspi_handle::p_instance
dspi_regs_t * p_instance
Definition: gr55xx_hal_dspi.h:118
dspi_handle_t
struct _dspi_handle dspi_handle_t
DSPI handle Structure definition.
hal_dspi_resume_reg
hal_status_t hal_dspi_resume_reg(dspi_handle_t *p_dspi)
Restore some registers related to DSPI configuration after sleep. This function must be used in conju...
_dspi_init_t::data_size
uint32_t data_size
Definition: gr55xx_hal_dspi.h:97
_dspi_handle::dspi_number
periph_device_number_t dspi_number
Definition: gr55xx_hal_dspi.h:140
hal_dspi_command_it
hal_status_t hal_dspi_command_it(dspi_handle_t *p_dspi, dspi_command_t *p_cmd)
Transmit instruction in non-blocking mode with Interrupt.
dspi_command_t
struct _dspi_command_t dspi_command_t
DSPI command Structure definition.
dma_sg_llp_config
LL DMA sg and llp config definition.
Definition: gr55xx_hal_dma.h:219
_dspi_handle::tx_xfer_count
__IO uint32_t tx_xfer_count
Definition: gr55xx_hal_dspi.h:126
hal_dspi_get_state
hal_dspi_state_t hal_dspi_get_state(dspi_handle_t *p_dspi)
Return the DSPI handle state.
hal_dspi_abort_callback
void hal_dspi_abort_callback(dspi_handle_t *p_dspi)
DSPI Abort callback.
_dspi_command_t::length
uint32_t length
Definition: gr55xx_hal_dspi.h:164
hal_dspi_transmit_dma
hal_status_t hal_dspi_transmit_dma(dspi_handle_t *p_dspi, uint8_t *p_data, uint32_t length)
Transmit an amount of data in non-blocking mode with DMA.
hal_dspi_command_transmit_dma_sg_llp
hal_status_t hal_dspi_command_transmit_dma_sg_llp(dspi_handle_t *p_dspi, dspi_command_t *p_cmd, uint8_t *p_data, dma_sg_llp_config_t *sg_llp_config)
Transmit an amount of data with the specified instruction in non-blocking mode with DMA SG or LLP.
_dspi_callback::dspi_tx_cplt_callback
void(* dspi_tx_cplt_callback)(dspi_handle_t *p_dspi)
Definition: gr55xx_hal_dspi.h:187
_dspi_init_t
QSPI init Structure definition.
Definition: gr55xx_hal_dspi.h:96
hal_dspi_command_transmit
hal_status_t hal_dspi_command_transmit(dspi_handle_t *p_dspi, dspi_command_t *p_cmd, uint8_t *p_data, uint32_t timeout)
Transmit an amount of data with the specified instruction in blocking mode.
hal_dspi_abort_it
hal_status_t hal_dspi_abort_it(dspi_handle_t *p_dspi)
Abort the current transmission (non-blocking function)
_dspi_command_t::data_size
uint32_t data_size
Definition: gr55xx_hal_dspi.h:161
hal_dspi_irq_handler
void hal_dspi_irq_handler(dspi_handle_t *p_dspi)
Handle DSPI interrupt request.
_dspi_command_t::instruction_size
uint32_t instruction_size
Definition: gr55xx_hal_dspi.h:158
hal_dspi_transmit
hal_status_t hal_dspi_transmit(dspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length, uint32_t timeout)
Transmit an amount of data in blocking mode.
hal_dspi_tx_cplt_callback
void hal_dspi_tx_cplt_callback(dspi_handle_t *p_dspi)
Tx Transfer completed callback.
hal_dspi_command_transmit_dma
hal_status_t hal_dspi_command_transmit_dma(dspi_handle_t *p_dspi, dspi_command_t *p_cmd, uint8_t *p_data)
Transmit an amount of data with the specified instruction in non-blocking mode with DMA .
_dspi_handle::p_dmatx
dma_handle_t * p_dmatx
Definition: gr55xx_hal_dspi.h:130
_dspi_callback::dspi_abort_callback
void(* dspi_abort_callback)(dspi_handle_t *p_dspi)
Definition: gr55xx_hal_dspi.h:185
_dspi_handle::timeout
uint32_t timeout
Definition: gr55xx_hal_dspi.h:138
_dspi_init_t::baud_rate
uint32_t baud_rate
Definition: gr55xx_hal_dspi.h:100
_dspi_handle
DSPI handle Structure definition.
Definition: gr55xx_hal_dspi.h:117
HAL_DSPI_STATE_READY
@ HAL_DSPI_STATE_READY
Definition: gr55xx_hal_dspi.h:75
_dspi_command_t::instruction
uint32_t instruction
Definition: gr55xx_hal_dspi.h:155
HAL_DSPI_STATE_ERROR
@ HAL_DSPI_STATE_ERROR
Definition: gr55xx_hal_dspi.h:79
hal_dspi_init
hal_status_t hal_dspi_init(dspi_handle_t *p_dspi)
Initialize the DSPI according to the specified parameters in the dspi_init_t and initialize the assoc...
_dspi_callback::dspi_msp_deinit
void(* dspi_msp_deinit)(dspi_handle_t *p_dspi)
Definition: gr55xx_hal_dspi.h:184
hal_dspi_command
hal_status_t hal_dspi_command(dspi_handle_t *p_dspi, dspi_command_t *p_cmd, uint32_t timeout)
Transmit only instruction in blocking mode.
_dspi_handle::p_tx_buffer
uint8_t * p_tx_buffer
Definition: gr55xx_hal_dspi.h:122
hal_dspi_transmit_it
hal_status_t hal_dspi_transmit_it(dspi_handle_t *p_dspi, uint8_t *p_data, uint32_t length)
Transmit an amount of data in non-blocking mode with Interrupt.
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
dspi_init_t
struct _dspi_init_t dspi_init_t
QSPI init Structure definition.
hal_dspi_config_mode
hal_status_t hal_dspi_config_mode(dspi_handle_t *p_dspi, uint32_t mode)
Set the DSPI transmission mode.
hal_dspi_get_error
uint32_t hal_dspi_get_error(dspi_handle_t *p_dspi)
Return the DSPI error code.
hal_dspi_deinit
hal_status_t hal_dspi_deinit(dspi_handle_t *p_dspi)
De-initialize the DSPI peripheral.
_dspi_handle::lock
__IO hal_lock_t lock
Definition: gr55xx_hal_dspi.h:132
gr55xx_hal_pwr_mgmt.h
This file contains all the functions prototypes for the HAL module driver.
gr55xx_ll_dspi.h
Header file containing functions prototypes of DSPI LL library.
hal_dspi_msp_deinit
void hal_dspi_msp_deinit(dspi_handle_t *p_dspi)
De-initialize the DSPI MSP.
HAL_DSPI_STATE_BUSY
@ HAL_DSPI_STATE_BUSY
Definition: gr55xx_hal_dspi.h:76
hal_dspi_suspend_reg
hal_status_t hal_dspi_suspend_reg(dspi_handle_t *p_dspi)
Suspend some registers related to DSPI configuration before sleep.
_dspi_callback
HAL_DSPI Callback function definition.
Definition: gr55xx_hal_dspi.h:182
_dspi_init_t::dspi_mode
uint32_t dspi_mode
Definition: gr55xx_hal_dspi.h:103
hal_dspi_set_timeout
void hal_dspi_set_timeout(dspi_handle_t *p_dspi, uint32_t timeout)
Set the DSPI internal process timeout value.
periph_device_number_t
periph_device_number_t
Peripheral Device ID definition NOTE:The order of enumeration is the order of recovery.
Definition: gr55xx_hal_pwr_mgmt.h:86
_dma_handle
DMA handle Structure definition.
Definition: gr55xx_hal_dma.h:277
_dspi_handle::tx_xfer_size
__IO uint32_t tx_xfer_size
Definition: gr55xx_hal_dspi.h:124
_dspi_callback::dspi_error_callback
void(* dspi_error_callback)(dspi_handle_t *p_dspi)
Definition: gr55xx_hal_dspi.h:186
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
_dspi_handle::write_fifo
void(* write_fifo)(struct _dspi_handle *p_dspi)
Definition: gr55xx_hal_dspi.h:128
_dspi_handle::state
__IO hal_dspi_state_t state
Definition: gr55xx_hal_dspi.h:134
hal_dspi_abort
hal_status_t hal_dspi_abort(dspi_handle_t *p_dspi)
Abort the current transmission.