1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 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 ("%s", 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);
|