2 * Copyright (c) 2001 Cubical Solutions Ltd. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * capi/capi.h The CAPI device interface.
27 * $FreeBSD: src/sys/i4b/capi/capi.h,v 1.1.2.1 2001/08/10 14:08:34 obrien Exp $
28 * $DragonFly: src/sys/net/i4b/capi/capi.h,v 1.2 2003/06/17 04:28:39 dillon Exp $
35 // CAPI driver context: B channels and controller softcs.
41 B_FREE, /* channel free, ncci invalid */
42 B_CONNECT_CONF, /* wait for CONNECT_CONF */
43 B_CONNECT_IND, /* IND got, wait for appl RESP */
44 B_CONNECT_ACTIVE_IND, /* wait for CONNECT_ACTIVE_IND */
45 B_CONNECT_B3_CONF, /* wait for CONNECT_B3_CONF */
46 B_CONNECT_B3_IND, /* wait for CONNECT_B3_IND */
47 B_CONNECT_B3_ACTIVE_IND, /* wait for CONNECT_B3_ACTIVE_IND */
48 B_CONNECTED, /* channel connected & in use */
49 B_DISCONNECT_CONF, /* wait for DISCONNECT_CONF */
50 B_DISCONNECT_B3_CONF, /* wait for DISCONNECT_B3_CONF */
51 B_DISCONNECT_IND, /* wait for DISCONNECT_IND */
54 typedef struct capi_bchan
59 #define CAPI_CTRL_MASK 0x000000ff
60 #define CAPI_PLCI_MASK 0x0000ffff
61 #define CAPI_NCCI_MASK 0xffff0000
64 enum capi_b_state state;
66 struct ifqueue tx_queue;
67 struct ifqueue rx_queue;
71 /* The rest is needed for i4b integration */
77 isdn_link_t capi_isdn_linktab;
78 drvr_link_t *capi_drvr_linktab;
82 C_DOWN, /* controller uninitialized */
83 C_READY, /* controller initialized but not listening */
84 C_UP, /* controller listening */
87 typedef struct capi_softc {
88 int sc_unit; /* index in capi_sc[] */
89 int ctrl_unit; /* index in isdn_ctrl_tab[] */
90 int card_type; /* CARD_TYPEC_xxx, filled by ll driver */
91 int sc_nbch; /* number of b channels on this controller */
92 int sc_enabled; /* is daemon connected TRUE/FALSE */
93 int sc_msgid; /* next CAPI message id */
94 char sc_profile[64];/* CAPI profile data */
95 enum capi_c_state sc_state;
97 capi_bchan_t sc_bchan[MAX_BCHAN];
99 /* Link layer driver context holder and methods */
103 int (*load)(struct capi_softc *, int, u_int8_t *);
104 int (*reg_appl)(struct capi_softc *, int, int);
105 int (*rel_appl)(struct capi_softc *, int);
106 int (*send)(struct capi_softc *, struct mbuf *);
109 extern capi_softc_t *capi_sc[];
113 // CAPI upcalls for the link layer.
116 #define I4BCAPI_APPLID 1
118 extern int capi_ll_attach(capi_softc_t *);
119 extern int capi_ll_control(capi_softc_t *, int op, int arg);
121 #define CAPI_CTRL_READY 0 /* ctrl ready, value=TRUE/FALSE */
122 #define CAPI_CTRL_PROFILE 1 /* set CAPI profile */
123 #define CAPI_CTRL_NEW_NCCI 2 /* new ncci value, assign bchan */
124 #define CAPI_CTRL_FREE_NCCI 3 /* free ncci value, clear bchan */
126 extern int capi_ll_receive(capi_softc_t *, struct mbuf *);
128 extern int capi_start_tx(capi_softc_t *, int bchan);
130 #endif /* _I4B_CAPI_H_ */