Skip to contentSkip to conversation

topology: Add command line topology tool to build topology binaries

PATCH Superseded Liam Girdwood 2 participants 2 messages Aug 4, 2015 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 topology: Add command line topology tool to build topology binaries

Add a command line tool that will parse topology text files and convert to the binary topology data as used by the kernel.

---
 Makefile.am          |   3 ++
 configure.ac         |   5 ++-
 topology/Makefile.am |  13 ++++++
 topology/topology.c  | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 137 insertions(+), 1 deletion(-)
 create mode 100644 topology/Makefile.am
 create mode 100644 topology/topology.c
Makefile.am +3 -0
index 5bbe588..613f62d 100644
@@ -25,6 +25,9 @@ endif
 if HAVE_UCM
 SUBDIRS += alsaucm
 endif
+if HAVE_TOPOLOGY
+SUBDIRS += topology
+endif
 
 EXTRA_DIST= TODO gitcompile
 AUTOMAKE_OPTIONS=foreign
configure.ac +4 -1
index f09aa54..4c279a9 100644
@@ -50,6 +50,8 @@ AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"],
   [#include <alsa/asoundlib.h>])
 AC_CHECK_HEADERS([alsa/use-case.h], [have_ucm="yes"], [have_ucm="no"],
   [#include <alsa/asoundlib.h>])
+AC_CHECK_HEADERS([alsa/topology.h], [have_topology="yes"], [have_topology="no"],
+  [#include <alsa/asoundlib.h>])
 AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
   [#include <samplerate.h>])
 
@@ -58,6 +60,7 @@ AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
 AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
 AM_CONDITIONAL(HAVE_UCM, test "$have_ucm" = "yes")
+AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes")
 AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
 
 dnl Check for librt
@@ -358,7 +361,7 @@ AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
 	  m4/Makefile po/Makefile.in \
 	  alsaconf/alsaconf alsaconf/Makefile \
 	  alsaconf/po/Makefile \
-	  alsaucm/Makefile \
+	  alsaucm/Makefile topology/Makefile \
 	  aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
 	  utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
 	  seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
topology/Makefile.am new file +13 -0
new file mode 100644
index 0000000..f59ce01
@@ -0,0 +1,13 @@
+bin_PROGRAMS = \
+	alsatplg
+
+alsatplg_SOURCES = topology.c
+
+AM_CPPFLAGS = \
+         -Wall -I$(top_srcdir)/include
+
+alsatplg_LDADD = -lasound
+
+# local build
+AM_CPPFLAGS += -I$(top_srcdir)/../alsa-lib/include
+alsatplg_LDADD = -L$(top_srcdir)/../alsa-lib/src/.libs
topology/topology.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.1.4
#1 lore raw
Quoted 67 lines · Liam Girdwood

Add a command line tool that will parse topology text files and convert to the binary topology data as used by the kernel.

---
 Makefile.am          |   3 ++
 configure.ac         |   5 ++-
 topology/Makefile.am |  13 ++++++
 topology/topology.c  | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 137 insertions(+), 1 deletion(-)
 create mode 100644 topology/Makefile.am
 create mode 100644 topology/topology.c
Makefile.am +3 -0
index 5bbe588..613f62d 100644
@@ -25,6 +25,9 @@ endif
 if HAVE_UCM
 SUBDIRS += alsaucm
 endif
+if HAVE_TOPOLOGY
+SUBDIRS += topology
+endif
 
 EXTRA_DIST= TODO gitcompile
 AUTOMAKE_OPTIONS=foreign
configure.ac +4 -1
index f09aa54..4c279a9 100644
@@ -50,6 +50,8 @@ AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"],
   [#include <alsa/asoundlib.h>])
 AC_CHECK_HEADERS([alsa/use-case.h], [have_ucm="yes"], [have_ucm="no"],
   [#include <alsa/asoundlib.h>])
+AC_CHECK_HEADERS([alsa/topology.h], [have_topology="yes"], [have_topology="no"],
+  [#include <alsa/asoundlib.h>])
 AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"],
   [#include <samplerate.h>])
 
@@ -58,6 +60,7 @@ AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes")
 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes")
 AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes")
 AM_CONDITIONAL(HAVE_UCM, test "$have_ucm" = "yes")
+AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes")
 AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes")
 
 dnl Check for librt
@@ -358,7 +361,7 @@ AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \
 	  m4/Makefile po/Makefile.in \
 	  alsaconf/alsaconf alsaconf/Makefile \
 	  alsaconf/po/Makefile \
-	  alsaucm/Makefile \
+	  alsaucm/Makefile topology/Makefile \
 	  aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \
 	  utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \
 	  seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \
topology/Makefile.am new file +3 -0
new file mode 100644
index 0000000..f59ce01
@@ -0,0 +1,13 @@
+bin_PROGRAMS = \
+	alsatplg
+

topology/Makefile.am line 13

Quoted 10 lines
topology/Makefile.am new file +10 -0
+alsatplg_SOURCES = topology.c
+
+AM_CPPFLAGS = \
+         -Wall -I$(top_srcdir)/include
+
+alsatplg_LDADD = -lasound
+
+# local build
+AM_CPPFLAGS += -I$(top_srcdir)/../alsa-lib/include
+alsatplg_LDADD = -L$(top_srcdir)/../alsa-lib/src/.libs

These two lines looks weird, the build shouldn't go beneath its root directory. Please drop them.
(Now I found the same in alsaucm, but it should have been overlooked.)

Quoted 31 lines
topology/topology.c new file +25 -0
new file mode 100644
index 0000000..7049bb7
@@ -0,0 +1,117 @@
+/*
+  Copyright(c) 2014-2015 Intel Corporation
+  Copyright(c) 2010-2011 Texas Instruments Incorporated,
+  All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of version 2 of the GNU General Public License as
+  published by the Free Software Foundation.
+
+  This program is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+  The full GNU General Public License is included in this distribution
+  in the file called LICENSE.GPL.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <fcntl.h>

topology/topology.c line 35

Quoted 10 lines
topology/topology.c new file +10 -0
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <dlfcn.h>
+#include <getopt.h>
+#include <alsa/asoundlib.h>
+#include <assert.h>
+
+#include "topology.h"

Use <alsa/topology.h>

thanks,

Takashi