gr55xx_hal_pdm.h File Reference

Header file containing functions prototypes of PDM HAL library. More...

#include "gr55xx_ll_pdm.h"
#include "gr55xx_hal_def.h"
#include "gr55xx_hal_dma.h"

Go to the source code of this file.

Classes

struct  _pdm_handle
 PDM handle Structure definition. More...
 
struct  _hal_pdm_callback
 HAL PDM Callback function definition. More...
 

Macros

#define HAL_PDM_ERROR_NONE   ((uint32_t)0x00000000)
 PDM error code. More...
 
#define HAL_PDM_ERROR_TIMEOUT   ((uint32_t)0x00000001)
 
#define HAL_PDM_ERROR_TRANSFER   ((uint32_t)0x00000002)
 
#define HAL_PDM_ERROR_DMA   ((uint32_t)0x00000004)
 
#define HAL_PDM_ERROR_INVALID_PARAM   ((uint32_t)0x00000008)
 
#define PDM_SAMPLE_RATE_15_625K   LL_PDM_SAMPLE_RATE_15_625K
 PDM sample rate. More...
 
#define PDM_SAMPLE_RATE_16K   LL_PDM_SAMPLE_RATE_16K
 
#define PDM_SAMPLE_RATE_8K   LL_PDM_SAMPLE_RATE_8K
 
#define PDM_MODE_LEFT   LL_PDM_MODE_LEFT
 PDM operation mode. More...
 
#define PDM_MODE_RIGHT   LL_PDM_MODE_RIGHT
 
#define PDM_MODE_STEREO   LL_PDM_MODE_STEREO
 
#define __HAL_PDM_RESET_HANDLE_STATE(__HANDLE__)   ((__HANDLE__)->state = HAL_PDM_STATE_RESET)
 Reset PDM handle states. More...
 
#define __HAL_PDM_ENABLE_CLOCK(__HANDLE__)   ll_pdm_enable_clk((__HANDLE__)->p_instance)
 Enable the specified PDM clock. More...
 
#define __HAL_PDM_DISABLE_CLOCK(__HANDLE__)   ll_pdm_disable_clk((__HANDLE__)->p_instance)
 Disable the specified ADC clock. More...
 

Typedefs

typedef ll_pdm_init_t pdm_init_t
 PDM init structure definition. More...
 
typedef struct _pdm_handle pdm_handle_t
 PDM handle Structure definition. More...
 
typedef struct _hal_pdm_callback hal_pdm_callback_t
 HAL PDM Callback function definition. More...
 

Enumerations

enum  hal_pdm_state_t {
  HAL_PDM_STATE_RESET = 0x00,
  HAL_PDM_STATE_READY = 0x01,
  HAL_PDM_STATE_BUSY = 0x02,
  HAL_PDM_STATE_ERROR = 0x04
}
 HAL PDM State Enumerations definition. More...
 

Functions

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 associated handle. More...
 
hal_status_t hal_pdm_deinit (pdm_handle_t *p_pdm)
 De-initialize the PDM peripheral. More...
 
void hal_pdm_msp_init (pdm_handle_t *p_pdm)
 Initialize the PDM MSP. More...
 
void hal_pdm_msp_deinit (pdm_handle_t *p_pdm)
 De-initialize the PDM MSP. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
hal_status_t hal_pdm_abort (pdm_handle_t *p_pdm)
 Abort ongoing conversion (blocking mode). More...
 
void hal_pdm_irq_handler (pdm_handle_t *p_pdm)
 Handle PDM interrupt request. More...
 
void hal_pdm_left_overflow_callback (pdm_handle_t *p_pdm)
 Left channel data overflow callback. More...
 
void hal_pdm_right_overflow_callback (pdm_handle_t *p_pdm)
 Right channel data overflow callback. More...
 
void hal_pdm_dma_cplt_callback (pdm_handle_t *p_pdm)
 Dma transfer completed callback.. More...
 
void hal_pdm_dma_blk_callback (pdm_handle_t *p_pdm)
 Block transfer completed callback.. More...
 
void hal_pdm_dma_error_callback (pdm_handle_t *p_pdm)
 DMA transfer error callback.. More...
 
hal_pdm_state_t hal_pdm_get_state (pdm_handle_t *p_pdm)
 Return the PDM handle state. More...
 
uint32_t hal_pdm_get_error (pdm_handle_t *p_pdm)
 Return the PDM error code. More...
 
hal_status_t hal_pdm_suspend_reg (pdm_handle_t *p_pdm)
 Suspend some registers related to PDM configuration before sleep. More...
 
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 conjunction with the hal_adc_suspend_reg(). More...
 

Detailed Description

Header file containing functions prototypes of PDM HAL library.

Author
BLE Driver Team
Attention
#####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file gr55xx_hal_pdm.h.