Deleted Added
full compact
emu10k1.c (119287) emu10k1.c (119690)
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

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

27#include <dev/sound/pcm/sound.h>
28#include <dev/sound/pcm/ac97.h>
29#include <gnu/dev/sound/pci/emu10k1.h>
30
31#include <dev/pci/pcireg.h>
32#include <dev/pci/pcivar.h>
33#include <sys/queue.h>
34
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

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

27#include <dev/sound/pcm/sound.h>
28#include <dev/sound/pcm/ac97.h>
29#include <gnu/dev/sound/pci/emu10k1.h>
30
31#include <dev/pci/pcireg.h>
32#include <dev/pci/pcivar.h>
33#include <sys/queue.h>
34
35SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/emu10k1.c 119287 2003-08-22 07:08:17Z imp $");
35SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/emu10k1.c 119690 2003-09-02 17:30:40Z jhb $");
36
37/* -------------------------------------------------------------------- */
38
39#define EMU10K1_PCI_ID 0x00021102
40#define EMU10K2_PCI_ID 0x00041102
41#define EMU_DEFAULT_BUFSZ 4096
42#define EMU_CHANS 4
43#undef EMUDEBUG

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

1473 sc->type = pci_get_devid(dev);
1474 sc->rev = pci_get_revid(dev);
1475
1476 data = pci_read_config(dev, PCIR_COMMAND, 2);
1477 data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN);
1478 pci_write_config(dev, PCIR_COMMAND, data, 2);
1479 data = pci_read_config(dev, PCIR_COMMAND, 2);
1480
36
37/* -------------------------------------------------------------------- */
38
39#define EMU10K1_PCI_ID 0x00021102
40#define EMU10K2_PCI_ID 0x00041102
41#define EMU_DEFAULT_BUFSZ 4096
42#define EMU_CHANS 4
43#undef EMUDEBUG

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

1473 sc->type = pci_get_devid(dev);
1474 sc->rev = pci_get_revid(dev);
1475
1476 data = pci_read_config(dev, PCIR_COMMAND, 2);
1477 data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN);
1478 pci_write_config(dev, PCIR_COMMAND, data, 2);
1479 data = pci_read_config(dev, PCIR_COMMAND, 2);
1480
1481 i = PCIR_MAPS;
1481 i = PCIR_BAR(0);
1482 sc->reg = bus_alloc_resource(dev, SYS_RES_IOPORT, &i, 0, ~0, 1, RF_ACTIVE);
1483 if (sc->reg == NULL) {
1484 device_printf(dev, "unable to map register space\n");
1485 goto bad;
1486 }
1487 sc->st = rman_get_bustag(sc->reg);
1488 sc->sh = rman_get_bushandle(sc->reg);
1489

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

1526 pcm_addchan(dev, PCMDIR_REC, &emurchan_class, sc);
1527
1528 pcm_setstatus(dev, status);
1529
1530 return 0;
1531
1532bad:
1533 if (codec) ac97_destroy(codec);
1482 sc->reg = bus_alloc_resource(dev, SYS_RES_IOPORT, &i, 0, ~0, 1, RF_ACTIVE);
1483 if (sc->reg == NULL) {
1484 device_printf(dev, "unable to map register space\n");
1485 goto bad;
1486 }
1487 sc->st = rman_get_bustag(sc->reg);
1488 sc->sh = rman_get_bushandle(sc->reg);
1489

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

1526 pcm_addchan(dev, PCMDIR_REC, &emurchan_class, sc);
1527
1528 pcm_setstatus(dev, status);
1529
1530 return 0;
1531
1532bad:
1533 if (codec) ac97_destroy(codec);
1534 if (sc->reg) bus_release_resource(dev, SYS_RES_IOPORT, PCIR_MAPS, sc->reg);
1534 if (sc->reg) bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), sc->reg);
1535 if (sc->ih) bus_teardown_intr(dev, sc->irq, sc->ih);
1536 if (sc->irq) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
1537 if (sc->parent_dmat) bus_dma_tag_destroy(sc->parent_dmat);
1538 if (sc->lock) snd_mtxfree(sc->lock);
1539 free(sc, M_DEVBUF);
1540 return ENXIO;
1541}
1542

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

1549 r = pcm_unregister(dev);
1550 if (r)
1551 return r;
1552
1553 sc = pcm_getdevinfo(dev);
1554 /* shutdown chip */
1555 emu_uninit(sc);
1556
1535 if (sc->ih) bus_teardown_intr(dev, sc->irq, sc->ih);
1536 if (sc->irq) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
1537 if (sc->parent_dmat) bus_dma_tag_destroy(sc->parent_dmat);
1538 if (sc->lock) snd_mtxfree(sc->lock);
1539 free(sc, M_DEVBUF);
1540 return ENXIO;
1541}
1542

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

1549 r = pcm_unregister(dev);
1550 if (r)
1551 return r;
1552
1553 sc = pcm_getdevinfo(dev);
1554 /* shutdown chip */
1555 emu_uninit(sc);
1556
1557 bus_release_resource(dev, SYS_RES_IOPORT, PCIR_MAPS, sc->reg);
1557 bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), sc->reg);
1558 bus_teardown_intr(dev, sc->irq, sc->ih);
1559 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
1560 bus_dma_tag_destroy(sc->parent_dmat);
1561 snd_mtxfree(sc->lock);
1562 free(sc, M_DEVBUF);
1563
1564 return 0;
1565}

--- 72 unchanged lines hidden ---
1558 bus_teardown_intr(dev, sc->irq, sc->ih);
1559 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
1560 bus_dma_tag_destroy(sc->parent_dmat);
1561 snd_mtxfree(sc->lock);
1562 free(sc, M_DEVBUF);
1563
1564 return 0;
1565}

--- 72 unchanged lines hidden ---