[TG3]: Add tagged status support.
[linux-2.6/verdex.git] / drivers / isdn / hisax / st5481_hdlc.h
blob495432f0f6ba550f9695de4eba55990e794c99e4
1 /*
2 * Driver for ST5481 USB ISDN modem
4 * Author Frode Isaksen
5 * Copyright 2001 by Frode Isaksen <fisaksen@bewan.com>
6 * 2001 by Kai Germaschewski <kai.germaschewski@gmx.de>
7 *
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
13 #ifndef __ST5481_HDLC_H__
14 #define __ST5481_HDLC_H__
16 struct hdlc_vars {
17 int bit_shift;
18 int hdlc_bits1;
19 int data_bits;
20 int ffbit_shift; // encoding only
21 int state;
22 int dstpos;
24 int data_received:1; // set if transferring data
25 int dchannel:1; // set if D channel (send idle instead of flags)
26 int do_adapt56:1; // set if 56K adaptation
27 int do_closing:1; // set if in closing phase (need to send CRC + flag
29 unsigned short crc;
31 unsigned char cbin;
32 unsigned char shift_reg;
33 unsigned char ffvalue;
39 The return value from hdlc_decode is
40 the frame length, 0 if no complete frame was decoded,
41 or a negative error number
44 #define HDLC_FRAMING_ERROR 1
45 #define HDLC_CRC_ERROR 2
46 #define HDLC_LENGTH_ERROR 3
48 void
49 hdlc_rcv_init(struct hdlc_vars *hdlc, int do_adapt56);
51 int
52 hdlc_decode(struct hdlc_vars *hdlc, const unsigned char *src, int slen,int *count,
53 unsigned char *dst, int dsize);
55 void
56 hdlc_out_init(struct hdlc_vars *hdlc,int is_d_channel,int do_adapt56);
58 int
59 hdlc_encode(struct hdlc_vars *hdlc,const unsigned char *src,unsigned short slen,int *count,
60 unsigned char *dst,int dsize);
62 #endif