CPU_DAI实践
物理拓扑图
上图可知,从dma过来数据,会保存在DAI的一个FIFO队列中,数据是并行过来的各个通道数据,经过shift移位寄存器,再经过P2S并行转串行,再经过DAVC音量控制输出到GPIO端口
音频数据接口实践
snd_soc_dai_driver
static struct snd_soc_dai_driver tcc_i2s_dai_drv[DAI_BLOCK_TYPE_MAX] = {
[DAI_BLOCK_STEREO_TYPE] = {
.name = "tcc-i2s",
.suspend = tcc_i2s_dai_suspend,
.resume = tcc_i2s_dai_resume,
.playback = {
.stream_name = "I2S-Playback",
.channels_min = 1,
.channels_max = 32,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats =
(SNDRV_PCM_FMTBIT_S16_LE
|SNDRV_PCM_FMTBIT_S24_LE),
},
.capture = ...
.ops = &tcc_i2s_ops
....
}
}
dai_driver都会注册到ALSA Core内部上去,最后通过调用其ops函数操作集来访问cpu_dai模块
snd_soc_dai_driver的ops函数集
static struct snd_soc_dai_ops tcc_i2s_ops = {
.set_clkdiv = tcc_i2s_set_clkdiv,
.set_bclk_ratio = tcc_i2s_set_bclk_ratio, //以上2个是传统的i2s同学参数,mclk和bclk的分频参数
.set_fmt = tcc_i2s_set_dai_fmt,
....
更多请跳转至这篇文章