summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>2000-01-26 11:23:51 +0000
committerkato <kato@FreeBSD.org>2000-01-26 11:23:51 +0000
commit8e057fffb8688cf1a512ff6435801037878a3e1e (patch)
tree6cbd6b696706e758d6192fec3c64ddc183aa5445
parentc5a78336fec6b1d0b003e8f47ffee09df9e2edea (diff)
downloadFreeBSD-src-8e057fffb8688cf1a512ff6435801037878a3e1e.zip
FreeBSD-src-8e057fffb8688cf1a512ff6435801037878a3e1e.tar.gz
Synced with sys/i386/isa/isa_compat.h and pcaudio.c revisions 1.26 and
1.58, respectively.
-rw-r--r--sys/pc98/pc98/isa_compat.h5
-rw-r--r--sys/pc98/pc98/pcaudio.c66
2 files changed, 38 insertions, 33 deletions
diff --git a/sys/pc98/pc98/isa_compat.h b/sys/pc98/pc98/isa_compat.h
index 1ef6681..62c6907 100644
--- a/sys/pc98/pc98/isa_compat.h
+++ b/sys/pc98/pc98/isa_compat.h
@@ -56,7 +56,6 @@
#include "opl.h"
#include "mpu.h"
#include "uart.h"
-#include "pca.h"
#include "mcd.h"
#include "scd.h"
#include "matcd.h"
@@ -117,7 +116,6 @@ extern struct isa_driver sscape_mssdriver;
extern struct isa_driver opldriver;
extern struct isa_driver mpudriver;
extern struct isa_driver uartdriver;
-extern struct isa_driver pcadriver;
extern struct isa_driver mcddriver;
extern struct isa_driver scddriver;
extern struct isa_driver matcddriver;
@@ -167,9 +165,6 @@ static struct old_isa_driver old_drivers[] = {
#if NMSE > 0
{ INTR_TYPE_TTY, &msedriver },
#endif
-#if NPCA > 0
- { INTR_TYPE_TTY, &pcadriver },
-#endif
#if NGP > 0
{ INTR_TYPE_TTY, &gpdriver },
#endif
diff --git a/sys/pc98/pc98/pcaudio.c b/sys/pc98/pc98/pcaudio.c
index f306860..5f4972b 100644
--- a/sys/pc98/pc98/pcaudio.c
+++ b/sys/pc98/pc98/pcaudio.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 1994-1998 Søren Schmidt
+ * Copyright (c) 1994-1998 Sen Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,13 +28,12 @@
* $FreeBSD$
*/
-#include "pca.h"
-#if NPCA > 0
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/proc.h>
+#include <sys/kernel.h>
+#include <sys/bus.h>
#include <sys/filio.h>
#include <sys/poll.h>
#include <sys/vnode.h>
@@ -42,15 +41,10 @@
#include <machine/clock.h>
#include <machine/pcaudioio.h>
-#ifdef PC98
-#include <pc98/pc98/pc98.h>
-#else
-#include <i386/isa/isa.h>
-#endif
-#include <i386/isa/isa_device.h>
+#include <isa/isareg.h>
+#include <isa/isavar.h>
#include <i386/isa/timerreg.h>
-
#define BUF_SIZE 8192
#define SAMPLE_RATE 8000
#define INTERRUPT_RATE 16000
@@ -153,12 +147,6 @@ static int pca_sleep = 0;
static int pca_initialized = 0;
static void pcaintr(struct clockframe *frame);
-static int pcaprobe(struct isa_device *dvp);
-static int pcaattach(struct isa_device *dvp);
-
-struct isa_driver pcadriver = {
- pcaprobe, pcaattach, "pca",
-};
static d_open_t pcaopen;
static d_close_t pcaclose;
@@ -220,7 +208,6 @@ pca_volume(int volume)
static void
pca_init(void)
{
- cdevsw_add(&pca_cdevsw);
pca_status.open = 0;
pca_status.queries = 0;
pca_status.timer_on = 0;
@@ -323,11 +310,10 @@ pca_continue(void)
#ifdef PC98
pca_status.oldval = inb(IO_PPI) & ~0x08;
- acquire_timer1(TIMER_LSB|TIMER_ONESHOT);
#else
pca_status.oldval = inb(IO_PPI) | 0x03;
- acquire_timer2(TIMER_LSB|TIMER_ONESHOT);
#endif
+ acquire_timer2(TIMER_LSB|TIMER_ONESHOT);
acquire_timer0(INTERRUPT_RATE, pcaintr);
pca_status.timer_on = 1;
splx(x);
@@ -358,23 +344,49 @@ pca_wait(void)
}
+static struct isa_pnp_id pca_ids[] = {
+ {0x0008d041, "AT-style speaker sound"}, /* PNP0800 */
+ {0}
+};
+
static int
-pcaprobe(struct isa_device *dvp)
+pcaprobe(device_t dev)
{
- return(-1);
+ int error;
+
+ /* Check isapnp ids */
+ error = ISA_PNP_PROBE(device_get_parent(dev), dev, pca_ids);
+ if (error == ENXIO)
+ return ENXIO;
+ return 0;
}
static int
-pcaattach(struct isa_device *dvp)
+pcaattach(device_t dev)
{
- printf("pca%d: PC speaker audio driver\n", dvp->id_unit);
pca_init();
make_dev(&pca_cdevsw, 0, 0, 0, 0600, "pcaudio");
make_dev(&pca_cdevsw, 128, 0, 0, 0600, "pcaudioctl");
- return 1;
+ return 0;
}
+static device_method_t pca_methods[] = {
+ DEVMETHOD(device_probe, pcaprobe),
+ DEVMETHOD(device_attach, pcaattach),
+ { 0, 0 }
+};
+
+static driver_t pca_driver = {
+ "pca",
+ pca_methods,
+ 1
+};
+
+static devclass_t pca_devclass;
+
+DRIVER_MODULE(pca, isa, pca_driver, pca_devclass, 0, 0);
+
static int
pcaopen(dev_t dev, int flags, int fmt, struct proc *p)
@@ -547,7 +559,7 @@ pcaintr(struct clockframe *frame)
disable_intr();
#ifdef PC98
__asm__("outb %0,$0x35\n"
- "orb $0x08,%0\n"
+ "andb $0x08,%0\n"
"outb %0,$0x35"
#else
__asm__("outb %0,$0x61\n"
@@ -610,5 +622,3 @@ pcapoll(dev_t dev, int events, struct proc *p)
splx(s);
return (revents);
}
-
-#endif
OpenPOWER on IntegriCloud