BSP files for STM32H747I-Discovery Copy from ST Cube delivery

Dependents:   DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo

Committer:
Jerome Coutant
Date:
Wed Nov 06 11:32:01 2019 +0100
Revision:
3:bc403474b366
Add PDM lib

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jerome Coutant 3:bc403474b366 1 /**
Jerome Coutant 3:bc403474b366 2 ******************************************************************************
Jerome Coutant 3:bc403474b366 3 * @file pdm2pcm_glo.h
Jerome Coutant 3:bc403474b366 4 * @author MCD Application Team
Jerome Coutant 3:bc403474b366 5 * @version V3.0.0
Jerome Coutant 3:bc403474b366 6 * @date 28-February-2017
Jerome Coutant 3:bc403474b366 7 * @brief Global header for PDM2PCM conversion code
Jerome Coutant 3:bc403474b366 8 ******************************************************************************
Jerome Coutant 3:bc403474b366 9 * @attention
Jerome Coutant 3:bc403474b366 10 *
Jerome Coutant 3:bc403474b366 11 * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
Jerome Coutant 3:bc403474b366 12 *
Jerome Coutant 3:bc403474b366 13 * Licensed under MCD-ST Image SW License Agreement V2, (the "License");
Jerome Coutant 3:bc403474b366 14 * You may not use this file except in compliance with the License.
Jerome Coutant 3:bc403474b366 15 * You may obtain a copy of the License at:
Jerome Coutant 3:bc403474b366 16 *
Jerome Coutant 3:bc403474b366 17 * http://www.st.com/software_license_agreement_image_v2
Jerome Coutant 3:bc403474b366 18 *
Jerome Coutant 3:bc403474b366 19 * Unless required by applicable law or agreed to in writing, software
Jerome Coutant 3:bc403474b366 20 * distributed under the License is distributed on an "AS IS" BASIS,
Jerome Coutant 3:bc403474b366 21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Jerome Coutant 3:bc403474b366 22 * See the License for the specific language governing permissions and
Jerome Coutant 3:bc403474b366 23 * limitations under the License.
Jerome Coutant 3:bc403474b366 24 *
Jerome Coutant 3:bc403474b366 25 *
Jerome Coutant 3:bc403474b366 26 ******************************************************************************
Jerome Coutant 3:bc403474b366 27 */
Jerome Coutant 3:bc403474b366 28
Jerome Coutant 3:bc403474b366 29 /* Define to prevent recursive inclusion -------------------------------------*/
Jerome Coutant 3:bc403474b366 30 #ifndef __PDM2PCM_FILTER_H
Jerome Coutant 3:bc403474b366 31 #define __PDM2PCM_FILTER_H
Jerome Coutant 3:bc403474b366 32
Jerome Coutant 3:bc403474b366 33 #ifdef __cplusplus
Jerome Coutant 3:bc403474b366 34 extern "C" {
Jerome Coutant 3:bc403474b366 35 #endif
Jerome Coutant 3:bc403474b366 36
Jerome Coutant 3:bc403474b366 37 /* Includes ------------------------------------------------------------------*/
Jerome Coutant 3:bc403474b366 38 #include <stdint.h>
Jerome Coutant 3:bc403474b366 39
Jerome Coutant 3:bc403474b366 40 /* Exported constants --------------------------------------------------------*/
Jerome Coutant 3:bc403474b366 41 #define PDM_FILTER_ENDIANNESS_LE ((uint16_t)0x0000)
Jerome Coutant 3:bc403474b366 42 #define PDM_FILTER_ENDIANNESS_BE ((uint16_t)0x0001)
Jerome Coutant 3:bc403474b366 43
Jerome Coutant 3:bc403474b366 44 #define PDM_FILTER_BIT_ORDER_LSB ((uint16_t)0x0000)
Jerome Coutant 3:bc403474b366 45 #define PDM_FILTER_BIT_ORDER_MSB ((uint16_t)0x0001)
Jerome Coutant 3:bc403474b366 46
Jerome Coutant 3:bc403474b366 47 #define PDM_FILTER_DEC_FACTOR_48 ((uint16_t)0x0001)
Jerome Coutant 3:bc403474b366 48 #define PDM_FILTER_DEC_FACTOR_64 ((uint16_t)0x0002)
Jerome Coutant 3:bc403474b366 49 #define PDM_FILTER_DEC_FACTOR_80 ((uint16_t)0x0003)
Jerome Coutant 3:bc403474b366 50 #define PDM_FILTER_DEC_FACTOR_128 ((uint16_t)0x0004)
Jerome Coutant 3:bc403474b366 51 #define PDM_FILTER_DEC_FACTOR_16 ((uint16_t)0x0005)
Jerome Coutant 3:bc403474b366 52 #define PDM_FILTER_DEC_FACTOR_24 ((uint16_t)0x0006)
Jerome Coutant 3:bc403474b366 53 #define PDM_FILTER_DEC_FACTOR_32 ((uint16_t)0x0007)
Jerome Coutant 3:bc403474b366 54
Jerome Coutant 3:bc403474b366 55 #define PDM_FILTER_INIT_ERROR ((uint16_t)0x0010)
Jerome Coutant 3:bc403474b366 56 #define PDM_FILTER_CONFIG_ERROR ((uint16_t)0x0020)
Jerome Coutant 3:bc403474b366 57 #define PDM_FILTER_ENDIANNESS_ERROR ((uint16_t)0x0001)
Jerome Coutant 3:bc403474b366 58 #define PDM_FILTER_BIT_ORDER_ERROR ((uint16_t)0x0002)
Jerome Coutant 3:bc403474b366 59 #define PDM_FILTER_CRC_LOCK_ERROR ((uint16_t)0x0004)
Jerome Coutant 3:bc403474b366 60 #define PDM_FILTER_DECIMATION_ERROR ((uint16_t)0x0008)
Jerome Coutant 3:bc403474b366 61 #define PDM_FILTER_GAIN_ERROR ((uint16_t)0x0040)
Jerome Coutant 3:bc403474b366 62 #define PDM_FILTER_SAMPLES_NUMBER_ERROR ((uint16_t)0x0080)
Jerome Coutant 3:bc403474b366 63 #define PDM2PCM_INTERNAL_MEMORY_SIZE 16
Jerome Coutant 3:bc403474b366 64
Jerome Coutant 3:bc403474b366 65 /* Exported types ------------------------------------------------------------*/
Jerome Coutant 3:bc403474b366 66 typedef struct{
Jerome Coutant 3:bc403474b366 67 uint16_t bit_order;
Jerome Coutant 3:bc403474b366 68 uint16_t endianness;
Jerome Coutant 3:bc403474b366 69 uint32_t high_pass_tap;
Jerome Coutant 3:bc403474b366 70 uint16_t in_ptr_channels;
Jerome Coutant 3:bc403474b366 71 uint16_t out_ptr_channels;
Jerome Coutant 3:bc403474b366 72 uint32_t pInternalMemory[PDM2PCM_INTERNAL_MEMORY_SIZE];
Jerome Coutant 3:bc403474b366 73 }PDM_Filter_Handler_t;
Jerome Coutant 3:bc403474b366 74
Jerome Coutant 3:bc403474b366 75 typedef struct{
Jerome Coutant 3:bc403474b366 76 uint16_t decimation_factor;
Jerome Coutant 3:bc403474b366 77 uint16_t output_samples_number;
Jerome Coutant 3:bc403474b366 78 int16_t mic_gain;
Jerome Coutant 3:bc403474b366 79 }PDM_Filter_Config_t;
Jerome Coutant 3:bc403474b366 80
Jerome Coutant 3:bc403474b366 81 /* Exported macros -----------------------------------------------------------*/
Jerome Coutant 3:bc403474b366 82
Jerome Coutant 3:bc403474b366 83 /* Exported functions ------------------------------------------------------- */
Jerome Coutant 3:bc403474b366 84 uint32_t PDM_Filter_Init(PDM_Filter_Handler_t *pHandler);
Jerome Coutant 3:bc403474b366 85 uint32_t PDM_Filter_setConfig(PDM_Filter_Handler_t *pHandler, PDM_Filter_Config_t *pConfig);
Jerome Coutant 3:bc403474b366 86 uint32_t PDM_Filter_getConfig(PDM_Filter_Handler_t *pHandler, PDM_Filter_Config_t *pConfig);
Jerome Coutant 3:bc403474b366 87 uint32_t PDM_Filter_deInterleave(void *pDataIn, void *pDataOut, PDM_Filter_Handler_t * pHandler);
Jerome Coutant 3:bc403474b366 88 uint32_t PDM_Filter(void *pDataIn, void *pDataOut, PDM_Filter_Handler_t *pHandler);
Jerome Coutant 3:bc403474b366 89
Jerome Coutant 3:bc403474b366 90 #ifdef __cplusplus
Jerome Coutant 3:bc403474b366 91 }
Jerome Coutant 3:bc403474b366 92 #endif
Jerome Coutant 3:bc403474b366 93
Jerome Coutant 3:bc403474b366 94 #endif /* __PDM2PCM_FILTER_H */
Jerome Coutant 3:bc403474b366 95
Jerome Coutant 3:bc403474b366 96 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Jerome Coutant 3:bc403474b366 97