11da177e4SLinus Torvalds /* Driver for USB Mass Storage compliant devices 21da177e4SLinus Torvalds * Debugging Functions Header File 31da177e4SLinus Torvalds * 41da177e4SLinus Torvalds * Current development and maintenance by: 51da177e4SLinus Torvalds * (c) 1999-2002 Matthew Dharm ([email protected]) 61da177e4SLinus Torvalds * 71da177e4SLinus Torvalds * Initial work by: 81da177e4SLinus Torvalds * (c) 1999 Michael Gee ([email protected]) 91da177e4SLinus Torvalds * 101da177e4SLinus Torvalds * This driver is based on the 'USB Mass Storage Class' document. This 111da177e4SLinus Torvalds * describes in detail the protocol used to communicate with such 121da177e4SLinus Torvalds * devices. Clearly, the designers had SCSI and ATAPI commands in 131da177e4SLinus Torvalds * mind when they created this document. The commands are all very 141da177e4SLinus Torvalds * similar to commands in the SCSI-II and ATAPI specifications. 151da177e4SLinus Torvalds * 161da177e4SLinus Torvalds * It is important to note that in a number of cases this class 171da177e4SLinus Torvalds * exhibits class-specific exemptions from the USB specification. 181da177e4SLinus Torvalds * Notably the usage of NAK, STALL and ACK differs from the norm, in 191da177e4SLinus Torvalds * that they are used to communicate wait, failed and OK on commands. 201da177e4SLinus Torvalds * 211da177e4SLinus Torvalds * Also, for certain devices, the interrupt endpoint is used to convey 221da177e4SLinus Torvalds * status of a command. 231da177e4SLinus Torvalds * 241da177e4SLinus Torvalds * Please see http://www.one-eyed-alien.net/~mdharm/linux-usb for more 251da177e4SLinus Torvalds * information about this driver. 261da177e4SLinus Torvalds * 271da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify it 281da177e4SLinus Torvalds * under the terms of the GNU General Public License as published by the 291da177e4SLinus Torvalds * Free Software Foundation; either version 2, or (at your option) any 301da177e4SLinus Torvalds * later version. 311da177e4SLinus Torvalds * 321da177e4SLinus Torvalds * This program is distributed in the hope that it will be useful, but 331da177e4SLinus Torvalds * WITHOUT ANY WARRANTY; without even the implied warranty of 341da177e4SLinus Torvalds * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 351da177e4SLinus Torvalds * General Public License for more details. 361da177e4SLinus Torvalds * 371da177e4SLinus Torvalds * You should have received a copy of the GNU General Public License along 381da177e4SLinus Torvalds * with this program; if not, write to the Free Software Foundation, Inc., 391da177e4SLinus Torvalds * 675 Mass Ave, Cambridge, MA 02139, USA. 401da177e4SLinus Torvalds */ 411da177e4SLinus Torvalds 421da177e4SLinus Torvalds #ifndef _DEBUG_H_ 431da177e4SLinus Torvalds #define _DEBUG_H_ 441da177e4SLinus Torvalds 451da177e4SLinus Torvalds #include <linux/kernel.h> 461da177e4SLinus Torvalds 471da177e4SLinus Torvalds #define USB_STORAGE "usb-storage: " 481da177e4SLinus Torvalds 491da177e4SLinus Torvalds #ifdef CONFIG_USB_STORAGE_DEBUG 50191648d0SJoe Perches void usb_stor_show_command(const struct us_data *us, struct scsi_cmnd *srb); 51191648d0SJoe Perches void usb_stor_show_sense(const struct us_data *us, unsigned char key, 521da177e4SLinus Torvalds unsigned char asc, unsigned char ascq); 53*e5283626SJoe Perches __printf(2, 3) void usb_stor_dbg(const struct us_data *us, 54191648d0SJoe Perches const char *fmt, ...); 5575b9130eSJoe Perches 5675b9130eSJoe Perches #define US_DEBUGPX(fmt, ...) printk(fmt, ##__VA_ARGS__) 571da177e4SLinus Torvalds #define US_DEBUG(x) x 581da177e4SLinus Torvalds #else 59191648d0SJoe Perches __printf(2, 3) 60*e5283626SJoe Perches static inline void _usb_stor_dbg(const struct us_data *us, 61*e5283626SJoe Perches const char *fmt, ...) 62*e5283626SJoe Perches { 63*e5283626SJoe Perches } 64191648d0SJoe Perches #define usb_stor_dbg(us, fmt, ...) \ 65191648d0SJoe Perches do { if (0) _usb_stor_dbg(us, fmt, ##__VA_ARGS__); } while (0) 6675b9130eSJoe Perches #define US_DEBUGPX(fmt, ...) \ 6775b9130eSJoe Perches do { if (0) printk(fmt, ##__VA_ARGS__); } while (0) 681da177e4SLinus Torvalds #define US_DEBUG(x) 691da177e4SLinus Torvalds #endif 701da177e4SLinus Torvalds 711da177e4SLinus Torvalds #endif 72