tc_audio_common.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2006-2025 RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2025-05-02 wumingzi first version
  9. */
  10. #include <rtthread.h>
  11. #include <rtdevice.h>
  12. #include <rttypes.h>
  13. #include "utest.h"
  14. /* DMA buffer of audio player device refresh is triggered only when the amount of transmitted data is
  15. * greater than the size of a single block in the data queue */
  16. #define TX_DMA_BLOCK_SIZE RT_AUDIO_REPLAY_MP_BLOCK_SIZE
  17. #define TX_DMA_FIFO_SIZE (RT_AUDIO_REPLAY_MP_BLOCK_SIZE * 2)
  18. #define RX_DMA_BLOCK_SIZE RT_AUDIO_RECORD_PIPE_SIZE
  19. #define RX_DMA_FIFO_SIZE (RT_AUDIO_RECORD_PIPE_SIZE * 2)
  20. #define SOUND_PLAYER_DEVICE_NAME "sound0"
  21. #define SOUND_MIC_DEVICE_NAME "mic0"
  22. #define PLAYER_SAMPLEBITS 16
  23. #define PLAYER_SAMPLERATE 16000
  24. #define PLAYER_CHANNEL 2
  25. #define PLAYER_VOLUME 30
  26. #define MIC_SAMPLEBITS 16
  27. #define MIC_SAMPLERATE 16000
  28. #define MIC_CHANNEL 2
  29. #define MIC_TIME_MS 5000
  30. extern rt_uint8_t audio_fsm_step ;
  31. struct mic_device
  32. {
  33. struct rt_audio_device audio;
  34. struct rt_audio_configure config;
  35. rt_uint8_t *rx_fifo;
  36. };
  37. struct sound_device
  38. {
  39. struct rt_audio_device audio;
  40. struct rt_audio_configure config;
  41. rt_uint8_t volume;
  42. rt_uint8_t *tx_fifo;
  43. };