BSP files for STM32H747I-Discovery Copy from ST Cube delivery

Dependents:   DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pdm2pcm_glo.h Source File

pdm2pcm_glo.h

00001 /**
00002   ******************************************************************************
00003   * @file    pdm2pcm_glo.h
00004   * @author  MCD Application Team
00005   * @version V3.0.0
00006   * @date    28-February-2017
00007   * @brief   Global header for PDM2PCM conversion code
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
00012   *
00013   * Licensed under MCD-ST Image SW License Agreement V2, (the "License");
00014   * You may not use this file except in compliance with the License.
00015   * You may obtain a copy of the License at:
00016   *
00017   *        http://www.st.com/software_license_agreement_image_v2
00018   *
00019   * Unless required by applicable law or agreed to in writing, software 
00020   * distributed under the License is distributed on an "AS IS" BASIS, 
00021   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00022   * See the License for the specific language governing permissions and
00023   * limitations under the License.
00024   *
00025   *
00026   ******************************************************************************
00027   */
00028 
00029 /* Define to prevent recursive inclusion -------------------------------------*/
00030 #ifndef __PDM2PCM_FILTER_H
00031 #define __PDM2PCM_FILTER_H
00032 
00033 #ifdef __cplusplus
00034  extern "C" {
00035 #endif
00036 
00037 /* Includes ------------------------------------------------------------------*/
00038 #include <stdint.h>
00039 
00040 /* Exported constants --------------------------------------------------------*/
00041 #define PDM_FILTER_ENDIANNESS_LE     ((uint16_t)0x0000)
00042 #define PDM_FILTER_ENDIANNESS_BE     ((uint16_t)0x0001)
00043 
00044 #define PDM_FILTER_BIT_ORDER_LSB     ((uint16_t)0x0000)
00045 #define PDM_FILTER_BIT_ORDER_MSB     ((uint16_t)0x0001)
00046 
00047 #define PDM_FILTER_DEC_FACTOR_48     ((uint16_t)0x0001)
00048 #define PDM_FILTER_DEC_FACTOR_64     ((uint16_t)0x0002)
00049 #define PDM_FILTER_DEC_FACTOR_80     ((uint16_t)0x0003)
00050 #define PDM_FILTER_DEC_FACTOR_128    ((uint16_t)0x0004)
00051 #define PDM_FILTER_DEC_FACTOR_16     ((uint16_t)0x0005)
00052 #define PDM_FILTER_DEC_FACTOR_24     ((uint16_t)0x0006)
00053 #define PDM_FILTER_DEC_FACTOR_32     ((uint16_t)0x0007)
00054 
00055 #define PDM_FILTER_INIT_ERROR           ((uint16_t)0x0010)
00056 #define PDM_FILTER_CONFIG_ERROR         ((uint16_t)0x0020)
00057 #define PDM_FILTER_ENDIANNESS_ERROR     ((uint16_t)0x0001)
00058 #define PDM_FILTER_BIT_ORDER_ERROR      ((uint16_t)0x0002)
00059 #define PDM_FILTER_CRC_LOCK_ERROR       ((uint16_t)0x0004)
00060 #define PDM_FILTER_DECIMATION_ERROR     ((uint16_t)0x0008)
00061 #define PDM_FILTER_GAIN_ERROR           ((uint16_t)0x0040)
00062 #define PDM_FILTER_SAMPLES_NUMBER_ERROR ((uint16_t)0x0080)
00063 #define PDM2PCM_INTERNAL_MEMORY_SIZE 16
00064 
00065 /* Exported types ------------------------------------------------------------*/
00066 typedef struct{
00067   uint16_t bit_order;
00068   uint16_t endianness;
00069   uint32_t high_pass_tap;
00070   uint16_t in_ptr_channels;
00071   uint16_t out_ptr_channels;
00072   uint32_t pInternalMemory[PDM2PCM_INTERNAL_MEMORY_SIZE];
00073 }PDM_Filter_Handler_t;
00074 
00075 typedef struct{
00076   uint16_t decimation_factor;
00077   uint16_t output_samples_number;
00078   int16_t  mic_gain;
00079 }PDM_Filter_Config_t;
00080 
00081 /* Exported macros -----------------------------------------------------------*/
00082 
00083 /* Exported functions ------------------------------------------------------- */
00084 uint32_t PDM_Filter_Init(PDM_Filter_Handler_t *pHandler);
00085 uint32_t PDM_Filter_setConfig(PDM_Filter_Handler_t *pHandler, PDM_Filter_Config_t *pConfig); 
00086 uint32_t PDM_Filter_getConfig(PDM_Filter_Handler_t *pHandler, PDM_Filter_Config_t *pConfig);
00087 uint32_t PDM_Filter_deInterleave(void *pDataIn, void *pDataOut, PDM_Filter_Handler_t * pHandler);
00088 uint32_t PDM_Filter(void *pDataIn, void *pDataOut, PDM_Filter_Handler_t *pHandler);
00089 
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093 
00094 #endif /* __PDM2PCM_FILTER_H */
00095 
00096 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
00097