137 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			137 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /****************************************************************************
 | |
| 
 | |
| Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
 | |
| 
 | |
| This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
 | |
| be copied by any method or incorporated into another program without
 | |
| the express written consent of Aerospace C.Power. This Information or any portion
 | |
| thereof remains the property of Aerospace C.Power. The Information contained herein
 | |
| is believed to be accurate and Aerospace C.Power assumes no responsibility or
 | |
| liability for its use in any way and conveys no license or title under
 | |
| any patent or copyright and makes no representation or warranty that this
 | |
| Information is free from patent or copyright infringement.
 | |
| 
 | |
| ****************************************************************************/
 | |
| 
 | |
| #ifndef _IOT_MIC_API_H
 | |
| #define _IOT_MIC_API_H
 | |
| 
 | |
| #include "iot_i2s_api.h"
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| /** \defgroup BSP_APIs MIC APIs
 | |
|  *  @brief MIC APIs
 | |
|  *
 | |
|  *
 | |
|  */
 | |
| 
 | |
| /** @addtogroup MIC_APIs
 | |
|  *  @{
 | |
|  *
 | |
|  */
 | |
| 
 | |
| /**
 | |
|  * @brief Usage:
 | |
| 
 | |
| 
 | |
|  */
 | |
| 
 | |
| typedef struct _iot_mic_cfg {
 | |
|     uint8_t port;
 | |
|     uint8_t bck_pin;
 | |
|     uint8_t data_pin;
 | |
| } iot_mic_cfg_t;
 | |
| 
 | |
| typedef struct _iot_mic_array_cfg {
 | |
|     uint8_t num;
 | |
|     uint8_t phase;
 | |
|     uint8_t hp_bypass;
 | |
|     uint8_t sinc16;
 | |
|     uint8_t rx_hp_dsample;
 | |
|     uint32_t clk;
 | |
|     uint32_t lphp_filter;
 | |
|     iot_i2s_dma_rcv_func recv;
 | |
|     iot_mic_cfg_t mic_cfg[I2S_MAX-1];
 | |
| } iot_mic_array_cfg_t;
 | |
| 
 | |
| typedef struct _iot_i2s_pin {
 | |
|     uint8_t port;
 | |
|     uint8_t bck_pin;
 | |
|     uint8_t lrck_pin;
 | |
|     uint8_t data_pin;
 | |
| }iot_i2s_pin_t;
 | |
| 
 | |
| typedef struct _iot_ana_mic_cfg {
 | |
|     uint8_t num;
 | |
|     uint32_t clk;
 | |
|     i2s_bits_sample_t bit_mode;
 | |
|     i2s_msb_right_t msb_right;
 | |
|     i2s_rx_cfg_t rx_cfg;
 | |
|     iot_i2s_dma_rcv_func recv;
 | |
|     iot_i2s_pin_t mic_cfg[I2S_MAX-1];
 | |
| } iot_ana_mic_cfg_t;
 | |
| 
 | |
| 
 | |
| /**
 | |
|  * @brief iot_ana_mic_array_init() - mic array init func
 | |
|  * @param cfg           mic array configure instruction
 | |
|  *
 | |
|  * @return              1 -- failed
 | |
|  * @return              0 -- success
 | |
|  *
 | |
|  */
 | |
| uint8_t iot_ana_mic_array_init(iot_ana_mic_cfg_t *cfg);
 | |
| 
 | |
| /**
 | |
|  * @brief iot_mic_array_init() - mic array init func
 | |
|  * @param cfg           mic array configure instruction
 | |
|  *
 | |
|  * @return              1 -- failed
 | |
|  * @return              0 -- success
 | |
|  *
 | |
|  */
 | |
| uint8_t iot_mic_array_init(iot_mic_array_cfg_t *cfg);
 | |
| 
 | |
| /**
 | |
|  * @brief iot_mic_array_start() - start mic array
 | |
|  * @param port          IIS port number
 | |
|  *
 | |
|  * @return              1 -- invalid param, 11 -- unsupport operation
 | |
|  * @return              0 -- success
 | |
|  *
 | |
|  */
 | |
| uint8_t iot_mic_array_start(uint8_t port);
 | |
| 
 | |
| /**
 | |
|  * @brief iot_get_i2s_mic_array_data() - get i2s mic data
 | |
|  * @param port          IIS port number
 | |
|  * @param size          the size of reveiving mic data
 | |
|  * @param fst_addr      the first address of mic data
 | |
|  * @param fst_size      the first length of mic data
 | |
|  * @param snd_addr      the second address of mic data
 | |
|                         if snd_addr = 0, means second address is invalid
 | |
|  * @param snd_size      the second address of mic data
 | |
|  *
 | |
|  * @return              1 -- invalid param, 11 -- no enough data
 | |
|  * @return              0 -- success
 | |
|  *
 | |
|  */
 | |
| uint8_t iot_get_i2s_mic_array_data(uint8_t port, uint32_t size,\
 | |
|         uint32_t * fst_addr, uint32_t *fst_size,
 | |
|         uint32_t *snd_addr, uint32_t *snd_size);
 | |
| 
 | |
| /**
 | |
|  * @}
 | |
|  */
 | |
| 
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif // _IOT_MIC_API_H
 | |
| 
 |