29 #define _HCI_OPS_OS_C_
38 #define RTL871X_VENQT_READ 0xc0
39 #define RTL871X_VENQT_WRITE 0x40
48 #define usb_write_cmd r8712_usb_write_mem
49 #define usb_write_cmd_complete usb_write_mem_complete
70 unsigned int pipe = 0;
71 struct usb_device *pusbd = pdvobj->
pusbdev;
76 pipe = usb_sndbulkpipe(pusbd, 0x07);
79 pipe = usb_sndbulkpipe(pusbd, 0x06);
82 pipe = usb_sndbulkpipe(pusbd, 0x05);
85 pipe = usb_sndbulkpipe(pusbd, 0x04);
88 pipe = usb_sndbulkpipe(pusbd, 0x0a);
91 pipe = usb_sndbulkpipe(pusbd, 0x0b);
94 pipe = usb_sndbulkpipe(pusbd, 0x0c);
97 pipe = usb_rcvbulkpipe(pusbd, 0x03);
100 pipe = usb_rcvbulkpipe(pusbd, 0x09);
103 pipe = usb_sndbulkpipe(pusbd, 0x0d);
109 pipe = usb_sndbulkpipe(pusbd, 0x07);
112 pipe = usb_sndbulkpipe(pusbd, 0x06);
115 pipe = usb_sndbulkpipe(pusbd, 0x05);
118 pipe = usb_sndbulkpipe(pusbd, 0x04);
122 pipe = usb_rcvbulkpipe(pusbd, 0x03);
128 pipe = usb_sndbulkpipe(pusbd, 0x0d);
134 pipe = usb_sndbulkpipe(pusbd, 0x06);
137 pipe = usb_sndbulkpipe(pusbd, 0x04);
141 pipe = usb_rcvbulkpipe(pusbd, 0x03);
147 pipe = usb_sndbulkpipe(pusbd, 0x0d);
155 static void usb_write_mem_complete(
struct urb *purb)
159 struct intf_priv *pintfpriv = pintf->pintfpriv;
162 if (purb->status != 0) {
179 struct usb_device *pusbd = pdvobj->
pusbdev;
186 pipe = ffaddr2pipehdl(pdvobj, addr);
189 usb_fill_bulk_urb(piorw_urb, pusbd, pipe,
190 wmem, cnt, usb_write_mem_complete,
196 static void r8712_usb_read_port_complete(
struct urb *purb)
205 if (purb->status == 0) {
208 precvbuf->
reuse =
true;
210 (
unsigned char *)precvbuf);
215 if ((isevt & 0x1ff) == 0x1ff) {
217 precvbuf->
reuse =
true;
219 0, (
unsigned char *)precvbuf);
222 skb_put(pskb, purb->actual_length);
226 precvbuf->
reuse =
false;
228 0, (
unsigned char *)precvbuf);
232 switch (purb->status) {
241 precvbuf->
reuse =
true;
243 (
unsigned char *)precvbuf);
268 struct usb_device *pusbd = pdvobj->
pusbdev;
271 adapter->pwrctrlpriv.pnp_bstop_trx)
273 if ((precvbuf->
reuse ==
false) || (precvbuf->
pskb ==
NULL)) {
276 precvbuf->
reuse =
true;
278 if (precvbuf !=
NULL) {
281 if ((precvbuf->
reuse ==
false) || (precvbuf->
pskb ==
NULL)) {
282 precvbuf->
pskb = netdev_alloc_skb(
adapter->pnetdev,
288 skb_reserve(precvbuf->
pskb,
292 precvbuf->
ptail = skb_tail_pointer(precvbuf->
pskb);
293 precvbuf->
pend = skb_end_pointer(precvbuf->
pskb);
294 precvbuf->
pbuf = precvbuf->
pskb->data;
298 precvbuf->
ptail = skb_tail_pointer(precvbuf->
pskb);
299 precvbuf->
pend = skb_end_pointer(precvbuf->
pskb);
300 precvbuf->
pbuf = precvbuf->
pskb->data;
301 precvbuf->
reuse =
false;
303 purb = precvbuf->
purb;
305 pipe = ffaddr2pipehdl(pdvobj, addr);
306 usb_fill_bulk_urb(purb, pusbd, pipe,
308 r8712_usb_read_port_complete,
311 if ((err) && (err != (-
EPERM)))
340 " or bSurpriseRemoved\n");
349 static void usb_write_port_complete(
struct urb *purb)
358 switch (pattrib->priority) {
361 pxmitpriv->bkq_cnt--;
365 pxmitpriv->viq_cnt--;
369 pxmitpriv->voq_cnt--;
374 pxmitpriv->beq_cnt--;
377 pxmitpriv->txirp_cnt--;
378 for (i = 0; i < 8; i++) {
386 switch (purb->status) {
396 tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
410 struct usb_device *pusbd = pdvobj->
pusbdev;
416 for (i = 0; i < 8; i++) {
417 if (pxmitframe->
bpending[i] ==
false) {
440 spin_unlock_irqrestore(&pxmitpriv->
lock, irqL);
441 pxmitframe->
sz[
i] = (
u16)cnt;
448 if (cnt > 0 && cnt % 512 == 0)
451 if (cnt > 0 && cnt % 64 == 0)
455 pipe = ffaddr2pipehdl(pdvobj, addr);
457 purb->transfer_flags &= (~URB_NO_INTERRUPT);
459 purb->transfer_flags |= URB_NO_INTERRUPT;
462 usb_fill_bulk_urb(purb, pusbd, pipe,
464 cnt, usb_write_port_complete,
481 for (j = 0; j < 8; j++) {
501 u8 *palloc_buf, *pIo_buf;
503 palloc_buf = _malloc((
u32) len + 16);
504 if (palloc_buf ==
NULL) {
506 " request\n", __func__);
509 pIo_buf = palloc_buf + 16 - ((
addr_t)(palloc_buf) & 0x0f);
510 if (requesttype == 0x01) {
511 pipe = usb_rcvctrlpipe(
udev, 0);
514 pipe = usb_sndctrlpipe(
udev, 0);
516 memcpy(pIo_buf, pdata, len);
519 pIo_buf, len,
HZ / 2);
521 if (requesttype == 0x01) {
525 memcpy(pdata, pIo_buf, status);