1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author         Notes
8  * 2019-07-28     Ernest         the first version
9  */
10 
11 #ifndef __DRV_SOUND_H_
12 #define __DRV_SOUND_H_
13 
14 #include <rtthread.h>
15 #include <rtdevice.h>
16 #include <board.h>
17 
18 #define AUDIO_FREQUENCY_048K ((rt_uint32_t) 48000)
19 #define AUDIO_FREQUENCY_044K ((rt_uint32_t) 44100)
20 #define AUDIO_FREQUENCY_032K ((rt_uint32_t) 32000)
21 #define AUDIO_FREQUENCY_022K ((rt_uint32_t) 22050)
22 #define AUDIO_FREQUENCY_016K ((rt_uint32_t) 16000)
23 #define AUDIO_FREQUENCY_011K ((rt_uint32_t) 11025)
24 #define AUDIO_FREQUENCY_008K ((rt_uint32_t)  8000)
25 
26 struct drv_sai
27 {
28     SAI_HandleTypeDef hsai;
29     DMA_HandleTypeDef hdma;
30 };
31 
32 void SAIA_samplerate_set(rt_uint32_t samplerate);
33 void SAIA_channels_set(rt_uint16_t channels);
34 void SAIA_samplebits_set(rt_uint16_t samplebits);
35 void SAIA_config_set(struct rt_audio_configure config);
36 
37 rt_err_t SAIA_tx_dma(void);
38 rt_err_t SAIA_config_init(void);
39 
40 #endif
41