1 /* $NetBSD: i4b_capi.h,v 1.4 2005/12/10 23:51:50 elad Exp $ */
4 * Copyright (c) 2001-2003 Cubical Solutions Ltd. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * capi/capi.h The CAPI device interface.
29 * $FreeBSD: src/sys/i4b/capi/capi.h,v 1.1 2001/05/25 08:39:31 hm Exp $
32 #ifndef _NETISDN_I4B_CAPI_H_
33 #define _NETISDN_I4B_CAPI_H_
36 // CAPI driver context: B channels and controller softcs.
42 B_FREE
, /* 0: channel free, ncci invalid */
43 B_CONNECT_CONF
, /* 1: wait for CONNECT_CONF */
44 B_CONNECT_IND
, /* 2: IND got, wait for appl RESP */
45 B_CONNECT_ACTIVE_IND
, /* 3: wait for CONNECT_ACTIVE_IND */
46 B_CONNECT_B3_CONF
, /* 4: wait for CONNECT_B3_CONF */
47 B_CONNECT_B3_IND
, /* 5: wait for CONNECT_B3_IND */
48 B_CONNECT_B3_ACTIVE_IND
, /* 6: wait for CONNECT_B3_ACTIVE_IND */
49 B_CONNECTED
, /* 7: channel connected & in use */
50 B_DISCONNECT_CONF
, /* 8: wait for DISCONNECT_CONF */
51 B_DISCONNECT_B3_CONF
, /* 9: wait for DISCONNECT_B3_CONF */
52 B_DISCONNECT_IND
, /* 10: wait for DISCONNECT_IND */
55 typedef struct capi_bchan
60 #define CAPI_CTRL_MASK 0x000000ff
61 #define CAPI_PLCI_MASK 0x0000ffff
62 #define CAPI_NCCI_MASK 0xffff0000
65 enum capi_b_state state
;
67 struct ifqueue tx_queue
;
68 struct ifqueue rx_queue
;
72 /* The rest is needed for i4b integration */
77 isdn_link_t capi_isdn_linktab
;
79 const struct isdn_l4_driver_functions
*l4_driver
;
80 void *l4_driver_softc
;
84 C_DOWN
, /* controller uninitialized */
85 C_READY
, /* controller initialized but not listening */
86 C_UP
, /* controller listening */
89 typedef struct capi_softc
{
90 int sc_unit
; /* index in capi_sc[] */
91 int card_type
; /* CARD_TYPEC_xxx, filled by ll driver */
92 int sc_nbch
; /* number of b channels on this controller */
93 int sc_enabled
; /* is daemon connected TRUE/FALSE */
94 int sc_msgid
; /* next CAPI message id */
95 int capi_isdnif
; /* isdnif identifier */
96 char sc_profile
[64];/* CAPI profile data */
97 enum capi_c_state sc_state
;
99 capi_bchan_t sc_bchan
[MAX_BCHAN
];
101 /* Link layer driver context holder and methods */
104 int (*load
)(struct capi_softc
*, int, u_int8_t
*);
105 int (*reg_appl
)(struct capi_softc
*, int, int);
106 int (*rel_appl
)(struct capi_softc
*, int);
107 int (*send
)(struct capi_softc
*, struct mbuf
*);
110 #define CARD_TYPEC_CAPI_UNK 0
111 #define CARD_TYPEC_AVM_T1_PCI 1
112 #define CARD_TYPEC_AVM_B1_PCI 2
113 #define CARD_TYPEC_AVM_B1_ISA 3
116 // CAPI upcalls for the link layer.
119 #define I4BCAPI_APPLID 1
121 extern int capi_ll_attach(capi_softc_t
*, const char *, const char *);
122 extern int capi_ll_control(capi_softc_t
*, int op
, int arg
);
123 extern int capi_ll_detach(capi_softc_t
*);
125 #define CAPI_CTRL_READY 0 /* ctrl ready, value=TRUE/FALSE */
126 #define CAPI_CTRL_PROFILE 1 /* set CAPI profile */
127 #define CAPI_CTRL_NEW_NCCI 2 /* new ncci value, assign bchan */
128 #define CAPI_CTRL_FREE_NCCI 3 /* free ncci value, clear bchan */
130 extern int capi_ll_receive(capi_softc_t
*, struct mbuf
*);
132 extern int capi_start_tx(void *, int bchan
);
134 #endif /* !_NETISDN_I4B_CAPI_H_ */