Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio: Start add simulated DAI and host component #8830

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/audio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,30 @@ config DAI_VERBOSE_GLITCH_WARNINGS
always emit a warning. This option useful to debug issues with
DAI DMA operation and issues with low-latency scheduling.

config ZEPHYR_SIMULATED_HOST_DRIVER
bool "Simulate host component"
default n
help
Select this to replace host-zephyr.c with simulated version of it,
simulated-host-zephyr.c. It replaces all playback content with
internally generated triangle wave. The PCM code is stepped for
every sample by +1 or -1 depending on channel. Each channel will
have unique waveform start base on step and offset. In capture
direction the waveform is passed to user but the PCM samples
are checked for expected triangle wave from the simulated DAI.
If there are missing PCM samples values they are reported as
glitch. The capture pipelines latency is reported when start
of test waveform is detected.

config ZEPHYR_SIMULATED_DAI_DRIVER
bool "Simulate DAI component"
default n
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do we get the CI to test these?..

help
Select this to replace dai-zephyr.c with simulated version it,
simulated-dai-zephyr.c. The simulated version skips are DAI device
driver programming and DMA transfer setup and usage. The playback
stream is checked for glitches and playback pipelines delay. The
capture stream is similar triangle wave as generated by simulated
host playback.

endmenu
21 changes: 21 additions & 0 deletions src/audio/copier/host_copier.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ struct hc_buf {
uint32_t current_end;
};

struct host_triangle_generator_state {
int32_t prev_pcm_value[SOF_IPC_MAX_CHANNELS];
int32_t pcm_increment[SOF_IPC_MAX_CHANNELS];
int32_t countdown;
bool first_copy;
};

struct host_glitch_detect_state {
int32_t prev_pcm_value[SOF_IPC_MAX_CHANNELS];
int32_t glitch_count[SOF_IPC_MAX_CHANNELS];
int32_t zeros_count[SOF_IPC_MAX_CHANNELS];
int32_t ignore_count;
bool no_signal[SOF_IPC_MAX_CHANNELS];
bool first_value;
bool zeros_count_reported;
};

/**
* \brief Host component data.
*
Expand All @@ -47,6 +64,10 @@ struct hc_buf {
* host_size is the host buffer size (in bytes) specified in the IPC parameters.
*/
struct host_data {
#if CONFIG_ZEPHYR_SIMULATED_HOST_DRIVER
struct host_triangle_generator_state triangle;
struct host_glitch_detect_state glitch;
#endif
/* local DMA config */
struct dma *dma;
struct dma_chan_data *chan;
Expand Down
Loading
Loading