Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame^] | 1 | /** |
| 2 | * This file contains definition for USB interface. |
| 3 | */ |
| 4 | #define CMD_TYPE_REQUEST 0xF00DFACE |
| 5 | #define CMD_TYPE_DATA 0xBEADC0DE |
| 6 | #define CMD_TYPE_INDICATION 0xBEEFFACE |
| 7 | |
| 8 | #define IPFIELD_ALIGN_OFFSET 2 |
| 9 | |
| 10 | #define USB8388_VID_1 0x1286 |
| 11 | #define USB8388_PID_1 0x2001 |
| 12 | #define USB8388_VID_2 0x05a3 |
| 13 | #define USB8388_PID_2 0x8388 |
| 14 | |
| 15 | #ifdef SUPPORT_BOOT_COMMAND |
| 16 | #define BOOT_CMD_FW_BY_USB 0x01 |
| 17 | #define BOOT_CMD_FW_IN_EEPROM 0x02 |
| 18 | #define BOOT_CMD_UPDATE_BOOT2 0x03 |
| 19 | #define BOOT_CMD_UPDATE_FW 0x04 |
| 20 | #define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* M=>0x4D,R=>0x52,V=>0x56,L=>0x4C */ |
| 21 | |
| 22 | struct bootcmdstr |
| 23 | { |
| 24 | u32 u32magicnumber; |
| 25 | u8 u8cmd_tag; |
| 26 | u8 au8dumy[11]; |
| 27 | }; |
| 28 | |
| 29 | #define BOOT_CMD_RESP_OK 0x0001 |
| 30 | #define BOOT_CMD_RESP_FAIL 0x0000 |
| 31 | |
| 32 | struct bootcmdrespStr |
| 33 | { |
| 34 | u32 u32magicnumber; |
| 35 | u8 u8cmd_tag; |
| 36 | u8 u8result; |
| 37 | u8 au8dumy[2]; |
| 38 | }; |
| 39 | #endif /* SUPPORT_BOOT_COMMAND */ |
| 40 | |
| 41 | /* read callback private data */ |
| 42 | struct read_cb_info { |
| 43 | wlan_private *priv; |
| 44 | struct sk_buff *skb; |
| 45 | }; |
| 46 | |
| 47 | /** USB card description structure*/ |
| 48 | struct usb_card_rec { |
| 49 | struct net_device *eth_dev; |
| 50 | struct usb_device *udev; |
| 51 | struct urb *rx_urb, *tx_urb; |
| 52 | void *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 | u8 CRC_OK; |
| 63 | u32 fwseqnum; |
| 64 | u32 lastseqnum; |
| 65 | u32 totalbytes; |
| 66 | u32 fwlastblksent; |
| 67 | u8 fwdnldover; |
| 68 | u8 fwfinalblk; |
| 69 | |
| 70 | u32 usb_event_cause; |
| 71 | u8 usb_int_cause; |
| 72 | |
| 73 | u8 rx_urb_recall; |
| 74 | |
| 75 | u8 bootcmdresp; |
| 76 | }; |
| 77 | |
| 78 | /** fwheader */ |
| 79 | struct fwheader { |
| 80 | u32 dnldcmd; |
| 81 | u32 baseaddr; |
| 82 | u32 datalength; |
| 83 | u32 CRC; |
| 84 | }; |
| 85 | |
| 86 | #define FW_MAX_DATA_BLK_SIZE 600 |
| 87 | /** FWData */ |
| 88 | struct FWData { |
| 89 | struct fwheader fwheader; |
| 90 | u32 seqnum; |
| 91 | u8 data[FW_MAX_DATA_BLK_SIZE]; |
| 92 | }; |
| 93 | |
| 94 | /** fwsyncheader */ |
| 95 | struct fwsyncheader { |
| 96 | u32 cmd; |
| 97 | u32 seqnum; |
| 98 | }; |
| 99 | |
| 100 | #define FW_HAS_DATA_TO_RECV 0x00000001 |
| 101 | #define FW_HAS_LAST_BLOCK 0x00000004 |
| 102 | |
| 103 | #define FW_DATA_XMIT_SIZE \ |
| 104 | sizeof(struct fwheader) + fwdata->fwheader.datalength + sizeof(u32) |
| 105 | |
| 106 | int usb_tx_block(wlan_private *priv, u8 *payload, u16 nb); |
| 107 | void if_usb_free(struct usb_card_rec *cardp); |
| 108 | int if_usb_issue_boot_command(wlan_private *priv, int ivalue); |
| 109 | |