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