1 #ifndef DEVICES_USB_MASSSTORAGE_H 2 #define DEVICES_USB_MASSSTORAGE_H 3 /* 4 ** $VER: usb_massstorage.h 2.0 (15.12.07) 5 ** 6 ** usb definitions include file 7 ** 8 ** (C) Copyright 2002-2007 Chris Hodges 9 ** All Rights Reserved 10 */ 11 12 #include <exec/types.h> 13 14 #if defined(__GNUC__) 15 # pragma pack(1) 16 #endif 17 18 /* Usb Mass Storage CBI Requests */ 19 #define UMSR_ADSC 0x00 20 21 /* Usb Mass Storage Bulk only Requests */ 22 #define UMSR_BULK_ONLY_RESET 0xff 23 #define UMSR_GET_MAX_LUN 0xfe 24 25 /* Mass Storage subclasses */ 26 #define MS_RBC_SUBCLASS 0x01 /* Flash devices */ 27 #define MS_ATAPI_SUBCLASS 0x02 /* CD roms etc */ 28 #define MS_QIC157_SUBCLASS 0x03 /* Tape devices */ 29 #define MS_UFI_SUBCLASS 0x04 /* Floppy */ 30 #define MS_FDDATAPI_SUBCLASS 0x05 /* ATAPI Floppy */ 31 #define MS_SCSI_SUBCLASS 0x06 /* SCSI devices */ 32 33 /* Mass Storage protocols */ 34 #define MS_PROTO_CBI 0x00 /* Control/Bulk/Interrupt transport with command completion interrupt */ 35 #define MS_PROTO_CB 0x01 /* Control/Bulk/Interrupt transport without command completion interrupt */ 36 #define MS_PROTO_BULK 0x50 /* Bulk-only transport */ 37 38 /* Usb Mass Storage Class specific stuff */ 39 40 struct UsbMSCmdBlkWrapper 41 { 42 ULONG dCBWSignature; /* 0x43425355 (little endian) indicating a CBW */ 43 ULONG dCBWTag; /* Command Block Tag */ 44 ULONG dCBWDataTransferLength; /* Number of bytes to transfer */ 45 UBYTE bmCBWFlags; /* Direction flag (Bit 7) */ 46 UBYTE bCBWLUN; /* target logical unit number */ 47 UBYTE bCBWCBLength; /* length of the command block in bytes (1-16) */ 48 UBYTE CBWCB[16]; /* the command block itself */ 49 }; 50 51 struct UsbMSCmdStatusWrapper 52 { 53 ULONG dCSWSignature; /* 0x53425355 (little endian) indicating a CSW */ 54 ULONG dCSWTag; /* Command Status Tag, associated with dCBWTag */ 55 ULONG dCSWDataResidue; /* Actual number of bytes to transfer */ 56 UBYTE bCSWStatus; /* Status (see below) */ 57 }; 58 59 struct UsbMSCBIStatusWrapper 60 { 61 UBYTE bType; /* always 0x00 for valid status block (for UFI/Floppy, this is ASC) */ 62 UBYTE bValue; /* mask out bit 0,1 for status (see below) (for UFI/Floppy, this is ASCQ) */ 63 }; 64 65 #define UMSCBW_SIZEOF 31 /* sizeof(UsbMSCmdBlkWrapper) will yield 32 instead of 31! */ 66 #define UMSCSW_SIZEOF 13 /* sizeof(UsbMSCmdStatusWrapper) will yield 14 instead of 13! */ 67 68 #define USMF_CSW_PASS 0x00 /* command passed */ 69 #define USMF_CSW_FAIL 0x01 /* command failed */ 70 #define USMF_CSW_PHASEERR 0x02 /* phase error */ 71 #define USMF_CSW_PERSIST 0x03 /* persistant error (CBI only) */ 72 73 #if defined(__GNUC__) 74 # pragma pack() 75 #endif 76 77 #endif /* DEVICES_USB_MASSSTORAGE_H */