diff options
author | Stephane Desneux <stephane.desneux@iot.bzh> | 2017-11-11 19:00:27 +0100 |
---|---|---|
committer | Stephane Desneux <stephane.desneux@iot.bzh> | 2017-11-11 23:44:36 +0100 |
commit | 54447aa1f8eb8366567a96f45713fd1cae036e1e (patch) | |
tree | 4b64dd821e616967bc15e33e135ce81704b6bb65 /meta-audio-4a-framework | |
parent | c3ec51de4f611d0c841cbae34611bfdf4cf8628f (diff) |
Initial integration of 4A (AGL Advance Audio Agent)
This is a move of the work done initially by Ronan Le Martret <ronan.lemartret@iot.bzh>
in https://gerrit.automotivelinux.org/gerrit/#/c/11651/
Change-Id: I3c2124b186e72fd9804ff713b22a36a93283650e
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'meta-audio-4a-framework')
13 files changed, 366 insertions, 0 deletions
diff --git a/meta-audio-4a-framework/README.md b/meta-audio-4a-framework/README.md new file mode 100644 index 00000000..37dd360a --- /dev/null +++ b/meta-audio-4a-framework/README.md @@ -0,0 +1,3 @@ +Collection of recipes for first integration of 4A (Advanced AGL Audio Architecture). + +This layer should disappear and recipes merged into meta-agl. diff --git a/meta-audio-4a-framework/classes/afb-system-cmake.bbclass b/meta-audio-4a-framework/classes/afb-system-cmake.bbclass new file mode 100644 index 00000000..b67ea90a --- /dev/null +++ b/meta-audio-4a-framework/classes/afb-system-cmake.bbclass @@ -0,0 +1,6 @@ +inherit afb-system + +DEPENDS += "alsa-lib json-c systemd af-binder" +inherit cmake pkgconfig + +EXTRA_OECMAKE_append = " -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}" diff --git a/meta-audio-4a-framework/classes/afb-system.bbclass b/meta-audio-4a-framework/classes/afb-system.bbclass new file mode 100644 index 00000000..b553d621 --- /dev/null +++ b/meta-audio-4a-framework/classes/afb-system.bbclass @@ -0,0 +1 @@ +INSTALL_PREFIX = "${libexecdir}/agl" diff --git a/meta-audio-4a-framework/conf/layer.conf b/meta-audio-4a-framework/conf/layer.conf new file mode 100644 index 00000000..1b2ee279 --- /dev/null +++ b/meta-audio-4a-framework/conf/layer.conf @@ -0,0 +1,10 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "4a-framework" +BBFILE_PATTERN_4a-framework = "^${LAYERDIR}/" +BBFILE_PRIORITY_4a-framework = "8" diff --git a/meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb b/meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb new file mode 100644 index 00000000..ec2c04d5 --- /dev/null +++ b/meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb @@ -0,0 +1,16 @@ +SUMMARY = "AGL Audio packages" +DESCRIPTION = "The set of packages required by the AGL Audio" +LICENSE = "MIT" + +inherit packagegroup + +PACKAGES = "\ + packagegroup-agl-audio \ + " + +RDEPENDS_${PN} += "\ + 4a-alsa-core \ + 4a-hal-reference \ + agl-service-audio-4a \ + virtual/4a-hal-config \ +" diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-alsa-core/4a-alsa-core_git.bb b/meta-audio-4a-framework/recipes-multimedia/4a-alsa-core/4a-alsa-core_git.bb new file mode 100644 index 00000000..20d493cd --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-alsa-core/4a-alsa-core_git.bb @@ -0,0 +1,20 @@ +SUMMARY = "4A - Low Level Alsa Binding" +DESCRIPTION = "Low Level Alsa Binding for 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-alsa-core/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-alsa-core;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "${AUTOREV}" + +PV = "0.1" +S = "${WORKDIR}/git" + +inherit afb-system-cmake + +FILES_${PN}-dev += "${INSTALL_PREFIX}/4a-alsa-core/htdocs" + +FILES_${PN} += "${INSTALL_PREFIX}/4a-alsa-core" +FILES_${PN} += "${INSTALL_PREFIX}/lib" diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-community/4a-hal-community_git.bb b/meta-audio-4a-framework/recipes-multimedia/4a-hal-community/4a-hal-community_git.bb new file mode 100644 index 00000000..d39de517 --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-community/4a-hal-community_git.bb @@ -0,0 +1,24 @@ +SUMMARY = "4A - Community HALs" +DESCRIPTION = "HALs maintained by AGL Community for 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-community/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-hal-community;protocol=https;branch=${AGL_BRANCH} \ + " + +SRCREV = "${AUTOREV}" + +PV = "0.1" +S = "${WORKDIR}/git" + +inherit afb-system-cmake + +#Select Here your HAL +EXTRA_OECMAKE += " -DHAL_JABRA=1" + +FILES_${PN}-dev += "${INSTALL_PREFIX}/afb-aaaa/htdocs" +FILES_${PN} += "${INSTALL_PREFIX}/afb-aaaa" +FILES_${PN} += "${INSTALL_PREFIX}/lib" diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb new file mode 100644 index 00000000..32f42299 --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb @@ -0,0 +1,40 @@ +SUMMARY = "4A - HAL Configuration" +DESCRIPTION = "Configuration files for HALs used in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-reference/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "file://asound.conf.template \ + file://ahl-config.json.template \ + " + +PV = "0.1" + +RPROVIDES_${PN} = "virtual/4a-hal-config" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +AUDIO_DEV_NAME ?= "Speakers" +AUDIO_DEV_NAME_ID ?= "usb-audio" + +AUDIO_DEV_NAME_m3ulcb = "M3-Speakers" +AUDIO_DEV_NAME_ID_m3ulcb = "rsnddai0ak4613h" + +inherit afb-system + +do_install () { + install -d ${D}/${sysconfdir} + install -m 0755 ${WORKDIR}/asound.conf.template ${D}/${sysconfdir}/asound.conf + sed -i "s|@AUDIO_DEV_NAME@|${AUDIO_DEV_NAME}|g" ${D}/${sysconfdir}/asound.conf + sed -i "s|@AUDIO_DEV_NAME_ID@|${AUDIO_DEV_NAME_ID}|g" ${D}/${sysconfdir}/asound.conf + sed -i "s|@INSTALL_PREFIX@|${INSTALL_PREFIX}|g" ${D}/${sysconfdir}/asound.conf + + install -d "${D}${prefix}/agl-service-audio-4a" + install -m 0755 ${WORKDIR}/ahl-config.json.template "${D}${prefix}/agl-service-audio-4a/ahl-agl-service-audio-4a-config.json" + sed -i "s|@AUDIO_DEV_NAME_ID@|${AUDIO_DEV_NAME_ID}|g" "${D}${prefix}/agl-service-audio-4a/ahl-agl-service-audio-4a-config.json" +} + +FILES_${PN} += "${sysconfdir}/asound.conf" +FILES_${PN} += "${prefix}/agl-service-audio-4a/ahl-agl-service-audio-4a-config.json" diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template new file mode 100644 index 00000000..82e9668d --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template @@ -0,0 +1,36 @@ +{ + "version": "0.2.0", + "policy_module": "AudioPolicy_v1", + "description": "High-level binding configuration file", + "note": "Devices and routings are always listed in order of priority (for device selection rules)", + "hal_list": ["@AUDIO_DEV_NAME_ID@"], + "audio_roles": [ + { + "name": "Guidance", + "description": "Important user information where user action is expected (e.g. navigation instruction)", + "priority": 25, + "output": [ + "alsa.plug:Guidance_Main" + ], + "interupt_behavior": "continue" + }, + { + "name": "Notification", + "description": "HMI or else notifications (e.g. touchscreen events, speech recognition on/off,...)", + "priority": 100, + "output": [ + "alsa.plug:Notification_Main" + ], + "interupt_behavior": "pause" + }, + { + "name": "Entertainment", + "description": "Multimedia content (e.g. tuner, media player, etc.)", + "priority": 0, + "output": [ + "alsa.plug:Entertainment_Main" + ], + "interupt_behavior": "pause" + } + ] +} diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template new file mode 100644 index 00000000..87e833da --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template @@ -0,0 +1,136 @@ + +# ------------------------------------------------------ +# Mixer PCM allow to play multiple stream simultaneously +# ------------------------------------------------------ +pcm.@AUDIO_DEV_NAME@ { + type dmix + slave {pcm "hw:@AUDIO_DEV_NAME_ID@"} # + ipc_key 1001 # ipc_key should be unique to each dmix +} + +# ----------------------------------------------------- +# Register ControllerHookPlugin (ToiBeFix fullpath) +# ----------------------------------------------------- +pcm_hook_type.CtlHookPlugin { + install "AlsaInstallHook" + lib "@INSTALL_PREFIX@/lib/policy_alsa_hook.so" +} + + +# ------------------------------------------------------- +# Define one Audio Virtual Channel per Audio Roles +# ------------------------------------------------------- +pcm.MusicPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "@AUDIO_DEV_NAME@" + + # name should match with HAL definition + control.name "Playback Multimedia" +} + +pcm.NaviPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "@AUDIO_DEV_NAME@" + + # name should match with HAL definition + control.name "Playback Navigation" +} + +pcm.UrgentPCM { + type softvol + + # Point Slave on HOOK for policies control + slave.pcm "@AUDIO_DEV_NAME@" + + # name should match with HAL definition + control.name "Playback Emergency" +} + +# ---------------------------------------------------- +# Define one hooked PCM channel per Audio Roles +# ---------------------------------------------------- +pcm.Multimedia { + type hooks + slave {pcm "MusicPCM"} + hooks.0 { + comment "Defined used hook sharelib and provide arguments/config to install func" + type "CtlHookPlugin" + hook_args { + + # print few log messages (default false) + verbose true + + # uri to audio-4a policy engine + uri="unix:/var/tmp/pol4a" + + # timeout in ms (default 500) + timeout 5000 + + # force API synchronous mode + synchronous true + + # api subcall to request a role + request { + multimedia-role "{'uid':'alsa-hook-client'}" + signal-timeout "{'timeout':180, 'music':'quit'}" + } + + # api subcall to request a role + release { + release-role "{'uid':'alsa-hook-client'}" + } + + # map AGL event on Unix signal. Search in event for json key=value + events { + sig-02 {search music, value quit} + sig-31 {search event, value start} + sig-32 {search event, value start} + } + } + } +} + +pcm.Navigation { + type hooks + slave {pcm "NaviPCM"} + hooks.0 { + comment "Defined used hook sharelib and provide arguments/config to install func" + type "CtlHookPlugin" + hook_args { + + # print few log messages (default false) + verbose true + + # uri to audio-4a policy engine + uri="unix:/var/tmp/pol4a" + + # timeout in ms (default 500) + timeout 5000 + + # force API synchronous mode + synchronous true + + # api subcall to request a role + request { + navigation-role "{'uid':'alsa-hook-client'}" + signal-timeout "{'timeout':5, 'navi':'quit'}" + } + + # api subcall to request a role + release { + release-role "{'uid':'alsa-hook-client'}" + } + + # map AGL event on Unix signal. Search in event for json key=value + events { + sig-02 {search navi, value quit} + sig-31 {search event, value start} + sig-32 {search event, value start} + } + } + } +} diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-reference/4a-hal-reference_git.bb b/meta-audio-4a-framework/recipes-multimedia/4a-hal-reference/4a-hal-reference_git.bb new file mode 100644 index 00000000..1dcaacaa --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-reference/4a-hal-reference_git.bb @@ -0,0 +1,23 @@ +SUMMARY = "4A - Reference HALs" +DESCRIPTION = "HALs used for Reference boards in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-reference/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-hal-reference;protocol=https;branch=${AGL_BRANCH}" + +SRCREV = "${AUTOREV}" + +PV = "0.1" +S = "${WORKDIR}/git" + +inherit afb-system-cmake + +#Select Here your HAL +EXTRA_OECMAKE_m3ulcb += " -DHAL_RCAR-M3=1" + +FILES_${PN}-dev += "${INSTALL_PREFIX}/afb-aaaa/htdocs" +FILES_${PN} += "${INSTALL_PREFIX}/afb-aaaa" +FILES_${PN} += "${INSTALL_PREFIX}/lib" diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-unicens/4a-hal-unicens_git.bb b/meta-audio-4a-framework/recipes-multimedia/4a-hal-unicens/4a-hal-unicens_git.bb new file mode 100644 index 00000000..a013a3a4 --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-unicens/4a-hal-unicens_git.bb @@ -0,0 +1,18 @@ +SUMMARY = "4A - Unicens (MOST) Binding" +DESCRIPTION = "Unicens binding (MOST audio network support) for 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-unicens/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-hal-unicens;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "${AUTOREV}" + +PV = "0.1" +S = "${WORKDIR}/git" + +inherit afb-system-cmake + +FILES_${PN}-dev += "${INSTALL_PREFIX}/afb-aaaa/htdocs" +FILES_${PN} += "${INSTALL_PREFIX}/afb-aaaa" diff --git a/meta-audio-4a-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb b/meta-audio-4a-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb new file mode 100644 index 00000000..260c636d --- /dev/null +++ b/meta-audio-4a-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb @@ -0,0 +1,33 @@ +SUMMARY = "4A - High Level Audio API Service" +DESCRIPTION = "High Level Audio API service used in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/apps/agl-service-audio-4a/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/apps/agl-service-audio-4a;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "${AUTOREV}" + +PV = "0.1" +S = "${WORKDIR}/git" + +inherit cmake aglwgt pkgconfig + +DEPENDS += "alsa-lib json-c systemd af-binder glib-2.0" + +do_aglwgt_deploy_append() { + cat <<'EOF' >${D}/${sysconfdir}/agl-postinsts/99_4A_service_patch.sh +svcfile=/usr/local/lib/systemd/user/afm-service-agl-service-audio-4a@1.0.service +set -x +echo "-- TMP 4A INSTALL FIX from meta-agl/meta-app-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb - MUST BE REMOVED !!!" +while [ ! -f $svcfile ]; do + echo . + sleep 0.2 +done +sed -i -e 's|--verbose |--verbose --ldpath=/usr/libexec/agl/afb-aaaa/lib/:/usr/libexec/agl/4a-alsa-core/lib/ |' $svcfile +echo "-- TMP 4A INSTALL FIX END" + +EOF + chmod a+x ${D}/${sysconfdir}/agl-postinsts/99_4A_service_patch.sh +} |