1 /* $NetBSD: i4b_l1l2.h,v 1.12 2007/03/04 06:03:30 christos Exp $ */
4 * Copyright (c) 2002 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Martin Husemann <martin@NetBSD.org>.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _NETISDN_I4B_L1L2_H_
33 #define _NETISDN_I4B_L1L2_H_
36 * This file defines the D-channel interface between layer 1 (physical
37 * card hardware) and layer 2 of a passive ISDN card (i.e. a card that
38 * does not run it's own ISDN stack in firmware).
40 * Since each layer 1 driver knows in advance it will need to attach
41 * to this layer 2, the whole layer 2 softc struct is typically included
42 * in the layer 1 softc.
44 * A back-pointer to the layer 1 softc is included (as void*) in this
48 typedef void *isdn_layer1token
;
51 * Each driver attaching to layer 2 via this interface provides a pointer
52 * to a struct of function pointers used to communicate with layer 1, while
53 * layer 1 calls layer 2 functions directly (see below).
55 * Layer 1 functions called from layer 2:
57 struct isdn_layer1_isdnif_driver
{
58 /* Request to transmit data. */
59 int (*ph_data_req
)(isdn_layer1token
, struct mbuf
*, int);
61 /* Request to activate layer 1. */
62 int (*ph_activate_req
)(isdn_layer1token
);
64 /* Request to execute an internal command. */
65 int (*mph_command_req
)(isdn_layer1token
, int, void *);
69 * Layer 2 functions called by layer 1:
72 /* Process a rx'd frame */
73 int isdn_layer2_data_ind(struct l2_softc
* t
, struct isdn_l3_driver
*, struct mbuf
*m
);
75 /* Pass a layer 1 activation/deactivation to layer 2. */
76 int isdn_layer2_activate_ind(struct l2_softc
*, struct isdn_l3_driver
*, int);
78 /* Pass trace data to layer 2. */
79 struct i4b_trace_hdr
; /* from i4b_trace.h */
80 int isdn_layer2_trace_ind(struct l2_softc
*, struct isdn_l3_driver
*, struct i4b_trace_hdr
*, size_t, unsigned char *);
82 /* Pass status informations to layer 2. */
83 int isdn_layer2_status_ind(struct l2_softc
*, struct isdn_l3_driver
*, int, int);
85 #endif /* !_NETISDN_I4B_L1L2_H_ */