Commit | Line | Data |
---|---|---|
126bb03b AC |
1 | #ifndef _TRANSPORT_H_ |
2 | #define _TRANSPORT_H_ | |
3 | ||
4 | #include <linux/blkdev.h> | |
5 | ||
126bb03b AC |
6 | /* usb_stor_bulk_transfer_xxx() return codes, in order of severity */ |
7 | #define USB_STOR_XFER_GOOD 0 /* good transfer */ | |
8 | #define USB_STOR_XFER_SHORT 1 /* transferred less than expected */ | |
9 | #define USB_STOR_XFER_STALLED 2 /* endpoint stalled */ | |
10 | #define USB_STOR_XFER_LONG 3 /* device tried to send too much */ | |
11 | #define USB_STOR_XFER_ERROR 4 /* transfer died in the middle */ | |
12 | ||
13 | /* Transport return codes */ | |
14 | #define USB_STOR_TRANSPORT_GOOD 0 /* Transport good, command good */ | |
3aa4fc58 CYC |
15 | #define USB_STOR_TRANSPORT_FAILED 1 /* Transport good, command failed */ |
16 | #define USB_STOR_TRANSPORT_NO_SENSE 2 /* Command failed, no auto-sense */ | |
17 | #define USB_STOR_TRANSPORT_ERROR 3 /* Transport bad (i.e. device dead) */ | |
126bb03b AC |
18 | |
19 | /* | |
20 | * We used to have USB_STOR_XFER_ABORTED and USB_STOR_TRANSPORT_ABORTED | |
21 | * return codes. But now the transport and low-level transfer routines | |
22 | * treat an abort as just another error (-ENOENT for a cancelled URB). | |
23 | * It is up to the invoke_transport() function to test for aborts and | |
24 | * distinguish them from genuine communication errors. | |
25 | */ | |
26 | ||
27 | /* CBI accept device specific command */ | |
28 | #define US_CBI_ADSC 0 | |
29 | extern int usb_stor_Bulk_transport(struct scsi_cmnd *, struct us_data*); | |
3aa4fc58 CYC |
30 | extern int usb_stor_Bulk_max_lun(struct us_data *); |
31 | extern int usb_stor_Bulk_reset(struct us_data *); | |
126bb03b AC |
32 | extern void usb_stor_print_cmd(struct scsi_cmnd *); |
33 | extern void usb_stor_invoke_transport(struct scsi_cmnd *, struct us_data*); | |
3aa4fc58 | 34 | extern void usb_stor_stop_transport(struct us_data *); |
126bb03b AC |
35 | extern int usb_stor_control_msg(struct us_data *us, unsigned int pipe, |
36 | u8 request, u8 requesttype, u16 value, u16 index, | |
37 | void *data, u16 size, int timeout); | |
38 | extern int usb_stor_clear_halt(struct us_data *us, unsigned int pipe); | |
39 | extern int usb_stor_bulk_transfer_buf(struct us_data *us, unsigned int pipe, | |
40 | void *buf, unsigned int length, unsigned int *act_len); | |
41 | extern int usb_stor_bulk_transfer_sg(struct us_data *us, unsigned int pipe, | |
42 | void *buf, unsigned int length, int use_sg, int *residual); | |
3aa4fc58 CYC |
43 | extern int usb_stor_bulk_srb(struct us_data *us, unsigned int pipe, |
44 | struct scsi_cmnd *srb); | |
126bb03b AC |
45 | extern int usb_stor_port_reset(struct us_data *us); |
46 | ||
47 | /* Protocol handling routines */ | |
48 | enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF}; | |
3aa4fc58 CYC |
49 | extern unsigned int usb_stor_access_xfer_buf(struct us_data*, |
50 | unsigned char *buffer, unsigned int buflen, struct scsi_cmnd *srb, | |
51 | struct scatterlist **, unsigned int *offset, enum xfer_buf_dir dir); | |
52 | extern void usb_stor_set_xfer_buf(struct us_data*, unsigned char *buffer, | |
53 | unsigned int buflen, struct scsi_cmnd *srb, | |
126bb03b AC |
54 | unsigned int dir); |
55 | ||
3aa4fc58 CYC |
56 | /* |
57 | * ENE scsi function | |
58 | */ | |
59 | extern void ENE_stor_invoke_transport(struct scsi_cmnd *, struct us_data *); | |
60 | extern int ENE_InitMedia(struct us_data *); | |
3aa4fc58 | 61 | extern int ENE_SMInit(struct us_data *); |
126bb03b AC |
62 | extern int ENE_SendScsiCmd(struct us_data*, BYTE, void*, int); |
63 | extern int ENE_LoadBinCode(struct us_data*, BYTE); | |
64 | extern int ENE_Read_BYTE(struct us_data*, WORD index, void *buf); | |
65 | extern int ENE_Read_Data(struct us_data*, void *buf, unsigned int length); | |
66 | extern int ENE_Write_Data(struct us_data*, void *buf, unsigned int length); | |
67 | extern void BuildSenseBuffer(struct scsi_cmnd *, int); | |
68 | ||
3aa4fc58 CYC |
69 | /* |
70 | * ENE scsi function | |
71 | */ | |
126bb03b AC |
72 | extern int SM_SCSIIrp(struct us_data *us, struct scsi_cmnd *srb); |
73 | ||
126bb03b | 74 | #endif |