if_usb.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef _LIBERTAS_IF_USB_H
  2. #define _LIBERTAS_IF_USB_H
  3. #include <linux/list.h>
  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. #define IPFIELD_ALIGN_OFFSET 2
  11. #define BOOT_CMD_FW_BY_USB 0x01
  12. #define BOOT_CMD_FW_IN_EEPROM 0x02
  13. #define BOOT_CMD_UPDATE_BOOT2 0x03
  14. #define BOOT_CMD_UPDATE_FW 0x04
  15. #define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* M=>0x4D,R=>0x52,V=>0x56,L=>0x4C */
  16. struct bootcmdstr
  17. {
  18. __le32 u32magicnumber;
  19. u8 u8cmd_tag;
  20. u8 au8dumy[11];
  21. };
  22. #define BOOT_CMD_RESP_OK 0x0001
  23. #define BOOT_CMD_RESP_FAIL 0x0000
  24. struct bootcmdrespStr
  25. {
  26. __le32 u32magicnumber;
  27. u8 u8cmd_tag;
  28. u8 u8result;
  29. u8 au8dumy[2];
  30. };
  31. /* read callback private data */
  32. struct read_cb_info {
  33. struct usb_card_rec *cardp;
  34. struct sk_buff *skb;
  35. };
  36. /** USB card description structure*/
  37. struct usb_card_rec {
  38. struct list_head list;
  39. struct net_device *eth_dev;
  40. struct usb_device *udev;
  41. struct urb *rx_urb, *tx_urb;
  42. void *priv;
  43. struct read_cb_info rinfo;
  44. int bulk_in_size;
  45. u8 bulk_in_endpointAddr;
  46. u8 *bulk_out_buffer;
  47. int bulk_out_size;
  48. u8 bulk_out_endpointAddr;
  49. const struct firmware *fw;
  50. u8 CRC_OK;
  51. u32 fwseqnum;
  52. u32 lastseqnum;
  53. u32 totalbytes;
  54. u32 fwlastblksent;
  55. u8 fwdnldover;
  56. u8 fwfinalblk;
  57. u8 surprise_removed;
  58. u32 usb_event_cause;
  59. u8 usb_int_cause;
  60. u8 rx_urb_recall;
  61. u8 bootcmdresp;
  62. };
  63. /** fwheader */
  64. struct fwheader {
  65. __le32 dnldcmd;
  66. __le32 baseaddr;
  67. __le32 datalength;
  68. __le32 CRC;
  69. };
  70. #define FW_MAX_DATA_BLK_SIZE 600
  71. /** FWData */
  72. struct FWData {
  73. struct fwheader fwheader;
  74. __le32 seqnum;
  75. u8 data[FW_MAX_DATA_BLK_SIZE];
  76. };
  77. /** fwsyncheader */
  78. struct fwsyncheader {
  79. __le32 cmd;
  80. __le32 seqnum;
  81. };
  82. #define FW_HAS_DATA_TO_RECV 0x00000001
  83. #define FW_HAS_LAST_BLOCK 0x00000004
  84. #define FW_DATA_XMIT_SIZE \
  85. sizeof(struct fwheader) + le32_to_cpu(fwdata->fwheader.datalength) + sizeof(u32)
  86. #endif