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