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 | |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 10 | #define BOOT_CMD_FW_BY_USB 0x01 |
| 11 | #define BOOT_CMD_FW_IN_EEPROM 0x02 |
| 12 | #define BOOT_CMD_UPDATE_BOOT2 0x03 |
| 13 | #define BOOT_CMD_UPDATE_FW 0x04 |
| 14 | #define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* M=>0x4D,R=>0x52,V=>0x56,L=>0x4C */ |
| 15 | |
| 16 | struct bootcmdstr |
| 17 | { |
| 18 | u32 u32magicnumber; |
| 19 | u8 u8cmd_tag; |
| 20 | u8 au8dumy[11]; |
| 21 | }; |
| 22 | |
| 23 | #define BOOT_CMD_RESP_OK 0x0001 |
| 24 | #define BOOT_CMD_RESP_FAIL 0x0000 |
| 25 | |
| 26 | struct bootcmdrespStr |
| 27 | { |
| 28 | u32 u32magicnumber; |
| 29 | u8 u8cmd_tag; |
| 30 | u8 u8result; |
| 31 | u8 au8dumy[2]; |
| 32 | }; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 33 | |
| 34 | /* read callback private data */ |
| 35 | struct read_cb_info { |
| 36 | wlan_private *priv; |
| 37 | struct sk_buff *skb; |
| 38 | }; |
| 39 | |
| 40 | /** USB card description structure*/ |
| 41 | struct usb_card_rec { |
| 42 | struct net_device *eth_dev; |
| 43 | struct usb_device *udev; |
| 44 | struct urb *rx_urb, *tx_urb; |
| 45 | void *priv; |
| 46 | struct read_cb_info rinfo; |
| 47 | |
| 48 | int bulk_in_size; |
| 49 | u8 bulk_in_endpointAddr; |
| 50 | |
| 51 | u8 *bulk_out_buffer; |
| 52 | int bulk_out_size; |
| 53 | u8 bulk_out_endpointAddr; |
| 54 | |
| 55 | u8 CRC_OK; |
| 56 | u32 fwseqnum; |
| 57 | u32 lastseqnum; |
| 58 | u32 totalbytes; |
| 59 | u32 fwlastblksent; |
| 60 | u8 fwdnldover; |
| 61 | u8 fwfinalblk; |
| 62 | |
| 63 | u32 usb_event_cause; |
| 64 | u8 usb_int_cause; |
| 65 | |
| 66 | u8 rx_urb_recall; |
| 67 | |
| 68 | u8 bootcmdresp; |
| 69 | }; |
| 70 | |
| 71 | /** fwheader */ |
| 72 | struct fwheader { |
| 73 | u32 dnldcmd; |
| 74 | u32 baseaddr; |
| 75 | u32 datalength; |
| 76 | u32 CRC; |
| 77 | }; |
| 78 | |
| 79 | #define FW_MAX_DATA_BLK_SIZE 600 |
| 80 | /** FWData */ |
| 81 | struct FWData { |
| 82 | struct fwheader fwheader; |
| 83 | u32 seqnum; |
| 84 | u8 data[FW_MAX_DATA_BLK_SIZE]; |
| 85 | }; |
| 86 | |
| 87 | /** fwsyncheader */ |
| 88 | struct fwsyncheader { |
| 89 | u32 cmd; |
| 90 | u32 seqnum; |
| 91 | }; |
| 92 | |
| 93 | #define FW_HAS_DATA_TO_RECV 0x00000001 |
| 94 | #define FW_HAS_LAST_BLOCK 0x00000004 |
| 95 | |
| 96 | #define FW_DATA_XMIT_SIZE \ |
| 97 | sizeof(struct fwheader) + fwdata->fwheader.datalength + sizeof(u32) |
| 98 | |
| 99 | int usb_tx_block(wlan_private *priv, u8 *payload, u16 nb); |
| 100 | void if_usb_free(struct usb_card_rec *cardp); |
| 101 | int if_usb_issue_boot_command(wlan_private *priv, int ivalue); |
| 102 | |