2007-11-16 07:05:47 +08:00
|
|
|
#ifndef _LBS_IF_USB_H
|
|
|
|
#define _LBS_IF_USB_H
|
2007-05-26 00:41:52 +08:00
|
|
|
|
2007-12-11 13:07:58 +08:00
|
|
|
#include <linux/wait.h>
|
|
|
|
#include <linux/timer.h>
|
|
|
|
|
2007-12-12 01:53:43 +08:00
|
|
|
struct lbs_private;
|
|
|
|
|
2007-02-10 22:25:27 +08:00
|
|
|
/**
|
|
|
|
* This file contains definition for USB interface.
|
|
|
|
*/
|
|
|
|
#define CMD_TYPE_REQUEST 0xF00DFACE
|
|
|
|
#define CMD_TYPE_DATA 0xBEADC0DE
|
|
|
|
#define CMD_TYPE_INDICATION 0xBEEFFACE
|
|
|
|
|
|
|
|
#define IPFIELD_ALIGN_OFFSET 2
|
|
|
|
|
|
|
|
#define BOOT_CMD_FW_BY_USB 0x01
|
|
|
|
#define BOOT_CMD_FW_IN_EEPROM 0x02
|
|
|
|
#define BOOT_CMD_UPDATE_BOOT2 0x03
|
|
|
|
#define BOOT_CMD_UPDATE_FW 0x04
|
|
|
|
#define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* M=>0x4D,R=>0x52,V=>0x56,L=>0x4C */
|
|
|
|
|
|
|
|
struct bootcmdstr
|
|
|
|
{
|
2007-05-26 11:36:54 +08:00
|
|
|
__le32 u32magicnumber;
|
2007-02-10 22:25:27 +08:00
|
|
|
u8 u8cmd_tag;
|
|
|
|
u8 au8dumy[11];
|
|
|
|
};
|
|
|
|
|
|
|
|
#define BOOT_CMD_RESP_OK 0x0001
|
|
|
|
#define BOOT_CMD_RESP_FAIL 0x0000
|
|
|
|
|
|
|
|
struct bootcmdrespStr
|
|
|
|
{
|
2007-05-26 11:36:54 +08:00
|
|
|
__le32 u32magicnumber;
|
2007-02-10 22:25:27 +08:00
|
|
|
u8 u8cmd_tag;
|
|
|
|
u8 u8result;
|
|
|
|
u8 au8dumy[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* read callback private data */
|
|
|
|
struct read_cb_info {
|
2007-08-20 23:43:25 +08:00
|
|
|
struct usb_card_rec *cardp;
|
2007-02-10 22:25:27 +08:00
|
|
|
struct sk_buff *skb;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** USB card description structure*/
|
|
|
|
struct usb_card_rec {
|
|
|
|
struct usb_device *udev;
|
|
|
|
struct urb *rx_urb, *tx_urb;
|
2007-12-12 01:53:43 +08:00
|
|
|
struct lbs_private *priv;
|
2007-02-10 22:25:27 +08:00
|
|
|
struct read_cb_info rinfo;
|
|
|
|
|
|
|
|
int bulk_in_size;
|
|
|
|
u8 bulk_in_endpointAddr;
|
|
|
|
|
|
|
|
u8 *bulk_out_buffer;
|
|
|
|
int bulk_out_size;
|
|
|
|
u8 bulk_out_endpointAddr;
|
|
|
|
|
2007-08-20 23:43:25 +08:00
|
|
|
const struct firmware *fw;
|
2007-12-11 13:07:58 +08:00
|
|
|
struct timer_list fw_timeout;
|
|
|
|
wait_queue_head_t fw_wq;
|
2007-02-10 22:25:27 +08:00
|
|
|
u8 CRC_OK;
|
|
|
|
u32 fwseqnum;
|
|
|
|
u32 lastseqnum;
|
|
|
|
u32 totalbytes;
|
|
|
|
u32 fwlastblksent;
|
|
|
|
u8 fwdnldover;
|
|
|
|
u8 fwfinalblk;
|
2007-08-20 23:43:25 +08:00
|
|
|
u8 surprise_removed;
|
2007-02-10 22:25:27 +08:00
|
|
|
|
|
|
|
u32 usb_event_cause;
|
|
|
|
u8 usb_int_cause;
|
|
|
|
|
2007-12-09 07:49:06 +08:00
|
|
|
s8 bootcmdresp;
|
2007-02-10 22:25:27 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/** fwheader */
|
|
|
|
struct fwheader {
|
2007-05-26 11:36:54 +08:00
|
|
|
__le32 dnldcmd;
|
|
|
|
__le32 baseaddr;
|
|
|
|
__le32 datalength;
|
|
|
|
__le32 CRC;
|
2007-02-10 22:25:27 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define FW_MAX_DATA_BLK_SIZE 600
|
|
|
|
/** FWData */
|
|
|
|
struct FWData {
|
|
|
|
struct fwheader fwheader;
|
2007-05-26 11:36:54 +08:00
|
|
|
__le32 seqnum;
|
2007-02-10 22:25:27 +08:00
|
|
|
u8 data[FW_MAX_DATA_BLK_SIZE];
|
|
|
|
};
|
|
|
|
|
|
|
|
/** fwsyncheader */
|
|
|
|
struct fwsyncheader {
|
2007-05-26 11:36:54 +08:00
|
|
|
__le32 cmd;
|
|
|
|
__le32 seqnum;
|
2007-02-10 22:25:27 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define FW_HAS_DATA_TO_RECV 0x00000001
|
|
|
|
#define FW_HAS_LAST_BLOCK 0x00000004
|
|
|
|
|
|
|
|
#define FW_DATA_XMIT_SIZE \
|
2007-05-26 11:38:14 +08:00
|
|
|
sizeof(struct fwheader) + le32_to_cpu(fwdata->fwheader.datalength) + sizeof(u32)
|
2007-02-10 22:25:27 +08:00
|
|
|
|
2007-05-26 00:41:52 +08:00
|
|
|
#endif
|