162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Driver for USB Mass Storage compliant devices
462306a36Sopenharmony_ci * Protocol Functions Header File
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Current development and maintenance by:
762306a36Sopenharmony_ci *   (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * This driver is based on the 'USB Mass Storage Class' document. This
1062306a36Sopenharmony_ci * describes in detail the protocol used to communicate with such
1162306a36Sopenharmony_ci * devices.  Clearly, the designers had SCSI and ATAPI commands in
1262306a36Sopenharmony_ci * mind when they created this document.  The commands are all very
1362306a36Sopenharmony_ci * similar to commands in the SCSI-II and ATAPI specifications.
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci * It is important to note that in a number of cases this class
1662306a36Sopenharmony_ci * exhibits class-specific exemptions from the USB specification.
1762306a36Sopenharmony_ci * Notably the usage of NAK, STALL and ACK differs from the norm, in
1862306a36Sopenharmony_ci * that they are used to communicate wait, failed and OK on commands.
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci * Also, for certain devices, the interrupt endpoint is used to convey
2162306a36Sopenharmony_ci * status of a command.
2262306a36Sopenharmony_ci */
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#ifndef _PROTOCOL_H_
2562306a36Sopenharmony_ci#define _PROTOCOL_H_
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/* Protocol handling routines */
2862306a36Sopenharmony_ciextern void usb_stor_pad12_command(struct scsi_cmnd*, struct us_data*);
2962306a36Sopenharmony_ciextern void usb_stor_ufi_command(struct scsi_cmnd*, struct us_data*);
3062306a36Sopenharmony_ciextern void usb_stor_transparent_scsi_command(struct scsi_cmnd*,
3162306a36Sopenharmony_ci		struct us_data*);
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/* struct scsi_cmnd transfer buffer access utilities */
3462306a36Sopenharmony_cienum xfer_buf_dir	{TO_XFER_BUF, FROM_XFER_BUF};
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciextern unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
3762306a36Sopenharmony_ci	unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **,
3862306a36Sopenharmony_ci	unsigned int *offset, enum xfer_buf_dir dir);
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciextern void usb_stor_set_xfer_buf(unsigned char *buffer,
4162306a36Sopenharmony_ci	unsigned int buflen, struct scsi_cmnd *srb);
4262306a36Sopenharmony_ci#endif
43