usb_ops_linux.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 FW_START_ADDRESS 0x1000
  24. #define RTW_USB_CONTROL_MSG_TIMEOUT_TEST 10//ms
  25. #define RTW_USB_CONTROL_MSG_TIMEOUT 500//ms
  26. #define RECV_BULK_IN_ADDR 0x80//assign by drv,not real address
  27. #define RECV_INT_IN_ADDR 0x81//assign by drv,not real address
  28. #if defined(CONFIG_VENDOR_REQ_RETRY) && defined(CONFIG_USB_VENDOR_REQ_MUTEX)
  29. /* vendor req retry should be in the situation when each vendor req is atomically submitted from others */
  30. #define MAX_USBCTRL_VENDORREQ_TIMES 10
  31. #else
  32. #define MAX_USBCTRL_VENDORREQ_TIMES 1
  33. #endif
  34. #define RTW_USB_BULKOUT_TIMEOUT 5000//ms
  35. #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) || (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
  36. #define _usbctrl_vendorreq_async_callback(urb, regs) _usbctrl_vendorreq_async_callback(urb)
  37. #define usb_bulkout_zero_complete(purb, regs) usb_bulkout_zero_complete(purb)
  38. #define usb_write_mem_complete(purb, regs) usb_write_mem_complete(purb)
  39. #define usb_write_port_complete(purb, regs) usb_write_port_complete(purb)
  40. #define usb_read_port_complete(purb, regs) usb_read_port_complete(purb)
  41. #define usb_read_interrupt_complete(purb, regs) usb_read_interrupt_complete(purb)
  42. #endif
  43. #ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ
  44. int usb_async_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val);
  45. int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val);
  46. int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val);
  47. #endif /* CONFIG_USB_SUPPORT_ASYNC_VDN_REQ */
  48. unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr);
  49. void usb_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem);
  50. void usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem);
  51. void usb_read_port_cancel(struct intf_hdl *pintfhdl);
  52. u32 usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem);
  53. void usb_write_port_cancel(struct intf_hdl *pintfhdl);
  54. int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u16 index, void *pdata, u16 len, u8 requesttype);
  55. #endif