summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorPatrick Mochel <mochel@osdl.org>2002-10-29 20:50:14 -0800
committerPatrick Mochel <mochel@osdl.org>2002-10-29 20:50:14 -0800
commitb835de74036753cf1f2e83f7938d90502213b9cd (patch)
tree25905fb9fcf8bce9a38aee58c4e5798bfd61d8e0 /include/linux
parentc3f575f0143002cea266135ab7fb348b9bfad6aa (diff)
parent4445b58eb2f5e5b20d21c4cf440a5b0f91037e3e (diff)
Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-kobject
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/isdn.h262
-rw-r--r--include/linux/isdn/fsm.h58
-rw-r--r--include/linux/isdn_ppp.h157
-rw-r--r--include/linux/isdnif.h8
-rw-r--r--include/linux/usb.h123
-rw-r--r--include/linux/usb_ch9.h91
6 files changed, 248 insertions, 451 deletions
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 0d0ce25b333e..2f429e27a007 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -1,10 +1,9 @@
-/* $Id: isdn.h,v 1.111.6.9 2001/09/23 22:25:05 kai Exp $
- *
- * Main header for the Linux ISDN subsystem (linklevel).
+/* Linux ISDN subsystem, main header
*
* Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg
* Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
+ * Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
@@ -15,9 +14,7 @@
#define __ISDN_H__
#include <linux/ioctl.h>
-
-// FIXME!!!
-#include <../drivers/isdn/i4l/isdn_fsm.h>
+#include <linux/isdn/fsm.h>
#ifdef CONFIG_COBALT_MICRO_SERVER
/* Save memory */
@@ -238,210 +235,9 @@ typedef struct {
#define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) )
-/* Timer-delays and scheduling-flags */
-#define ISDN_TIMER_RES 4 /* Main Timer-Resolution */
-#define ISDN_TIMER_02SEC (HZ/ISDN_TIMER_RES/5) /* Slow-Timer1 .2 sec */
-#define ISDN_TIMER_1SEC (HZ/ISDN_TIMER_RES) /* Slow-Timer2 1 sec */
-#define ISDN_TIMER_RINGING 5 /* tty RINGs = ISDN_TIMER_1SEC * this factor */
-#define ISDN_TIMER_KEEPINT 10 /* Cisco-Keepalive = ISDN_TIMER_1SEC * this factor */
-#define ISDN_TIMER_MODEMREAD 1
-#define ISDN_TIMER_MODEMPLUS 2
-#define ISDN_TIMER_MODEMRING 4
-#define ISDN_TIMER_MODEMXMIT 8
-#define ISDN_TIMER_CARRIER 256 /* Wait for Carrier */
-#define ISDN_TIMER_FAST (ISDN_TIMER_MODEMREAD | ISDN_TIMER_MODEMPLUS | \
- ISDN_TIMER_MODEMXMIT)
-#define ISDN_TIMER_SLOW (ISDN_TIMER_MODEMRING | ISDN_TIMER_CARRIER)
-
/* GLOBAL_FLAGS */
#define ISDN_GLOBAL_STOPPED 1
-/*=================== Start of ip-over-ISDN stuff =========================*/
-
-/* Feature- and status-flags for a net-interface */
-#define ISDN_NET_SECURE 0x02 /* Accept calls from phonelist only */
-#define ISDN_NET_CALLBACK 0x04 /* activate callback */
-#define ISDN_NET_CBHUP 0x08 /* hangup before callback */
-#define ISDN_NET_CBOUT 0x10 /* remote machine does callback */
-
-#define ISDN_NET_MAGIC 0x49344C02 /* for paranoia-checking */
-
-/* Phone-list-element */
-struct isdn_net_phone {
- struct list_head list;
- char num[ISDN_MSNLEN];
-};
-
-/*
- Principles when extending structures for generic encapsulation protocol
- ("concap") support:
- - Stuff which is hardware specific (here i4l-specific) goes in
- the netdev -> local structure (here: isdn_net_local)
- - Stuff which is encapsulation protocol specific goes in the structure
- which holds the linux device structure (here: isdn_net_device)
-*/
-
-struct isdn_net_dev_s;
-struct isdn_net_local_s;
-
-struct isdn_netif_ops {
- int (*hard_start_xmit) (struct sk_buff *skb,
- struct net_device *dev);
- int (*hard_header) (struct sk_buff *skb,
- struct net_device *dev,
- unsigned short type,
- void *daddr,
- void *saddr,
- unsigned len);
- int (*do_ioctl)(struct net_device *dev,
- struct ifreq *ifr, int cmd);
-
- unsigned short flags; /* interface flags (a la BSD) */
- unsigned short type; /* interface hardware type */
- unsigned char addr_len;/* hardware address length */
- void (*receive)(struct isdn_net_local_s *,
- struct isdn_net_dev_s *,
- struct sk_buff *);
- void (*connected)(struct isdn_net_dev_s *);
- void (*disconnected)(struct isdn_net_dev_s *);
- int (*bind)(struct isdn_net_dev_s *);
- void (*unbind)(struct isdn_net_dev_s *);
- int (*init)(struct isdn_net_local_s *);
- void (*cleanup)(struct isdn_net_local_s *);
- int (*open)(struct isdn_net_local_s *);
- void (*close)(struct isdn_net_local_s *);
-};
-
-/* Local interface-data */
-typedef struct isdn_net_local_s {
- ulong magic;
- struct net_device_stats stats; /* Ethernet Statistics */
- int flags; /* Connection-flags */
- int dialmax; /* Max. Number of Dial-retries */
- int dialtimeout; /* How long shall we try on dialing */
- int dialwait; /* wait after failed attempt */
-
- int cbdelay; /* Delay before Callback starts */
- char msn[ISDN_MSNLEN]; /* MSNs/EAZs for this interface */
-
- u_char cbhup; /* Flag: Reject Call before Callback*/
- int hupflags; /* Flags for charge-unit-hangup: */
- int onhtime; /* Time to keep link up */
-
- u_char p_encap; /* Packet encapsulation */
- u_char l2_proto; /* Layer-2-protocol */
- u_char l3_proto; /* Layer-3-protocol */
-
- ulong slavedelay; /* Dynamic bundling delaytime */
- int triggercps; /* BogoCPS needed for trigger slave */
- struct list_head phone[2]; /* List of remote-phonenumbers */
- /* phone[0] = Incoming Numbers */
- /* phone[1] = Outgoing Numbers */
-
- struct list_head slaves; /* list of all bundled channels
- protected by serializing config
- ioctls / no change allowed when
- interface is running */
- struct list_head online; /* list of all bundled channels
- which can be used for actual
- data (IP) transfer
- protected by xmit_lock */
-
- spinlock_t xmit_lock; /* used to protect the xmit path of
- a net_device, including all
- associated channels's frame_cnt */
- struct list_head running_devs; /* member of global running_devs */
- atomic_t refcnt; /* references held by ISDN code */
-
-#ifdef CONFIG_ISDN_X25
- struct concap_device_ops *dops; /* callbacks used by encapsulator */
-#endif
-#ifdef CONFIG_ISDN_PPP
- unsigned int mpppcfg;
- long mp_seqno;
- struct ippp_ccp *ccp;
- unsigned long debug;
-#ifdef CONFIG_ISDN_PPP_VJ
- unsigned char *cbuf;
- struct slcompress *slcomp;
-#endif
-#endif
-
- /* use an own struct for that in later versions */
- ulong cisco_myseq; /* Local keepalive seq. for Cisco */
- ulong cisco_mineseen; /* returned keepalive seq. from remote */
- ulong cisco_yourseq; /* Remote keepalive seq. for Cisco */
- int cisco_keepalive_period; /* keepalive period */
- ulong cisco_last_slarp_in; /* jiffie of last keepalive packet we received */
- char cisco_line_state; /* state of line according to keepalive packets */
- char cisco_debserint; /* debugging flag of cisco hdlc with slarp */
-
- struct timer_list cisco_timer;
-
- struct isdn_netif_ops *ops;
-
- struct net_device dev; /* interface to upper levels */
-} isdn_net_local;
-
-/* the interface itself */
-typedef struct isdn_net_dev_s {
- int isdn_slot; /* Index to isdn device/channel */
- int pre_device; /* Preselected isdn-device */
- int pre_channel; /* Preselected isdn-channel */
- int exclusive; /* -1 if non excl./idx to excl chan */
-
- struct timer_list dial_timer; /* dial events timer */
- struct fsm_inst fi; /* call control state machine */
- int dial_event; /* event in case of timer expiry */
- int dial; /* # of phone number just dialed */
- int outgoing; /* Flag: outgoing call */
- int dialretry; /* Counter for Dialout-retries */
-
- int cps; /* current speed of this interface */
- int transcount; /* byte-counter for cps-calculation */
- int last_jiffies; /* when transcount was reset */
- int sqfull; /* Flag: netdev-queue overloaded */
- ulong sqfull_stamp; /* Start-Time of overload */
-
- int huptimer; /* Timeout-counter for auto-hangup */
- int charge; /* Counter for charging units */
- int charge_state; /* ChargeInfo state machine */
- unsigned long chargetime; /* Timer for Charging info */
- int chargeint; /* Interval between charge-infos */
-
- int pppbind; /* ippp device for bindings */
- struct ipppd *ipppd; /* /dev/ipppX which controls us */
-
- struct sk_buff_head super_tx_queue; /* List of supervisory frames to */
- /* be transmitted asap */
- int frame_cnt; /* number of frames currently */
- /* queued in HL driver */
- struct tasklet_struct tlet;
-
- isdn_net_local *mlp; /* Ptr to master device for all devs*/
-
- struct list_head slaves; /* member of local->slaves */
- struct list_head online; /* member of local->online */
-
- char name[10]; /* Name of device */
- struct list_head global_list; /* global list of all isdn_net_devs */
-#ifdef CONFIG_ISDN_PPP
- unsigned int pppcfg;
- unsigned int pppseq; /* last seq no seen */
- struct ippp_ccp *ccp;
- unsigned long debug;
-
- ippp_bundle * pb; /* pointer to the common bundle structure
- * with the per-bundle data */
-#endif
-#ifdef CONFIG_ISDN_X25
- struct concap_proto *cprot; /* connection oriented encapsulation protocol */
-#endif
-
-} isdn_net_dev;
-
-/*===================== End of ip-over-ISDN stuff ===========================*/
-
/*======================= Start of ISDN-tty stuff ===========================*/
#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
@@ -494,7 +290,6 @@ typedef struct atemu {
int mdmcmdl; /* Length of Modem-Commandbuffer */
int pluscount; /* Counter for +++ sequence */
int lastplus; /* Timestamp of last + */
- int carrierwait; /* Seconds of carrier waiting */
char mdmcmd[255]; /* Modem-Commandbuffer */
unsigned int charge; /* Charge units of current connection */
} atemu;
@@ -516,7 +311,9 @@ typedef struct modem_info {
/* 2 = B-Channel is up, deliver d.*/
int dialing; /* Dial in progress or ATA */
int rcvsched; /* Receive needs schedule */
- int isdn_slot; /* Index to isdn-driver/channel */
+ struct isdn_slot *isdn_slot; /* Ptr to isdn-driver/channel */
+ struct sk_buff_head rpqueue; /* Queue of recv'd packets */
+ int rcvcount; /* Byte-counters for B rx */
int ncarrier; /* Flag: schedule NO CARRIER */
unsigned char last_cause[8]; /* Last cause message */
unsigned char last_num[ISDN_MSNLEN];
@@ -533,6 +330,7 @@ typedef struct modem_info {
struct sk_buff_head xmit_queue; /* transmit queue */
atomic_t xmit_lock; /* Semaphore for isdn_tty_write */
#ifdef CONFIG_ISDN_AUDIO
+ unsigned long DLEflag; /* Insert DLE at next read */
int vonline; /* Voice-channel status */
/* Bit 0 = recording */
/* Bit 1 = playback */
@@ -549,6 +347,10 @@ typedef struct modem_info {
#endif
struct tty_struct *tty; /* Pointer to corresponding tty */
atemu emu; /* AT-emulator data */
+ struct timer_list escape_timer; /* to recognize +++ escape */
+ struct timer_list ring_timer; /* for writing 'RING' responses */
+ struct timer_list connect_timer; /* waiting for CONNECT */
+ struct timer_list read_timer; /* read incoming data */
struct termios normal_termios; /* For saving termios structs */
struct termios callout_termios;
wait_queue_head_t open_wait, close_wait;
@@ -557,17 +359,6 @@ typedef struct modem_info {
#define ISDN_MODEM_WINSIZE 8
-/* Description of one ISDN-tty */
-typedef struct {
- int refcount; /* Number of opens */
- struct tty_driver tty_modem; /* tty-device */
- struct tty_driver cua_modem; /* cua-device */
- struct tty_struct *modem_table[ISDN_MAX_CHANNELS]; /* ?? copied from Orig */
- struct termios *modem_termios[ISDN_MAX_CHANNELS];
- struct termios *modem_termios_locked[ISDN_MAX_CHANNELS];
- modem_info info[ISDN_MAX_CHANNELS]; /* Private data */
-} modem;
-
/*======================= End of ISDN-tty stuff ============================*/
/*======================== Start of V.110 stuff ============================*/
@@ -602,37 +393,10 @@ typedef struct {
char *private;
} infostruct;
-#define DRV_FLAG_RUNNING 1
-#define DRV_FLAG_REJBUS 2
-#define DRV_FLAG_LOADED 4
-
-/* Description of hardware-level-driver */
-typedef struct {
- ulong online; /* Channel-Online flags */
- ulong flags; /* Misc driver Flags */
- int locks; /* Number of locks for this driver */
- int channels; /* Number of channels */
- wait_queue_head_t st_waitq; /* Wait-Queue for status-read's */
- int maxbufsize; /* Maximum Buffersize supported */
- unsigned long pktcount; /* Until now: unused */
- int stavail; /* Chars avail on Status-device */
- isdn_if *interface; /* Interface to driver */
- int *rcverr; /* Error-counters for B-Ch.-receive */
- int *rcvcount; /* Byte-counters for B-Ch.-receive */
-#ifdef CONFIG_ISDN_AUDIO
- unsigned long DLEflag; /* Flags: Insert DLE at next read */
-#endif
- struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */
- wait_queue_head_t *rcv_waitq; /* Wait-Queues for B-Channel-Reads */
- wait_queue_head_t *snd_waitq; /* Wait-Queue for B-Channel-Send's */
- char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */
-} driver;
-
/* Main driver-data */
typedef struct isdn_devt {
unsigned short flags; /* Bitmapped Flags: */
/* */
- int drivers; /* Current number of drivers */
int channels; /* Current number of channels */
int net_verbose; /* Verbose-Flag */
int modempoll; /* Flag: tty-read active */
@@ -641,11 +405,7 @@ typedef struct isdn_devt {
int global_flags;
infostruct *infochain; /* List of open info-devs. */
wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */
- struct timer_list timer; /* Misc.-function Timer */
- driver *drv[ISDN_MAX_DRIVERS]; /* Array of drivers */
- char drvid[ISDN_MAX_DRIVERS][20];/* Driver-ID */
struct task_struct *profd; /* For iprofd */
- modem mdm; /* tty-driver-data */
struct semaphore sem; /* serialize list access*/
unsigned long global_features;
#ifdef CONFIG_DEVFS_FS
diff --git a/include/linux/isdn/fsm.h b/include/linux/isdn/fsm.h
new file mode 100644
index 000000000000..95beb142b392
--- /dev/null
+++ b/include/linux/isdn/fsm.h
@@ -0,0 +1,58 @@
+/* Linux ISDN subsystem, finite state machine
+ *
+ * Author Karsten Keil
+ * Copyright by Karsten Keil <keil@isdn4linux.de>
+ * 2001-2002 by Kai Germaschewski <kai@germaschewski.name>
+ *
+ * This software may be used and distributed according to the terms
+ * of the GNU General Public License, incorporated herein by reference.
+ */
+
+#ifndef __ISDN_FSM_H__
+#define __ISDN_FSM_H__
+
+#include <linux/kernel.h>
+#include <linux/timer.h>
+
+struct fsm_inst;
+
+typedef int (*fsm_fn)(struct fsm_inst *, int, void *);
+
+struct fsm {
+ fsm_fn *jumpmatrix;
+ int st_cnt, ev_cnt, fn_cnt;
+ char **st_str, **ev_str;
+ struct fsm_node *fn_tbl;
+};
+
+struct fsm_inst {
+ struct fsm *fsm;
+ int state;
+ int debug;
+ void *userdata;
+ int userint;
+ void (*printdebug) (struct fsm_inst *, char *, ...);
+};
+
+struct fsm_node {
+ int st, ev;
+ fsm_fn fn;
+};
+
+struct fsm_timer {
+ struct fsm_inst *fi;
+ struct timer_list tl;
+ int ev;
+ void *arg;
+};
+
+int fsm_new(struct fsm *fsm);
+void fsm_free(struct fsm *fsm);
+int fsm_event(struct fsm_inst *fi, int event, void *arg);
+void fsm_change_state(struct fsm_inst *fi, int newstate);
+void fsm_init_timer(struct fsm_inst *fi, struct fsm_timer *ft);
+int fsm_add_timer(struct fsm_timer *ft, int timeout, int event);
+void fsm_mod_timer(struct fsm_timer *ft, int timeout, int event);
+void fsm_del_timer(struct fsm_timer *ft);
+
+#endif
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index ec6016c37421..669822e2868a 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -1,10 +1,15 @@
-/*
+/* Linux ISDN subsystem, sync PPP, interface to ipppd
+ *
+ * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
+ * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
+ * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
+ * Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name)
+ *
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
-
#ifndef _LINUX_ISDN_PPP_H
#define _LINUX_ISDN_PPP_H
@@ -16,22 +21,21 @@
struct pppcallinfo
{
- int calltype;
- unsigned char local_num[64];
- unsigned char remote_num[64];
- int charge_units;
+ int calltype;
+ unsigned char local_num[64];
+ unsigned char remote_num[64];
+ int charge_units;
};
-#define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo)
-#define PPPIOCBUNDLE _IOW('t',129,int)
-#define PPPIOCGMPFLAGS _IOR('t',130,int)
-#define PPPIOCSMPFLAGS _IOW('t',131,int)
-#define PPPIOCSMPMTU _IOW('t',132,int)
-#define PPPIOCSMPMRU _IOW('t',133,int)
-#define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8])
-#define PPPIOCSCOMPRESSOR _IOW('t',135,int)
-#define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] )
-
+#define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo)
+#define PPPIOCBUNDLE _IOW('t',129,int)
+#define PPPIOCGMPFLAGS _IOR('t',130,int)
+#define PPPIOCSMPFLAGS _IOW('t',131,int)
+#define PPPIOCSMPMTU _IOW('t',132,int)
+#define PPPIOCSMPMRU _IOW('t',133,int)
+#define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long[8])
+#define PPPIOCSCOMPRESSOR _IOW('t',135,int)
+#define PPPIOCGIFNAME _IOR('t',136,char[IFNAMSIZ])
#define SC_MP_PROT 0x00000200
#define SC_REJ_MP_PROT 0x00000400
@@ -44,26 +48,19 @@ struct pppcallinfo
#define IPPP_COMP_FLAG_LINK 0x2
struct isdn_ppp_comp_data {
- int num;
- unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
- int optlen;
- int flags;
+ int num;
+ unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
+ int optlen;
+ int flags;
};
#ifdef __KERNEL__
-
-#include <linux/config.h>
#include <linux/skbuff.h>
#include <linux/ppp_defs.h>
#define DECOMP_ERR_NOMEM (-10)
-#define MP_END_FRAG 0x40
-#define MP_BEGIN_FRAG 0x80
-
-#define MP_MAX_QUEUE_LEN 16
-
/*
* We need a way for the decompressor to influence the generation of CCP
* Reset-Requests in a variety of ways. The decompressor is already returning
@@ -82,15 +79,15 @@ struct isdn_ppp_comp_data {
#define IPPP_RESET_MAXDATABYTES 32
struct isdn_ppp_resetparams {
- unsigned char valid:1; /* rw Is this structure filled at all ? */
- unsigned char rsend:1; /* rw Should we send one at all ? */
- unsigned char idval:1; /* rw Is the id field valid ? */
- unsigned char dtval:1; /* rw Is the data field valid ? */
- unsigned char expra:1; /* rw Is an Ack expected for this Req ? */
- unsigned char id; /* wo Send CCP ResetReq with this id */
- unsigned short maxdlen; /* ro Max bytes to be stored in data field */
- unsigned short dlen; /* rw Bytes stored in data field */
- unsigned char *data; /* wo Data for ResetReq info field */
+ unsigned char valid:1; /* rw Is this structure filled at all ? */
+ unsigned char rsend:1; /* rw Should we send one at all ? */
+ unsigned char idval:1; /* rw Is the id field valid ? */
+ unsigned char dtval:1; /* rw Is the data field valid ? */
+ unsigned char expra:1; /* rw Is an Ack expected for this Req ? */
+ unsigned char id; /* wo Send CCP ResetReq with this id */
+ unsigned short maxdlen; /* ro Max bytes to be stored in data field */
+ unsigned short dlen; /* rw Bytes stored in data field */
+ unsigned char *data; /* wo Data for ResetReq info field */
};
/*
@@ -98,89 +95,37 @@ struct isdn_ppp_resetparams {
* check the original include for more information
*/
struct isdn_ppp_compressor {
- struct isdn_ppp_compressor *next, *prev;
- int num; /* CCP compression protocol number */
+ struct isdn_ppp_compressor *next, *prev;
+ int num; /* CCP compression protocol number */
- void *(*alloc) (struct isdn_ppp_comp_data *);
- void (*free) (void *state);
- int (*init) (void *state, struct isdn_ppp_comp_data *,
- int unit,int debug);
+ void *(*alloc) (struct isdn_ppp_comp_data *);
+ void (*free) (void *state);
+ int (*init) (void *state, struct isdn_ppp_comp_data *,
+ int unit,int debug);
- /* The reset entry needs to get more exact information about the
- ResetReq or ResetAck it was called with. The parameters are
- obvious. If reset is called without a Req or Ack frame which
- could be handed into it, code MUST be set to 0. Using rsparm,
- the reset entry can control if and how a ResetAck is returned. */
+ /* The reset entry needs to get more exact information about the
+ ResetReq or ResetAck it was called with. The parameters are
+ obvious. If reset is called without a Req or Ack frame which
+ could be handed into it, code MUST be set to 0. Using rsparm,
+ the reset entry can control if and how a ResetAck is returned. */
- void (*reset) (void *state, unsigned char code, unsigned char id,
- unsigned char *data, unsigned len,
- struct isdn_ppp_resetparams *rsparm);
+ void (*reset) (void *state, unsigned char code, unsigned char id,
+ unsigned char *data, unsigned len,
+ struct isdn_ppp_resetparams *rsparm);
- int (*compress) (void *state, struct sk_buff *in,
- struct sk_buff *skb_out, int proto);
+ int (*compress) (void *state, struct sk_buff *in,
+ struct sk_buff *skb_out, int proto);
int (*decompress) (void *state,struct sk_buff *in,
struct sk_buff *skb_out,
struct isdn_ppp_resetparams *rsparm);
- void (*incomp) (void *state, struct sk_buff *in,int proto);
- void (*stat) (void *state, struct compstat *stats);
+ void (*incomp) (void *state, struct sk_buff *in,int proto);
+ void (*stat) (void *state, struct compstat *stats);
};
extern int isdn_ppp_register_compressor(struct isdn_ppp_compressor *);
extern int isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *);
-typedef struct {
- unsigned long seqerrs;
- unsigned long frame_drops;
- unsigned long overflows;
- unsigned long max_queue_len;
-} isdn_mppp_stats;
-
-typedef struct {
- int mp_mrru; /* unused */
- struct sk_buff * frags; /* fragments sl list -- use skb->next */
- long frames; /* number of frames in the frame list */
- unsigned int seq; /* last processed packet seq #: any packets
- * with smaller seq # will be dropped
- * unconditionally */
- spinlock_t lock;
- int ref_ct;
- /* statistics */
- isdn_mppp_stats stats;
-} ippp_bundle;
-
-#define IPPP_MAX_RQ_LEN 8
-
-/* The data structure for one CCP reset transaction */
-enum ippp_ccp_reset_states {
- CCPResetIdle,
- CCPResetSentReq,
- CCPResetRcvdReq,
- CCPResetSentAck,
- CCPResetRcvdAck
-};
-
-struct ippp_ccp_reset_state {
- enum ippp_ccp_reset_states state; /* State of this transaction */
- struct ippp_ccp *ccp; /* Backlink */
- unsigned char id; /* id index */
- unsigned char ta:1; /* The timer is active (flag) */
- unsigned char expra:1; /* We expect a ResetAck at all */
- int dlen; /* Databytes stored in data */
- struct timer_list timer; /* For timeouts/retries */
- /* This is a hack but seems sufficient for the moment. We do not want
- to have this be yet another allocation for some bytes, it is more
- memory management overhead than the whole mess is worth. */
- unsigned char data[IPPP_RESET_MAXDATABYTES];
-};
-
-/* The data structure keeping track of the currently outstanding CCP Reset
- transactions. */
-struct ippp_ccp_reset {
- struct ippp_ccp_reset_state *rs[256]; /* One per possible id */
- unsigned char lastid; /* Last id allocated by the engine */
-};
-
#endif /* __KERNEL__ */
#endif /* _LINUX_ISDN_PPP_H */
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h
index c9718d4de584..342dd971b1b6 100644
--- a/include/linux/isdnif.h
+++ b/include/linux/isdnif.h
@@ -202,14 +202,12 @@ typedef struct
#define ISDN_STAT_LOAD 265 /* Signal new lowlevel-driver is loaded */
#define ISDN_STAT_UNLOAD 266 /* Signal unload of lowlevel-driver */
#define ISDN_STAT_BSENT 267 /* Signal packet sent */
-#define ISDN_STAT_NODCH 268 /* Signal no D-Channel */
#define ISDN_STAT_ADDCH 269 /* Add more Channels */
#define ISDN_STAT_CAUSE 270 /* Cause-Message */
#define ISDN_STAT_ICALLW 271 /* Incoming call without B-chan waiting */
#define ISDN_STAT_REDIR 272 /* Redir result */
#define ISDN_STAT_PROT 273 /* protocol IO specific callback */
#define ISDN_STAT_DISPLAY 274 /* deliver a received display message */
-#define ISDN_STAT_L1ERR 275 /* Signal Layer-1 Error */
#define ISDN_STAT_FAXIND 276 /* FAX indications from HL-driver */
#define ISDN_STAT_AUDIO 277 /* DTMF, DSP indications */
#define ISDN_STAT_DISCH 278 /* Disable/Enable channel usage */
@@ -221,12 +219,6 @@ typedef struct
#define ISDN_AUDIO_DTMF 1 /* Rx/Tx DTMF */
/*
- * Values for errcode field
- */
-#define ISDN_STAT_L1ERR_SEND 1
-#define ISDN_STAT_L1ERR_RECV 2
-
-/*
* Values for feature-field of interface-struct.
*/
/* Layer 2 */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 0397f55aabdc..0f486d95bdb7 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -41,56 +41,36 @@ struct usb_device;
/*-------------------------------------------------------------------------*/
/*
- * Standard USB Descriptor support.
+ * Host-side wrappers for standard USB descriptors ... these are parsed
+ * from the data provided by devices. Parsing turns them from a flat
+ * sequence of descriptors into a hierarchy:
+ *
+ * - devices have one (usually) or more configs;
+ * - configs have one (often) or more interfaces;
+ * - interfaces have one (usually) or more settings;
+ * - each interface setting has zero or (usually) more endpoints.
+ *
+ * And there might be other descriptors mixed in with those.
+ *
* Devices may also have class-specific or vendor-specific descriptors.
*/
-/*
- * Descriptor sizes per descriptor type
- */
-#define USB_DT_DEVICE_SIZE 18
-#define USB_DT_CONFIG_SIZE 9
-#define USB_DT_INTERFACE_SIZE 9
-#define USB_DT_ENDPOINT_SIZE 7
-#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
-
-/* most of these maximums are arbitrary */
-#define USB_MAXCONFIG 8
-#define USB_ALTSETTINGALLOC 4
-#define USB_MAXALTSETTING 128 /* Hard limit */
-#define USB_MAXINTERFACES 32
-#define USB_MAXENDPOINTS 32 /* Hard limit */
-
-/* USB_DT_ENDPOINT: Endpoint descriptor */
-struct usb_endpoint_descriptor {
- __u8 bLength __attribute__ ((packed));
- __u8 bDescriptorType __attribute__ ((packed));
- __u8 bEndpointAddress __attribute__ ((packed));
- __u8 bmAttributes __attribute__ ((packed));
- __u16 wMaxPacketSize __attribute__ ((packed));
- __u8 bInterval __attribute__ ((packed));
- __u8 bRefresh __attribute__ ((packed));
- __u8 bSynchAddress __attribute__ ((packed));
-
- /* the rest is internal to the Linux implementation */
+/* host-side wrapper for parsed endpoint descriptors */
+struct usb_host_endpoint {
+ struct usb_endpoint_descriptor desc;
+
unsigned char *extra; /* Extra descriptors */
int extralen;
};
-/* USB_DT_INTERFACE: Interface descriptor */
-struct usb_interface_descriptor {
- __u8 bLength __attribute__ ((packed));
- __u8 bDescriptorType __attribute__ ((packed));
- __u8 bInterfaceNumber __attribute__ ((packed));
- __u8 bAlternateSetting __attribute__ ((packed));
- __u8 bNumEndpoints __attribute__ ((packed));
- __u8 bInterfaceClass __attribute__ ((packed));
- __u8 bInterfaceSubClass __attribute__ ((packed));
- __u8 bInterfaceProtocol __attribute__ ((packed));
- __u8 iInterface __attribute__ ((packed));
-
- /* the rest is internal to the Linux implementation */
- struct usb_endpoint_descriptor *endpoint;
+/* host-side wrapper for one interface setting's parsed descriptors */
+struct usb_host_interface {
+ struct usb_interface_descriptor desc;
+
+ /* array of desc.bNumEndpoint endpoints associated with this
+ * interface setting. these will be in no particular order.
+ */
+ struct usb_host_endpoint *endpoint;
unsigned char *extra; /* Extra descriptors */
int extralen;
@@ -127,7 +107,10 @@ struct usb_interface_descriptor {
* will use them in non-default settings.
*/
struct usb_interface {
- struct usb_interface_descriptor *altsetting;
+ /* array of alternate settings for this interface.
+ * these will be in numeric order, 0..num_altsettting
+ */
+ struct usb_host_interface *altsetting;
unsigned act_altsetting; /* active alternate setting */
unsigned num_altsetting; /* number of alternate settings */
@@ -148,17 +131,12 @@ struct usb_interface {
* different depending on what speed they're currently running. Only
* devices with a USB_DT_DEVICE_QUALIFIER have an OTHER_SPEED_CONFIG.
*/
-struct usb_config_descriptor {
- __u8 bLength __attribute__ ((packed));
- __u8 bDescriptorType __attribute__ ((packed));
- __u16 wTotalLength __attribute__ ((packed));
- __u8 bNumInterfaces __attribute__ ((packed));
- __u8 bConfigurationValue __attribute__ ((packed));
- __u8 iConfiguration __attribute__ ((packed));
- __u8 bmAttributes __attribute__ ((packed));
- __u8 MaxPower __attribute__ ((packed));
-
- /* the rest is internal to the Linux implementation */
+struct usb_host_config {
+ struct usb_config_descriptor desc;
+
+ /* the interfaces associated with this configuration
+ * these will be in numeric order, 0..desc.bNumInterfaces
+ */
struct usb_interface *interface;
unsigned char *extra; /* Extra descriptors */
@@ -178,8 +156,6 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
/* -------------------------------------------------------------------------- */
-/* Host Controller Driver (HCD) support */
-
struct usb_operations;
/*
@@ -248,8 +224,8 @@ struct usb_device {
struct device dev; /* Generic device interface */
struct usb_device_descriptor descriptor;/* Descriptor */
- struct usb_config_descriptor *config; /* All of the configs */
- struct usb_config_descriptor *actconfig;/* the active configuration */
+ struct usb_host_config *config; /* All of the configs */
+ struct usb_host_config *actconfig;/* the active configuration */
char **rawdescriptors; /* Raw descriptors for each config */
@@ -560,17 +536,15 @@ extern int usb_disabled(void);
/*
* urb->transfer_flags:
- *
- * FIXME should _all_ be URB_* flags
*/
#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
-#define USB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */
+#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */
#define URB_NO_DMA_MAP 0x0004 /* urb->*_dma are valid on submit */
-#define USB_ASYNC_UNLINK 0x0008 /* usb_unlink_urb() returns asap */
-#define USB_NO_FSBR 0x0020 /* UHCI-specific */
-#define USB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */
+#define URB_ASYNC_UNLINK 0x0008 /* usb_unlink_urb() returns asap */
+#define URB_NO_FSBR 0x0020 /* UHCI-specific */
+#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */
#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */
-#define USB_TIMEOUT_KILLED 0x1000 /* only set by HCD! */
+#define URB_TIMEOUT_KILLED 0x1000 /* only set by HCD! */
struct usb_iso_packet_descriptor {
unsigned int offset;
@@ -674,7 +648,7 @@ typedef void (*usb_complete_t)(struct urb *);
*
* All URBs submitted must initialize dev, pipe,
* transfer_flags (may be zero), complete, timeout (may be zero).
- * The USB_ASYNC_UNLINK transfer flag affects later invocations of
+ * The URB_ASYNC_UNLINK transfer flag affects later invocations of
* the usb_unlink_urb() routine.
*
* All URBs must also initialize
@@ -683,7 +657,7 @@ typedef void (*usb_complete_t)(struct urb *);
* to be treated as errors; that flag is invalid for write requests.
*
* Bulk URBs may
- * use the USB_ZERO_PACKET transfer flag, indicating that bulk OUT transfers
+ * use the URB_ZERO_PACKET transfer flag, indicating that bulk OUT transfers
* should always terminate with a short packet, even if it means adding an
* extra zero length packet.
*
@@ -700,7 +674,7 @@ typedef void (*usb_complete_t)(struct urb *);
* endpoints, as well as high speed interrupt endpoints, the encoding of
* the transfer interval in the endpoint descriptor is logarithmic.)
*
- * Isochronous URBs normally use the USB_ISO_ASAP transfer flag, telling
+ * Isochronous URBs normally use the URB_ISO_ASAP transfer flag, telling
* the host controller to schedule the transfer as soon as bandwidth
* utilization allows, and then set start_frame to reflect the actual frame
* selected during submission. Otherwise drivers must specify the start_frame
@@ -872,17 +846,6 @@ static inline void usb_fill_int_urb (struct urb *urb,
urb->start_frame = -1;
}
-/*
- * old style macros to enable 2.4 and 2.2 drivers to build
- * properly. Please do not use these for new USB drivers.
- */
-#define FILL_CONTROL_URB(URB,DEV,PIPE,SETUP_PACKET,TRANSFER_BUFFER,BUFFER_LENGTH,COMPLETE,CONTEXT) \
- usb_fill_control_urb(URB,DEV,PIPE,SETUP_PACKET,TRANSFER_BUFFER,BUFFER_LENGTH,COMPLETE,CONTEXT)
-#define FILL_BULK_URB(URB,DEV,PIPE,TRANSFER_BUFFER,BUFFER_LENGTH,COMPLETE,CONTEXT) \
- usb_fill_bulk_urb(URB,DEV,PIPE,TRANSFER_BUFFER,BUFFER_LENGTH,COMPLETE,CONTEXT)
-#define FILL_INT_URB(URB,DEV,PIPE,TRANSFER_BUFFER,BUFFER_LENGTH,COMPLETE,CONTEXT,INTERVAL) \
- usb_fill_int_urb(URB,DEV,PIPE,TRANSFER_BUFFER,BUFFER_LENGTH,COMPLETE,CONTEXT,INTERVAL)
-
extern struct urb *usb_alloc_urb(int iso_packets, int mem_flags);
extern void usb_free_urb(struct urb *urb);
#define usb_put_urb usb_free_urb
diff --git a/include/linux/usb_ch9.h b/include/linux/usb_ch9.h
index 9e05b8c05004..69645ae25aae 100644
--- a/include/linux/usb_ch9.h
+++ b/include/linux/usb_ch9.h
@@ -6,7 +6,7 @@
*
* - the master/host side Linux-USB kernel driver API;
* - the "usbfs" user space API; and
- * - (eventually) a Linux slave/device side driver API.
+ * - (eventually) a Linux "gadget" slave/device side driver API.
*
* USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems
* act either as a USB master/host or as a USB slave/device. That means
@@ -101,7 +101,8 @@ struct usb_ctrlrequest {
* (rarely) accepted by SET_DESCRIPTOR.
*
* Note that all multi-byte values here are encoded in little endian
- * byte order.
+ * byte order "on the wire". But when exposed through Linux-USB APIs,
+ * they've been converted to cpu byte order.
*/
/*
@@ -123,10 +124,13 @@ struct usb_descriptor_header {
} __attribute__ ((packed));
+/*-------------------------------------------------------------------------*/
+
/* USB_DT_DEVICE: Device descriptor */
struct usb_device_descriptor {
__u8 bLength;
__u8 bDescriptorType;
+
__u16 bcdUSB;
__u8 bDeviceClass;
__u8 bDeviceSubClass;
@@ -141,10 +145,12 @@ struct usb_device_descriptor {
__u8 bNumConfigurations;
} __attribute__ ((packed));
+#define USB_DT_DEVICE_SIZE 18
+
/*
* Device and/or Interface Class codes
- * as found in device and interface descriptors
+ * as found in bDeviceClass or bInterfaceClass
* and defined by www.usb.org documents
*/
#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
@@ -162,18 +168,88 @@ struct usb_device_descriptor {
#define USB_CLASS_APP_SPEC 0xfe
#define USB_CLASS_VENDOR_SPEC 0xff
-// FIXME include struct usb_config_descriptor
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_CONFIG: Configuration descriptor information.
+ *
+ * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
+ * descriptor type is different. Highspeed-capable devices can look
+ * different depending on what speed they're currently running. Only
+ * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG
+ * descriptors.
+ */
+struct usb_config_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u16 wTotalLength;
+ __u8 bNumInterfaces;
+ __u8 bConfigurationValue;
+ __u8 iConfiguration;
+ __u8 bmAttributes;
+ __u8 bMaxPower;
+} __attribute__ ((packed));
+
+#define USB_DT_CONFIG_SIZE 9
+
+/* from config descriptor bmAttributes */
+#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */
+#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */
+#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */
+
+/*-------------------------------------------------------------------------*/
/* USB_DT_STRING: String descriptor */
struct usb_string_descriptor {
__u8 bLength;
__u8 bDescriptorType;
+
__u16 wData[1]; /* UTF-16LE encoded */
} __attribute__ ((packed));
-// FIXME include struct usb_interface_descriptor
+/* note that "string" zero is special, it holds language codes that
+ * the device supports, not Unicode characters.
+ */
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_INTERFACE: Interface descriptor */
+struct usb_interface_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u8 bInterfaceNumber;
+ __u8 bAlternateSetting;
+ __u8 bNumEndpoints;
+ __u8 bInterfaceClass;
+ __u8 bInterfaceSubClass;
+ __u8 bInterfaceProtocol;
+ __u8 iInterface;
+} __attribute__ ((packed));
+
+#define USB_DT_INTERFACE_SIZE 9
+
+/*-------------------------------------------------------------------------*/
+
+/* USB_DT_ENDPOINT: Endpoint descriptor */
+struct usb_endpoint_descriptor {
+ __u8 bLength;
+ __u8 bDescriptorType;
+
+ __u8 bEndpointAddress;
+ __u8 bmAttributes;
+ __u16 wMaxPacketSize;
+ __u8 bInterval;
+
+ // NOTE: these two are _only_ in audio endpoints.
+ // use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof.
+ __u8 bRefresh;
+ __u8 bSynchAddress;
+} __attribute__ ((packed));
+
+#define USB_DT_ENDPOINT_SIZE 7
+#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
-// FIXME include struct usb_endpoint_descriptor
/*
* Endpoints
@@ -188,10 +264,13 @@ struct usb_string_descriptor {
#define USB_ENDPOINT_XFER_INT 3
+/*-------------------------------------------------------------------------*/
+
/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
struct usb_qualifier_descriptor {
__u8 bLength;
__u8 bDescriptorType;
+
__u16 bcdUSB;
__u8 bDeviceClass;
__u8 bDeviceSubClass;