gr55xx_hal_pdm.h
Go to the documentation of this file.
1 /**
2  ****************************************************************************************
3  *
4  * @file gr55xx_hal_pdm.h
5  * @author BLE Driver Team
6  * @brief Header file containing functions prototypes of PDM 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_PDM PDM
47  * @brief PDM HAL module driver.
48  * @{
49  */
50 
51 /* Define to prevent recursive inclusion ----------------------------------------------------------*/
52 #ifndef __GR55xx_HAL_PDM_H__
53 #define __GR55xx_HAL_PDM_H__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /* Includes ---------------------------------------------------------------------------------------*/
60 #include "gr55xx_ll_pdm.h"
61 #include "gr55xx_hal_def.h"
62 #include "gr55xx_hal_dma.h"
63 
64 /* Exported types --------------------------------------------------------------------------------*/
65 /** @addtogroup HAL_PDM_ENUMERATIONS Enumerations
66  * @{
67  */
68 /**
69  * @brief HAL PDM State Enumerations definition
70  */
71 typedef enum
72 {
73  HAL_PDM_STATE_RESET = 0x00, /**< Peripheral not initialized */
74  HAL_PDM_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */
75  HAL_PDM_STATE_BUSY = 0x02, /**< An internal process is ongoing */
76  HAL_PDM_STATE_ERROR = 0x04 /**< Peripheral in error */
78 /** @} */
79 
80 /** @addtogroup HAL_PDM_TYPEDEFS Type definitions
81  * @{
82  */
83 /**
84  * @brief PDM init structure definition
85  */
86 typedef ll_pdm_init_t pdm_init_t;
87 /** @} */
88 
89 /** @addtogroup HAL_PDM_STRUCTURES Structures
90  * @{
91  */
92 
93 /**
94  * @brief PDM handle Structure definition
95  */
96 typedef struct _pdm_handle
97 {
98  pdm_regs_t *p_instance; /**< PDM registers base address */
99 
100  pdm_init_t init; /**< PDM configuration parameters */
101 
102  dma_handle_t *p_dma; /**< PDM DMA Handle parameters */
103 
104  __IO hal_lock_t lock; /**< Locking object */
105 
106  __IO hal_pdm_state_t state; /**< PDM communication state */
107 
108  __IO uint32_t error_code; /**< PDM error code */
109 
110  uint32_t retention[5]; /**< PDM important register information. */
112 /** @} */
113 
114 
115 /** @addtogroup HAL_PDM_CALLBACK_STRUCTURES Callback Structures
116  * @{
117  */
118 
119 /** @defgroup PDM_Callback PDM Callback
120  * @{
121  */
122 /**
123  * @brief HAL PDM Callback function definition
124  */
125 typedef struct _hal_pdm_callback
126 {
127  void (*pdm_msp_init)(pdm_handle_t *p_pdm); /**< PDM init MSP callback */
128  void (*pdm_msp_deinit)(pdm_handle_t *p_pdm); /**< PDM de-init MSP callback */
129  void (*pdm_left_overflow_callback)(pdm_handle_t *p_pdm); /**< PDM left channel overflow callback */
130  void (*pdm_right_overflow_callback)(pdm_handle_t *p_pdm);/**< PDM right channel overflow callback */
131  void (*pdm_dma_cplt_callback)(pdm_handle_t *p_pdm); /**< PDM dma completed callback */
132  void (*pdm_dma_blk_callback)(pdm_handle_t *p_pdm); /**< PDM dma blocks completed callback */
133  void (*pdm_dma_error_callback)(pdm_handle_t *p_pdm); /**< PDM error callback */
135 /** @} */
136 
137 /** @} */
138 
139 /** @defgroup HAL_PDM_MACRO Defines
140  * @{
141  */
142 /* Exported constants -----------------------------------------------------------------------------*/
143 /** @defgroup PDM_Exported_Constants PDM Exported Constants
144  * @{
145  */
146 /** @defgroup PDM_Error_Code PDM Error Code
147  * @{
148  */
149  /**
150  * @brief PDM error code.
151  */
152 #define HAL_PDM_ERROR_NONE ((uint32_t)0x00000000) /**< No error. */
153 #define HAL_PDM_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error. */
154 #define HAL_PDM_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error. */
155 #define HAL_PDM_ERROR_DMA ((uint32_t)0x00000004) /**< DMA transfer error. */
156 #define HAL_PDM_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameter error. */
157 /** @} */
158 
159 /**
160  * @brief PDM sample rate.
161  */
162 #define PDM_SAMPLE_RATE_15_625K LL_PDM_SAMPLE_RATE_15_625K /**< PDM sample rate 15.625K. */
163 #define PDM_SAMPLE_RATE_16K LL_PDM_SAMPLE_RATE_16K /**< PDM sample rate 16K. */
164 #define PDM_SAMPLE_RATE_8K LL_PDM_SAMPLE_RATE_8K /**< PDM sample rate 8K. */
165 
166 /**
167  * @brief PDM operation mode.
168  */
169 #define PDM_MODE_LEFT LL_PDM_MODE_LEFT /**< PDM left mono. */
170 #define PDM_MODE_RIGHT LL_PDM_MODE_RIGHT /**< PDM right mono. */
171 #define PDM_MODE_STEREO LL_PDM_MODE_STEREO /**< PDM stereo mono. */
172 
173 /**
174  * @brief PDM_default_config initStruct default configuartion
175  */
176 //#define PDM_DEFAULT_CONFIG LL_PDM_DEFAULT_CONFIG
177 /** @} */
178 
179 /* Exported macro ---------------------------------------------------------------------------------*/
180 /** @defgroup PDM_Exported_Macros PDM Exported Macros
181  * @{
182  */
183 
184 /** @brief Reset PDM handle states.
185  * @param __HANDLE__ PDM handle.
186  * @retval None
187  */
188 #define __HAL_PDM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_PDM_STATE_RESET)
189 
190 /** @brief Enable the specified PDM clock.
191  * @param __HANDLE__ Specify the PDM Handle.
192  * @retval None
193  */
194 #define __HAL_PDM_ENABLE_CLOCK(__HANDLE__) ll_pdm_enable_clk((__HANDLE__)->p_instance)
195 
196 /** @brief Disable the specified ADC clock.
197  * @param __HANDLE__ Specify the ADC Handle.
198  * @retval None
199  */
200 #define __HAL_PDM_DISABLE_CLOCK(__HANDLE__) ll_pdm_disable_clk((__HANDLE__)->p_instance)
201 /** @} */
202 
203 /** @} */
204 
205 /* Exported functions -----------------------------------------------------------------------------*/
206 /** @addtogroup HAL_PDM_DRIVER_FUNCTIONS Functions
207  * @{
208  */
209 
210 /** @addtogroup PDM_Exported_Functions_Group1 Initialization and de-initialization Functions
211  * @brief Initialization and Configuration functions
212  * @{
213  */
214 
215 /**
216  ****************************************************************************************
217  * @brief Initialize the PDM according to the specified parameters
218  * in the pdm_init_t and initialize the associated handle.
219  *
220  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
221  * the specified PDM module.
222  *
223  * @retval ::HAL_OK: Operation is OK.
224  * @retval ::HAL_ERROR: Parameter error or operation not supported.
225  * @retval ::HAL_BUSY: Driver is busy.
226  * @retval ::HAL_TIMEOUT: Timeout occurred.
227  ****************************************************************************************
228  */
230 
231 /**
232  ****************************************************************************************
233  * @brief De-initialize the PDM peripheral.
234  *
235  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
236  * the specified PDM module.
237  *
238  * @retval ::HAL_OK: Operation is OK.
239  * @retval ::HAL_ERROR: Parameter error or operation not supported.
240  * @retval ::HAL_BUSY: Driver is busy.
241  * @retval ::HAL_TIMEOUT: Timeout occurred.
242  ****************************************************************************************
243  */
245 
246 /**
247  ****************************************************************************************
248  * @brief Initialize the PDM MSP.
249  *
250  * @note This function should not be modified. When the callback is needed,
251  * the hal_pdm_msp_deinit can be implemented in the user file.
252  *
253  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
254  * the specified PDM module.
255  ****************************************************************************************
256  */
258 
259 /**
260  ****************************************************************************************
261  * @brief De-initialize the PDM MSP.
262  *
263  * @note This function should not be modified. When the callback is needed,
264  * the hal_pdm_msp_deinit can be implemented in the user file.
265  *
266  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
267  * the specified PDM module.
268  ****************************************************************************************
269  */
271 
272 /**
273  ****************************************************************************************
274  * @brief Start the pdm left channel transfer with dma.
275  *
276  * @param[in] p_pdm: Pointer to an PDM handle.
277  * @param[in] p_data: Point to the buffer that stores the data collected by PDM.
278  * @param[in] length: Length of data buffer, ranging between 0 and 4095.
279  *
280  * @retval ::HAL_OK: Operation is OK.
281  * @retval ::HAL_ERROR: Parameter error or operation not supported.
282  * @retval ::HAL_BUSY: Driver is busy.
283  * @retval ::HAL_TIMEOUT: Timeout occurred.
284  ****************************************************************************************
285  */
286 hal_status_t hal_pdm_left_start_dma(pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length);
287 
288 /**
289  ****************************************************************************************
290  * @brief Start the pdm right channel transfer with dma's sg and llp.
291  *
292  * @param[in] p_pdm: Pointer to an PDM handle.
293  * @param[in] p_data: Point to the buffer that stores the data collected by PDM.
294  * @param[in] length: Length of data buffer, ranging between 0 and 4095.
295  * @param[in] sg_llp_config: Config for dma llp and sg fuction.
296  *
297  * @retval ::HAL_OK: Operation is OK.
298  * @retval ::HAL_ERROR: Parameter error or operation not supported.
299  * @retval ::HAL_BUSY: Driver is busy.
300  * @retval ::HAL_TIMEOUT: Timeout occurred.
301  ****************************************************************************************
302  */
303 hal_status_t hal_pdm_left_start_dma_sg_llp(pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config);
304 
305 /**
306  ****************************************************************************************
307  * @brief Start the pdm right channel transfer with dma.
308  *
309  * @param[in] p_pdm: Pointer to an PDM handle.
310  * @param[in] p_data: Point to the buffer that stores the data collected by PDM.
311  * @param[in] length: Length of data buffer, ranging between 0 and 4095.
312  *
313  * @retval ::HAL_OK: Operation is OK.
314  * @retval ::HAL_ERROR: Parameter error or operation not supported.
315  * @retval ::HAL_BUSY: Driver is busy.
316  * @retval ::HAL_TIMEOUT: Timeout occurred.
317  ****************************************************************************************
318  */
319 hal_status_t hal_pdm_right_start_dma(pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length);
320 
321 /**
322  ****************************************************************************************
323  * @brief Start the pdm right channel transfer with dma's sg and llp.
324  *
325  * @param[in] p_pdm: Pointer to an PDM handle.
326  * @param[in] p_data: Point to the buffer that stores the data collected by PDM.
327  * @param[in] length: Length of data buffer, ranging between 0 and 4095.
328  * @param[in] sg_llp_config: config for dma llp and sg fuction.
329  *
330  * @retval ::HAL_OK: Operation is OK.
331  * @retval ::HAL_ERROR: Parameter error or operation not supported.
332  * @retval ::HAL_BUSY: Driver is busy.
333  * @retval ::HAL_TIMEOUT: Timeout occurred.
334  ****************************************************************************************
335  */
336 hal_status_t hal_pdm_right_start_dma_sg_llp(pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config);
337 
338 /**
339  ****************************************************************************************
340  * @brief Start the pdm dual channel transfer with dma.
341  *
342  * @param[in] p_pdm: Pointer to an PDM handle.
343  * @param[in] p_data: Point to the buffer that stores the data collected by PDM.
344  * @param[in] length: Length of data buffer, ranging between 0 and 4095.
345  *
346  * @retval ::HAL_OK: Operation is OK.
347  * @retval ::HAL_ERROR: Parameter error or operation not supported.
348  * @retval ::HAL_BUSY: Driver is busy.
349  * @retval ::HAL_TIMEOUT: Timeout occurred.
350  ****************************************************************************************
351  */
352 hal_status_t hal_pdm_stereo_start_dma(pdm_handle_t *p_pdm, uint32_t *p_data, uint32_t length);
353 
354 /**
355  ****************************************************************************************
356  * @brief Start the pdm dual channel transfer with dma's sg and llp.
357  *
358  * @param[in] p_pdm: Pointer to an PDM handle.
359  * @param[in] p_data: Point to the buffer that stores the data collected by PDM.
360  * @param[in] length: Length of data buffer, ranging between 0 and 4095.
361  * @param[in] sg_llp_config: config for dma llp and sg fuction.
362  *
363  * @retval ::HAL_OK: Operation is OK.
364  * @retval ::HAL_ERROR: Parameter error or operation not supported.
365  * @retval ::HAL_BUSY: Driver is busy.
366  * @retval ::HAL_TIMEOUT: Timeout occurred.
367  ****************************************************************************************
368  */
369 hal_status_t hal_pdm_stereo_start_dma_sg_llp(pdm_handle_t *p_pdm, uint32_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config);
370 
371 /**
372  ****************************************************************************************
373  * @brief Abort ongoing conversion (blocking mode).
374  *
375  * @note This procedure could be only used for aborting transfer started in DMA mode.
376  * This procedure performs following operations:
377  * - Disable PDM clock, stop conversion
378  * - Abort DMA transfer by calling hal_dma_abort_it (in case of transfer in DMA mode)
379  * - Set handle State to READY.
380  * This procedure is executed in blocking mode: when exiting function, Abort is transfered as completed.
381  *
382  * @param[in] p_pdm: PDM handle.
383  *
384  * @retval ::HAL_OK: Operation is OK.
385  * @retval ::HAL_ERROR: Parameter error or operation not supported.
386  * @retval ::HAL_BUSY: Driver is busy.
387  * @retval ::HAL_TIMEOUT: Timeout occurred.
388  ****************************************************************************************
389  */
391 
392 /**
393  ****************************************************************************************
394  * @brief Handle PDM interrupt request.
395  *
396  * @param[in] p_pdm: Pointer to a PDM handle which contains the configuration information for the specified PDM.
397  ****************************************************************************************
398  */
400 
401 /**
402  ****************************************************************************************
403  * @brief Left channel data overflow callback.
404  *
405  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
406  * the specified PDM module.
407  ****************************************************************************************
408  */
410 
411 /**
412  ****************************************************************************************
413  * @brief Right channel data overflow callback.
414  *
415  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
416  * the specified PDM module.
417  ****************************************************************************************
418  */
420 
421 /**
422  ****************************************************************************************
423  * @brief Dma transfer completed callback..
424  *
425  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
426  * the specified PDM module.
427  ****************************************************************************************
428 */
430 
431 /**
432  ****************************************************************************************
433  * @brief Block transfer completed callback..
434  *
435  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
436  * the specified PDM module.
437  ****************************************************************************************
438  */
440 
441 /**
442  ****************************************************************************************
443  * @brief DMA transfer error callback..
444  *
445  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
446  * the specified PDM module.
447  ****************************************************************************************
448  */
450 /** @} */
451 
452 /** @defgroup PDM_Exported_Functions_Group3 Peripheral State and Errors Functions
453  * @brief PDM control functions
454  *
455 @verbatim
456  ===============================================================================
457  ##### Peripheral State and Errors functions #####
458  ===============================================================================
459  [..]
460  This subsection provides a set of functions allowing to control the PDM.
461  (+) hal_pdm_get_state() API can be helpful to check in run-time the state of the PDM peripheral.
462  (+) hal_pdm_get_error() check in run-time Errors occurring during communication.
463 @endverbatim
464  * @{
465  */
466 /**
467  ****************************************************************************************
468  * @brief Return the PDM handle state.
469  *
470  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
471  * the specified PDM module.
472  *
473  * @retval ::HAL_ADC_STATE_RESET: Peripheral not initialized.
474  * @retval ::HAL_ADC_STATE_READY: Peripheral initialized and ready for use.
475  * @retval ::HAL_ADC_STATE_BUSY: An internal process is ongoing.
476  * @retval ::HAL_ADC_STATE_ERROR: Peripheral in error.
477  ****************************************************************************************
478  */
480 
481 /**
482  ****************************************************************************************
483  * @brief Return the PDM error code.
484  *
485  * @param[in] p_pdm: Pointer to an PDM handle which contains the configuration information for
486  * the specified PDM module.
487  *
488  * @return PDM error code in bitmap format
489  ****************************************************************************************
490  */
492 
493 /**
494  ****************************************************************************************
495  * @brief Suspend some registers related to PDM configuration before sleep.
496  * @param[in] p_pdm: Pointer to a PDM handle which contains the configuration
497  * information for the specified PDM module.
498  * @retval ::HAL_OK: Operation is OK.
499  * @retval ::HAL_ERROR: Parameter error or operation not supported.
500  * @retval ::HAL_BUSY: Driver is busy.
501  * @retval ::HAL_TIMEOUT: Timeout occurred.
502  ****************************************************************************************
503  */
505 
506 /**
507  ****************************************************************************************
508  * @brief Restore some registers related to PDM configuration after sleep.
509  * This function must be used in conjunction with the hal_adc_suspend_reg().
510  * @param[in] p_pdm: Pointer to a PDM handle which contains the configuration
511  * information for the specified PDM module.
512  * @retval ::HAL_OK: Operation is OK.
513  * @retval ::HAL_ERROR: Parameter error or operation not supported.
514  * @retval ::HAL_BUSY: Driver is busy.
515  * @retval ::HAL_TIMEOUT: Timeout occurred.
516  ****************************************************************************************
517  */
519 
520 /** @} */
521 
522 /** @} */
523 
524 
525 #ifdef __cplusplus
526 }
527 #endif
528 
529 #endif /* __GR55xx_HAL_PDM_H__ */
530 
531 /** @} */
532 
533 /** @} */
534 
535 /** @} */
hal_pdm_callback_t
struct _hal_pdm_callback hal_pdm_callback_t
HAL PDM Callback function definition.
hal_pdm_right_start_dma_sg_llp
hal_status_t hal_pdm_right_start_dma_sg_llp(pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config)
Start the pdm right channel transfer with dma's sg and llp.
hal_lock_t
hal_lock_t
HAL Lock structures definition.
Definition: gr55xx_hal_def.h:81
_pdm_handle::lock
__IO hal_lock_t lock
Definition: gr55xx_hal_pdm.h:104
hal_pdm_deinit
hal_status_t hal_pdm_deinit(pdm_handle_t *p_pdm)
De-initialize the PDM peripheral.
HAL_PDM_STATE_BUSY
@ HAL_PDM_STATE_BUSY
Definition: gr55xx_hal_pdm.h:75
hal_pdm_irq_handler
void hal_pdm_irq_handler(pdm_handle_t *p_pdm)
Handle PDM interrupt request.
hal_pdm_dma_blk_callback
void hal_pdm_dma_blk_callback(pdm_handle_t *p_pdm)
Block transfer completed callback..
hal_pdm_get_state
hal_pdm_state_t hal_pdm_get_state(pdm_handle_t *p_pdm)
Return the PDM handle state.
_pdm_handle::state
__IO hal_pdm_state_t state
Definition: gr55xx_hal_pdm.h:106
_hal_pdm_callback::pdm_right_overflow_callback
void(* pdm_right_overflow_callback)(pdm_handle_t *p_pdm)
Definition: gr55xx_hal_pdm.h:130
_hal_pdm_callback::pdm_dma_cplt_callback
void(* pdm_dma_cplt_callback)(pdm_handle_t *p_pdm)
Definition: gr55xx_hal_pdm.h:131
hal_pdm_resume_reg
hal_status_t hal_pdm_resume_reg(pdm_handle_t *p_pdm)
Restore some registers related to PDM configuration after sleep. This function must be used in conjun...
hal_pdm_msp_deinit
void hal_pdm_msp_deinit(pdm_handle_t *p_pdm)
De-initialize the PDM MSP.
hal_pdm_left_overflow_callback
void hal_pdm_left_overflow_callback(pdm_handle_t *p_pdm)
Left channel data overflow callback.
hal_pdm_dma_cplt_callback
void hal_pdm_dma_cplt_callback(pdm_handle_t *p_pdm)
Dma transfer completed callback..
dma_sg_llp_config
LL DMA sg and llp config definition.
Definition: gr55xx_hal_dma.h:219
hal_pdm_state_t
hal_pdm_state_t
HAL PDM State Enumerations definition.
Definition: gr55xx_hal_pdm.h:72
_hal_pdm_callback
HAL PDM Callback function definition.
Definition: gr55xx_hal_pdm.h:126
HAL_PDM_STATE_READY
@ HAL_PDM_STATE_READY
Definition: gr55xx_hal_pdm.h:74
_hal_pdm_callback::pdm_left_overflow_callback
void(* pdm_left_overflow_callback)(pdm_handle_t *p_pdm)
Definition: gr55xx_hal_pdm.h:129
HAL_PDM_STATE_RESET
@ HAL_PDM_STATE_RESET
Definition: gr55xx_hal_pdm.h:73
hal_pdm_left_start_dma_sg_llp
hal_status_t hal_pdm_left_start_dma_sg_llp(pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config)
Start the pdm right channel transfer with dma's sg and llp.
_pdm_handle::retention
uint32_t retention[5]
Definition: gr55xx_hal_pdm.h:110
pdm_handle_t
struct _pdm_handle pdm_handle_t
PDM handle Structure definition.
gr55xx_ll_pdm.h
Header file containing functions prototypes of PDM LL library.
_pdm_handle::p_dma
dma_handle_t * p_dma
Definition: gr55xx_hal_pdm.h:102
hal_pdm_dma_error_callback
void hal_pdm_dma_error_callback(pdm_handle_t *p_pdm)
DMA transfer error callback..
hal_pdm_right_start_dma
hal_status_t hal_pdm_right_start_dma(pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length)
Start the pdm right channel transfer with dma.
hal_pdm_get_error
uint32_t hal_pdm_get_error(pdm_handle_t *p_pdm)
Return the PDM error code.
_hal_pdm_callback::pdm_dma_blk_callback
void(* pdm_dma_blk_callback)(pdm_handle_t *p_pdm)
Definition: gr55xx_hal_pdm.h:132
_pdm_handle
PDM handle Structure definition.
Definition: gr55xx_hal_pdm.h:97
hal_pdm_stereo_start_dma
hal_status_t hal_pdm_stereo_start_dma(pdm_handle_t *p_pdm, uint32_t *p_data, uint32_t length)
Start the pdm dual channel transfer with dma.
hal_pdm_abort
hal_status_t hal_pdm_abort(pdm_handle_t *p_pdm)
Abort ongoing conversion (blocking mode).
HAL_PDM_STATE_ERROR
@ HAL_PDM_STATE_ERROR
Definition: gr55xx_hal_pdm.h:76
gr55xx_hal_dma.h
Header file containing functions prototypes of DMA HAL library.
_pdm_handle::p_instance
pdm_regs_t * p_instance
Definition: gr55xx_hal_pdm.h:98
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr55xx_hal_def.h:70
_pdm_handle::error_code
__IO uint32_t error_code
Definition: gr55xx_hal_pdm.h:108
hal_pdm_right_overflow_callback
void hal_pdm_right_overflow_callback(pdm_handle_t *p_pdm)
Right channel data overflow callback.
hal_pdm_stereo_start_dma_sg_llp
hal_status_t hal_pdm_stereo_start_dma_sg_llp(pdm_handle_t *p_pdm, uint32_t *p_data, uint32_t length, dma_sg_llp_config_t *sg_llp_config)
Start the pdm dual channel transfer with dma's sg and llp.
_pdm_handle::init
pdm_init_t init
Definition: gr55xx_hal_pdm.h:100
hal_pdm_left_start_dma
hal_status_t hal_pdm_left_start_dma(pdm_handle_t *p_pdm, uint16_t *p_data, uint32_t length)
Start the pdm left channel transfer with dma.
hal_pdm_init
hal_status_t hal_pdm_init(pdm_handle_t *p_pdm)
Initialize the PDM according to the specified parameters in the pdm_init_t and initialize the associa...
_hal_pdm_callback::pdm_dma_error_callback
void(* pdm_dma_error_callback)(pdm_handle_t *p_pdm)
Definition: gr55xx_hal_pdm.h:133
_hal_pdm_callback::pdm_msp_init
void(* pdm_msp_init)(pdm_handle_t *p_pdm)
Definition: gr55xx_hal_pdm.h:127
hal_pdm_msp_init
void hal_pdm_msp_init(pdm_handle_t *p_pdm)
Initialize the PDM MSP.
_dma_handle
DMA handle Structure definition.
Definition: gr55xx_hal_dma.h:277
hal_pdm_suspend_reg
hal_status_t hal_pdm_suspend_reg(pdm_handle_t *p_pdm)
Suspend some registers related to PDM configuration before sleep.
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
_hal_pdm_callback::pdm_msp_deinit
void(* pdm_msp_deinit)(pdm_handle_t *p_pdm)
Definition: gr55xx_hal_pdm.h:128
pdm_init_t
ll_pdm_init_t pdm_init_t
PDM init structure definition.
Definition: gr55xx_hal_pdm.h:86