c64-tools: new recipe for c64_tools
authorGrazvydas Ignotas <notasas@gmail.com>
Sat, 26 Oct 2013 23:24:11 +0000 (02:24 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sat, 26 Oct 2013 23:24:11 +0000 (02:24 +0300)
recipes/c64_tools/c64-tools.bb [new file with mode: 0644]
recipes/c64_tools/c64-tools/99_c64_tools [new file with mode: 0644]
recipes/c64_tools/c64-tools/c64_tools.rules [new file with mode: 0644]
recipes/c64_tools/c64-tools/op_dsp_c64.sh [new file with mode: 0755]

diff --git a/recipes/c64_tools/c64-tools.bb b/recipes/c64_tools/c64-tools.bb
new file mode 100644 (file)
index 0000000..0ad565f
--- /dev/null
@@ -0,0 +1,69 @@
+DESCRIPTION = "Tools and libraries to support the C64+ DSP found in TI's OMAP3 hardware."
+HOMEPAGE="http://tkscript.de/c64_tools/"
+LICENSE = "LGPL GPL"
+
+PV_TAR = "25Oct2013_dist"
+PV = "20131025"
+PR = "r0"
+
+SRC_URI = " \
+  http://tkscript.de/c64_tools/c64_tools-${PV_TAR}.tar.gz \
+  file://c64_tools.rules \
+  file://op_dsp_c64.sh \
+  file://99_c64_tools \
+"
+
+S = "${WORKDIR}/c64_tools"
+
+TARGET_CFLAGS += "-Wall -I../include "
+PARALLEL_MAKE = ""
+
+
+do_compile() {
+  cd ${S}/libc64/
+  # TARGET_SHARED=libc64.so.1
+  oe_runmake -f makefile.linux clean bin
+  ln -fs libc64.so.1 libc64.so
+  cd ${S}/c64_load/
+  touch libc64 # :(
+  oe_runmake -f makefile.linux clean bin
+}
+
+do_install() {
+  install -d ${D}${libdir}/
+  install -m 0755 ${S}/libc64/libc64.so.1 ${D}${libdir}/
+  install -d ${D}${sbindir}
+  install -m 0755 ${S}/c64_load/c64_load ${D}${sbindir}/
+
+  # dsp images
+  install -d ${D}${base_libdir}/dsp
+  install -m 0644 ${S}/dsp/core/core.out ${D}${base_libdir}/dsp/
+
+  # script, udev rule, sudoers
+  install -d ${D}${prefix}/pandora/scripts/
+  #install -m 0755 ${S}/scripts/go64.sh ${D}${prefix}/pandora/scripts/op_dsp_c64.sh
+  install -m 0755 ${WORKDIR}/op_dsp_c64.sh ${D}${prefix}/pandora/scripts/
+  install -d ${D}${base_libdir}/udev/rules.d/
+  install -m 0644 ${WORKDIR}/c64_tools.rules ${D}${base_libdir}/udev/rules.d/
+  install -d ${D}${sysconfdir}/sudoers.d/
+  install -m 440 ${WORKDIR}/99_c64_tools ${D}${sysconfdir}/sudoers.d/
+
+  # -dev stuff
+  install -d ${D}${includedir}/c64_tools/include
+  install -d ${D}${includedir}/c64_tools/dsp/libc64_dsp/include
+  install -m 0644 ${S}/include/*.h ${D}${includedir}/c64_tools/include
+  install -m 0644 dsp/libc64_dsp/include/com.h ${D}${includedir}/c64_tools/dsp/libc64_dsp/include/com.h
+  install -m 0644 ${S}/libc64/libc64.a ${D}${libdir}/
+  cp -a ${S}/libc64/libc64.so ${D}${libdir}/
+}
+
+FILES_${PN} += " \
+  ${base_libdir}/dsp ${prefix}/pandora/scripts \
+  ${base_libdir}/udev/rules.d ${sysconfdir}/sudoers.d/ \
+"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+COMPATIBLE_MACHINE = "omap3-pandora"
+
+SRC_URI[md5sum] = "63cc274c1b1ad47667ccc45c228c8d0f"
+SRC_URI[sha256sum] = "e5fc86ae09ff9128e104f6acf440fb0a2a25abd31622f296d53a96a54e3f6c93"
diff --git a/recipes/c64_tools/c64-tools/99_c64_tools b/recipes/c64_tools/c64-tools/99_c64_tools
new file mode 100644 (file)
index 0000000..6efb64f
--- /dev/null
@@ -0,0 +1 @@
+%wheel ALL=(ALL) NOPASSWD: /usr/pandora/scripts/op_dsp_c64.sh
diff --git a/recipes/c64_tools/c64-tools/c64_tools.rules b/recipes/c64_tools/c64-tools/c64_tools.rules
new file mode 100644 (file)
index 0000000..12a1f37
--- /dev/null
@@ -0,0 +1 @@
+KERNEL=="c64", MODE="0666"
diff --git a/recipes/c64_tools/c64-tools/op_dsp_c64.sh b/recipes/c64_tools/c64-tools/op_dsp_c64.sh
new file mode 100755 (executable)
index 0000000..25a743c
--- /dev/null
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+# ----
+# ---- file   : go64.sh
+# ---- author : Bastian Spiegel <bs@tkscript.de>
+# ---- legal  : (c) 2013 by Bastian Spiegel. 
+# ----          Distributed under terms of the GNU GENERAL PUBLIC LICENSE (GPL). See 
+# ----          http://www.gnu.org/licenses/licenses.html#GPL or COPYING_GPL for further information.
+# ----
+# ---- info   : This is part of the "c64_tools" package.
+# ----
+# ---- changed: 06Sep2013, 08Sep2013, 14Sep2013, 16Sep2013, 18Sep2013, 01Oct2013
+# ----
+# ----
+#
+
+#
+#
+# You need to be root in order to run this:
+#
+#  $ sudo ./go64.sh [c64_load args] [c64_load dspimage pathname]
+#
+# Enable kernel module debug output by setting the C64_DEBUG variable
+#  before running this script:
+#
+#  $ export C64_DEBUG=1
+#
+# To disable debug output, unset the variable:
+#
+#  $ unset C64_DEBUG
+#
+# then re-run this script.
+#
+#
+
+#export C64_DEBUG=10
+
+#ARGS=-vv
+#ARGS=-vv
+#ARGS=-v
+ARGS=
+
+DSPIMAGE=/lib/dsp/core.out
+
+# LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:./"
+
+
+if [ $# -eq 2 ]; then
+   # args + DSP image pathname
+   ARGS="$1"
+   DSPIMAGE="$2"
+else
+   if [ $# -eq 1 ]; then
+      if [ "x`echo $1 | cut -c -1`" = "x-" ]; then
+         # args only
+         ARGS="$1"
+      else
+         # DSP image pathname only
+         DSPIMAGE="$1"
+      fi
+   else 
+      if [ $# -eq 0 ]; then
+        if [ "x" != "x`/sbin/lsmod | grep c64`" -a -c /dev/c64 ] ; then
+          # don't reload or reinit, somebody may be using it
+          echo "module already loaded"
+          exit 0
+        fi
+        # use default args
+        echo " "
+      else
+        echo "Usage: sudo go64.sh [c64_load args] [c64_load dspimage pathname]"
+        exit 10;
+      fi
+   fi
+fi
+
+
+
+# Unload kernel module if it's already loaded
+if [ "x" != "x`/sbin/lsmod | grep c64`" ] ; then
+  /sbin/rmmod c64
+  rm -f /dev/c64
+fi
+
+
+# Load kernel module
+KMODARGS=
+if [ "x" != "x$C64_DEBUG" ]; then
+  KMODARGS="debug=$C64_DEBUG"
+fi
+# /sbin/insmod ./
+modprobe c64 $KMODARGS
+
+
+sleep 0.25
+
+
+# Grant everyone access to the c64 driver 
+# (done by udev rule)
+#chmod 0666 /dev/c64
+
+
+# Load COFF2 DSP image and start the DSP
+echo "go64.sh: ARGS=\"${ARGS}\" DSPIMAGE=\"${DSPIMAGE}\""
+/usr/sbin/c64_load ${ARGS} ${DSPIMAGE}