audio.h
Go to the documentation of this file.
1 /********************************************************************************************************
2  * @file audio.h
3  *
4  * @brief This is the Audio driver header file for TLSR8258
5  *
6  * @author Driver Group
7  * @date May 8, 2018
8  *
9  * @par Copyright (c) 2018, Telink Semiconductor (Shanghai) Co., Ltd.
10  * All rights reserved.
11  *
12  * The information contained herein is confidential property of Telink
13  * Semiconductor (Shanghai) Co., Ltd. and is available under the terms
14  * of Commercial License Agreement between Telink Semiconductor (Shanghai)
15  * Co., Ltd. and the licensee or the terms described here-in. This heading
16  * MUST NOT be removed from this file.
17  *
18  * Licensees are granted free, non-transferable use of the information in this
19  * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided.
20  * @par History:
21  * 1.initial release(DEC. 26 2018)
22  *
23  * @version A001
24  *
25  *******************************************************************************************************/
26 
27 #ifndef audio_H
28 #define audio_H
29 
30 
31 #include "register.h"
32 #include "i2c.h"
33 #include "dfifo.h"
34 
35 #define AUDIO_DBL_BUF_ENABLE 0
36 
40 typedef enum{
46 
50 typedef enum{
57 
61 typedef enum{
66 
70 enum{
73 };
74 
80 void audio_stop(void);
81 
87 static inline void audio_reset(void)
88 {
90  reg_rst2 = 0;
91 }
92 
99 static inline void audio_set_dmic_clk(unsigned char step,unsigned char mod)
100 {
102  reg_dmic_mod = mod;
103 }
104 
111 static inline void audio_set_i2s_clk(unsigned char step,unsigned char mod)
112 {
114  reg_i2s_mod = mod;
115 }
121 static inline unsigned short get_mic_wr_ptr (void)
122 {
123  return reg_audio_wptr >>1;
124 }
130 void audio_amic_init(AudioRate_Typedef Audio_Rate);
136 void audio_dmic_init(AudioRate_Typedef Audio_Rate);
143 void audio_usb_init(AudioRate_Typedef Audio_Rate);
144 
151 void audio_buff_init(AudioRate_Typedef Audio_Rate);
152 
158 void audio_i2s_init(void);
159 
160 
168 void audio_set_sdm_output(AudioInput_Typedef InType,AudioRate_Typedef Audio_Rate,unsigned char audio_out_en);
169 
175 void audio_set_usb_output(void);
176 
184 
192 void audio_set_codec(I2C_GPIO_GroupTypeDef i2c_pin_group, CodecMode_Typedef CodecMode,unsigned sysclk);
193 
194 #endif
195  //end of GP3
Definition: audio.h:51
#define reg_audio_wptr
Definition: register_8258.h:987
static void audio_set_dmic_clk(unsigned char step, unsigned char mod)
This function serves to set the clock of dmic.
Definition: audio.h:99
void audio_usb_init(AudioRate_Typedef Audio_Rate)
audio USB init function, config the speed of DMIC and downsample audio data to required speed...
#define reg_i2s_step
Definition: register_8258.h:216
Definition: audio.h:52
void audio_dmic_init(AudioRate_Typedef Audio_Rate)
audio DMIC init function, config the speed of DMIC and downsample audio data to required speed...
#define reg_rst2
Definition: register_8258.h:165
Definition: audio.h:72
static void audio_set_i2s_clk(unsigned char step, unsigned char mod)
This function serves to set the clock of i2s.
Definition: audio.h:111
void audio_set_i2s_output(AudioInput_Typedef InType, AudioRate_Typedef Audio_Rate)
i2s setting function, enable or disable the i2s output, configure i2s output paramaters ...
Definition: audio.h:41
Definition: register_8258.h:228
Definition: audio.h:54
Definition: audio.h:53
AudioRate_Typedef
Definition: audio.h:40
void audio_set_usb_output(void)
This function servers to set USB input/output.
Definition: audio.h:43
CodecMode_Typedef
Definition: audio.h:61
Definition: register_8258.h:168
void audio_amic_init(AudioRate_Typedef Audio_Rate)
audio amic initial function. configure ADC corresponding parameters. set hpf,lpf and decimation ratio...
#define reg_i2s_mod
Definition: register_8258.h:222
void audio_stop(void)
shut down audio and ADC Module
static unsigned short get_mic_wr_ptr(void)
This function performs to read pointer/write pointer location.
Definition: audio.h:121
I2C_GPIO_GroupTypeDef
select pin as SDA and SCL of i2c
Definition: i2c.h:39
#define reg_dmic_step
Definition: register_8258.h:225
void audio_buff_init(AudioRate_Typedef Audio_Rate)
audio buff init function, config the speed of DMIC and downsample audio data to required speed...
void audio_set_codec(I2C_GPIO_GroupTypeDef i2c_pin_group, CodecMode_Typedef CodecMode, unsigned sysclk)
This function serves to set I2S input.
static void audio_reset(void)
This function serves to reset audio Module.
Definition: audio.h:87
void audio_i2s_init(void)
audio I2S init in function, config the speed of i2s and MCLK to required speed.
Definition: audio.h:44
Definition: audio.h:55
Definition: audio.h:42
void audio_set_sdm_output(AudioInput_Typedef InType, AudioRate_Typedef Audio_Rate, unsigned char audio_out_en)
sdm setting function, enable or disable the sdm output, configure SDM output paramaters.
Definition: audio.h:71
#define reg_dmic_mod
Definition: register_8258.h:231
Definition: register_8258.h:219
AudioInput_Typedef
Definition: audio.h:50