diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-05-03 21:08:42 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-05-03 21:08:42 +0400 |
commit | 1058def8e7827e56ce4a70afb4aeacb5dc44148f (patch) | |
tree | 4495d23e7b54ab5700e3839081e797c1eafe0db9 /setup/FreeBSD/oss/build/module.inc | |
download | oss4-upstream.tar.gz |
Imported Upstream version 4.2-build2006upstream/4.2-build2006upstream
Diffstat (limited to 'setup/FreeBSD/oss/build/module.inc')
-rw-r--r-- | setup/FreeBSD/oss/build/module.inc | 89 |
1 files changed, 89 insertions, 0 deletions
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); |