drv_sound.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #ifndef __DRV_SOUND_H_
  11. #define __DRV_SOUND_H_
  12. #include <rtthread.h>
  13. #include <rtdevice.h>
  14. #include <board.h>
  15. #define AUDIO_FREQUENCY_048K ((rt_uint32_t) 48000)
  16. #define AUDIO_FREQUENCY_044K ((rt_uint32_t) 44100)
  17. #define AUDIO_FREQUENCY_032K ((rt_uint32_t) 32000)
  18. #define AUDIO_FREQUENCY_022K ((rt_uint32_t) 22050)
  19. #define AUDIO_FREQUENCY_016K ((rt_uint32_t) 16000)
  20. #define AUDIO_FREQUENCY_011K ((rt_uint32_t) 11025)
  21. #define AUDIO_FREQUENCY_008K ((rt_uint32_t) 8000)
  22. struct drv_sai
  23. {
  24. SAI_HandleTypeDef hsai;
  25. DMA_HandleTypeDef hdma;
  26. };
  27. void SAIA_samplerate_set(rt_uint32_t samplerate);
  28. void SAIA_channels_set(rt_uint16_t channels);
  29. void SAIA_samplebits_set(rt_uint16_t samplebits);
  30. void SAIA_config_set(struct rt_audio_configure config);
  31. rt_err_t SAIA_tx_dma(void);
  32. rt_err_t SAIA_config_init(void);
  33. #endif