* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <linux/jiffies.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+
#include "transport.h"
#include "protocol.h"
#include "usb.h"
#include "debug.h"
#include "sddr55.h"
-#include <linux/jiffies.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
#define LSB_of(s) ((s)&0xFF)
sddr55_bulk_transport(struct us_data *us, int direction,
unsigned char *data, unsigned int len) {
struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra;
- unsigned int pipe = (direction == SCSI_DATA_READ) ?
+ unsigned int pipe = (direction == DMA_FROM_DEVICE) ?
us->recv_bulk_pipe : us->send_bulk_pipe;
if (!len)
command[5] = 0xB0;
command[7] = 0x80;
result = sddr55_bulk_transport(us,
- SCSI_DATA_WRITE, command, 8);
+ DMA_TO_DEVICE, command, 8);
US_DEBUGP("Result for send_command in status %d\n",
result);
}
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, status, 4);
+ DMA_FROM_DEVICE, status, 4);
/* expect to get short transfer if no card fitted */
if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) {
/* now read status */
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, status, 2);
+ DMA_FROM_DEVICE, status, 2);
if (result != USB_STOR_XFER_GOOD) {
set_sense_info (4, 0, 0); /* hardware error */
/* send command */
result = sddr55_bulk_transport(us,
- SCSI_DATA_WRITE, command, 8);
+ DMA_TO_DEVICE, command, 8);
US_DEBUGP("Result for send_command in read_data %d\n",
result);
/* read data */
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, buffer, len);
+ DMA_FROM_DEVICE, buffer, len);
if (result != USB_STOR_XFER_GOOD) {
result = USB_STOR_TRANSPORT_ERROR;
/* now read status */
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, status, 2);
+ DMA_FROM_DEVICE, status, 2);
if (result != USB_STOR_XFER_GOOD) {
result = USB_STOR_TRANSPORT_ERROR;
/* send command */
result = sddr55_bulk_transport(us,
- SCSI_DATA_WRITE, command, 8);
+ DMA_TO_DEVICE, command, 8);
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Result for send_command in write_data %d\n",
/* send the data */
result = sddr55_bulk_transport(us,
- SCSI_DATA_WRITE, buffer, len);
+ DMA_TO_DEVICE, buffer, len);
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Result for send_data in write_data %d\n",
}
/* now read status */
- result = sddr55_bulk_transport(us, SCSI_DATA_READ, status, 6);
+ result = sddr55_bulk_transport(us, DMA_FROM_DEVICE, status, 6);
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Result for get_status in write_data %d\n",
memset(command, 0, 8);
command[5] = 0xB0;
command[7] = 0x84;
- result = sddr55_bulk_transport(us, SCSI_DATA_WRITE, command, 8);
+ result = sddr55_bulk_transport(us, DMA_TO_DEVICE, command, 8);
US_DEBUGP("Result of send_control for device ID is %d\n",
result);
return USB_STOR_TRANSPORT_ERROR;
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, content, 4);
+ DMA_FROM_DEVICE, content, 4);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;
if (content[0] != 0xff) {
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, content, 2);
+ DMA_FROM_DEVICE, content, 2);
}
return USB_STOR_TRANSPORT_GOOD;
command[6] = numblocks * 2 / 256;
command[7] = 0x8A;
- result = sddr55_bulk_transport(us, SCSI_DATA_WRITE, command, 8);
+ result = sddr55_bulk_transport(us, DMA_TO_DEVICE, command, 8);
if ( result != USB_STOR_XFER_GOOD) {
kfree (buffer);
return -1;
}
- result = sddr55_bulk_transport(us, SCSI_DATA_READ, buffer, numblocks * 2);
+ result = sddr55_bulk_transport(us, DMA_FROM_DEVICE, buffer, numblocks * 2);
if ( result != USB_STOR_XFER_GOOD) {
kfree (buffer);
return -1;
}
- result = sddr55_bulk_transport(us, SCSI_DATA_READ, command, 2);
+ result = sddr55_bulk_transport(us, DMA_FROM_DEVICE, command, 2);
if ( result != USB_STOR_XFER_GOOD) {
kfree (buffer);
/*
* Transport for the Sandisk SDDR-55
*/
-int sddr55_transport(Scsi_Cmnd *srb, struct us_data *us)
+int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
{
int result;
static unsigned char inquiry_response[8] = {
capacity /= PAGESIZE;
capacity--;
- ((u32 *) ptr)[0] = cpu_to_be32(capacity);
- ((u32 *) ptr)[1] = cpu_to_be32(PAGESIZE);
+ ((__be32 *) ptr)[0] = cpu_to_be32(capacity);
+ ((__be32 *) ptr)[1] = cpu_to_be32(PAGESIZE);
usb_stor_set_xfer_buf(ptr, 8, srb);
sddr55_read_map(us);