]> err.no Git - linux-2.6/blob - drivers/net/wireless/libertas/if_usb.h
libertas: cope with device which already has firmware loaded
[linux-2.6] / drivers / net / wireless / libertas / if_usb.h
1 #ifndef _LBS_IF_USB_H
2 #define _LBS_IF_USB_H
3
4 /**
5   * This file contains definition for USB interface.
6   */
7 #define CMD_TYPE_REQUEST                0xF00DFACE
8 #define CMD_TYPE_DATA                   0xBEADC0DE
9 #define CMD_TYPE_INDICATION             0xBEEFFACE
10
11 #define IPFIELD_ALIGN_OFFSET    2
12
13 #define BOOT_CMD_FW_BY_USB     0x01
14 #define BOOT_CMD_FW_IN_EEPROM  0x02
15 #define BOOT_CMD_UPDATE_BOOT2  0x03
16 #define BOOT_CMD_UPDATE_FW     0x04
17 #define BOOT_CMD_MAGIC_NUMBER  0x4C56524D   /* M=>0x4D,R=>0x52,V=>0x56,L=>0x4C */
18
19 struct bootcmdstr
20 {
21         __le32 u32magicnumber;
22         u8  u8cmd_tag;
23         u8  au8dumy[11];
24 };
25
26 #define BOOT_CMD_RESP_OK     0x0001
27 #define BOOT_CMD_RESP_FAIL   0x0000
28
29 struct bootcmdrespStr
30 {
31         __le32 u32magicnumber;
32         u8  u8cmd_tag;
33         u8  u8result;
34         u8  au8dumy[2];
35 };
36
37 /* read callback private data */
38 struct read_cb_info {
39         struct usb_card_rec *cardp;
40         struct sk_buff *skb;
41 };
42
43 /** USB card description structure*/
44 struct usb_card_rec {
45         struct net_device *eth_dev;
46         struct usb_device *udev;
47         struct urb *rx_urb, *tx_urb;
48         void *priv;
49         struct read_cb_info rinfo;
50
51         int bulk_in_size;
52         u8 bulk_in_endpointAddr;
53
54         u8 *bulk_out_buffer;
55         int bulk_out_size;
56         u8 bulk_out_endpointAddr;
57
58         const struct firmware *fw;
59         u8 CRC_OK;
60         u32 fwseqnum;
61         u32 lastseqnum;
62         u32 totalbytes;
63         u32 fwlastblksent;
64         u8 fwdnldover;
65         u8 fwfinalblk;
66         u8 surprise_removed;
67
68         u32 usb_event_cause;
69         u8 usb_int_cause;
70
71         u8 rx_urb_recall;
72
73         s8 bootcmdresp;
74 };
75
76 /** fwheader */
77 struct fwheader {
78         __le32 dnldcmd;
79         __le32 baseaddr;
80         __le32 datalength;
81         __le32 CRC;
82 };
83
84 #define FW_MAX_DATA_BLK_SIZE    600
85 /** FWData */
86 struct FWData {
87         struct fwheader fwheader;
88         __le32 seqnum;
89         u8 data[FW_MAX_DATA_BLK_SIZE];
90 };
91
92 /** fwsyncheader */
93 struct fwsyncheader {
94         __le32 cmd;
95         __le32 seqnum;
96 };
97
98 #define FW_HAS_DATA_TO_RECV             0x00000001
99 #define FW_HAS_LAST_BLOCK               0x00000004
100
101 #define FW_DATA_XMIT_SIZE \
102         sizeof(struct fwheader) + le32_to_cpu(fwdata->fwheader.datalength) + sizeof(u32)
103
104 #endif