hif_usb.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright (c) 2010-2011 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef HTC_USB_H
  17. #define HTC_USB_H
  18. #define MAJOR_VERSION_REQ 1
  19. #define MINOR_VERSION_REQ 3
  20. #define IS_AR7010_DEVICE(_v) (((_v) == AR9280_USB) || ((_v) == AR9287_USB))
  21. #define AR9271_FIRMWARE 0x501000
  22. #define AR9271_FIRMWARE_TEXT 0x903000
  23. #define AR7010_FIRMWARE_TEXT 0x906000
  24. #define FIRMWARE_DOWNLOAD 0x30
  25. #define FIRMWARE_DOWNLOAD_COMP 0x31
  26. #define ATH_USB_RX_STREAM_MODE_TAG 0x4e00
  27. #define ATH_USB_TX_STREAM_MODE_TAG 0x697e
  28. /* FIXME: Verify these numbers (with Windows) */
  29. #define MAX_TX_URB_NUM 8
  30. #define MAX_TX_BUF_NUM 256
  31. #define MAX_TX_BUF_SIZE 32768
  32. #define MAX_TX_AGGR_NUM 20
  33. #define MAX_RX_URB_NUM 8
  34. #define MAX_RX_BUF_SIZE 16384
  35. #define MAX_PKT_NUM_IN_TRANSFER 10
  36. #define MAX_REG_OUT_URB_NUM 1
  37. #define MAX_REG_IN_URB_NUM 64
  38. #define MAX_REG_IN_BUF_SIZE 64
  39. /* USB Endpoint definition */
  40. #define USB_WLAN_TX_PIPE 1
  41. #define USB_WLAN_RX_PIPE 2
  42. #define USB_REG_IN_PIPE 3
  43. #define USB_REG_OUT_PIPE 4
  44. #define HIF_USB_MAX_RXPIPES 2
  45. #define HIF_USB_MAX_TXPIPES 4
  46. struct tx_buf {
  47. u8 *buf;
  48. u16 len;
  49. u16 offset;
  50. struct urb *urb;
  51. struct sk_buff_head skb_queue;
  52. struct hif_device_usb *hif_dev;
  53. struct list_head list;
  54. };
  55. #define HIF_USB_TX_STOP BIT(0)
  56. #define HIF_USB_TX_FLUSH BIT(1)
  57. struct hif_usb_tx {
  58. u8 flags;
  59. u8 tx_buf_cnt;
  60. u16 tx_skb_cnt;
  61. struct sk_buff_head tx_skb_queue;
  62. struct list_head tx_buf;
  63. struct list_head tx_pending;
  64. spinlock_t tx_lock;
  65. };
  66. struct cmd_buf {
  67. struct sk_buff *skb;
  68. struct hif_device_usb *hif_dev;
  69. };
  70. #define HIF_USB_START BIT(0)
  71. struct hif_device_usb {
  72. u16 device_id;
  73. struct usb_device *udev;
  74. struct usb_interface *interface;
  75. const struct firmware *firmware;
  76. struct htc_target *htc_handle;
  77. struct hif_usb_tx tx;
  78. struct usb_anchor regout_submitted;
  79. struct usb_anchor rx_submitted;
  80. struct usb_anchor reg_in_submitted;
  81. struct usb_anchor mgmt_submitted;
  82. struct sk_buff *remain_skb;
  83. const char *fw_name;
  84. int rx_remain_len;
  85. int rx_pkt_len;
  86. int rx_transfer_len;
  87. int rx_pad_len;
  88. spinlock_t rx_lock;
  89. u8 flags; /* HIF_USB_* */
  90. };
  91. int ath9k_hif_usb_init(void);
  92. void ath9k_hif_usb_exit(void);
  93. #endif /* HTC_USB_H */