On 3/20/2018 11:11 PM, Hongmei Gou wrote:
* This is to enable run-time firmware switch between opencl-monitor and tiovx

Signed-off-by: Hongmei Gou <[email protected]>
---
  recipes-ti/tiovx/files/reload-dsp-fw.sh | 66 +++++++++++++++++++++++++++++++++
  recipes-ti/tiovx/tiovx-sys-iface.bb     | 12 +++++-
  2 files changed, 77 insertions(+), 1 deletion(-)
  create mode 100755 recipes-ti/tiovx/files/reload-dsp-fw.sh

diff --git a/recipes-ti/tiovx/files/reload-dsp-fw.sh 
b/recipes-ti/tiovx/files/reload-dsp-fw.sh
new file mode 100755
index 0000000..198fd60
--- /dev/null
+++ b/recipes-ti/tiovx/files/reload-dsp-fw.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+usage() {
+    cat << EOF
+
+  Usage:
+         $0 <fw-type: opencl, tiovx>
+
+EOF
+}
+
+if [ "$1" ]; then
+case "$1" in
+    opencl) echo "Reload opencl firmware to DSP"
+        ;;
+    tiovx) echo "Reload tiovx firmware to DSP"
+        ;;
+    *) echo "Wrong argument $1"
+       usage
+       exit
+        ;;
+esac
+else
+       usage
+       exit
+fi
+
+fw="${1}"
+
+if [[ ${fw} == opencl ]]; then
+    #Start OpenCL CMEM memory allocation daemon
+    if pgrep -x "ti-mctd" > /dev/null
+    then
+        echo "ti-mctd is running"
+    else
+        echo "Starting ti-mctd..."
+        ti-mctd
+    fi
+    # Link opencl monitor firmware for DSPs
+    ln -s -f /lib/firmware/dra7-dsp1-fw.xe66.opencl-monitor 
/lib/firmware/dra7-dsp1-fw.xe66
+    ln -s -f /lib/firmware/dra7-dsp2-fw.xe66.opencl-monitor 
/lib/firmware/dra7-dsp2-fw.xe66
+fi
+
+if [[ ${fw} == tiovx ]]; then
+    # Kill CMEM multi-process daemon. This releases all CMEM memory used by 
OpenCL memory allocation
+    pkill ti-mctd
+
+    # Link tiovx firmware for DSPs
+    ln -s -f /lib/firmware/dra7-dsp1-fw.xe66.openvx 
/lib/firmware/dra7-dsp1-fw.xe66
+    ln -s -f /lib/firmware/dra7-dsp2-fw.xe66.openvx 
/lib/firmware/dra7-dsp2-fw.xe66
+fi
+
+cd /sys/bus/platform/drivers/omap-rproc/
+
+# release DSPs
+echo "Releasing DSPs..."
+echo 40800000.dsp > unbind
+
+echo 41000000.dsp > unbind
+
+# reload firmware for DSPs
+echo "Reloading firmware for DSPs..."
+echo 40800000.dsp > bind
+
+echo 41000000.dsp > bind
+
+cd ~-
diff --git a/recipes-ti/tiovx/tiovx-sys-iface.bb 
b/recipes-ti/tiovx/tiovx-sys-iface.bb
index bcfbcc9..8f1b4d3 100644
--- a/recipes-ti/tiovx/tiovx-sys-iface.bb
+++ b/recipes-ti/tiovx/tiovx-sys-iface.bb
@@ -7,13 +7,19 @@ LIC_FILES_CHKSUM = 
"file://iface/VSDK/docs/TIOVX-SYS-IFACE_1.0.0.0_manifest.html
  require recipes-ti/includes/tisdk-paths.inc
  require tiovx-sys.inc
-PR = "r0"
+PR = "r1"
COMPATIBLE_MACHINE = "dra7xx"
  PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit update-alternatives +FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

This FILESEXTRAPATHS_prepend is not required as this is not a bbappend.

The oe-core/meta/classes/base.bbclass initializes the search path relative to the bb file through the FILESPATH variable with "${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files"

+
+SRC_URI_append += "\
+     file://reload-dsp-fw.sh \
+"
+
  S = "${WORKDIR}/git"
do_install () {
@@ -21,9 +27,13 @@ do_install () {
      CP_ARGS="-Prf --preserve=mode,timestamps --no-preserve=ownership"
      install -d ${D}${TIOVX_INSTALL_DIR_RECIPE}/sys-iface
      cp ${CP_ARGS} ${S}/iface/VSDK/* ${D}${TIOVX_INSTALL_DIR_RECIPE}/sys-iface
+#   Install the firmware
      install -d ${D}/${base_libdir}/firmware
      install -m 0644 ${S}/firmware/tiovx_dsp1.xe66 
${D}/${base_libdir}/firmware/dra7-dsp1-fw.xe66.openvx
      install -m 0644 ${S}/firmware/tiovx_dsp2.xe66 
${D}/${base_libdir}/firmware/dra7-dsp2-fw.xe66.openvx
+#   Install the scripts for loading dsp firmware
+    install -d ${D}${bindir}/
+    install -m 0755 ${WORKDIR}/reload-dsp-fw.sh ${D}${bindir}
  }
ALTERNATIVE_${PN} = "dra7-dsp1-fw.xe66 dra7-dsp2-fw.xe66"

_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago

Reply via email to