1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2007 - 2011 Realtek Corporation. */
7 #include "osdep_service.h"
9 #include "osdep_intf.h"
11 #define REALTEK_USB_VENQT_READ 0xC0
12 #define REALTEK_USB_VENQT_WRITE 0x40
13 #define REALTEK_USB_VENQT_CMD_REQ 0x05
14 #define REALTEK_USB_VENQT_CMD_IDX 0x00
20 #define ALIGNMENT_UNIT 16
21 #define MAX_VENDOR_REQ_CMD_SIZE 254 /* 8188cu SIE Support */
22 #define MAX_USB_IO_CTL_SIZE (MAX_VENDOR_REQ_CMD_SIZE + ALIGNMENT_UNIT)
24 #include "usb_ops_linux.h"
26 void rtl8188eu_set_hw_type(struct adapter *padapter);
27 #define hal_set_hw_type rtl8188eu_set_hw_type
28 void rtl8188eu_set_intf_ops(struct _io_ops *pops);
29 #define usb_set_intf_ops rtl8188eu_set_intf_ops
32 * Increase and check if the continual_urb_error of this @param dvobjprivei
33 * is larger than MAX_CONTINUAL_URB_ERR
37 static inline int rtw_inc_and_chk_continual_urb_error(struct dvobj_priv *dvobj)
41 value = atomic_inc_return(&dvobj->continual_urb_error);
42 if (value > MAX_CONTINUAL_URB_ERR) {
43 DBG_88E("[dvobj:%p][ERROR] continual_urb_error:%d > %d\n",
44 dvobj, value, MAX_CONTINUAL_URB_ERR);
51 * Set the continual_urb_error of this @param dvobjprive to 0
53 static inline void rtw_reset_continual_urb_error(struct dvobj_priv *dvobj)
55 atomic_set(&dvobj->continual_urb_error, 0);
58 #define USB_HIGH_SPEED_BULK_SIZE 512
59 #define USB_FULL_SPEED_BULK_SIZE 64
61 static inline u8 rtw_usb_bulk_size_boundary(struct adapter *padapter,
65 struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
67 if (pdvobjpriv->ishighspeed)
68 rst = (0 == (buf_len) % USB_HIGH_SPEED_BULK_SIZE) ?
71 rst = (0 == (buf_len) % USB_FULL_SPEED_BULK_SIZE) ?
76 #endif /* __USB_OPS_H_ */