csavar.h revision 77504
1248619Sdes/*-
2248619Sdes * Copyright (c) 1999 Seigo Tanimura
3248619Sdes * All rights reserved.
4248619Sdes *
5248619Sdes * Redistribution and use in source and binary forms, with or without
6248619Sdes * modification, are permitted provided that the following conditions
7248619Sdes * are met:
8248619Sdes * 1. Redistributions of source code must retain the above copyright
9248619Sdes *    notice, this list of conditions and the following disclaimer.
10248619Sdes * 2. Redistributions in binary form must reproduce the above copyright
11248619Sdes *    notice, this list of conditions and the following disclaimer in the
12248619Sdes *    documentation and/or other materials provided with the distribution.
13248619Sdes *
14248619Sdes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15248619Sdes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16248619Sdes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17248619Sdes * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18248619Sdes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19248619Sdes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20248619Sdes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21248619Sdes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22248619Sdes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23248619Sdes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24248619Sdes * SUCH DAMAGE.
25248619Sdes *
26248619Sdes * $FreeBSD: head/sys/dev/sound/pci/csavar.h 77504 2001-05-30 22:38:31Z cg $
27248619Sdes */
28248619Sdes
29248619Sdes#ifndef _CSA_VAR_H
30248619Sdes#define _CSA_VAR_H
31248619Sdesstruct csa_card {
32248619Sdes	u_int16_t subvendor, subdevice;
33248619Sdes	char *name;
34248619Sdes	void *amp;
35248619Sdes	void *amp_init;
36248619Sdes	int (*active)(int);
37248619Sdes};
38248619Sdes
39248619Sdes/* Resources. */
40248619Sdesstruct csa_res {
41248619Sdes	int io_rid; /* io rid */
42248619Sdes	struct resource *io; /* io */
43248619Sdes	int mem_rid; /* memory rid */
44248619Sdes	struct resource *mem; /* memory */
45248619Sdes	int irq_rid; /* irq rid */
46248619Sdes	struct resource *irq; /* irq */
47248619Sdes};
48248619Sdestypedef struct csa_res csa_res;
49248619Sdes
50248619Sdes/* State of the bridge. */
51248619Sdesstruct csa_bridgeinfo {
52248619Sdes	u_int32_t hisr; /* The value of HISR on this interrupt. */
53248619Sdes	struct csa_card *card;
54248619Sdes};
55248619Sdes
56248619Sdesvoid csa_clearserialfifos(csa_res *resp);
57248619Sdes
58248619Sdes/* Common functions for csa. */
59248619Sdesstruct csa_card *csa_findsubcard(device_t dev);
60248619Sdesint csa_readcodec(csa_res *resp, u_long offset, u_int32_t *data);
61248619Sdesint csa_writecodec(csa_res *resp, u_long offset, u_int32_t data);
62248619Sdes
63248619Sdesu_int32_t csa_readio(csa_res *resp, u_long offset);
64248619Sdesvoid csa_writeio(csa_res *resp, u_long offset, u_int32_t data);
65248619Sdesu_int32_t csa_readmem(csa_res *resp, u_long offset);
66248619Sdesvoid csa_writemem(csa_res *resp, u_long offset, u_int32_t data);
67248619Sdes
68248619Sdes#endif /* _CSA_VAR_H */
69248619Sdes