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