# include/usb/msc_protocol.h File Reference

USB Mass Storage Class protocol definitions. More...

`#include <types.h>`

Include dependency graph for msc_protocol.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | usb_msc_cbw
| A Command Block Wrapper (CBW). More...
struct | usb_msc_csw
| A Command Status Wrapper (CSW). More...
## Defines
#define | USB_INTERFACE_CLASS_MSC 8
| The bInterfaceClass value identifying a mass-storage interface.
#define | USB_CBW_SIGNATURE 0x43425355
| dCBWSignature value
#define | USB_CBW_DIRECTION_IN (1 << 7)
| Data from device to host.
#define | USB_CBW_LUN_MASK 0x0f
| Valid bits in bCBWLUN.
#define | USB_CBW_LEN_MASK 0x1f
| Valid bits in bCBWCBLength.
#define | USB_CSW_SIGNATURE 0x53425355
| dCSWSignature value
#define | USB_CSW_STATUS_PASS 0x00
| Command Passed.
#define | USB_CSW_STATUS_FAIL 0x01
| Command Failed.
#define | USB_CSW_STATUS_PE 0x02
| Phase Error.
## Enumerations
enum | usb_msc_interface_subclass
| Possible bInterfaceSubClass values for a mass-storage interface. More...
enum | usb_msc_interface_protocol { USB_MSC_PROTOCOL_CBI = 0x00, USB_MSC_PROTOCOL_CBI_ALT = 0x01, USB_MSC_PROTOCOL_BULK = 0x50 }
| Possible bInterfaceProtocol values for a mass-storage interface. More...
enum | usb_msc_reqid { USB_MSC_REQ_BULK_RESET = 0xff, USB_MSC_REQ_GET_MAX_LUN = 0xfe }
| Mass Storage Bulk-only class specific requests. More...
## Variables
struct usb_msc_cbw | __packed
| A Command Block Wrapper (CBW).

## Detailed Description

USB Mass Storage Class protocol definitions.

This file contains definitions and data structures taken from the USB Mass Storage Class Specification Overview 1.2 and the USB Mass Storage Class Bulk-Only Transport 1.0 specifications.

- Compiler: IAR EWAVR32 and GNU GCC for AVR32
- Supported devices: All devices with a USB host and/or device controller
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file msc_protocol.h.

## Define Documentation

#define USB_CBW_DIRECTION_IN (1 << 7)

Data from device to host.

Definition at line 109 of file msc_protocol.h.

Referenced by msc_do_read().

#define USB_CBW_LEN_MASK 0x1f

Valid bits in bCBWCBLength.

Definition at line 111 of file msc_protocol.h.

#define USB_CBW_LUN_MASK 0x0f

Valid bits in bCBWLUN.

Definition at line 110 of file msc_protocol.h.

#define USB_CBW_SIGNATURE 0x43425355

dCBWSignature value

Definition at line 108 of file msc_protocol.h.

#define USB_CSW_SIGNATURE 0x53425355

dCSWSignature value

Definition at line 123 of file msc_protocol.h.

#define USB_CSW_STATUS_FAIL 0x01

Command Failed.

Definition at line 125 of file msc_protocol.h.

Referenced by msc_do_read().

#define USB_CSW_STATUS_PASS 0x00

Command Passed.

Definition at line 124 of file msc_protocol.h.

Referenced by msc_do_read().

#define USB_CSW_STATUS_PE 0x02

Phase Error.

Definition at line 126 of file msc_protocol.h.

#define USB_INTERFACE_CLASS_MSC 8

The bInterfaceClass value identifying a mass-storage interface.

Definition at line 54 of file msc_protocol.h.

## Enumeration Type Documentation

enum usb_msc_interface_protocol

Possible bInterfaceProtocol values for a mass-storage interface.

Note:
  The CBI protocols should not be used in new designs.

Enumerator:

  USB_MSC_PROTOCOL_CBI | Command/Bulk/Interrupt.
  USB_MSC_PROTOCOL_CBI_ALT | W/o command completion.
  USB_MSC_PROTOCOL_BULK | Bulk-only.

Definition at line 81 of file msc_protocol.h.

enum usb_msc_interface_subclass

Possible bInterfaceSubClass values for a mass-storage interface.

Note:
  In practice, most devices should use USB_MSC_SUBCLASS_TRANSPARENT and specify the actual command set in the standard INQUIRY data block, even if the MSC spec indicates otherwise. In particular, RBC is not supported by certain major operating systems like Windows XP.

Definition at line 66 of file msc_protocol.h.

enum usb_msc_reqid

Mass Storage Bulk-only class specific requests.

Enumerator:

  USB_MSC_REQ_BULK_RESET | Mass Storage Reset.
  USB_MSC_REQ_GET_MAX_LUN | Get Max LUN.

Definition at line 90 of file msc_protocol.h.

## Variable Documentation

struct usb_msc_csw __packed

A Command Block Wrapper (CBW).

A Command Status Wrapper (CSW).