Fix common misspellings
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / isdn / hdlc.h
CommitLineData
1da177e4 1/*
6bd4bcd3 2 * hdlc.h -- General purpose ISDN HDLC decoder.
1da177e4
LT
3 *
4 * Implementation of a HDLC decoder/encoder in software.
25985edc 5 * Necessary because some ISDN devices don't have HDLC
6bd4bcd3 6 * controllers.
1da177e4 7 *
6bd4bcd3 8 * Copyright (C)
c38fc3bc 9 * 2009 Karsten Keil <keil@b1-systems.de>
6bd4bcd3
KK
10 * 2002 Wolfgang Mües <wolfgang@iksw-muees.de>
11 * 2001 Frode Isaksen <fisaksen@bewan.com>
12 * 2001 Kai Germaschewski <kai.germaschewski@gmx.de>
1da177e4 13 *
6bd4bcd3
KK
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.
1da177e4 18 *
6bd4bcd3
KK
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.
1da177e4 23 *
6bd4bcd3
KK
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.
1da177e4
LT
27 */
28
29#ifndef __ISDNHDLC_H__
30#define __ISDNHDLC_H__
31
32struct isdnhdlc_vars {
33 int bit_shift;
34 int hdlc_bits1;
35 int data_bits;
6bd4bcd3 36 int ffbit_shift; /* encoding only */
1da177e4
LT
37 int state;
38 int dstpos;
39
6bd4bcd3 40 u16 crc;
1da177e4 41
6bd4bcd3
KK
42 u8 cbin;
43 u8 shift_reg;
44 u8 ffvalue;
1da177e4 45
6bd4bcd3
KK
46 /* set if transferring data */
47 u32 data_received:1;
48 /* set if D channel (send idle instead of flags) */
49 u32 dchannel:1;
50 /* set if 56K adaptation */
51 u32 do_adapt56:1;
52 /* set if in closing phase (need to send CRC + flag) */
53 u32 do_closing:1;
c38fc3bc
KK
54 /* set if data is bitreverse */
55 u32 do_bitreverse:1;
1da177e4
LT
56};
57
c38fc3bc
KK
58/* Feature Flags */
59#define HDLC_56KBIT 0x01
60#define HDLC_DCHANNEL 0x02
61#define HDLC_BITREVERSE 0x04
1da177e4
LT
62
63/*
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
67*/
68#define HDLC_FRAMING_ERROR 1
69#define HDLC_CRC_ERROR 2
70#define HDLC_LENGTH_ERROR 3
71
c38fc3bc 72extern void isdnhdlc_rcv_init(struct isdnhdlc_vars *hdlc, u32 features);
1da177e4 73
6bd4bcd3
KK
74extern int isdnhdlc_decode(struct isdnhdlc_vars *hdlc, const u8 *src,
75 int slen, int *count, u8 *dst, int dsize);
1da177e4 76
c38fc3bc 77extern void isdnhdlc_out_init(struct isdnhdlc_vars *hdlc, u32 features);
1da177e4 78
6bd4bcd3
KK
79extern int isdnhdlc_encode(struct isdnhdlc_vars *hdlc, const u8 *src,
80 u16 slen, int *count, u8 *dst, int dsize);
1da177e4
LT
81
82#endif /* __ISDNHDLC_H__ */