FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/daicvar.h
1 /* $NetBSD: daicvar.h,v 1.6 2003/12/04 13:57:30 keihan Exp $ */
2
3 /*-
4 * Copyright (c) 2002 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Martin Husemann <martin@NetBSD.org>.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #ifndef DIEHLISDNVAR
40 #define DIEHLISDNVAR
41 #if defined(KERNEL) || defined(_KERNEL)
42
43 #define DAIC_MAX_PORT 4
44 #define DAIC_ISA_MEMSIZE 2048
45 #define DAIC_ISA_QUADSIZE (DAIC_MAX_PORT*DAIC_ISA_MEMSIZE)
46 #define DAIC_MAX_ACTIVE (2*DAIC_MAX_PORT) /* simlutaneous connections on one instance */
47
48 /* A queue of pending outgoing calls */
49 struct outcallentry {
50 TAILQ_ENTRY(outcallentry) queue;
51 unsigned int cdid; /* call descriptor id for layer 4 */
52 u_int8_t dchan_id; /* task id for microcode */
53 u_int8_t rc; /* return code */
54 };
55
56 /* One active connection */
57 struct daic_connection {
58 u_int cdid; /* layer 4 call descriptor id */
59 struct ifqueue tx_queue; /* outgoing data */
60 struct ifqueue rx_queue; /* incoming data */
61 isdn_link_t isdn_linktab; /* description of ourself */
62 const struct isdn_l4_driver_functions
63 *l4_driver; /* layer 4 driver */
64 void *l4_driver_softc; /* layer 4 driver instance */
65 u_int8_t dchan_inst; /* d-channel instance */
66 u_int8_t dchan_rc; /* return code for dchannel requests */
67 u_int8_t bchan_inst; /* b-channel instance */
68 u_int8_t bchan_rc; /* return code for bchannel requests */
69 };
70
71 /*
72 * One BRI as exposed to the upper layers, with all the internal management
73 * information we need for it. A pointer to this is passed as the driver
74 * token.
75 */
76 struct daic_unit {
77 struct daic_softc *du_sc; /* pointer to softc */
78 const struct isdn_l3_driver *du_l3;
79 int du_port; /* port number (on multi BRI cards) */
80 int du_state; /* state of board, see below */
81 #define DAIC_STATE_COLD 0 /* nothing happened to the board */
82 #define DAIC_STATE_DOWNLOAD 1 /* the card is waiting for protocol code */
83 #define DAIC_STATE_TESTING 2 /* waiting for first interrupt from card */
84 #define DAIC_STATE_RUNNING 3 /* the protocol is running */
85 #define DAIC_STATE_DIAGNOSTIC 4 /* temporary disabled for diagnostics */
86
87 int du_assign; /* allocate new protocol instance */
88 #define DAIC_ASSIGN_PENDING 1 /* we are awaiting a new ID */
89 #define DAIC_ASSIGN_SLEEPING 2 /* somebody sleeping, wakeup after we got the ID */
90 #define DAIC_ASSIGN_GLOBAL 4 /* result is a global d-channel id */
91 #define DAIC_ASSIGN_NOGLOBAL 8 /* need to assign a global d-channel id */
92
93 u_int8_t du_global_dchan; /* handle of global dchannel instance */
94 u_int8_t du_request_res; /* result of requests */
95 u_int8_t du_assign_res; /* result of assigns */
96 };
97
98 /* superclass of all softc structs for attachments, you should
99 * always be able to cast an attachments struct device *self to this. */
100 struct daic_softc {
101 struct device sc_dev;
102 bus_space_tag_t sc_iot; /* bus identifier */
103 bus_space_handle_t sc_ioh; /* mem handle */
104 int sc_cardtype; /* variant of card */
105 #define DAIC_TYPE_S 0
106 #define DAIC_TYPE_SX 1
107 #define DAIC_TYPE_SCOM 2
108 #define DAIC_TYPE_QUAD 3
109
110 struct daic_unit sc_port[DAIC_MAX_PORT];
111
112 /* one record for each b-channel we could handle concurrently */
113 struct daic_connection sc_con[DAIC_MAX_ACTIVE];
114
115 /* a tailq of ougoing calls no yet assigned to any b-channel */
116 TAILQ_HEAD(outcallhead, outcallentry) sc_outcalls[DAIC_MAX_PORT];
117 };
118
119 /*
120 * functions exported from MI part
121 */
122 extern int daic_probe __P((bus_space_tag_t bus, bus_space_handle_t io));
123 extern void daic_attach __P((struct device *self, struct daic_softc *sc));
124 extern int daic_intr __P((struct daic_softc *));
125
126 #endif
127 #endif
Cache object: 3100c79158f70f31fb2c1d2f1ea768be
|