1 #ifndef DEVICES_USB_MASSSTORAGE_H
2 #define DEVICES_USB_MASSSTORAGE_H
4 ** $VER: usb_massstorage.h 2.0 (15.12.07)
6 ** usb definitions include file
8 ** (C) Copyright 2002-2007 Chris Hodges
12 #include <exec/types.h>
18 /* Usb Mass Storage CBI Requests */
19 #define UMSR_ADSC 0x00
21 /* Usb Mass Storage Bulk only Requests */
22 #define UMSR_BULK_ONLY_RESET 0xff
23 #define UMSR_GET_MAX_LUN 0xfe
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 */
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 */
38 /* Usb Mass Storage Class specific stuff */
40 struct UsbMSCmdBlkWrapper
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 */
51 struct UsbMSCmdStatusWrapper
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) */
59 struct UsbMSCBIStatusWrapper
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) */
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! */
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) */
77 #endif /* DEVICES_USB_MASSSTORAGE_H */