From owner-freebsd-multimedia Thu Dec 2 2:19: 0 1999 Delivered-To: freebsd-multimedia@freebsd.org Received: from cip12.melaten.rwth-aachen.de (cip12.melaten.RWTH-Aachen.DE [134.130.92.12]) by hub.freebsd.org (Postfix) with ESMTP id B309D14E2D for ; Thu, 2 Dec 1999 02:18:54 -0800 (PST) (envelope-from tg@melaten.rwth-aachen.de) Received: (from tg@localhost) by cip12.melaten.rwth-aachen.de (8.9.3/8.9.3) id LAA54940; Thu, 2 Dec 1999 11:20:09 +0100 (CET) (envelope-from tg) To: freebsd-multimedia@freebsd.org Subject: Aztech 2320 soundcard From: Thomas Gellekum Date: 02 Dec 1999 11:20:08 +0100 Message-ID: Lines: 10 User-Agent: Gnus/5.070098 (Pterodactyl Gnus v0.98) XEmacs/20.4 (Emerald) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --=-=-= Moin, The attached patch adds some support for soundcards based on Aztech's 2320. The method for switching the device into MSS mode was taken from NetBSD. The diff is relative to -stable. tg --=-=-= Content-Disposition: attachment; filename=snd.diff Index: ad1848.c =================================================================== RCS file: /usr/cvs/src/sys/i386/isa/snd/Attic/ad1848.c,v retrieving revision 1.20.2.1 diff -u -r1.20.2.1 ad1848.c --- ad1848.c 1999/05/10 12:31:53 1.20.2.1 +++ ad1848.c 1999/12/01 17:03:09 @@ -47,6 +47,7 @@ * board-specific include files */ +#include #include /* @@ -1424,6 +1425,76 @@ */ #if NPNP > 0 + +static char *azt2320_probe(u_long csn, u_long vend_id); +static void +azt2320_attach(u_long csn, u_long vend_id, char *name, + struct isa_device *dev); + +static struct pnp_device azt2320 = { + "AZT2320", + azt2320_probe, + azt2320_attach, + &nsnd, + &tty_imask +}; +DATA_SET(pnpdevice_set, azt2320); + +static char * +azt2320_probe(u_long csn, u_long vend_id) +{ + if (vend_id == 0x20235407) { + struct pnp_cinfo d; + read_pnp_parms(&d, 1); + if (d.enable == 0) { + printf("This is an AZT2320, but LDN 1 is disabled\n"); + return NULL; + } + return "Aztech 2320"; + } + return NULL; +} + +static void +azt2320_attach(u_long csn, u_long vend_id, char *name, + struct isa_device *dev) +{ + struct pnp_cinfo d; + snddev_info tmp_d; + + if (read_pnp_parms(&d, 1) == 0) { + printf("failed to read pnp parms\n"); + return; + } + write_pnp_parms(&d, 1); + enable_pnp_card(); + + snddev_last_probed = &tmp_d; + if (vend_id == 0x20235407) { + tmp_d = mss_op_desc; + + /* put into WSS mode (snatched from NetBSD) */ + while (inb(d.port[0] + SBDSP_STATUS) & 0x80) + ; + outb(d.port[0] + SBDSP_CMD, 0x09); + while (inb(d.port[0] + SBDSP_STATUS) & 0x80) + ; + outb(d.port[0] + SBDSP_CMD, 0x00); + DELAY(1000); + + /* now fill in the device info */ + dev->id_iobase = d.port[2] - 4; + tmp_d.io_base = dev->id_iobase; + tmp_d.alt_base = d.port[0]; /* soundblaster comp. but we don't + * use that */ + tmp_d.synth_base = d.port[1]; + strcpy(tmp_d.name, name); + dev->id_drq = d.drq[0]; + dev->id_irq = (1 << d.irq[0] ); + dev->id_intr = pcmintr; + pcmattach(dev); + } +} static char * cs423x_probe(u_long csn, u_long vend_id); static void --=-=-=-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message