18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Driver for USB Mass Storage compliant devices 48c2ecf20Sopenharmony_ci * Protocol Functions Header File 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Current development and maintenance by: 78c2ecf20Sopenharmony_ci * (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net) 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This driver is based on the 'USB Mass Storage Class' document. This 108c2ecf20Sopenharmony_ci * describes in detail the protocol used to communicate with such 118c2ecf20Sopenharmony_ci * devices. Clearly, the designers had SCSI and ATAPI commands in 128c2ecf20Sopenharmony_ci * mind when they created this document. The commands are all very 138c2ecf20Sopenharmony_ci * similar to commands in the SCSI-II and ATAPI specifications. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * It is important to note that in a number of cases this class 168c2ecf20Sopenharmony_ci * exhibits class-specific exemptions from the USB specification. 178c2ecf20Sopenharmony_ci * Notably the usage of NAK, STALL and ACK differs from the norm, in 188c2ecf20Sopenharmony_ci * that they are used to communicate wait, failed and OK on commands. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * Also, for certain devices, the interrupt endpoint is used to convey 218c2ecf20Sopenharmony_ci * status of a command. 228c2ecf20Sopenharmony_ci */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#ifndef _PROTOCOL_H_ 258c2ecf20Sopenharmony_ci#define _PROTOCOL_H_ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* Protocol handling routines */ 288c2ecf20Sopenharmony_ciextern void usb_stor_pad12_command(struct scsi_cmnd*, struct us_data*); 298c2ecf20Sopenharmony_ciextern void usb_stor_ufi_command(struct scsi_cmnd*, struct us_data*); 308c2ecf20Sopenharmony_ciextern void usb_stor_transparent_scsi_command(struct scsi_cmnd*, 318c2ecf20Sopenharmony_ci struct us_data*); 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* struct scsi_cmnd transfer buffer access utilities */ 348c2ecf20Sopenharmony_cienum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF}; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciextern unsigned int usb_stor_access_xfer_buf(unsigned char *buffer, 378c2ecf20Sopenharmony_ci unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **, 388c2ecf20Sopenharmony_ci unsigned int *offset, enum xfer_buf_dir dir); 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciextern void usb_stor_set_xfer_buf(unsigned char *buffer, 418c2ecf20Sopenharmony_ci unsigned int buflen, struct scsi_cmnd *srb); 428c2ecf20Sopenharmony_ci#endif 43