usb_ops_linux.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_LINUX_H__
  21. #define __USB_OPS_LINUX_H__
  22. #define VENDOR_CMD_MAX_DATA_LEN 254
  23. #define RTW_USB_CONTROL_MSG_TIMEOUT_TEST 10/* ms */
  24. #define RTW_USB_CONTROL_MSG_TIMEOUT 500/* ms */
  25. #define MAX_USBCTRL_VENDORREQ_TIMES 10
  26. #define RTW_USB_BULKOUT_TIME 5000/* ms */
  27. #define REALTEK_USB_VENQT_READ 0xC0
  28. #define REALTEK_USB_VENQT_WRITE 0x40
  29. #define ALIGNMENT_UNIT 16
  30. #define MAX_VENDOR_REQ_CMD_SIZE 254 /* 8188cu SIE Support */
  31. #define MAX_USB_IO_CTL_SIZE (MAX_VENDOR_REQ_CMD_SIZE + ALIGNMENT_UNIT)
  32. #define USB_HIGH_SPEED_BULK_SIZE 512
  33. #define USB_FULL_SPEED_BULK_SIZE 64
  34. #define _usbctrl_vendorreq_async_callback(urb, regs) \
  35. _usbctrl_vendorreq_async_callback(urb)
  36. #define usb_bulkout_zero_complete(purb, regs) \
  37. usb_bulkout_zero_complete(purb)
  38. #define usb_write_mem_complete(purb, regs) \
  39. usb_write_mem_complete(purb)
  40. #define usb_write_port_complete(purb, regs) \
  41. usb_write_port_complete(purb)
  42. #define usb_read_port_complete(purb, regs) \
  43. usb_read_port_complete(purb)
  44. #define usb_read_interrupt_complete(purb, regs) \
  45. usb_read_interrupt_complete(purb)
  46. static inline u8 rtw_usb_bulk_size_boundary(struct adapter *padapter,
  47. int buf_len)
  48. {
  49. u8 rst = true;
  50. struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
  51. if (pdvobjpriv->ishighspeed)
  52. rst = (0 == (buf_len) % USB_HIGH_SPEED_BULK_SIZE) ?
  53. true : false;
  54. else
  55. rst = (0 == (buf_len) % USB_FULL_SPEED_BULK_SIZE) ?
  56. true : false;
  57. return rst;
  58. }
  59. unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr);
  60. u8 usb_read8(struct adapter *adapter, u32 addr);
  61. u16 usb_read16(struct adapter *adapter, u32 addr);
  62. u32 usb_read32(struct adapter *adapter, u32 addr);
  63. u32 usb_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
  64. void usb_read_port_cancel(struct adapter *adapter);
  65. int usb_write8(struct adapter *adapter, u32 addr, u8 val);
  66. int usb_write16(struct adapter *adapter, u32 addr, u16 val);
  67. int usb_write32(struct adapter *adapter, u32 addr, u32 val);
  68. u32 usb_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
  69. void usb_write_port_cancel(struct adapter *adapter);
  70. #endif