點(diǎn)擊藍(lán)字 ╳ 關(guān)注我們
陳甲印
鴻湖萬(wàn)聯(lián)資深技術(shù)專家
1 功能描述
2 準(zhǔn)備工作
3 代碼介紹
├── audio_config.hcs // 此配置文件配置聲卡信息
├── codec_config.hcs // 此配置文件配置codec信息
├── dai_config.hcs // 此配置文件配置dai信息
└── dma_config.hcs // 此配置文件配置platform信息
vendor/isoftstone/yangfan/hdf_config/khdf/device_info/
device_info.hcs//此配置文件配置聲卡驅(qū)動(dòng)服務(wù)信息
4 構(gòu)建開關(guān)
5 功能配置
audio :: host {
hostName = "audio_host";
priority = 110;
device_dai :: device {...
device_hdmi :: deviceNode {
policy = 1;
priority = 50;
preload = 0;
permission = 0666;
moduleName = "DAI_RK3568";
serviceName = "hdmi_dai_service";
deviceMatchAttr = "hdf_hdmi_dai_driver";
}
}
device_codec :: device {...
device_hdmi :: deviceNode {
policy = 1;
priority = 50;
preload = 0;
permission = 0666;
moduleName = "AUDIO_HDMI_CODEC";
serviceName = "codec_service_1";
deviceMatchAttr = "hdf_codec_driver_1";
}
...
}
...
device_dma :: device {...
device_hdmi :: deviceNode {
policy = 1;
priority = 50;
preload = 0;
permission = 0666;
moduleName = "DMA_RK3568";
serviceName = "hdmi_dma_service_0";
deviceMatchAttr = "hdf_hdmi_dma_driver";
}
...
}
device_audio :: device {...
device_hdmi :: deviceNode {
policy = 2;
priority = 60;
preload = 2;
permission = 0666;
moduleName = "HDF_AUDIO";
deviceMatchAttr = "hdf_audio_driver_1";
serviceName = "hdf_audio_codec_hdmi_dev0";
}
...
}
...
}
root {
platform {
...
controller_0x120c1001 :: card_controller {
match_attr = "hdf_audio_driver_1";
serviceName = "hdf_audio_codec_hdmi_dev0";
codecName = "codec_service_1";
platformName = "hdmi_dma_service_0";
cpuDaiName = "hdmi_dai_service";
codecDaiName = "hdmi_codec_dai";
}
...
}
}
root {
platform {
template dma_controller {
match_attr = "";
serviceName = "";
}
...
controller_0x120c1011 :: dma_controller {
match_attr = "hdf_hdmi_dma_driver";
serviceName = "hdmi_dma_service_0";
idInfo {
chipName = "/i2s@fe400000"; // 根據(jù)hdmi驅(qū)動(dòng)芯片連接的I2S總線地址進(jìn)行配置
chipIdRegister = 0xfe400000; // 根據(jù)hdmi驅(qū)動(dòng)芯片連接的I2S總線地址進(jìn)行配置
chipIdSize = 0x1000;
}
regConfig {
daiStartupSeqConfig = [
0x00, 0, 0, 0, 0xFFFFFFFF, 0xFFFFFFFF, 0, 0x0, //Transmit Operation Init
];
}
}
}
}
root {
platform {
template dai_controller {
match_attr = "";
serviceName = "";
}
...
controller_0x120c1021 :: dai_controller {
match_attr = "hdf_hdmi_dai_driver";
serviceName = "hdmi_dai_service";
idInfo {
chipName = "/i2s@fe400000"; // 根據(jù)hdmi驅(qū)動(dòng)芯片連接的I2S總線地址進(jìn)行配置
chipIdRegister = 0xfe400000; // 根據(jù)hdmi驅(qū)動(dòng)芯片連接的I2S總線地址進(jìn)行配置
chipIdSize = 0x1000;
}
regConfig {
daiStartupSeqConfig = [
0x00, 0, 0, 0, 0xFFFFFFFF, 0xFFFFFFFF, 0, 0x0, //Transmit Operation Init
];
}
}
}
}
root {
platform {
template codec_controller {
match_attr = "";
serviceName = "";
codecDaiName = "";
}
...
controller_0x120c1031 :: codec_controller {
match_attr = "hdf_codec_driver_1";
serviceName = "codec_service_1";
codecDaiName = "hdmi_codec_dai";
hwInfo = [
/*
formats, rates, rate_min, rate_max, channels_min, channels_max,
period_bytes_min, period_bytes_max, periods_min, periods_max
*/
0xF, 0xFF, 8000, 96000, 1, 2, 1, 2, 3, 4, 5
];
}
...
}
6 應(yīng)用樣例
--product-name yangfan -T audio_sample_render -T audio_sample_capture -T audio_sample_event
hdc shell
cd /data/
./audio_sample_renderYoungForYou.wav
7 功能驗(yàn)證
hdc file send E:audio_sample_render /data
hdc file send E:audio_sample_event /data
hdcfilesendE:xxx.wav/data
hdc shell
cd/data/#chmod+xaudio_sample_event#./audio_sample_event
===============================================================================
===============================================================================
===============================================================================
===============================================================================
hdc shell
# cd /data/# chmod +x audio_sample_render## ./audio_sample_render YoungForYou.wav
==================== Loading Mode ===================
| 1. Passthrough Loading |
| 2. IPC Loading |
======================================================
Please enter your choice:
2
================= Select Audio Card ==================
1. primary
2. primary1
3. hdmi
4. usb
5. a2dp
======================================================
Please enter your choice:
3
================== Play Render Menu ==================
| 1. Render Start |
| 2. Render Stop |
| 3. Render Resume |
| 4. Render Pause |
| 5. Render SetVolume |
| 6. Render GetGain |
| 7. Render SetMute |
| 8. Render SetAttributes |
| 9. Render SelectScene |
| 10. Render getEXtParams |
| 11. Render getMmapPosition |
| 12.Exit |
======================================================
your choice is:
1
Music channels = 2
Music Rate = 44100 Hz
Music Bit = 16 bit
============= Play Render Mode ==========
| 1. Render non-mmap |
| 2. Render mmap |
========================================
Please enter your choice:
1
Start Successful,Music is playing
================== Play Render Menu ==================
| 1. Render Start |
| 2. Render Stop |
| 3. Render Resume |
| 4. Render Pause |
| 5. Render SetVolume |
| 6. Render GetGain |
| 7. Render SetMute |
| 8. Render SetAttributes |
| 9. Render SelectScene |
| 10. Render getEXtParams |
| 11. Render getMmapPosition |
| 12.Exit |
======================================================
your choice is:
2
Stop Successful
================== Play Render Menu ==================
| 1. Render Start |
| 2. Render Stop |
| 3. Render Resume |
| 4. Render Pause |
| 5. Render SetVolume |
| 6. Render GetGain |
| 7. Render SetMute |
| 8. Render SetAttributes |
| 9. Render SelectScene |
| 10. Render getEXtParams |
| 11. Render getMmapPosition |
| 12.Exit |
======================================================
your choice is:
12
8 總結(jié)
原文標(biāo)題:OpenHarmony支持HDMI接口聲卡適配說(shuō)明
文章出處:【微信公眾號(hào):OpenAtom OpenHarmony】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
-
鴻蒙
+關(guān)注
關(guān)注
57文章
2352瀏覽量
42859 -
OpenHarmony
+關(guān)注
關(guān)注
25文章
3722瀏覽量
16321
原文標(biāo)題:OpenHarmony支持HDMI接口聲卡適配說(shuō)明
文章出處:【微信號(hào):gh_e4f28cfa3159,微信公眾號(hào):OpenAtom OpenHarmony】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論