hif_usb.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (c) 2010 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 AR9271_FIRMWARE 0x501000
  19. #define AR9271_FIRMWARE_TEXT 0x903000
  20. #define FIRMWARE_DOWNLOAD 0x30
  21. #define FIRMWARE_DOWNLOAD_COMP 0x31
  22. #define ATH_USB_RX_STREAM_MODE_TAG 0x4e00
  23. #define ATH_USB_TX_STREAM_MODE_TAG 0x697e
  24. /* FIXME: Verify these numbers (with Windows) */
  25. #define MAX_TX_URB_NUM 8
  26. #define MAX_TX_BUF_NUM 1024
  27. #define MAX_TX_BUF_SIZE 32768
  28. #define MAX_TX_AGGR_NUM 20
  29. #define MAX_RX_URB_NUM 8
  30. #define MAX_RX_BUF_SIZE 16384
  31. #define MAX_PKT_NUM_IN_TRANSFER 10
  32. #define MAX_REG_OUT_URB_NUM 1
  33. #define MAX_REG_OUT_BUF_NUM 8
  34. #define MAX_REG_IN_BUF_SIZE 64
  35. /* USB Endpoint definition */
  36. #define USB_WLAN_TX_PIPE 1
  37. #define USB_WLAN_RX_PIPE 2
  38. #define USB_REG_IN_PIPE 3
  39. #define USB_REG_OUT_PIPE 4
  40. #define HIF_USB_MAX_RXPIPES 2
  41. #define HIF_USB_MAX_TXPIPES 4
  42. struct tx_buf {
  43. u8 *buf;
  44. u16 len;
  45. u16 offset;
  46. struct urb *urb;
  47. struct sk_buff_head skb_queue;
  48. struct hif_device_usb *hif_dev;
  49. struct list_head list;
  50. };
  51. #define HIF_USB_TX_STOP BIT(0)
  52. struct hif_usb_tx {
  53. u8 flags;
  54. u8 tx_buf_cnt;
  55. u16 tx_skb_cnt;
  56. struct sk_buff_head tx_skb_queue;
  57. struct list_head tx_buf;
  58. struct list_head tx_pending;
  59. spinlock_t tx_lock;
  60. };
  61. struct cmd_buf {
  62. struct sk_buff *skb;
  63. struct hif_device_usb *hif_dev;
  64. };
  65. #define HIF_USB_START BIT(0)
  66. struct hif_device_usb {
  67. u16 device_id;
  68. struct usb_device *udev;
  69. struct usb_interface *interface;
  70. const struct firmware *firmware;
  71. struct htc_target *htc_handle;
  72. struct hif_usb_tx tx;
  73. struct urb *reg_in_urb;
  74. struct usb_anchor regout_submitted;
  75. struct usb_anchor rx_submitted;
  76. struct sk_buff *remain_skb;
  77. int rx_remain_len;
  78. int rx_pkt_len;
  79. int rx_transfer_len;
  80. int rx_pad_len;
  81. spinlock_t rx_lock;
  82. u8 flags; /* HIF_USB_* */
  83. };
  84. int ath9k_hif_usb_init(void);
  85. void ath9k_hif_usb_exit(void);
  86. #endif /* HTC_USB_H */