Deleted Added
full compact
csa.c (142890) csa.c (147626)
1/*-
2 * Copyright (c) 1999 Seigo Tanimura
3 * All rights reserved.
4 *
5 * Portions of this source are based on cwcealdr.cpp and dhwiface.cpp in
6 * cwcealdr1.zip, the sample sources by Crystal Semiconductor.
7 * Copyright (c) 1996-1998 Crystal Semiconductor Corp.
8 *

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

43#include <dev/sound/pci/csareg.h>
44#include <dev/sound/pci/csavar.h>
45
46#include <dev/pci/pcireg.h>
47#include <dev/pci/pcivar.h>
48
49#include <gnu/dev/sound/pci/csaimg.h>
50
1/*-
2 * Copyright (c) 1999 Seigo Tanimura
3 * All rights reserved.
4 *
5 * Portions of this source are based on cwcealdr.cpp and dhwiface.cpp in
6 * cwcealdr1.zip, the sample sources by Crystal Semiconductor.
7 * Copyright (c) 1996-1998 Crystal Semiconductor Corp.
8 *

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

43#include <dev/sound/pci/csareg.h>
44#include <dev/sound/pci/csavar.h>
45
46#include <dev/pci/pcireg.h>
47#include <dev/pci/pcivar.h>
48
49#include <gnu/dev/sound/pci/csaimg.h>
50
51SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/csa.c 142890 2005-03-01 08:58:06Z imp $");
51SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/csa.c 147626 2005-06-27 07:43:57Z glebius $");
52
53/* This is the pci device id. */
54#define CS4610_PCI_ID 0x60011013
55#define CS4614_PCI_ID 0x60031013
56#define CS4615_PCI_ID 0x60041013
57
58/* Here is the parameter structure per a device. */
59struct csa_softc {

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

82 struct resource *r);
83static int csa_setup_intr(device_t bus, device_t child,
84 struct resource *irq, int flags,
85 driver_intr_t *intr, void *arg, void **cookiep);
86static int csa_teardown_intr(device_t bus, device_t child,
87 struct resource *irq, void *cookie);
88static driver_intr_t csa_intr;
89static int csa_initialize(sc_p scp);
52
53/* This is the pci device id. */
54#define CS4610_PCI_ID 0x60011013
55#define CS4614_PCI_ID 0x60031013
56#define CS4615_PCI_ID 0x60041013
57
58/* Here is the parameter structure per a device. */
59struct csa_softc {

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

82 struct resource *r);
83static int csa_setup_intr(device_t bus, device_t child,
84 struct resource *irq, int flags,
85 driver_intr_t *intr, void *arg, void **cookiep);
86static int csa_teardown_intr(device_t bus, device_t child,
87 struct resource *irq, void *cookie);
88static driver_intr_t csa_intr;
89static int csa_initialize(sc_p scp);
90static void csa_resetdsp(csa_res *resp);
91static int csa_downloadimage(csa_res *resp);
92
93static devclass_t csa_devclass;
94
95static void
96amp_none(void)
97{
98}

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

361 bus_release_resource(dev, SYS_RES_MEMORY, resp->io_rid, resp->io);
362
363 return bus_generic_detach(dev);
364}
365
366static int
367csa_resume(device_t dev)
368{
90static int csa_downloadimage(csa_res *resp);
91
92static devclass_t csa_devclass;
93
94static void
95amp_none(void)
96{
97}

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

360 bus_release_resource(dev, SYS_RES_MEMORY, resp->io_rid, resp->io);
361
362 return bus_generic_detach(dev);
363}
364
365static int
366csa_resume(device_t dev)
367{
369#if 0
370 /*
371 * XXX: this cannot possibly work
372 * needs to be properly implemented
373 */
374 csa_detach(dev);
375 csa_attach(dev);
376#endif
377 return 0;
368 csa_res *resp;
369 sc_p scp;
370
371 scp = device_get_softc(dev);
372 resp = &scp->res;
373
374 /* Initialize the chip. */
375 if (csa_initialize(scp))
376 return (ENXIO);
377
378 /* Reset the Processor. */
379 csa_resetdsp(resp);
380
381 /* Download the Processor Image to the processor. */
382 if (csa_downloadimage(resp))
383 return (ENXIO);
384
385 return (bus_generic_resume(dev));
378}
379
380static struct resource *
381csa_alloc_resource(device_t bus, device_t child, int type, int *rid,
382 u_long start, u_long end, u_long count, u_int flags)
383{
384 sc_p scp;
385 csa_res *resp;

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

789 /*
790 * Now, if we powered up the devices, then power them back down again.
791 * This is kinda ugly, but should never happen.
792 */
793 if (!pwr)
794 csa_writeio(resp, BA0_CLKCR1, clkcr1);
795}
796
386}
387
388static struct resource *
389csa_alloc_resource(device_t bus, device_t child, int type, int *rid,
390 u_long start, u_long end, u_long count, u_int flags)
391{
392 sc_p scp;
393 csa_res *resp;

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

797 /*
798 * Now, if we powered up the devices, then power them back down again.
799 * This is kinda ugly, but should never happen.
800 */
801 if (!pwr)
802 csa_writeio(resp, BA0_CLKCR1, clkcr1);
803}
804
797static void
805void
798csa_resetdsp(csa_res *resp)
799{
800 int i;
801
802 /*
803 * Write the reset bit of the SP control register.
804 */
805 csa_writemem(resp, BA1_SPCR, SPCR_RSTSP);

--- 263 unchanged lines hidden ---
806csa_resetdsp(csa_res *resp)
807{
808 int i;
809
810 /*
811 * Write the reset bit of the SP control register.
812 */
813 csa_writemem(resp, BA1_SPCR, SPCR_RSTSP);

--- 263 unchanged lines hidden ---