07.06.2013 Views

Scsi - Index of

Scsi - Index of

Scsi - Index of

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

950 struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;<br />

951 struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf;<br />

952 unsigned int transfer_length = srb->request_bufflen;<br />

953 unsigned int residue;<br />

954 int result;<br />

955 int fake_sense = 0;<br />

956 unsigned int cswlen;<br />

957<br />

958 /* set up the command wrapper */<br />

959 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);<br />

960 bcb->DataTransferLength = cpu_to_le32(transfer_length);<br />

961 bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ? 1 Tag = srb->serial_number;<br />

963 bcb->Lun = srb->device->lun;<br />

964 if (us->flags & US_FL_SCM_MULT_TARG)<br />

965 bcb->Lun |= srb->device->id Length = srb->cmd_len;<br />

967<br />

151<br />

968 /* copy the command payload */<br />

969 memset(bcb->CDB, 0, size<strong>of</strong>(bcb->CDB));<br />

970 memcpy(bcb->CDB, srb->cmnd, bcb->Length);<br />

971<br />

972 /* send it to out endpoint */<br />

973 US_DEBUGP("Bulk Command S 0x%x T 0x%x L %d F %d Trg %d LUN %d<br />

CL %d\n",<br />

974 le32_to_cpu(bcb->Signature), bcb->Tag,<br />

975 le32_to_cpu(bcb->DataTransferLength), bcb->Flags,<br />

976 (bcb->Lun >> 4), (bcb->Lun & 0x0F),<br />

977 bcb->Length);<br />

978 result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe,<br />

979 bcb, US_BULK_CB_WRAP_LEN, NULL);<br />

980 US_DEBUGP("Bulk command transfer result=%d\n", result);<br />

981 if (result != USB_STOR_XFER_GOOD)<br />

982 return USB_STOR_TRANSPORT_ERROR;<br />

983<br />

984 /* DATA STAGE */<br />

985 /* send/receive data payload, if there is any */<br />

986<br />

987 /* Genesys Logic interface chips need a 100us delay between the<br />

988 * command phase and the data phase */<br />

989 if (us->pusb_dev->descriptor.idVendor == USB_VENDOR_ID_GENESYS)<br />

990 udelay(100);<br />

991

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

Saved successfully!

Ooh no, something went wrong!