summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorkhorben <khorben@NetBSD.org>2022-09-07 00:29:23 +0000
committerkhorben <khorben@NetBSD.org>2022-09-07 00:29:23 +0000
commitc7e9e00a366427d29d7b3e049b58a7169641f7dc (patch)
tree0ad7d2a02fd71a26a6f192bbbef7f1d0c2d77cff /sys/dev
parente93852f4cb8a40505e3a36a54195ffc02588418d (diff)
emuxki(4): allow building as a module
Tested on NetBSD/amd64 with a Sound Blaster Live! Value (CT4870) Note that this required setting outputs.master to the maximum value allowed (255) to get sound out, and then cranking the volume pretty high. Additional sound cards sponsored by the NetBSD Foundation; thanks!
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/emuxki.c42
1 files changed, 36 insertions, 6 deletions
diff --git a/sys/dev/pci/emuxki.c b/sys/dev/pci/emuxki.c
index b1718d7a3ce..ccff2bf4064 100644
--- a/sys/dev/pci/emuxki.c
+++ b/sys/dev/pci/emuxki.c
@@ -1,4 +1,4 @@
-/* $NetBSD: emuxki.c,v 1.72 2022/08/29 09:04:27 khorben Exp $ */
+/* $NetBSD: emuxki.c,v 1.73 2022/09/07 00:29:23 khorben Exp $ */
/*-
* Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -38,10 +38,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.72 2022/08/29 09:04:27 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.73 2022/09/07 00:29:23 khorben Exp $");
#include <sys/param.h>
#include <sys/device.h>
+#include <sys/module.h>
#include <sys/errno.h>
#include <sys/systm.h>
#include <sys/audioio.h>
@@ -164,10 +165,10 @@ struct emuxki_softc {
void (*pintr)(void *);
void *pintrarg;
audio_params_t play;
- int pframesize;
- int pblksize;
- int plength;
- int poffset;
+ uint32_t pframesize;
+ uint32_t pblksize;
+ uint32_t plength;
+ uint32_t poffset;
struct dmamem *rmem; /* rec internal memory */
void (*rintr)(void *);
@@ -1431,3 +1432,32 @@ emuxki_ac97_flags(void *hdl)
return AC97_HOST_SWAPPED_CHANNELS;
}
+
+MODULE(MODULE_CLASS_DRIVER, emuxki, "pci,audio");
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+emuxki_modcmd(modcmd_t cmd, void *opaque)
+{
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+#ifdef _MODULE
+ error = config_init_component(cfdriver_ioconf_emuxki,
+ cfattach_ioconf_emuxki, cfdata_ioconf_emuxki);
+#endif
+ return error;
+ case MODULE_CMD_FINI:
+#ifdef _MODULE
+ error = config_fini_component(cfdriver_ioconf_emuxki,
+ cfattach_ioconf_emuxki, cfdata_ioconf_emuxki);
+#endif
+ return error;
+ default:
+ return ENOTTY;
+ }
+}