diff options
Diffstat (limited to 'setup/FreeBSD')
-rw-r--r-- | setup/FreeBSD/build.sh | 176 | ||||
-rw-r--r-- | setup/FreeBSD/confgen.c | 188 | ||||
-rw-r--r-- | setup/FreeBSD/etc/rc.d/oss | 58 | ||||
-rw-r--r-- | setup/FreeBSD/make.local | 11 | ||||
-rw-r--r-- | setup/FreeBSD/mkpkg.sh | 18 | ||||
-rw-r--r-- | setup/FreeBSD/oss/build/Makefile.osscore | 7 | ||||
-rw-r--r-- | setup/FreeBSD/oss/build/Makefile.tmpl | 8 | ||||
-rw-r--r-- | setup/FreeBSD/oss/build/bsdpci.inc | 153 | ||||
-rw-r--r-- | setup/FreeBSD/oss/build/bsdvirtual.inc | 83 | ||||
-rw-r--r-- | setup/FreeBSD/oss/build/devid.h | 5 | ||||
-rw-r--r-- | setup/FreeBSD/oss/build/install.sh | 75 | ||||
-rw-r--r-- | setup/FreeBSD/oss/build/module.inc | 89 | ||||
-rw-r--r-- | setup/FreeBSD/oss/build/osscore.c | 559 | ||||
-rw-r--r-- | setup/FreeBSD/oss/soundon.user | 7 | ||||
-rw-r--r-- | setup/FreeBSD/pkg-comment | 1 | ||||
-rw-r--r-- | setup/FreeBSD/pkg-descr | 4 | ||||
-rw-r--r-- | setup/FreeBSD/pkg-message | 87 | ||||
-rw-r--r-- | setup/FreeBSD/pkg-postinstall | 18 | ||||
-rw-r--r-- | setup/FreeBSD/pkg-postremove | 10 | ||||
-rw-r--r-- | setup/FreeBSD/pkg-preremove | 10 | ||||
-rwxr-xr-x | setup/FreeBSD/sbin/soundoff | 60 | ||||
-rwxr-xr-x | setup/FreeBSD/sbin/soundon | 122 |
22 files changed, 1749 insertions, 0 deletions
diff --git a/setup/FreeBSD/build.sh b/setup/FreeBSD/build.sh new file mode 100644 index 0000000..595d77e --- /dev/null +++ b/setup/FreeBSD/build.sh @@ -0,0 +1,176 @@ +#!/bin/sh + +. ./.directories + +if which gawk >/dev/null +then + TXT2MAN=$SRCDIR/setup/txt2man +else + echo "No gawk found. Using lesser replacement" >&2 + cc -o txt2man origdir/setup/txt2man.c + TXT2MAN=./txt2man +fi + +rm -rf prototype + +mkdir prototype +mkdir prototype/etc +mkdir prototype/etc/rc.d +mkdir prototype/usr +mkdir prototype/usr/bin +mkdir prototype/usr/sbin +mkdir -p prototype/$OSSLIBDIR +mkdir prototype/$OSSLIBDIR/etc +mkdir prototype/$OSSLIBDIR/lib +mkdir prototype/$OSSLIBDIR/include +mkdir prototype/$OSSLIBDIR/include/internals +mkdir prototype/$OSSLIBDIR/include/sys +mkdir prototype/$OSSLIBDIR/modules +mkdir prototype/$OSSLIBDIR/objects +mkdir prototype/usr/share +mkdir prototype/usr/share/man +mkdir prototype/usr/share/man/man1 +mkdir prototype/usr/share/man/man7 +mkdir prototype/usr/share/man/man8 +mkdir prototype/$OSSLIBDIR/conf + +echo "OSSLIBDIR=$OSSLIBDIR" > prototype/etc/oss.conf + +# Regenerating the config file templates +rm -f /tmp/confgen +if ! cc -o /tmp/confgen ./setup/FreeBSD/confgen.c +then + echo Building confgen failed + exit 1 +fi + +if ! /tmp/confgen prototype/$OSSLIBDIR/conf $OSSLIBDIR/conf kernel/drv/* kernel/nonfree/drv/* +then + echo Running confgen failed + exit 1 +fi + +rm -f /tmp/confgen + +cp -r $SRCDIR/setup/FreeBSD/oss/* prototype/$OSSLIBDIR/ +cp $SRCDIR/kernel/OS/FreeBSD/wrapper/bsddefs.h prototype/$OSSLIBDIR/build/ + +cp $SRCDIR/include/*.h prototype/$OSSLIBDIR/include/sys/ +cp $SRCDIR/lib/libOSSlib/midiparser.h prototype/$OSSLIBDIR/include/ +cp kernel/framework/include/timestamp.h kernel/framework/include/local_config.h $SRCDIR/kernel/framework/include/*_core.h $SRCDIR/kernel/framework/include/ossddk/*.h prototype/$OSSLIBDIR/include/internals +cp kernel/framework/include/ossddk/oss_limits.h prototype/$OSSLIBDIR/include/internals + +ld -r -o prototype/$OSSLIBDIR/build/osscore.lib target/objects/*.o + +rm -f devlist.txt + +for n in target/modules/*.o +do + N=`basename $n .o` +echo Check devices for $N + grep "^$N[ ]" ./devices.list >> devlist.txt +done + +(cd target/bin; rm -f ossrecord; ln -s ossplay ossrecord) +cp target/modules/*.o prototype/$OSSLIBDIR/objects +cp target/build/*.c prototype/$OSSLIBDIR/build/ +cp target/bin/* prototype/usr/bin/ +cp target/sbin/* prototype/usr/sbin/ +cp $SRCDIR/setup/FreeBSD/sbin/* prototype/usr/sbin/ +cp $SRCDIR/setup/FreeBSD/etc/rc.d/oss prototype/etc/rc.d +cp lib/libOSSlib/libOSSlib.so prototype/$OSSLIBDIR/lib + +cp devlist.txt prototype/$OSSLIBDIR/etc/devices.list + +if test -d kernel/nonfree +then + rm -f $SRCDIR/devlists/FreeBSD + cp devlist.txt $SRCDIR/devlists/FreeBSD +fi + +# Generate Man pages for commands +for i in target/bin/* +do +CMD=`basename $i` +$TXT2MAN -t "$CMD" -v "User Commands" -s 1 cmd/$CMD/$CMD.man | gzip -9 > prototype/usr/share/man/man1/$CMD.1.gz +echo done $CMD +done + +for i in target/sbin/* +do + CMD=`basename $i` + if test -f cmd/$CMD/$CMD.man + then + $TXT2MAN -t "$CMD" -v "System Administration Commands" -s 8 cmd/$CMD/$CMD.man | gzip -9 > prototype/usr/share/man/man8/$CMD.8.gz + echo done $CMD + fi +done + +for i in $SRCDIR/misc/man1m/*.man +do + N=`basename $i .man` + $TXT2MAN -t "$CMD" -v "OSS System Administration Commands" -s 1 $i | gzip -9 > prototype/usr/share/man/man1/$N.1.gz +done + +$TXT2MAN -t "ossdetect" -v "User Commands" -s 8 os_cmd/FreeBSD/ossdetect/ossdetect.man | gzip -9 > prototype/usr/share/man/man8/ossdetect.8.gz +echo done ossdetect + +for n in target/modules/*.o +do + N=`basename $n .o` + ld -r -o prototype/$OSSLIBDIR/$MODULES/$N.o $n + echo Check devices for $N + grep "^$N[ ]" ./devices.list >> devlist.txt + + rm -f /tmp/ossman.txt + + if test -f $SRCDIR/kernel/drv/$N/$N.man + then + sed "s:CONFIGFILEPATH:$OSSLIBDIR/conf:g" < $SRCDIR/kernel/drv/$N/$N.man > /tmp/ossman.txt + $TXT2MAN -t "$CMD" -v "OSS Devices" -s 7 /tmp/ossman.txt|gzip -9 > prototype/usr/share/man/man7/$N.7.gz + else + if test -f $SRCDIR/kernel/nonfree/drv/$N/$N.man + then + sed "s:CONFIGFILEPATH:$OSSLIBDIR/conf:g" < $SRCDIR/kernel/nonfree/drv/$N/$N.man > /tmp/ossman.txt + $TXT2MAN -t "$CMD" -v "OSS Devices" -s 7 $SRCDIR/kernel/nonfree/drv/$N/$N.man|gzip -9 > prototype/usr/share/man/man7/$N.7.gz + fi + fi +done + +sed "s:CONFIGFILEPATH:$OSSLIBDIR/conf:g" < $SRCDIR/kernel/drv/osscore/osscore.man > /tmp/ossman.txt +$TXT2MAN -t "osscore" -v "OSS Devices" -s 7 /tmp/ossman.txt|gzip -9 > prototype/usr/share/man/man7/osscore.7.gz +rm -f /tmp/ossman.txt + +cp .version prototype/$OSSLIBDIR/version.dat + +# Licensing stuff +if test -f $SRCDIR/4front-private/osslic.c +then + cc -o prototype/usr/sbin/osslic -Isetup -Ikernel/nonfree/include -Ikernel/framework/include -Iinclude -Ikernel/OS/FreeBSD -I$SRCDIR $SRCDIR/4front-private/osslic.c + strip prototype/usr/sbin/osslic + + BITS=3 # Default to 32 bit ELF format + if test "`uname -m` " = "amd64 " + then + BITS=6 # Use 64 bit ELF format + fi + + prototype/usr/sbin/osslic -q -u -$BITS./prototype/$OSSLIBDIR/build/osscore.lib + +fi + +if test -f 4front-private/ossupdate.c +then + #ossupdate + cc -I. 4front-private/ossupdate.c -s -o prototype/usr/sbin/ossupdate +fi + +sh $SRCDIR/setup/build_common.sh $SRCDIR $OSSLIBDIR + +chmod 700 prototype/usr/sbin/* +chmod 755 prototype/usr/bin/* +chmod 700 prototype/$OSSLIBDIR + +(cd prototype;ls usr/sbin/* usr/bin/* etc/* usr/share/man/man*/*) > prototype/$OSSLIBDIR/sysfiles.list + +exit 0 diff --git a/setup/FreeBSD/confgen.c b/setup/FreeBSD/confgen.c new file mode 100644 index 0000000..d94157b --- /dev/null +++ b/setup/FreeBSD/confgen.c @@ -0,0 +1,188 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <libgen.h> +#include <sys/stat.h> + +char *targetdir = ""; +char *confpath = ""; + +static int +copy_parms (FILE * f, FILE * conf) +{ + char line[1024], *s; + char var[256] = "", comment[64 * 1024] = ""; + int i; + int ok = 0; + + while (fgets (line, sizeof (line), f) != NULL) + { + for (i = 0; i < strlen (line); i++) + if (line[i] == '\n') + line[i] = 0; + + s = line; + + while (*s == ' ' || *s == '\t') + s++; + if (strncmp (s, "int ", 4) == 0) + { + if (*var != 0) + { + fprintf (conf, "%s\n", comment); + if (*var != 0) + fprintf (conf, "#%s\n#\n", var); + *var = 0; + *comment = 0; + } + s += 4; + + for (i = 0; i < strlen (line); i++) + if (line[i] == ';') + line[i] = 0; + ok = 1; + strcpy (var, s); + continue; + } + + + s = line; + + while (*s == ' ' || *s == '\t' || *s == '/' || *s == '*') + s++; + + if (*comment != 0) + strcat (comment, "\n"); + strcat (comment, "# "); + strcat (comment, s); + } + + if (*var != 0) + { + fprintf (conf, "%s\n", comment); + fprintf (conf, "#%s\n", var); + } + + return ok; +} + +static void +scan_dir (const char *srcdir, const char *modnam) +{ + char confname[256], tmp[256], line[1024]; + char module[256], *p; + FILE *conf; + FILE *f; + int i; + struct stat st; + + int check_platform = 0; + int platform_ok = 0; + int ok = 0; + + strcpy (module, modnam); + p = module; + while (*p) + { + if (*p == '.') + *p = 0; + else + p++; + } + + if (stat (srcdir, &st) == -1) + return; + + if (!S_ISDIR (st.st_mode)) /* Not a directory? */ + return; + + sprintf (tmp, "%s/.nomake", srcdir); + if (stat (tmp, &st) != -1) /* File exists */ + return; /* Skip this one */ + + sprintf (tmp, "%s/.config", srcdir); + if ((f = fopen (tmp, "r")) != NULL) + { + while (fgets (line, sizeof (line) - 1, f) != NULL) + { + char *s; + for (i = 0; i < strlen (line); i++) + if (line[i] == '\n') + line[i] = 0; + + s = line; + while (*s && *s != '=') + s++; + if (*s == '=') + *s++ = 0; + + if (strcmp (line, "OS") == 0 || strcmp (line, "targetos") == 0) + { + check_platform = 1; + if (strcmp (s, "Linux") == 0) + platform_ok = 1; + continue; + } + } + fclose (f); + } + + if (check_platform && !platform_ok && strcmp (modnam, "osscore")) + { + return; + } +#if 0 + /* copy the man pages */ + sprintf (syscmd, "sed 's:CONFIGFILEPATH:%s:g' < %s/%s.man > /tmp/ossman.man", + confpath, srcdir, module); + printf ("%s\n", syscmd); + unlink ("/tmp/ossman.man"); + system (syscmd); + + sprintf (syscmd, + "./origdir/setup/txt2man -t \"%s\" -v \"Devices\" -s 7 /tmp/ossman.man > prototype/usr/man/man7/%s.7", + module, module); + printf ("%s\n", syscmd); + system (syscmd); +#endif + + sprintf (confname, "%s/%s.conf", targetdir, module); + sprintf (tmp, "%s/.params", srcdir); + if ((f = fopen (tmp, "r")) != NULL) + { + if ((conf = fopen (confname, "w")) == NULL) + { + perror (confname); + exit (-1); + } + fprintf (conf, "# Open Sound System configuration file\n"); + fprintf (conf, + "# Remove the '#' in front of the option(s) you like to set.\n#\n"); + ok = copy_parms (f, conf); + fclose (f); +// fprintf(conf, "#\n"); + fclose (conf); + if (!ok) + unlink (confname); + } +} + +int +main (int argc, char *argv[]) +{ + int i; + + if (argc < 3) + exit (-1); + + targetdir = argv[1]; + confpath = argv[2]; + + for (i = 3; i < argc; i++) + { + scan_dir (argv[i], basename (argv[i])); + } + + exit (0); +} diff --git a/setup/FreeBSD/etc/rc.d/oss b/setup/FreeBSD/etc/rc.d/oss new file mode 100644 index 0000000..6b532e5 --- /dev/null +++ b/setup/FreeBSD/etc/rc.d/oss @@ -0,0 +1,58 @@ +#!/bin/sh - +# +# Copyright (c) 2006, 4Front Technologies. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# + +# PROVIDE: oss +# REQUIRE: cleanvar +# KEYWORD: nojail shutdown + +. /etc/rc.subr + +name="oss" +stop_cmd="oss_stop" +start_cmd="oss_start" + +# +# Start Open Sound System +# +oss_start() +{ + echo "Starting Open Sound System" + /usr/sbin/soundon +} + +# +# Stop Open Sound System +# +oss_stop() +{ + echo "Stopping Open Sound System" + /usr/sbin/soundoff +} + +load_rc_config $name +run_rc_command "$1" diff --git a/setup/FreeBSD/make.local b/setup/FreeBSD/make.local new file mode 100644 index 0000000..2cd68f8 --- /dev/null +++ b/setup/FreeBSD/make.local @@ -0,0 +1,11 @@ +build: kernel/framework/include/buildid.h all + sh build.sh + +copy: build + cp -R prototype/* / + +package: build + sh setup/FreeBSD/mkpkg.sh + +install: copy + cd ${OSSLIBDIR}/build && sh install.sh diff --git a/setup/FreeBSD/mkpkg.sh b/setup/FreeBSD/mkpkg.sh new file mode 100644 index 0000000..d7908bf --- /dev/null +++ b/setup/FreeBSD/mkpkg.sh @@ -0,0 +1,18 @@ +#!/bin/sh +VERSION=`sh showversion.sh` +BUILDID=`cat buildid.dat` +TOPDIR=`pwd` +SETUPDIR=$TOPDIR/setup/FreeBSD +PROTODIR=$TOPDIR/prototype +KERNELVERS=`uname -m` +BSDVER=`uname -r | cut -s -d'.' -f1` +PKGNAME=oss-freebsd$BSDVER-$VERSION-$BUILDID-$KERNELVERS + +(cd $PROTODIR; find . -type f -print > $SETUPDIR/pkg-plist) + +(cd /; pkg_create -c $SETUPDIR/pkg-comment -d $SETUPDIR/pkg-descr -I $SETUPDIR/pkg-postinstall -k $SETUPDIR/pkg-preremove -K $SETUPDIR/pkg-postremove -f $SETUPDIR/pkg-plist -p / -S $PROTODIR -v $TOPDIR/$PKGNAME.tbz) + +if test -f 4front-private/export_package.sh +then + sh 4front-private/export_package.sh $PKGNAME.tbz . `sh showversion.sh` /tmp `uname -m` +fi diff --git a/setup/FreeBSD/oss/build/Makefile.osscore b/setup/FreeBSD/oss/build/Makefile.osscore new file mode 100644 index 0000000..e1f428b --- /dev/null +++ b/setup/FreeBSD/oss/build/Makefile.osscore @@ -0,0 +1,7 @@ +SRCS=osscore.c +KMOD=osscore +OBJS += osscore_mainline.o +SRCS += device_if.h bus_if.h pci_if.h + +.include <bsd.kmod.mk> + diff --git a/setup/FreeBSD/oss/build/Makefile.tmpl b/setup/FreeBSD/oss/build/Makefile.tmpl new file mode 100644 index 0000000..1653841 --- /dev/null +++ b/setup/FreeBSD/oss/build/Makefile.tmpl @@ -0,0 +1,8 @@ +SRCS=MODNAME.c +KMOD=MODNAME +OBJS += MODNAME_mainline.o +SRCS += device_if.h bus_if.h pci_if.h +CFLAGS += -I../include/internals + +.include <bsd.kmod.mk> + diff --git a/setup/FreeBSD/oss/build/bsdpci.inc b/setup/FreeBSD/oss/build/bsdpci.inc new file mode 100644 index 0000000..5cb0b55 --- /dev/null +++ b/setup/FreeBSD/oss/build/bsdpci.inc @@ -0,0 +1,153 @@ +/* + * Purpose: Wrapper functions for PCI drivers under FreeBSD + */ +/* + * Copyright (C) 4Front Technologies 2005-2007. Released under BSD license. + */ +#include <dev/pci/pcivar.h> /* For pci_get macros! */ +#include <dev/pci/pcireg.h> + +/* PCI Support Functions */ + +static oss_device_t *device_list[16]; +static device_t bsd_devices[16]; +static int ndevs = 0; + +/* + * Compare the device ID of this device against the IDs that this driver + * supports. If there is a match, set the description and return success. + */ +static int +osspci_probe (device_t dev) +{ +#ifdef DEVTYPE_PCI + int i, ok = 0; + int vendor, device, class; + oss_device_t *osdev; + + for (i = 0; i < ndevs; i++) + if (dev == bsd_devices[i]) /* Already detected */ + { + return ENXIO; + } + + if (ndevs >= 16) + { + printf (DRIVER_NICK ": Too many instances\n"); + return ENXIO; + } + + vendor = pci_get_vendor (dev); + device = pci_get_device (dev); + class = pci_get_class (dev); +// printf("PCI dev %08lx c=%x, v=%04x, d=%04x\n", (unsigned long)dev, class, vendor, device); + + if (class != 4) /* Not a multimedia device */ + return ENXIO; + + for (i = 0; id_table[i].vendor != 0; i++) + if (vendor == id_table[i].vendor && device == id_table[i].device) /* Match */ + { + ok = 1; + break; + } + + if (!ok) + { + return (ENXIO); + } + + if ((osdev = + osdev_create (dev, DRIVER_TYPE, ndevs, DRIVER_NICK, NULL)) == NULL) + { + return ENOMEM; + } + if (!DRIVER_ATTACH (osdev)) + return EIO; + + bsd_devices[ndevs] = dev; + device_list[ndevs++] = osdev; +#endif + return (BUS_PROBE_DEFAULT); +} + +/* Attach function is only called if the probe is successful */ + +static int +osspci_attach (device_t dev) +{ + return 0; +} + +/* Detach device. */ + +static int +osspci_detach (device_t dev) +{ + oss_device_t *osdev; + int i; + + for (i = 0; i < ndevs; i++) + { + osdev = device_list[i]; + if (osdev->dip == dev) + { + if (device_get_state(dev) == DS_BUSY) + device_unbusy(dev); + if (!DRIVER_DETACH (osdev)) + { + printf (DRIVER_NICK ": Unloading busy device\n"); + return EBUSY; + } + osdev_delete (osdev); + } + } + + return (0); +} + +/* Called during system shutdown after sync. */ + +static int +osspci_shutdown (device_t dev) +{ + + printf ("Mypci shutdown!\n"); + return (0); +} + +/* + * Device suspend routine. + */ +static int +osspci_suspend (device_t dev) +{ + + printf ("Mypci suspend!\n"); + return (0); +} + +/* + * Device resume routine. + */ +static int +osspci_resume (device_t dev) +{ + + printf ("Mypci resume!\n"); + return (0); +} + +static device_method_t osspci_methods[] = { + /* Device interface */ + DEVMETHOD (device_probe, osspci_probe), + DEVMETHOD (device_attach, osspci_attach), + DEVMETHOD (device_detach, osspci_detach), + DEVMETHOD (device_shutdown, osspci_shutdown), + DEVMETHOD (device_suspend, osspci_suspend), + DEVMETHOD (device_resume, osspci_resume), + + {0, 0} +}; + +static devclass_t osspci_devclass; diff --git a/setup/FreeBSD/oss/build/bsdvirtual.inc b/setup/FreeBSD/oss/build/bsdvirtual.inc new file mode 100644 index 0000000..cb5190e --- /dev/null +++ b/setup/FreeBSD/oss/build/bsdvirtual.inc @@ -0,0 +1,83 @@ +/* + * Purpose: Wrapper functions for virtual drivers under FreeBSD + */ +/* + * Copyright (C) 4Front Technologies 2005-2007. Released under BSD license. + */ +static int ndevs = 0; +oss_device_t *device_list[16]; + +static int +module_attach (void) +{ + oss_device_t *osdev; + + if ((osdev = + osdev_create (NULL, DRIVER_TYPE, ndevs, DRIVER_NICK, NULL)) == NULL) + { + return ENOMEM; + } + if (!DRIVER_ATTACH (osdev)) + return EIO; + device_list[ndevs++] = osdev; + + return 0; +} + +static int +module_detach (void) +{ + oss_device_t *osdev; + int i; + + for (i = 0; i < ndevs; i++) + { + osdev = device_list[i]; + + if (osdev->dip != NULL && device_get_state(osdev->dip) == DS_BUSY) + device_unbusy(osdev->dip); + if (!DRIVER_DETACH (osdev)) + { + printf (DRIVER_NICK ": Unloading busy device\n"); + return EBUSY; + } + osdev_delete (osdev); + } + + return 0; +} + +/* + * Load handler that deals with the loading and unloading of a KLD. + */ + +static int +ossmodule_loader (struct module *m, int what, void *arg) +{ + int err = 0; + + switch (what) + { + case MOD_LOAD: /* kldload */ + return module_attach (); + break; + case MOD_UNLOAD: + return module_detach (); + break; + default: + err = EINVAL; + break; + } + return (err); +} + +/* Declare this module to the rest of the kernel */ + +static moduledata_t ossmodule_mod = { + "ossmodule", + ossmodule_loader, + NULL +}; + +DECLARE_MODULE (ossmodule, ossmodule_mod, SI_SUB_KLD, SI_ORDER_ANY); +MODULE_VERSION (ossmodule, 4); diff --git a/setup/FreeBSD/oss/build/devid.h b/setup/FreeBSD/oss/build/devid.h new file mode 100644 index 0000000..8d6a5c7 --- /dev/null +++ b/setup/FreeBSD/oss/build/devid.h @@ -0,0 +1,5 @@ + +typedef struct +{ + unsigned short vendor, device; +} device_id_t; diff --git a/setup/FreeBSD/oss/build/install.sh b/setup/FreeBSD/oss/build/install.sh new file mode 100644 index 0000000..872d43f --- /dev/null +++ b/setup/FreeBSD/oss/build/install.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +if test -f /etc/oss.conf +then + . /etc/oss.conf +else + OSSLIBDIR=/usr/lib/oss +fi + +rm -f osscore_mainline.o +ln -s osscore.lib osscore_mainline.o + +rm -f Makefile +ln -s Makefile.osscore Makefile + +echo Compiling module osscore + +if ! make > compile.list 2>&1 +then + echo Compiling osscore module failed + cat compile.list + exit 1 +fi + +if ! test -d ../modules +then + mkdir ../modules +fi + +if ! test -d ../logs +then + mkdir ../logs +fi + +mv osscore.ko ../modules/ +make clean > /dev/null 2>&1 + +for n in ../objects/*.o +do + N=`basename $n .o` + + rm -f $N"_mainline.o" + ln -s $n $N"_mainline.o" + + rm -f Makefile + sed "s/MODNAME/$N/g" < Makefile.tmpl > Makefile + + echo Compiling module $N + + if ! make > compile.list 2>&1 + then + echo Compiling module $N failed + cat compile.list + exit 2 + fi + + mv $N.ko* ../modules/ + make clean > /dev/null 2>&1 + rm -f Makefile +done + +if ! test -f $OSSLIBDIR/etc/installed_drivers +then + echo "-----------------------------" + /usr/sbin/ossdetect -v + echo "-----------------------------" + echo "" +fi + +if test ! -f $OSSLIBDIR/etc/userdefs +then + echo "autosave_mixer yes" > $OSSLIBDIR/etc/userdefs +fi + +exit 0 diff --git a/setup/FreeBSD/oss/build/module.inc b/setup/FreeBSD/oss/build/module.inc new file mode 100644 index 0000000..8ed73e9 --- /dev/null +++ b/setup/FreeBSD/oss/build/module.inc @@ -0,0 +1,89 @@ +/* + * Purpose: Generic OSS driver module interface for FreeBSD + * + * This file is included by the driver modules when they are compiled + * in the target system. In this way this code can be changed for non-srandard + * kernels. Compiling this file in the target file makes it also possible + * to distribute single OSS binary package that works under as many + * FreeBSD versions as possible. + */ +/* + * Copyright (C) 4Front Technologies 2005-2007. Released under BSD license. + */ + +#include <machine/stdarg.h> +#include <sys/param.h> /* defines used in kernel.h */ +#include <sys/module.h> +#include <sys/systm.h> +#include <sys/errno.h> +#include <sys/kernel.h> /* types used in module initialization */ +#include <sys/conf.h> /* cdevsw struct */ +#include <sys/uio.h> /* uio struct */ +#include <sys/malloc.h> + +#include <sys/bus.h> /* structs, prototypes for pci bus stuff */ +#include <machine/bus.h> +#include <sys/rman.h> +#include <machine/resource.h> + +#include <timestamp.h> +#include <oss_exports.h> +#include "bsddefs.h" + +void +cmn_err (int level, char *s, ...) +{ + char tmp[1024], *a[6]; + va_list ap; + int i, n = 0; + + va_start (ap, s); + + for (i = 0; i < strlen (s); i++) + if (s[i] == '%') + n++; + + for (i = 0; i < n && i < 6; i++) + a[i] = va_arg (ap, char *); + + for (i = n; i < 6; i++) + a[i] = NULL; + + strcpy (tmp, DRIVER_NICK ": "); + sprintf (tmp + strlen (tmp), s, a[0], a[1], a[2], a[3], a[4], a[5], NULL, + NULL, NULL, NULL); + if (level == CE_PANIC) + panic (tmp); + printf ("%s", tmp); +#if 0 + /* This may cause a crash under SMP */ + if (sound_started) + store_msg (tmp); +#endif + + va_end (ap); +} + +extern int DRIVER_ATTACH (oss_device_t * osdev); +extern int DRIVER_DETACH (oss_device_t * osdev); + +#ifdef DEVTYPE_VMIX +#define TYPE_OK +#include "bsdvirtual.inc" +#endif + +#ifdef DEVTYPE_PCI +#define TYPE_OK +#include "bsdpci.inc" +#endif + +#ifdef DEVTYPE_VIRTUAL +#define TYPE_OK +#include "bsdvirtual.inc" +#endif + +#ifndef TYPE_OK +#error Unrecognized driver type +#endif + +MODULE_DEPEND (DRIVER_NAME, osscore, 4, 4, 4); diff --git a/setup/FreeBSD/oss/build/osscore.c b/setup/FreeBSD/oss/build/osscore.c new file mode 100644 index 0000000..5264118 --- /dev/null +++ b/setup/FreeBSD/oss/build/osscore.c @@ -0,0 +1,559 @@ +/* + * Purpose: OSS core functions that need to be compiled in the target system + * + * Some parts of the FreeBSD operating system interface of OSS are sensitive + * to changes in internal structures of FreeBSD. For this reason these + * files have to be compiled in the target system when OSS is installed. + * In this way the same OSS binary package can be used with several FreeBSD + * versions. + */ +#include <machine/stdarg.h> +#include <sys/param.h> /* defines used in kernel.h */ +#include <sys/module.h> +#include <sys/systm.h> +#include <sys/errno.h> +#include <sys/kernel.h> /* types used in module initialization */ +#include <sys/conf.h> /* cdevsw struct */ +#include <sys/uio.h> /* uio struct */ +#include <sys/malloc.h> + +#include <sys/bus.h> /* structs, prototypes for pci bus stuff */ +#include <machine/bus.h> +#include <sys/rman.h> +#include <machine/resource.h> +#include <sys/types.h> +#include <sys/errno.h> +#include <sys/param.h> /* defines used in kernel.h */ +#include <dev/pci/pcivar.h> /* For pci_get macros! */ +#include <dev/pci/pcireg.h> +#include <machine/intr_machdep.h> + +#include <vm/vm.h> +#include <vm/pmap.h> +#include <sys/proc.h> + +typedef struct _oss_device_t oss_device_t; +#include "bsddefs.h" + +/* The PCIBIOS_* defines must match oss_pci.h */ +#define PCIBIOS_SUCCESSFUL 0x00 +#define PCIBIOS_FAILED -1 + +extern int soundcard_attach (void); +extern int soundcard_detach (void); + +void * +memset (void *t, int val, int l) +{ + char *c = t; + while (l-- > 0) + *c++ = val; + + return t; +} + +void +cmn_err (int level, char *s, ...) +{ + char tmp[1024], *a[6]; + va_list ap; + int i, n = 0; + + va_start (ap, s); + + for (i = 0; i < strlen (s); i++) + if (s[i] == '%') + n++; + + for (i = 0; i < n && i < 6; i++) + a[i] = va_arg (ap, char *); + + for (i = n; i < 6; i++) + a[i] = NULL; + + strcpy (tmp, "osscore: "); + sprintf (tmp + strlen (tmp), s, a[0], a[1], a[2], a[3], a[4], a[5], NULL, + NULL, NULL, NULL); + if (level == CE_PANIC) + panic (tmp); + printf ("%s", tmp); +#if 0 + /* This may cause a crash under SMP */ + if (sound_started) + store_msg (tmp); +#endif + + va_end (ap); +} + +void +oss_udelay (unsigned long t) +{ + DELAY (t); +} + +typedef struct +{ + int irq; + oss_device_t *osdev; + oss_tophalf_handler_t top; + oss_bottomhalf_handler_t bottom; + struct resource *irqres; + int irqid; + void *cookie; +} osscore_intr_t; + +#define MAX_INTRS 32 + +static osscore_intr_t intrs[MAX_INTRS] = { {0} }; +static int nintrs = 0; + +static void +ossintr (void *arg) +{ + osscore_intr_t *intr = arg; + int serviced = 0; + + if (intr->top) + serviced = intr->top (intr->osdev); + if (intr->bottom) + intr->bottom (intr->osdev); + oss_inc_intrcount (intr->osdev, serviced); +} + +int +oss_register_interrupts (oss_device_t * osdev, int intrnum, + oss_tophalf_handler_t top, + oss_bottomhalf_handler_t bottom) +{ + + osscore_intr_t *intr; + char name[32]; + + if (nintrs >= MAX_INTRS) + { + cmn_err (CE_CONT, + "oss_register_interrupts: Too many interrupt handlers\n"); + return -ENOMEM; + } + + intr = &intrs[nintrs]; + + intr->irq = 0; + intr->osdev = osdev; + intr->top = top; + intr->bottom = bottom; + + sprintf (name, "%s%d", osdev->nick, osdev->instance); + + intr->irqid = 0; + intr->irqres = bus_alloc_resource (osdev->dip, SYS_RES_IRQ, &(intr->irqid), + 0, ~0, 1, RF_SHAREABLE | RF_ACTIVE); + if (intr->irqres == NULL) + { + cmn_err (CE_CONT, + "oss_register_interrupts: bus_alloc_resource failed.\n"); + return -EIO; + } + + intr->irq = bus_setup_intr (osdev->dip, intr->irqres, + INTR_TYPE_AV | INTR_MPSAFE, +#if __FreeBSD_version >= 700031 + NULL, +#endif + ossintr, intr, &(intr->cookie)); + + nintrs++; + + return 0; +} + +void +oss_unregister_interrupts (oss_device_t * osdev) +{ + int i; + + for (i = 0; i < nintrs; i++) + if (intrs[i].osdev == osdev) + { + osscore_intr_t *intr; + + intr = &intrs[i]; + bus_teardown_intr (osdev->dip, intr->irqres, intr->cookie); + bus_release_resource (osdev->dip, SYS_RES_IRQ, intr->irqid, + intr->irqres); + } +} + +/* + * PCI config space access + */ +char * +oss_pci_read_devpath (dev_info_t * dip) +{ + return "Unknown PCI path"; // TODO +} + +int +pci_read_config_byte (oss_device_t * osdev, offset_t where, + unsigned char *val) +{ + *val = pci_read_config (osdev->dip, where, 1); + return PCIBIOS_SUCCESSFUL; +} + +int +pci_read_config_irq (oss_device_t * osdev, offset_t where, unsigned char *val) +{ + *val = pci_read_config (osdev->dip, where, 1); + return PCIBIOS_SUCCESSFUL; +} + +int +pci_read_config_word (oss_device_t * osdev, offset_t where, + unsigned short *val) +{ + *val = pci_read_config (osdev->dip, where, 2); + return PCIBIOS_SUCCESSFUL; +} + +int +pci_read_config_dword (oss_device_t * osdev, offset_t where, + unsigned int *val) +{ + *val = pci_read_config (osdev->dip, where, 4); + return PCIBIOS_SUCCESSFUL; +} + +int +pci_write_config_byte (oss_device_t * osdev, offset_t where, + unsigned char val) +{ + pci_write_config (osdev->dip, where, val, 1); + return PCIBIOS_FAILED; +} + +int +pci_write_config_word (oss_device_t * osdev, offset_t where, + unsigned short val) +{ + pci_write_config (osdev->dip, where, val, 2); + return PCIBIOS_FAILED; +} + +int +pci_write_config_dword (oss_device_t * osdev, offset_t where, + unsigned int val) +{ + pci_write_config (osdev->dip, where, val, 4); + return PCIBIOS_FAILED; +} + +void * +oss_contig_malloc (unsigned long buffsize, unsigned long memlimit, + oss_native_word * phaddr) +{ + char *tmpbuf; + *phaddr = 0; + + tmpbuf = + (char *) contigmalloc (buffsize, M_DEVBUF, M_WAITOK, 0ul, memlimit, + PAGE_SIZE, 0ul); + if (tmpbuf == NULL) + { + cmn_err (CE_CONT, "OSS: Unable to allocate %lu bytes for a DMA buffer\n", + buffsize); + cmn_err (CE_CONT, "run soundoff and run soundon again.\n"); + return NULL; + } + *phaddr = vtophys (tmpbuf); + return tmpbuf; +} + +void +oss_contig_free (void *p, unsigned long sz) +{ + if (p) + contigfree (p, sz, M_DEVBUF); +} + +/* + * Load handler that deals with the loading and unloading of a KLD. + */ + +static int +osscore_loader (struct module *m, int what, void *arg) +{ + int err = 0; + + switch (what) + { + case MOD_LOAD: /* kldload */ + return soundcard_attach (); + break; + case MOD_UNLOAD: + return soundcard_detach (); + break; + default: + err = EINVAL; + break; + } + return (err); +} + +/* Declare this module to the rest of the kernel */ + +static moduledata_t osscore_mod = { + "osscore", + osscore_loader, + NULL +}; + +#define _FP_SAVE(envbuf) asm ("fnsave %0":"=m" (*envbuf)); +#define _FP_RESTORE(envbuf) asm ("frstor %0":"=m" (*envbuf)); + +/* SSE/SSE2 compatible macros */ +#define FX_SAVE(envbuf) asm ("fxsave %0":"=m" (*envbuf)); +#define FX_RESTORE(envbuf) asm ("fxrstor %0":"=m" (*envbuf)); + +static int old_arch = 0; /* No SSE/SSE2 instructions */ + +#define asm __asm__ + +#if defined(__amd64__) +#define AMD64 +#endif + +static inline void +cpuid (int op, int *eax, int *ebx, int *ecx, int *edx) +{ +__asm__ ("cpuid": "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx):"0" (op), "c" + (0)); +} + +#ifdef AMD64 +# define local_save_flags(x) asm volatile("pushfq ; popq %0":"=g" (x):) +# define local_restore_flags(x) asm volatile("pushq %0 ; popfq"::"g" (x):"memory", "cc") +#else +# define local_save_flags(x) asm volatile("pushfl ; popl %0":"=g" (x):) +# define local_restore_flags(x) asm volatile("pushl %0 ; popfl"::"g" (x):"memory", "cc") +#endif + +static inline unsigned long +read_cr0 (void) +{ + unsigned long cr0; +#ifdef AMD64 +asm ("movq %%cr0,%0":"=r" (cr0)); +#else +asm ("movl %%cr0,%0":"=r" (cr0)); +#endif + return cr0; +} + +static inline void +write_cr0 (unsigned long val) +{ +#ifdef AMD64 + asm ("movq %0,%%cr0"::"r" (val)); +#else + asm ("movl %0,%%cr0"::"r" (val)); +#endif +} + +static inline unsigned long +read_cr4 (void) +{ + unsigned long cr4; +#ifdef AMD64 +asm ("movq %%cr4,%0":"=r" (cr4)); +#else +asm ("movl %%cr4,%0":"=r" (cr4)); +#endif + return cr4; +} + +static inline void +write_cr4 (unsigned long val) +{ +#ifdef AMD64 + asm ("movq %0,%%cr4"::"r" (val)); +#else + asm ("movl %0,%%cr4"::"r" (val)); +#endif +} + +static inline unsigned long long +read_mxcsr (void) +{ + unsigned long long mxcsr; +asm ("stmxcsr %0":"=m" (mxcsr)); + return mxcsr; +} + +static inline void +write_mxcsr (unsigned long long val) +{ + asm ("ldmxcsr %0"::"m" (val)); +} + +int +oss_fp_check (void) +{ + int eax, ebx, ecx, edx; +#define FLAGS_ID (1<<21) + + oss_native_word flags_reg; + + local_save_flags (flags_reg); + flags_reg &= ~FLAGS_ID; + local_restore_flags (flags_reg); + + local_save_flags (flags_reg); + if (flags_reg & FLAGS_ID) + return 0; + + flags_reg |= FLAGS_ID; + local_restore_flags (flags_reg); + + local_save_flags (flags_reg); + if (!(flags_reg & FLAGS_ID)) + return 0; + +#define OSS_CPUID_FXSR (1<<24) +#define OSS_CPUID_SSE (1<<25) +#define OSS_CPUID_SSE2 (1<<26) + + cpuid (1, &eax, &ebx, &ecx, &edx); + + if (!(edx & OSS_CPUID_FXSR)) + return 0; + + /* + * Older machines require different FP handling than the latest ones. Use the SSE + * instruction set as an indicator. + */ + if (!(edx & OSS_CPUID_SSE)) + old_arch = 1; + + return 1; +} + +void +oss_fp_save (short *envbuf, unsigned int flags[]) +{ + flags[0] = read_cr0 (); + write_cr0 (flags[0] & ~0x0e); /* Clear CR0.TS/MP/EM */ + + if (old_arch) + { + _FP_SAVE (envbuf); + } + else + { + flags[1] = read_cr4 (); + write_cr4 (flags[1] | 0x600); /* Set OSFXSR & OSXMMEXCEPT */ + FX_SAVE (envbuf); + asm ("fninit"); + asm ("fwait"); + write_mxcsr (0x1f80); + } + flags[2] = read_cr0 (); +} + +void +oss_fp_restore (short *envbuf, unsigned int flags[]) +{ + asm ("fwait"); + if (old_arch) + { + _FP_RESTORE (envbuf); + } + else + { + FX_RESTORE (envbuf); + write_cr4 (flags[1]); /* Restore cr4 */ + } + write_cr0 (flags[0]); /* Restore cr0 */ +} + +#ifdef VDEV_SUPPORT +static void +oss_file_free_private (void *v) +{ + free (v, M_DEVBUF); +} + +int +oss_file_get_private (void **v) +{ + int error; + + error = devfs_get_cdevpriv (v); + if (error) + { + cmn_err (CE_CONT, "Couldn't retrieve private data from file handle!\n"); + return error; + } + return 0; +} + +int +oss_file_set_private (struct thread *t, void *v, size_t l) +{ + int error; + void * p; + + p = malloc (l, M_DEVBUF, M_WAITOK); + if (p == NULL) + { + cmn_err (CE_CONT, "Couldn't allocate memory!\n"); + return -1; + } + memcpy (p, v, l); + error = devfs_set_cdevpriv (p, oss_file_free_private); + if (error) + { + cmn_err (CE_CONT, "Couldn't attach private data to file handle!\n"); + oss_file_free_private (p); + return error; + } + return 0; +} +#endif + +int +oss_get_uid(void) +{ + return curthread->td_ucred->cr_uid; +} + +extern int max_intrate; +extern int detect_trace; +extern int src_quality; +extern int flat_device_model; +extern int vmix_disabled; +extern int vmix_loopdevs; +extern int vmix_no_autoattach; +extern int ac97_amplifier; +extern int ac97_recselect; +extern int cooked_enable; +extern int dma_buffsize; +extern int excl_policy; +extern int mixer_muted; +TUNABLE_INT("osscore.max_intrate", &max_intrate); +TUNABLE_INT("osscore.detect_trace", &detect_trace); +TUNABLE_INT("osscore.src_quality", &src_quality); +TUNABLE_INT("osscore.flat_device_model", &flat_device_model); +TUNABLE_INT("osscore.vmix_disabled", &vmix_disabled); +TUNABLE_INT("osscore.vmix_loopdevs", &vmix_loopdevs); +TUNABLE_INT("osscore.vmix_no_autoattach", &vmix_no_autoattach); +TUNABLE_INT("osscore.ac97_amplifier", &ac97_amplifier); +TUNABLE_INT("osscore.ac97_recselect", &ac97_recselect); +TUNABLE_INT("osscore.cooked_enable", &cooked_enable); +TUNABLE_INT("osscore.dma_buffsize", &dma_buffsize); +TUNABLE_INT("osscore.excl_policy", &excl_policy); +TUNABLE_INT("osscore.mixer_muted", &mixer_muted); + +DECLARE_MODULE (osscore, osscore_mod, SI_SUB_KLD, SI_ORDER_ANY); +MODULE_VERSION (osscore, 4); diff --git a/setup/FreeBSD/oss/soundon.user b/setup/FreeBSD/oss/soundon.user new file mode 100644 index 0000000..da31b6d --- /dev/null +++ b/setup/FreeBSD/oss/soundon.user @@ -0,0 +1,7 @@ +#!/bin/sh +# +# This script can be used to run programs every time OSS is started. +# By default, this script is disabled, and contains no commands. +# To enable, add executable permissions to this file, and edit below +# commands to be run. +exit 0 diff --git a/setup/FreeBSD/pkg-comment b/setup/FreeBSD/pkg-comment new file mode 100644 index 0000000..d2bd0e3 --- /dev/null +++ b/setup/FreeBSD/pkg-comment @@ -0,0 +1 @@ +Open Sound System for FreeBSD diff --git a/setup/FreeBSD/pkg-descr b/setup/FreeBSD/pkg-descr new file mode 100644 index 0000000..d56fdaa --- /dev/null +++ b/setup/FreeBSD/pkg-descr @@ -0,0 +1,4 @@ +Open Sound System for FreeBSD is a audio subsystem that provides a cross +platform audio and MIDI API with device drivers for most consumer and +professional PCI and USB audio devices. Additional information about +Open Sound System is available at http://www.opensound.com diff --git a/setup/FreeBSD/pkg-message b/setup/FreeBSD/pkg-message new file mode 100644 index 0000000..00aefe4 --- /dev/null +++ b/setup/FreeBSD/pkg-message @@ -0,0 +1,87 @@ + + SOFTWARE LICENSE AGREEMENT + -------------------------- + +PLEASE CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS BEFORE +INSTALLING THE SOFTWARE. INSTALLING THE SOFTWARE INDICATES THAT YOU HAVE +ACCEPTED THESE TERMS AND CONDITIONS. + +4Front Technologies provides this program and licenses its use to you, the +licensee, pursuant to the following terms. You assume responsibility for the +selection of the program to achieve your intended results. Further, you are +responsible for the installation, use and results obtained from this program. + +LICENSE +You, the licensee, have the non-exclusive right to use the hardware, software +and its documentation. You may only use the software on a single computer at +one time. You may not distribute copies of the software or documentation to +others nor are you licensed to sell or lend it to others.You may copy the +program for "backup" purposes only. You agree to replicate the copyright note +shown below on any such copies. + +If you violate the terms and conditions set forth, eg, sharing your licenses +with a third party or illegally trading OSS licenses, your license will be +terminated without any refund and we will report any fraud to the SPA. We +appreciate your cooperation in this matter. + +COPYRIGHT +THE PROGRAM IS COPYRIGHTED AND EXCEPT AS PERMITTED BY THIS AGREEMENT, YOU +MAY NOT DUPLICATE THE PROGRAM OR DISCLOSE IT TO ANY OTHER PARTY. IF YOU +TRANSFER POSSESSION OF THIS PROGRAM TO ANOTHER PARTY, YOUR LICENSE IS +AUTOMATICALLY TERMNIATED. + +TERM +This license agreement is effective until terminated. You may terminate it +voluntarily at any time. Voluntary termination by you must be accompanied by +the full destruction of the licensed copies thereof. Should you fail to comply +with the terms and conditions, your license will be automatically terminated +by 4Front Technologies. + +SUPPORT +4Front Technologies will provide free technical support for the software for +a period of 1 year from the date of purchase. After the expiration of this +period, you may choose to renew the support by signing a Technical Support +Contract with 4Front Technologies. + +GENERAL WARRANTY +THE SOFTWARE DISTRIBUTED AND LICENSED "AS-IS". ALL WARRANTIES, EITHER EXPRESSED +OR IMPLIED, ARE DISCLAIMED AS TO THE SOFTWARE'S QUALITY, PERFORMANCE OR FITNESS +FOR ANY PARTICULAR PURPOSE. THE LICENSEE BEARS THE ENTIRE RISK RELATING TO THE +QUALITY, PERFORMANCE AND FITNESS OF THE SOFTWARE. + +LIABILITY +IN NO EVENT SHALL 4FRONT TECHNOLOGIES BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OUR SOLE OBLIGATION TO +YOU SHALL BE THE REPAIR OR REPLACEMENT OF A NON-CONFORMING PROGRAM IN THE +SOFTWARE. + +MISCELLANEOUS + +(1) This Agreement shall be governed by State of California law. + +(2) U.S. GOVERNMENT RESTRICTED RIGHTS. Use, duplication or disclosure by + the Government is subject to restrictions set forth in subparagraphs + (a) through (d) of the Commercial Computer-Restricted Rights clause at + DFAR 52.227-19 when applicable, or in subparagraph (c)(1)(ii) of the + Rights in Technical Data and Computer Software clause at DFARS + 252.227-7013, or at 252.211-7015. + +(3) U.S. GOVERNMENT EXPORT RESTRICTIONS. None of the Software or underlying + information or technology may be downloaded or otherwise exported or + reexported to any country to which the U.S. has embargoed goods. + Manufacturer is 4Front Technologies. + +______________________________________________________________________________ + +4Front Technologies, Inc. +9826 Beverlywood Street +Los Angeles, CA 90064 +U.S.A. + +Tel: (+01) 310-202-8530 WWW: http://www.opensound.com +Fax: (+01) 310-202-0496 E-mail: info@opensound.com diff --git a/setup/FreeBSD/pkg-postinstall b/setup/FreeBSD/pkg-postinstall new file mode 100644 index 0000000..de2c03a --- /dev/null +++ b/setup/FreeBSD/pkg-postinstall @@ -0,0 +1,18 @@ +#!/bin/sh +if test -f /etc/oss.conf +then + . /etc/oss.conf +else + OSSLIBDIR=/usr/lib/oss +fi + +cd $OSSLIBDIR/build +echo "Build Open Sound System for FreeBSD-`uname -m` `uname -r`" +sh install.sh + +chmod 744 /etc/rc.d/oss + +echo "Starting Open Sound System" +rm -f /dev/dsp; ln -s /dev/dsp0 /dev/dsp +/usr/sbin/soundoff > /dev/null 2>&1 +/usr/sbin/soundon diff --git a/setup/FreeBSD/pkg-postremove b/setup/FreeBSD/pkg-postremove new file mode 100644 index 0000000..4d6d028 --- /dev/null +++ b/setup/FreeBSD/pkg-postremove @@ -0,0 +1,10 @@ +#!/bin/sh +if test -f /etc/oss.conf +then + . /etc/oss.conf +else + OSSLIBDIR=/usr/lib/oss +fi + +rm -rf $OSSLIBDIR +rm -f /dev/dsp* /dev/audio* /dev/mixer* /dev/midi* /dev/sndstat /dev/sequencer /dev/music diff --git a/setup/FreeBSD/pkg-preremove b/setup/FreeBSD/pkg-preremove new file mode 100644 index 0000000..c02f38b --- /dev/null +++ b/setup/FreeBSD/pkg-preremove @@ -0,0 +1,10 @@ +#!/bin/sh + +echo "Killing all active audio applications" + +/usr/sbin/fuser -k /dev/mixer* /dev/dsp* /dev/audio* /dev/sequencer /dev/music /dev/midi* > /dev/null 2>&1 + +sleep 2 + +/usr/sbin/soundoff +exit 0 diff --git a/setup/FreeBSD/sbin/soundoff b/setup/FreeBSD/sbin/soundoff new file mode 100755 index 0000000..7cb4962 --- /dev/null +++ b/setup/FreeBSD/sbin/soundoff @@ -0,0 +1,60 @@ +#!/bin/sh + +if test -f /etc/oss.conf +then + . /etc/oss.conf +else + OSSLIBDIR=/usr/lib/oss +fi + +if ! /sbin/kldstat | grep -q osscore.ko +then + echo OSS not loaded. + exit 0 +fi + +if ! test -f $OSSLIBDIR/etc/installed_drivers +then + echo $OSSLIBDIR/etc/installed_drivers is missing. + exit 1 +fi + +# Save mixer settings automatically if requested +if test -f $OSSLIBDIR/etc/userdefs && grep -q "autosave_mixer yes" $OSSLIBDIR/etc/userdefs +then + /usr/sbin/savemixer +fi + +# Save legacy devices +/usr/sbin/ossdevlinks -N + +PROGRAMS="`fstat /dev/mixer* /dev/dsp* /dev/midi* /dev/oss/*/* 2>/dev/null | sed '1 D'`" + +if test "$PROGRAMS " != " " +then + echo + echo Some applications are still using OSS - cannot unload + echo + + fstat /dev/mixer* /dev/dsp* /dev/midi* /dev/oss/*/* 2>/dev/null + + echo + echo Please stop these applications and run soundoff again + exit 2 +fi + +for n in `cat $OSSLIBDIR/etc/installed_drivers | sed 's/#.*//'` +do + /sbin/kldunload $n > /dev/null 2>&1 +done + +/sbin/kldunload osscore + +if ! /sbin/kldstat | grep -q osscore.ko # OSS gone? +then + exit 0 +fi + +echo Cannot unload the OSS driver modules + +exit 0 diff --git a/setup/FreeBSD/sbin/soundon b/setup/FreeBSD/sbin/soundon new file mode 100755 index 0000000..091b2dc --- /dev/null +++ b/setup/FreeBSD/sbin/soundon @@ -0,0 +1,122 @@ +#!/bin/sh + +if test -f /etc/oss.conf +then + . /etc/oss.conf +else + OSSLIBDIR=/usr/lib/oss +fi + +LOG=/var/log/soundon.log +echo "Open Sound System starting" `date` > $LOG +echo "OSS version: " `cat $OSSLIBDIR/version.dat` >> $LOG 2>&1 +echo "Kernel version: " `uname -a` >> $LOG + +if ! test -f $OSSLIBDIR/etc/installed_drivers +then + echo No $OSSLIBDIR/etc/installed_drivers >> $LOG + echo No $OSSLIBDIR/etc/installed_drivers + echo Please run ossdetect to create it. + exit 1 +fi + +if ! test -f $OSSLIBDIR/modules/osscore.ko +then + echo No $OSSLIBDIR/modules/osscore.ko module >> $LOG + echo No $OSSLIBDIR/modules/osscore.ko module + exit 2 +fi + +if test -f $OSSLIBDIR/etc/license.asc +then + /usr/sbin/ossdetect -l >> $LOG +fi + +OPTIONS= +if test -f $OSSLIBDIR/conf/osscore.conf +then + OPTIONS=`grep -v -h '^#' $OSSLIBDIR/conf/osscore.conf | sed 's/[ ]//g'` + if test "$OPTIONS " != " " + then + echo $OPTIONS | xargs -I % kenv osscore.% + fi +fi + +if ! /sbin/kldload $OSSLIBDIR/modules/osscore.ko +then + echo Loading the osscore module failed + echo Loading the osscore module failed >> $LOG + dmesg >> $LOG + exit 4 +fi + +for n in `cat $OSSLIBDIR/etc/installed_drivers | sed 's/#.*//'` +do + OPTIONS= + if test -f $OSSLIBDIR/conf/$n.conf + then + OPTIONS=`grep -v -h '^#' $OSSLIBDIR/conf/$n.conf | sed 's/[ ]//g'` + if test "$OPTIONS " != " " + then + echo $OPTIONS | xargs -I % kenv $n.% + fi + fi + + if ! /sbin/kldload $OSSLIBDIR/modules/$n.ko + then + echo Loading module $n failed '-' ignored >> $LOG + echo Loading module $n failed '-' ignored + fi +done + +echo "+++ ossinfo -v3 +++" >> $LOG +/usr/bin/ossinfo -v3 >> $LOG 2>&1 +echo "+++ /dev/sndstat +++" >> $LOG +cat /dev/sndstat >> $LOG 2>&1 +echo "+++ dmesg +++" >> $LOG +dmesg >> $LOG +echo "+++ pciconf +++" >> $LOG +/usr/sbin/pciconf -l -v >> $LOG 2>&1 +echo "+++ OSS devices +++" >> $LOG + +# Restore the previous legacy device links +if test -f $OSSLIBDIR/etc/legacy_devices +then + sh $OSSLIBDIR/etc/legacy_devices >> $LOG 2>&1 +fi + +/usr/sbin/ossdevlinks -v >> $LOG 2>&1 + +ls -l /dev/dsp* /dev/sndstat /dev/mixer* /dev/oss/*/* >> $LOG 2>&1 + +/usr/sbin/savemixer -L -v >> $LOG 2>&1 + +if test -x $OSSLIBDIR/soundon.user +then + echo Running $OSSLIBDIR/soundon.user >> $LOG + $OSSLIBDIR/soundon.user >> $LOG 2>&1 +fi + +if test "`ossinfo -g|grep TRIAL` " != " " +then + echo + echo "************************************************************" + echo "* NOTE! You are using trial version of Open Sound System *" + echo "************************************************************" + echo + + sleep 1 +fi + +if test "`ossinfo -g|grep EXPIRED` " != " " +then + echo + echo "****************************************************************" + echo "* NOTE! Your Open Sound System evaluation license has expired *" + echo "****************************************************************" + echo + + sleep 15 +fi + +exit 0 |