]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - include/linux/isdn/hdlc.h
2 * hdlc.h -- General purpose ISDN HDLC decoder.
4 * Implementation of a HDLC decoder/encoder in software.
5 * Necessary because some ISDN devices don't have HDLC
9 * 2009 Karsten Keil <keil@b1-systems.de>
10 * 2002 Wolfgang Mües <wolfgang@iksw-muees.de>
11 * 2001 Frode Isaksen <fisaksen@bewan.com>
12 * 2001 Kai Germaschewski <kai.germaschewski@gmx.de>
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #ifndef __ISDNHDLC_H__
30 #define __ISDNHDLC_H__
32 struct isdnhdlc_vars
{
36 int ffbit_shift
; /* encoding only */
46 /* set if transferring data */
48 /* set if D channel (send idle instead of flags) */
50 /* set if 56K adaptation */
52 /* set if in closing phase (need to send CRC + flag) */
54 /* set if data is bitreverse */
59 #define HDLC_56KBIT 0x01
60 #define HDLC_DCHANNEL 0x02
61 #define HDLC_BITREVERSE 0x04
64 The return value from isdnhdlc_decode is
65 the frame length, 0 if no complete frame was decoded,
66 or a negative error number
68 #define HDLC_FRAMING_ERROR 1
69 #define HDLC_CRC_ERROR 2
70 #define HDLC_LENGTH_ERROR 3
72 extern void isdnhdlc_rcv_init(struct isdnhdlc_vars
*hdlc
, u32 features
);
74 extern int isdnhdlc_decode(struct isdnhdlc_vars
*hdlc
, const u8
*src
,
75 int slen
, int *count
, u8
*dst
, int dsize
);
77 extern void isdnhdlc_out_init(struct isdnhdlc_vars
*hdlc
, u32 features
);
79 extern int isdnhdlc_encode(struct isdnhdlc_vars
*hdlc
, const u8
*src
,
80 u16 slen
, int *count
, u8
*dst
, int dsize
);
82 #endif /* __ISDNHDLC_H__ */