usb_ops.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #ifndef __USB_OPS_H_
  21. #define __USB_OPS_H_
  22. #define REALTEK_USB_VENQT_READ 0xC0
  23. #define REALTEK_USB_VENQT_WRITE 0x40
  24. #define REALTEK_USB_VENQT_CMD_REQ 0x05
  25. #define REALTEK_USB_VENQT_CMD_IDX 0x00
  26. #define REALTEK_USB_IN_INT_EP_IDX 1
  27. enum {
  28. VENDOR_WRITE = 0x00,
  29. VENDOR_READ = 0x01,
  30. };
  31. #define ALIGNMENT_UNIT 16
  32. #define MAX_VENDOR_REQ_CMD_SIZE 254 /* 8188cu SIE Support */
  33. #define MAX_USB_IO_CTL_SIZE (MAX_VENDOR_REQ_CMD_SIZE + ALIGNMENT_UNIT)
  34. #ifdef PLATFORM_LINUX
  35. #include <usb_ops_linux.h>
  36. #endif /* PLATFORM_LINUX */
  37. #ifdef CONFIG_RTL8188E
  38. void rtl8188eu_set_hw_type(struct dvobj_priv *pdvobj);
  39. #ifdef CONFIG_SUPPORT_USB_INT
  40. void interrupt_handler_8188eu(_adapter *padapter, u16 pkt_len, u8 *pbuf);
  41. #endif
  42. #endif
  43. #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A)
  44. void rtl8812au_set_hw_type(struct dvobj_priv *pdvobj);
  45. #ifdef CONFIG_SUPPORT_USB_INT
  46. void interrupt_handler_8812au(_adapter *padapter, u16 pkt_len, u8 *pbuf);
  47. #endif
  48. #endif
  49. #ifdef CONFIG_RTL8814A
  50. void rtl8814au_set_hw_type(struct dvobj_priv *pdvobj);
  51. #ifdef CONFIG_SUPPORT_USB_INT
  52. void interrupt_handler_8814au(_adapter *padapter, u16 pkt_len, u8 *pbuf);
  53. #endif
  54. #endif /* CONFIG_RTL8814 */
  55. #ifdef CONFIG_RTL8192E
  56. void rtl8192eu_set_hw_type(struct dvobj_priv *pdvobj);
  57. #ifdef CONFIG_SUPPORT_USB_INT
  58. void interrupt_handler_8192eu(_adapter *padapter, u16 pkt_len, u8 *pbuf);
  59. #endif
  60. #endif
  61. #ifdef CONFIG_RTL8188F
  62. void rtl8188fu_set_hw_type(struct dvobj_priv *pdvobj);
  63. #ifdef CONFIG_SUPPORT_USB_INT
  64. void interrupt_handler_8188fu(_adapter *padapter, u16 pkt_len, u8 *pbuf);
  65. #endif
  66. #endif
  67. #ifdef CONFIG_RTL8723B
  68. void rtl8723bu_set_hw_type(struct dvobj_priv *pdvobj);
  69. #ifdef CONFIG_SUPPORT_USB_INT
  70. void interrupt_handler_8723bu(_adapter *padapter, u16 pkt_len, u8 *pbuf);
  71. #endif
  72. #endif
  73. #ifdef CONFIG_RTL8703B
  74. void rtl8703bu_set_hw_type(struct dvobj_priv *pdvobj);
  75. #ifdef CONFIG_SUPPORT_USB_INT
  76. void interrupt_handler_8703bu(_adapter *padapter, u16 pkt_len, u8 *pbuf);
  77. #endif /* CONFIG_SUPPORT_USB_INT */
  78. #endif /* CONFIG_RTL8703B */
  79. void usb_set_intf_ops(_adapter *padapter, struct _io_ops *pops);
  80. #ifdef CONFIG_RTL8723D
  81. void rtl8723du_set_hw_type(struct dvobj_priv *pdvobj);
  82. void rtl8723du_set_intf_ops(struct _io_ops *pops);
  83. void rtl8723du_recv_tasklet(void *priv);
  84. void rtl8723du_xmit_tasklet(void *priv);
  85. #ifdef CONFIG_SUPPORT_USB_INT
  86. void interrupt_handler_8723du(_adapter *padapter, u16 pkt_len, u8 *pbuf);
  87. #endif /* CONFIG_SUPPORT_USB_INT */
  88. #endif /* CONFIG_RTL8723D */
  89. enum RTW_USB_SPEED {
  90. RTW_USB_SPEED_UNKNOWN = 0,
  91. RTW_USB_SPEED_1_1 = 1,
  92. RTW_USB_SPEED_2 = 2,
  93. RTW_USB_SPEED_3 = 3,
  94. };
  95. #define IS_FULL_SPEED_USB(Adapter) (adapter_to_dvobj(Adapter)->usb_speed == RTW_USB_SPEED_1_1)
  96. #define IS_HIGH_SPEED_USB(Adapter) (adapter_to_dvobj(Adapter)->usb_speed == RTW_USB_SPEED_2)
  97. #define IS_SUPER_SPEED_USB(Adapter) (adapter_to_dvobj(Adapter)->usb_speed == RTW_USB_SPEED_3)
  98. #define USB_SUPER_SPEED_BULK_SIZE 1024 /* usb 3.0 */
  99. #define USB_HIGH_SPEED_BULK_SIZE 512 /* usb 2.0 */
  100. #define USB_FULL_SPEED_BULK_SIZE 64 /* usb 1.1 */
  101. static inline u8 rtw_usb_bulk_size_boundary(_adapter *padapter, int buf_len)
  102. {
  103. u8 rst = _TRUE;
  104. if (IS_SUPER_SPEED_USB(padapter))
  105. rst = (0 == (buf_len) % USB_SUPER_SPEED_BULK_SIZE) ? _TRUE : _FALSE;
  106. if (IS_HIGH_SPEED_USB(padapter))
  107. rst = (0 == (buf_len) % USB_HIGH_SPEED_BULK_SIZE) ? _TRUE : _FALSE;
  108. else
  109. rst = (0 == (buf_len) % USB_FULL_SPEED_BULK_SIZE) ? _TRUE : _FALSE;
  110. return rst;
  111. }
  112. #endif /* __USB_OPS_H_ */