]> git.alsa-project.org Git - alsa-firmware.git/commitdiff
Hotplug firmware loader support
authorTakashi Iwai <tiwai@suse.de>
Mon, 20 Dec 2004 11:32:34 +0000 (11:32 +0000)
committerTakashi Iwai <tiwai@suse.de>
Mon, 20 Dec 2004 11:32:34 +0000 (11:32 +0000)
New configure options, --disable-hotplug, --disable-loader and
--with-hotplug-dir.  As default, the firmware files will be installed
to the paths for both hotplug and ALSA fw loaders.

README
configure.in
mixartloader/Makefile.am
vxloader/Makefile.am
vxloader/toxlx.c [new file with mode: 0644]

diff --git a/README b/README
index 719013fc6d1bfbc33cc0d051d682f14fb0b4724e..683de59086e4bd0ec04a325022f7934915d06122 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,37 @@
+GENERAL
+=======
+
 This package contains the firmware binaries for each loader program
-included in alsa-tools package.  Specify the same prefix option given
-to the alsa-tools configure script, too, in order to keep the
+included in alsa-tools package.  The firmware data can be used by each
+ALSA firmware loader program like vxloader, or passed through the
+hotplug firmware-loading mechanism.
+
+
+HOTPLUG FIRMWARE LOADER SUPPORT
+===============================
+
+The recent ALSA driver supports the hotplug firmware loader.
+As default, the package will install firmware data to the places for
+both the old ALSA fw loader and the hotplug fw loader.  To disable
+the installation of old ALSA fw loader data (if both ALSA and hotplug
+fw loaders are available), pass --disable-loader to configure.
+Similarly, to disable the hotplug fw loader data, pass
+--disable-hotplug option.
+
+For the old ALSA fw loader, specify the same prefix option given to
+the alsa-tools configure script, too, in order to keep the
 installation directories consistent.
 
+The default directory for hotplug firmware data files is
+/usr/lib/hotplug/firmware.  You can change to another path via
+--with-hotplug-dir option.
+
+
+LICENSE AND COPYRIGHT
+=====================
+
+The files contained in this package is regarded as the example data
+for each alsa-tools program.  Hence, their copyright and license
+follow basically to the definition of alsa-tools programs.  The
+detailed license and copyright is found in README of each
+subdirectory.
index 1f5e0209652d54a4ec2a36297492767ce73c3b5d..f8269f763d840b451ed81f9610ef59787ab4e19a 100644 (file)
@@ -7,6 +7,24 @@ AC_HEADER_STDC
 
 echo $VERSION > $srcdir/version
 
+AC_ARG_ENABLE(loader,
+  [  --disable-loader        Disable the old ALSA fw loader support],
+  [loader="$enableval"],[loader=yes])
+AC_ARG_ENABLE(hotplug,
+  [  --disable-hotplug       Disable the hotplug fw loader support],
+  [hotplug="$enableval"],[hotplug=yes])
+
+AM_CONDITIONAL(USE_LOADER, test "$loader" = "yes")
+AM_CONDITIONAL(USE_HOTPLUG, test "$hotplug" = "yes")
+
+AC_ARG_WITH(hotplug-dir,
+  [  --with-hotplug-dir      Specify the hotplug firmware directory],
+  [hotplugfwdir="$withval"],
+  [hotplugfwdir="/usr/lib/hotplug/firmware"])
+HOTPLUGFWDIR="$hotplugfwdir"
+AC_SUBST(HOTPLUGFWDIR)
+    
+
 AC_OUTPUT(Makefile \
          hdsploader/Makefile \
          mixartloader/Makefile \
index 10213eedbc8bdbabe77a2ba33305f8e8604d5461..41538d4ce78bc4eba20e66121f19830ee27e5814 100644 (file)
@@ -1,11 +1,25 @@
 MYNAME = mixartloader
 
-cfg_files = miXart.conf \
+cfg_files = miXart.conf
+dsp_files = \
        miXart8AES.xlx \
        miXart8.elf \
        miXart8.xlx
 
-EXTRA_DIST = $(cfg_files)
+EXTRA_DIST = $(cfg_files) $(dsp_files)
 
+if USE_LOADER
 firmwaredir = $(datadir)/alsa/firmware/$(MYNAME)
-firmware_DATA = $(cfg_files)
+firmware_DATA = $(cfg_files) $(dsp_files)
+else
+firmwaredir = 
+firmware_DATA = 
+endif
+
+if USE_HOTPLUG
+hotplugfwdir = @HOTPLUGFWDIR@/mixart
+hotplugfw_DATA = $(dsp_files)
+else
+hotplugfwdir =
+hotplugfw_DATA = 
+endif
index 7d0c1b12ff3e7772b438fd9a674d91fec406994e..ca21494d68d849aeb8d2278f3512bb4e4e4e89a0 100644 (file)
@@ -1,6 +1,8 @@
 MYNAME = vxloader
 
-cfg_files = vx222.conf vxboard.conf vxpocket.conf vxp440.conf \
+cfg_files = vx222.conf vxboard.conf vxpocket.conf vxp440.conf
+
+dsp_files = \
        bd56002.boot \
        bd563s3.boot \
        bd563v2.boot \
@@ -9,13 +11,37 @@ cfg_files = vx222.conf vxboard.conf vxpocket.conf vxp440.conf \
        l_1_v22.d56 \
        l_1_vx2.d56 \
        l_1_vxp.d56 \
-       l_1_vp4.d56 \
+       l_1_vp4.d56
+
+rbt_files = \
        x1_2_v22.rbt \
        x1_1_vx2.rbt \
        x1_1_vxp.rbt \
        x1_1_vp4.rbt
 
-EXTRA_DIST = $(cfg_files)
+xlx_files = $(rbt_files:%.rbt=%.xlx)
+
+noinst_PROGRAMS = toxlx
+toxlx_SOURCES = toxlx.c
 
+EXTRA_DIST = $(cfg_files) $(dsp_files) $(rbt_files) toxlx.c
+CLEANFILES = $(xlx_files)
+
+if USE_LOADER
 firmwaredir = $(datadir)/alsa/firmware/$(MYNAME)
-firmware_DATA = $(cfg_files)
+firmware_DATA = $(cfg_files) $(dsp_files) $(rbt_files)
+else
+firmwaredir = 
+firmware_DATA = 
+endif
+
+if USE_HOTPLUG
+hotplugfwdir = @HOTPLUGFWDIR@/vx
+hotplugfw_DATA = $(dsp_files) $(xlx_files)
+else
+hotplugfwdir =
+hotplugfw_DATA = 
+endif
+
+%.xlx: %.rbt toxlx
+       ./toxlx < $< > $@
diff --git a/vxloader/toxlx.c b/vxloader/toxlx.c
new file mode 100644 (file)
index 0000000..807b9ac
--- /dev/null
@@ -0,0 +1,68 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+int main()
+{
+       char buf[256];
+       int data, c, idx, length;
+       unsigned char *imgbuf = NULL;
+       char *p;
+
+       c = 0;
+       data = 0;
+       idx = 0;
+       length = 0;
+       while (fgets(buf, sizeof(buf), stdin)) {
+               if (strncmp(buf, "Bits:", 5) == 0) {
+                       for (p = buf + 5; *p && isspace(*p); p++)
+                               ;
+                       if (! *p) {
+                               fprintf(stderr, "corrupted file in Bits line\n");
+                               return 1;
+                       }
+                       length = atoi(p);
+                       length /= 8;
+                       if (length <= 0) {
+                               fprintf(stderr, "corrupted file, detected length = %d\n", length);
+                               return 1;
+                       }
+                       imgbuf = malloc(length);
+                       if (! imgbuf) {
+                               fprintf(stderr, "cannot alloc %d bytes\n", length);
+                               return 1;
+                       }
+                       continue;
+               }
+               if (buf[0] != '0' && buf[1] != '1')
+                       continue;
+               if (length <= 0) {
+                       fprintf(stderr, "corrupted file, starting without Bits line\n");
+                       return 1;
+               }
+               for (p = buf; *p == '0' || *p == '1'; p++) {
+                       data |= (*p - '0') << c;
+                       c++;
+                       if (c >= 8) {
+                               imgbuf[idx] = data;
+                               data = 0;
+                               c = 0;
+                               idx++;
+                               if (idx >= length)
+                                       break;
+                       }
+               }
+       }
+       if (c)
+               imgbuf[idx++] = data;
+       if (idx != length) {
+               fprintf(stderr, "length doesn't match: %d != %d\n", idx, length);
+               return 1;
+       }
+
+       for (idx = 0; idx < length; idx++)
+               putchar(imgbuf[idx]);
+
+       return 0;
+}