07.06.2013 Views

Scsi - Index of

Scsi - Index of

Scsi - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1076 return USB_STOR_TRANSPORT_NO_SENSE;<br />

1077 }<br />

1078<br />

1079 /* command good -- note that data could be short */<br />

1080 return USB_STOR_TRANSPORT_GOOD;<br />

1081<br />

1082 case US_BULK_STAT_FAIL:<br />

1083 /* command failed */<br />

1084 return USB_STOR_TRANSPORT_FAILED;<br />

1085<br />

1086 case US_BULK_STAT_PHASE:<br />

1087 /* phase error -- note that a transport reset will be<br />

1088 * invoked by the invoke_transport() function<br />

1089 */<br />

1090 return USB_STOR_TRANSPORT_ERROR;<br />

1091 }<br />

1092<br />

1093 /* we should never get here, but if we do, we're in trouble */<br />

1094 return USB_STOR_TRANSPORT_ERROR;<br />

1095 }<br />

154<br />

看傻了吧,这个函数也不是好惹的.但正是这个函数掀开了我们bulk 传输的新篇章.<br />

迷雾重重的 Bulk 传输(三)<br />

在usb_stor_Bulk_transport()中, 古人一针见血的为我们指出了这个函数中调用的第一个最重要的<br />

函数,那就是usb_stor_bulk_transfer_buf().仍然是来自drivers/usb/stroage/transport.c.<br />

409 /*<br />

410 * Transfer one buffer via bulk pipe, without timeouts, but allowing early<br />

411 * termination. Return codes are USB_STOR_XFER_xxx. If the bulk pipe<br />

412 * stalls during the transfer, the halt is automatically cleared.<br />

413 */<br />

414 int usb_stor_bulk_transfer_buf(struct us_data *us, unsigned int pipe,<br />

415 void *buf, unsigned int length, unsigned int *act_len)<br />

416 {<br />

417 int result;<br />

418<br />

419 US_DEBUGP("%s: xfer %u bytes\n", __FUNCTION__, length);<br />

420<br />

421 /* fill and submit the URB */<br />

422 usb_fill_bulk_urb(us->current_urb, us->pusb_dev, pipe, buf, length,<br />

423 usb_stor_blocking_completion, NULL);<br />

424 result = usb_stor_msg_common(us, 0);<br />

425

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!