original comment: +Wilson03172004,marked due to this pci host does not support MWI
[linux-2.4.git] / drivers / usb / CDCEther.h
1 // Portions of this file taken from
2 // Petko Manolov - Petkan (petkan@dce.bg)
3 // from his driver pegasus.h
4
5 /*
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20
21 /* From CDC Spec Table 24 */
22 #define CS_INTERFACE                    0x24
23
24 #define CDC_ETHER_MAX_MTU               1536
25
26 /* These definitions are used with the ether_dev_t flags element */
27 #define CDC_ETHER_PRESENT               0x00000001
28 #define CDC_ETHER_RUNNING               0x00000002
29 #define CDC_ETHER_TX_BUSY               0x00000004
30 #define CDC_ETHER_RX_BUSY               0x00000008
31 #define CDC_ETHER_UNPLUG                0x00000040
32
33 #define CDC_ETHER_TX_TIMEOUT    (HZ*10)
34
35 #define TX_UNDERRUN                     0x80
36 #define EXCESSIVE_COL                   0x40
37 #define LATE_COL                        0x20
38 #define NO_CARRIER                      0x10
39 #define LOSS_CARRIER                    0x08
40 #define JABBER_TIMEOUT                  0x04
41
42 #define CDC_ETHER_REQT_READ             0xc0
43 #define CDC_ETHER_REQT_WRITE    0x40
44 #define CDC_ETHER_REQ_GET_REGS  0xf0
45 #define CDC_ETHER_REQ_SET_REGS  0xf1
46 #define CDC_ETHER_REQ_SET_REG   PIPERIDER_REQ_SET_REGS
47
48 typedef struct _ether_dev_t {
49         struct usb_device       *usb;
50         struct net_device       *net;
51         struct net_device_stats stats;
52         unsigned                flags;
53         unsigned                properties;
54         int                     configuration_num;
55         int                     bConfigurationValue;
56         int                     comm_interface;
57         int                     comm_bInterfaceNumber;
58         int                     comm_interface_altset_num;
59         int                     comm_bAlternateSetting;
60         int                     comm_ep_in;
61         int                     data_interface;
62         int                     data_bInterfaceNumber;
63         int                     data_interface_altset_num_with_traffic;
64         int                     data_bAlternateSetting_with_traffic;
65         int                     data_interface_altset_num_without_traffic;
66         int                     data_bAlternateSetting_without_traffic;
67         int                     data_ep_in;
68         int                     data_ep_out;
69         int                     data_ep_out_size;
70         __u16                   bcdCDC;
71         __u8                    iMACAddress;
72         __u32                   bmEthernetStatistics;
73         __u16                   wMaxSegmentSize;
74         __u16                   wNumberMCFilters;
75         __u8                    bNumberPowerFilters;
76         __u16                   mode_flags;
77         int                     intr_interval;
78         struct usb_ctrlrequest  ctrl_dr;
79         struct urb              rx_urb, tx_urb, intr_urb, ctrl_urb;
80         unsigned char           rx_buff[CDC_ETHER_MAX_MTU] __attribute__((aligned(L1_CACHE_BYTES)));
81         unsigned char           tx_buff[CDC_ETHER_MAX_MTU] __attribute__((aligned(L1_CACHE_BYTES)));
82         unsigned char           intr_buff[16]
83                                 __attribute__((aligned(L1_CACHE_BYTES))) ;
84 } ether_dev_t;
85
86 /* These definitions used in the Ethernet Packet Filtering requests */
87 /* See CDC Spec Table 62 */
88 #define MODE_FLAG_PROMISCUOUS   (1<<0)
89 #define MODE_FLAG_ALL_MULTICAST (1<<1)
90 #define MODE_FLAG_DIRECTED      (1<<2)
91 #define MODE_FLAG_BROADCAST     (1<<3)
92 #define MODE_FLAG_MULTICAST     (1<<4)
93
94 /* CDC Spec class requests - CDC Spec Table 46 */
95 #define SET_ETHERNET_MULTICAST_FILTER    0x40
96 #define SET_ETHERNET_PACKET_FILTER       0x43
97
98
99 /* These definitions are used with the ether_dev_t properties field */
100 #define HAVE_NOTIFICATION_ELEMENT       0x0001
101 #define PERFECT_FILTERING               0x0002
102 #define NO_SET_MULTICAST                0x0004
103
104 /* These definitions are used in the requirements parser */
105 #define REQ_HDR_FUNC_DESCR      0x0001
106 #define REQ_UNION_FUNC_DESCR    0x0002
107 #define REQ_ETH_FUNC_DESCR      0x0004
108 #define REQUIREMENTS_TOTAL      REQ_ETH_FUNC_DESCR | REQ_UNION_FUNC_DESCR | REQ_HDR_FUNC_DESCR
109
110 /* Some useful lengths */
111 #define HEADER_FUNC_DESC_LEN    0x5
112 #define UNION_FUNC_DESC_LEN     0x5
113 #define ETHERNET_FUNC_DESC_LEN  0xD /* 13 for all you decimal weenies */
114
115