Path: blob/master/drivers/isdn/isdnloop/isdnloop.h
15111 views
/* $Id: isdnloop.h,v 1.5.6.3 2001/09/23 22:24:56 kai Exp $1*2* Loopback lowlevel module for testing of linklevel.3*4* Copyright 1997 by Fritz Elfert ([email protected])5*6* This software may be used and distributed according to the terms7* of the GNU General Public License, incorporated herein by reference.8*9*/1011#ifndef isdnloop_h12#define isdnloop_h1314#define ISDNLOOP_IOCTL_DEBUGVAR 015#define ISDNLOOP_IOCTL_ADDCARD 116#define ISDNLOOP_IOCTL_LEASEDCFG 217#define ISDNLOOP_IOCTL_STARTUP 31819/* Struct for adding new cards */20typedef struct isdnloop_cdef {21char id1[10];22} isdnloop_cdef;2324/* Struct for configuring cards */25typedef struct isdnloop_sdef {26int ptype;27char num[3][20];28} isdnloop_sdef;2930#if defined(__KERNEL__) || defined(__DEBUGVAR__)3132#ifdef __KERNEL__33/* Kernel includes */3435#include <linux/errno.h>36#include <linux/fs.h>37#include <linux/major.h>38#include <asm/io.h>39#include <linux/kernel.h>40#include <linux/signal.h>41#include <linux/slab.h>42#include <linux/mm.h>43#include <linux/mman.h>44#include <linux/ioport.h>45#include <linux/timer.h>46#include <linux/wait.h>47#include <linux/isdnif.h>4849#endif /* __KERNEL__ */5051#define ISDNLOOP_FLAGS_B1ACTIVE 1 /* B-Channel-1 is open */52#define ISDNLOOP_FLAGS_B2ACTIVE 2 /* B-Channel-2 is open */53#define ISDNLOOP_FLAGS_RUNNING 4 /* Cards driver activated */54#define ISDNLOOP_FLAGS_RBTIMER 8 /* scheduling of B-Channel-poll */55#define ISDNLOOP_TIMER_BCREAD 1 /* B-Channel poll-cycle */56#define ISDNLOOP_TIMER_DCREAD (HZ/2) /* D-Channel poll-cycle */57#define ISDNLOOP_TIMER_ALERTWAIT (10*HZ) /* Alert timeout */58#define ISDNLOOP_MAX_SQUEUE 65536 /* Max. outstanding send-data */59#define ISDNLOOP_BCH 2 /* channels per card */6061/*62* Per card driver data63*/64typedef struct isdnloop_card {65struct isdnloop_card *next; /* Pointer to next device struct */66struct isdnloop_card67*rcard[ISDNLOOP_BCH]; /* Pointer to 'remote' card */68int rch[ISDNLOOP_BCH]; /* 'remote' channel */69int myid; /* Driver-Nr. assigned by linklevel */70int leased; /* Flag: This Adapter is connected */71/* to a leased line */72int sil[ISDNLOOP_BCH]; /* SI's to listen for */73char eazlist[ISDNLOOP_BCH][11];74/* EAZ's to listen for */75char s0num[3][20]; /* 1TR6 base-number or MSN's */76unsigned short flags; /* Statusflags */77int ptype; /* Protocol type (1TR6 or Euro) */78struct timer_list st_timer; /* Timer for Status-Polls */79struct timer_list rb_timer; /* Timer for B-Channel-Polls */80struct timer_list81c_timer[ISDNLOOP_BCH]; /* Timer for Alerting */82int l2_proto[ISDNLOOP_BCH]; /* Current layer-2-protocol */83isdn_if interface; /* Interface to upper layer */84int iptr; /* Index to imsg-buffer */85char imsg[60]; /* Internal buf for status-parsing */86int optr; /* Index to omsg-buffer */87char omsg[60]; /* Internal buf for cmd-parsing */88char msg_buf[2048]; /* Buffer for status-messages */89char *msg_buf_write; /* Writepointer for statusbuffer */90char *msg_buf_read; /* Readpointer for statusbuffer */91char *msg_buf_end; /* Pointer to end of statusbuffer */92int sndcount[ISDNLOOP_BCH]; /* Byte-counters for B-Ch.-send */93struct sk_buff_head94bqueue[ISDNLOOP_BCH]; /* B-Channel queues */95struct sk_buff_head dqueue; /* D-Channel queue */96spinlock_t isdnloop_lock;97} isdnloop_card;9899/*100* Main driver data101*/102#ifdef __KERNEL__103static isdnloop_card *cards = (isdnloop_card *) 0;104#endif /* __KERNEL__ */105106/* Utility-Macros */107108#define CID (card->interface.id)109110#endif /* defined(__KERNEL__) || defined(__DEBUGVAR__) */111#endif /* isdnloop_h */112113114