xref: /haiku/headers/os/drivers/usb/USB_massbulk.h (revision 92d556084ca7f0e9472976a35aff6a21acf12fda)
1 /*
2  * Copyright 2014, Haiku Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _USB_MSC_H
6 #define _USB_MSC_H
7 
8 
9 // (Partial) USB Class Definitions for Mass Storage Devices (MSC), version 1.0
10 // Reference: http://www.usb.org/developers/devclass_docs/usbmassbulk_10.pdf
11 
12 
13 #define USB_MASS_STORAGE_DEVICE_CLASS			0x08
14 
15 #define USB_MASSBULK_CBW_SIGNATURE				0x43425355
16 #define USB_MASSBULK_CBW_DATA_OUTPUT			0x00
17 #define USB_MASSBULK_CBW_DATA_INPUT				0x80
18 
19 #define USB_MASSBULK_CSW_SIGNATURE				0x53425355
20 #define USB_MASSBULK_CSW_STATUS_COMMAND_PASSED	0x00
21 #define USB_MASSBULK_CSW_STATUS_COMMAND_FAILED	0x01
22 #define USB_MASSBULK_CSW_STATUS_PHASE_ERROR		0x02
23 
24 #define USB_MASSBULK_REQUEST_MASS_STORAGE_RESET	0xff
25 #define USB_MASSBULK_REQUEST_GET_MAX_LUN		0xfe
26 
27 
28 typedef struct {
29 	uint32		signature;
30 	uint32		tag;
31 	uint32		data_transfer_length;
32 	uint8		flags;
33 	uint8		lun;
34 	uint8		command_block_length;
35 	uint8		command_block[16];
36 } _PACKED usb_massbulk_command_block_wrapper;
37 
38 
39 typedef struct {
40 	uint32		signature;
41 	uint32		tag;
42 	uint32		data_residue;
43 	uint8		status;
44 } _PACKED usb_massbulk_command_status_wrapper;
45 
46 
47 #endif
48 
49