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 11 #include <rtthread.h> 12 #include <rtdevice.h> 13 #include <rttypes.h> 14 #include "utest.h" 15 16 /* DMA buffer of audio player device refresh is triggered only when the amount of transmitted data is 17 * greater than the size of a single block in the data queue */ 18 #define TX_DMA_BLOCK_SIZE RT_AUDIO_REPLAY_MP_BLOCK_SIZE 19 #define TX_DMA_FIFO_SIZE (RT_AUDIO_REPLAY_MP_BLOCK_SIZE * 2) 20 #define RX_DMA_BLOCK_SIZE RT_AUDIO_RECORD_PIPE_SIZE 21 #define RX_DMA_FIFO_SIZE (RT_AUDIO_RECORD_PIPE_SIZE * 2) 22 23 #define SOUND_PLAYER_DEVICE_NAME "sound0" 24 #define SOUND_MIC_DEVICE_NAME "mic0" 25 26 #define PLAYER_SAMPLEBITS 16 27 #define PLAYER_SAMPLERATE 16000 28 #define PLAYER_CHANNEL 2 29 #define PLAYER_VOLUME 30 30 31 #define MIC_SAMPLEBITS 16 32 #define MIC_SAMPLERATE 16000 33 #define MIC_CHANNEL 2 34 #define MIC_TIME_MS 5000 35 36 extern rt_uint8_t audio_fsm_step ; 37 38 struct mic_device 39 { 40 struct rt_audio_device audio; 41 struct rt_audio_configure config; 42 rt_uint8_t *rx_fifo; 43 }; 44 struct sound_device 45 { 46 struct rt_audio_device audio; 47 struct rt_audio_configure config; 48 rt_uint8_t volume; 49 rt_uint8_t *tx_fifo; 50 };