summaryrefslogtreecommitdiff
path: root/components/drivers/audio/utest/tc_audio_common.h
blob: fa506969918d14ce9128c1cad553b175032e537d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Copyright (c) 2006-2025 RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2025-05-02     wumingzi     first version
 */

#include <rtthread.h>
#include <rtdevice.h>
#include <rttypes.h>
#include "utest.h"

/* DMA buffer of audio player device refresh is triggered only when the amount of transmitted data is
 * greater than the size of a single block in the data queue */
#define TX_DMA_BLOCK_SIZE   RT_AUDIO_REPLAY_MP_BLOCK_SIZE
#define TX_DMA_FIFO_SIZE   (RT_AUDIO_REPLAY_MP_BLOCK_SIZE * 2)
#define RX_DMA_BLOCK_SIZE   RT_AUDIO_RECORD_PIPE_SIZE
#define RX_DMA_FIFO_SIZE   (RT_AUDIO_RECORD_PIPE_SIZE * 2)

#define SOUND_PLAYER_DEVICE_NAME    "sound0"
#define SOUND_MIC_DEVICE_NAME    "mic0"

#define PLAYER_SAMPLEBITS   16
#define PLAYER_SAMPLERATE   16000
#define PLAYER_CHANNEL      2
#define PLAYER_VOLUME    30

#define MIC_SAMPLEBITS   16
#define MIC_SAMPLERATE   16000
#define MIC_CHANNEL      2
#define MIC_TIME_MS      5000

extern rt_uint8_t audio_fsm_step ;

struct mic_device
{
    struct rt_audio_device audio;
    struct rt_audio_configure config;
    rt_uint8_t *rx_fifo;
};
struct sound_device
{
    struct rt_audio_device audio;
    struct rt_audio_configure config;
    rt_uint8_t volume;
    rt_uint8_t *tx_fifo;
};