1 /*****************************************************************************/
2 /*
3  *      auerisdn.h  --  Auerswald PBX/System Telephone ISDN interface.
4  *
5  *      Copyright (C) 2002  Wolfgang M�es (wolfgang@iksw-muees.de)
6  *
7  *      This program is free software; you can redistribute it and/or modify
8  *      it under the terms of the GNU General Public License as published by
9  *      the Free Software Foundation; either version 2 of the License, or
10  *      (at your option) any later version.
11  *
12  *      This program is distributed in the hope that it will be useful,
13  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *      GNU General Public License for more details.
16  *
17  *      You should have received a copy of the GNU General Public License
18  *      along with this program; if not, write to the Free Software
19  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21  /*****************************************************************************/
22 
23 #ifndef AUERISDN_H
24 #define AUERISDN_H
25 
26 #if (CONFIG_USB_AUERISDN || CONFIG_USB_AUERISDN_MODULE)
27 
28 #include <linux/timer.h>
29 #include "auerserv.h"
30 #include "auerisdn_b.h"
31 
32 #define AUISDN_IPTIMEOUT (HZ * 60)	/* IP Timeout is 40s */
33 
34 struct auerswald;
35 struct auerhisax;
36 
37 struct auerisdn {
38 	struct auerscon dchannelservice;	/* serving the D channel */
39 	struct auerhisax *ahp;			/* Reference to hisax interface */
40 	unsigned int dc_activated;		/* 1 if D-Channel is activated */
41 	struct auerisdnbc bc[AUISDN_BCHANNELS];	/* B channel data */
42 	unsigned int insize;			/* Max. Block Size of Input INT */
43 	unsigned int outsize;			/* Max. Block Size of Output INT */
44 	unsigned int outInterval;		/* nr. of ms between INT OUT transfers */
45 	struct urb *intbi_urbp;			/* B channel Input Interrupt urb */
46 	unsigned char *intbi_bufp;		/* B channel Input data buffer */
47 	unsigned int paketsize;			/* Data size of the INT OUT pakets */
48 	struct usb_device *usbdev;		/* USB device handle */
49 	unsigned int intbo_state;		/* Status of INT OUT urb */
50 	struct urb *intbo_urbp;			/* B channel Output Interrupt urb */
51 	unsigned char *intbo_bufp;		/* B channel Output data buffer */
52 	unsigned int intbo_index;		/* Index of last served B channel */
53 	unsigned int intbo_toggletimer;		/* data toggle timer for 2 b channels */
54 	unsigned int intbo_endp;		/* grrr.. different on some devices */
55 	struct timer_list dcopen_timer;		/* Open D-channel once more later... */
56 };
57 
58 struct auerhisax {
59 	struct hisax_d_if hisax_d_if;		/* Hisax D-Channel interface */
60 	struct hisax_b_if hisax_b_if[AUISDN_BCHANNELS];	/* Hisax B-channel interfaces */
61 	struct auerswald *cp;			/* Context to usb device */
62 	unsigned int hisax_registered;		/* 1 if registered at hisax interface */
63 	unsigned char txseq;			/* L2 emulation: tx sequence byte */
64 	unsigned char rxseq;			/* L2 emulation: rx sequence byte */
65 	spinlock_t seq_lock;			/* Lock sequence numbers */
66 	unsigned long last_close;		/* Time of last close in jiffies */
67 };
68 
69 /* Function Prototypes */
70 void auerisdn_init_dev(struct auerswald *cp);
71 
72 int auerisdn_probe(struct auerswald *cp);
73 
74 void auerisdn_disconnect(struct auerswald *cp);
75 
76 void auerisdn_init(void);
77 
78 void auerisdn_cleanup(void);
79 
80 #else	/* no CONFIG_USB_AUERISDN */
81 
82 struct auerisdn {
83 	int dummy;
84 };
85 
86 /* Dummy ISDN functions */
87 #define auerisdn_init_dev( cp)
88 #define auerisdn_probe( cp) 0
89 #define auerisdn_disconnect( cp)
90 #define auerisdn_init()
91 #define auerisdn_cleanup()
92 #endif	/* CONFIG_USB_AUERISDN */
93 
94 #endif	/* AUERISDN_H */
95