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
Parent:
0:146cf26a9bbb
Add PDM lib

Who changed what in which revision?

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