1 /* $NetBSD: i4b_l1l2.h,v 1.14 2014/10/18 08:33:29 snj 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 * 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. 30 */ 31 32 #ifndef _NETISDN_I4B_L1L2_H_ 33 #define _NETISDN_I4B_L1L2_H_ 34 35 /* 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 its own ISDN stack in firmware). 39 * 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. 43 * 44 * A back-pointer to the layer 1 softc is included (as void*) in this 45 * structure. 46 */ 47 48 typedef void *isdn_layer1token; 49 50 /* 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). 54 * 55 * Layer 1 functions called from layer 2: 56 */ 57 struct isdn_layer1_isdnif_driver { 58 /* Request to transmit data. */ 59 int (*ph_data_req)(isdn_layer1token, struct mbuf *, int); 60 61 /* Request to activate layer 1. */ 62 int (*ph_activate_req)(isdn_layer1token); 63 64 /* Request to execute an internal command. */ 65 int (*mph_command_req)(isdn_layer1token, int, void *); 66 }; 67 68 /* 69 * Layer 2 functions called by layer 1: 70 */ 71 72 /* Process a rx'd frame */ 73 int isdn_layer2_data_ind(struct l2_softc * t, struct isdn_l3_driver *, struct mbuf *m); 74 75 /* Pass a layer 1 activation/deactivation to layer 2. */ 76 int isdn_layer2_activate_ind(struct l2_softc *, struct isdn_l3_driver *, int); 77 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 *); 81 82 /* Pass status informations to layer 2. */ 83 int isdn_layer2_status_ind(struct l2_softc *, struct isdn_l3_driver *, int, int); 84 85 #endif /* !_NETISDN_I4B_L1L2_H_ */ 86