Deleted Added
full compact
aureal.c (70291) aureal.c (74763)
1/*
2 * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*
2 * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/sound/pci/aureal.c 70291 2000-12-23 03:16:13Z cg $
26 * $FreeBSD: head/sys/dev/sound/pci/aureal.c 74763 2001-03-24 23:10:29Z cg $
27 */
28
29#include <dev/sound/pcm/sound.h>
30#include <dev/sound/pcm/ac97.h>
31#include <dev/sound/pci/aureal.h>
32
33#include <pci/pcireg.h>
34#include <pci/pcivar.h>

--- 4 unchanged lines hidden (view full) ---

39/* channel interface */
40static u_int32_t au_playfmt[] = {
41 AFMT_U8,
42 AFMT_STEREO | AFMT_U8,
43 AFMT_S16_LE,
44 AFMT_STEREO | AFMT_S16_LE,
45 0
46};
27 */
28
29#include <dev/sound/pcm/sound.h>
30#include <dev/sound/pcm/ac97.h>
31#include <dev/sound/pci/aureal.h>
32
33#include <pci/pcireg.h>
34#include <pci/pcivar.h>

--- 4 unchanged lines hidden (view full) ---

39/* channel interface */
40static u_int32_t au_playfmt[] = {
41 AFMT_U8,
42 AFMT_STEREO | AFMT_U8,
43 AFMT_S16_LE,
44 AFMT_STEREO | AFMT_S16_LE,
45 0
46};
47static pcmchan_caps au_playcaps = {4000, 48000, au_playfmt, 0};
47static struct pcmchan_caps au_playcaps = {4000, 48000, au_playfmt, 0};
48
49static u_int32_t au_recfmt[] = {
50 AFMT_U8,
51 AFMT_STEREO | AFMT_U8,
52 AFMT_S16_LE,
53 AFMT_STEREO | AFMT_S16_LE,
54 0
55};
48
49static u_int32_t au_recfmt[] = {
50 AFMT_U8,
51 AFMT_STEREO | AFMT_U8,
52 AFMT_S16_LE,
53 AFMT_STEREO | AFMT_S16_LE,
54 0
55};
56static pcmchan_caps au_reccaps = {4000, 48000, au_recfmt, 0};
56static struct pcmchan_caps au_reccaps = {4000, 48000, au_recfmt, 0};
57
58/* -------------------------------------------------------------------- */
59
60struct au_info;
61
62struct au_chinfo {
63 struct au_info *parent;
57
58/* -------------------------------------------------------------------- */
59
60struct au_info;
61
62struct au_chinfo {
63 struct au_info *parent;
64 pcm_channel *channel;
65 snd_dbuf *buffer;
64 struct pcm_channel *channel;
65 struct snd_dbuf *buffer;
66 int dir;
67};
68
69struct au_info {
70 int unit;
71
72 bus_space_tag_t st[3];
73 bus_space_handle_t sh[3];
74
75 bus_dma_tag_t parent_dmat;
66 int dir;
67};
68
69struct au_info {
70 int unit;
71
72 bus_space_tag_t st[3];
73 bus_space_handle_t sh[3];
74
75 bus_dma_tag_t parent_dmat;
76 void *lock;
76
77 u_int32_t x[32], y[128];
78 char z[128];
79 u_int32_t routes[4], interrupts;
80 struct au_chinfo pch;
81};
82
83static int au_init(device_t dev, struct au_info *au);

--- 204 unchanged lines hidden (view full) ---

288
289 au_addroute(au, 0x11, 0, 0x58);
290 au_addroute(au, 0x11, stereo? 0 : 1, 0x59);
291}
292
293/* -------------------------------------------------------------------- */
294/* channel interface */
295static void *
77
78 u_int32_t x[32], y[128];
79 char z[128];
80 u_int32_t routes[4], interrupts;
81 struct au_chinfo pch;
82};
83
84static int au_init(device_t dev, struct au_info *au);

--- 204 unchanged lines hidden (view full) ---

289
290 au_addroute(au, 0x11, 0, 0x58);
291 au_addroute(au, 0x11, stereo? 0 : 1, 0x59);
292}
293
294/* -------------------------------------------------------------------- */
295/* channel interface */
296static void *
296auchan_init(kobj_t obj, void *devinfo, snd_dbuf *b, pcm_channel *c, int dir)
297auchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
297{
298 struct au_info *au = devinfo;
299 struct au_chinfo *ch = (dir == PCMDIR_PLAY)? &au->pch : NULL;
300
301 ch->parent = au;
302 ch->channel = c;
303 ch->buffer = b;
304 ch->dir = dir;

--- 55 unchanged lines hidden (view full) ---

360 struct au_info *au = ch->parent;
361 if (ch->dir == PCMDIR_PLAY) {
362 return au_rd(au, 0, AU_REG_UNK2, 4) & (AU_BUFFSIZE-1);
363 } else {
364 return 0;
365 }
366}
367
298{
299 struct au_info *au = devinfo;
300 struct au_chinfo *ch = (dir == PCMDIR_PLAY)? &au->pch : NULL;
301
302 ch->parent = au;
303 ch->channel = c;
304 ch->buffer = b;
305 ch->dir = dir;

--- 55 unchanged lines hidden (view full) ---

361 struct au_info *au = ch->parent;
362 if (ch->dir == PCMDIR_PLAY) {
363 return au_rd(au, 0, AU_REG_UNK2, 4) & (AU_BUFFSIZE-1);
364 } else {
365 return 0;
366 }
367}
368
368static pcmchan_caps *
369static struct pcmchan_caps *
369auchan_getcaps(kobj_t obj, void *data)
370{
371 struct au_chinfo *ch = data;
372 return (ch->dir == PCMDIR_PLAY)? &au_playcaps : &au_reccaps;
373}
374
375static kobj_method_t auchan_methods[] = {
376 KOBJMETHOD(channel_init, auchan_init),

--- 238 unchanged lines hidden (view full) ---

615 }
616#endif
617
618 au_wr(au, 0, AU_REG_IRQEN, 0, 4);
619
620 irqid = 0;
621 irq = bus_alloc_resource(dev, SYS_RES_IRQ, &irqid,
622 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
370auchan_getcaps(kobj_t obj, void *data)
371{
372 struct au_chinfo *ch = data;
373 return (ch->dir == PCMDIR_PLAY)? &au_playcaps : &au_reccaps;
374}
375
376static kobj_method_t auchan_methods[] = {
377 KOBJMETHOD(channel_init, auchan_init),

--- 238 unchanged lines hidden (view full) ---

616 }
617#endif
618
619 au_wr(au, 0, AU_REG_IRQEN, 0, 4);
620
621 irqid = 0;
622 irq = bus_alloc_resource(dev, SYS_RES_IRQ, &irqid,
623 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
623 if (!irq
624 || bus_setup_intr(dev, irq, INTR_TYPE_TTY, au_intr, au, &ih)) {
624 if (!irq || snd_setup_intr(dev, irq, 0, au_intr, au, &ih)) {
625 device_printf(dev, "unable to map interrupt\n");
626 goto bad;
627 }
628
629 if (au_testirq(au)) device_printf(dev, "irq test failed\n");
630
631 if (au_init(dev, au) == -1) {
632 device_printf(dev, "unable to initialize the card\n");

--- 40 unchanged lines hidden (view full) ---

673 DEVMETHOD(device_attach, au_pci_attach),
674
675 { 0, 0 }
676};
677
678static driver_t au_driver = {
679 "pcm",
680 au_methods,
625 device_printf(dev, "unable to map interrupt\n");
626 goto bad;
627 }
628
629 if (au_testirq(au)) device_printf(dev, "irq test failed\n");
630
631 if (au_init(dev, au) == -1) {
632 device_printf(dev, "unable to initialize the card\n");

--- 40 unchanged lines hidden (view full) ---

673 DEVMETHOD(device_attach, au_pci_attach),
674
675 { 0, 0 }
676};
677
678static driver_t au_driver = {
679 "pcm",
680 au_methods,
681 sizeof(snddev_info),
681 sizeof(struct snddev_info),
682};
683
684static devclass_t pcm_devclass;
685
686DRIVER_MODULE(snd_aureal, pci, au_driver, pcm_devclass, 0, 0);
687MODULE_DEPEND(snd_aureal, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER);
688MODULE_VERSION(snd_aureal, 1);
682};
683
684static devclass_t pcm_devclass;
685
686DRIVER_MODULE(snd_aureal, pci, au_driver, pcm_devclass, 0, 0);
687MODULE_DEPEND(snd_aureal, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER);
688MODULE_VERSION(snd_aureal, 1);