USB Host Shield 2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Macros
masstorage.h File Reference
#include <inttypes.h>
#include "avrpins.h"
#include <avr/pgmspace.h>
#include "max3421e.h"
#include "usbhost.h"
#include "usb_ch9.h"
#include "Usb.h"
#include <message.h>
#include "Arduino.h"
#include <confdescparser.h>
Include dependency graph for masstorage.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Capacity
 
struct  InquiryResponse
 
struct  CommandBlockWrapperBase
 
struct  CommandBlockWrapper
 
struct  CommandStatusWrapper
 
struct  RequestSenseResponce
 
class  BulkOnly
 

Macros

#define MASS_MAX_SUPPORTED_LUN   8
 
#define SWAP(a, b)   (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))
 
#define bmREQ_MASSOUT   USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
 
#define bmREQ_MASSIN   USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE
 
#define MASS_SUBCLASS_SCSI_NOT_REPORTED   0x00
 
#define MASS_SUBCLASS_RBC   0x01
 
#define MASS_SUBCLASS_ATAPI   0x02
 
#define MASS_SUBCLASS_OBSOLETE1   0x03
 
#define MASS_SUBCLASS_UFI   0x04
 
#define MASS_SUBCLASS_OBSOLETE2   0x05
 
#define MASS_SUBCLASS_SCSI   0x06
 
#define MASS_SUBCLASS_LSDFS   0x07
 
#define MASS_SUBCLASS_IEEE1667   0x08
 
#define MASS_PROTO_CBI   0x00
 
#define MASS_PROTO_CBI_NO_INT   0x01
 
#define MASS_PROTO_OBSOLETE   0x02
 
#define MASS_PROTO_BBB   0x50
 
#define MASS_PROTO_UAS   0x62
 
#define MASS_REQ_ADSC   0x00
 
#define MASS_REQ_GET   0xFC
 
#define MASS_REQ_PUT   0xFD
 
#define MASS_REQ_GET_MAX_LUN   0xFE
 
#define MASS_REQ_BOMSR   0xFF
 
#define MASS_CBW_SIGNATURE   0x43425355
 
#define MASS_CSW_SIGNATURE   0x53425355
 
#define MASS_CMD_DIR_OUT   (0 << 7)
 
#define MASS_CMD_DIR_IN   (1 << 7)
 
#define SCSI_CMD_INQUIRY   0x12
 
#define SCSI_CMD_REPORT_LUNS   0xA0
 
#define SCSI_CMD_REQUEST_SENSE   0x03
 
#define SCSI_CMD_FORMAT_UNIT   0x04
 
#define SCSI_CMD_READ_6   0x08
 
#define SCSI_CMD_READ_10   0x28
 
#define SCSI_CMD_READ_CAPACITY_10   0x25
 
#define SCSI_CMD_TEST_UNIT_READY   0x00
 
#define SCSI_CMD_WRITE_6   0x0A
 
#define SCSI_CMD_WRITE_10   0x2A
 
#define SCSI_CMD_MODE_SENSE_6   0x1A
 
#define SCSI_CMD_MODE_SENSE_10   0x5A
 
#define SCSI_CMD_START_STOP_UNIT   0x1B
 
#define SCSI_CMD_PREVENT_REMOVAL   0x1E
 
#define SCSI_S_NOT_READY   0x02
 
#define SCSI_S_MEDIUM_ERROR   0x03
 
#define SCSI_S_ILLEGAL_REQUEST   0x05
 
#define SCSI_S_UNIT_ATTENTION   0x06
 
#define SCSI_ASC_MEDIUM_NOT_PRESENT   0x3A
 
#define SCSI_ASC_LBA_OUT_OF_RANGE   0x21
 
#define SCSI_ASC_MEDIA_CHANGED   0x28
 
#define MASS_ERR_SUCCESS   0x00
 
#define MASS_ERR_PHASE_ERROR   0x02
 
#define MASS_ERR_UNIT_NOT_READY   0x03
 
#define MASS_ERR_UNIT_BUSY   0x04
 
#define MASS_ERR_STALL   0x05
 
#define MASS_ERR_CMD_NOT_SUPPORTED   0x06
 
#define MASS_ERR_INVALID_CSW   0x07
 
#define MASS_ERR_NO_MEDIA   0x08
 
#define MASS_ERR_BAD_LBA   0x09
 
#define MASS_ERR_MEDIA_CHANGED   0x0A
 
#define MASS_ERR_DEVICE_DISCONNECTED   0x11
 
#define MASS_ERR_UNABLE_TO_RECOVER   0x12
 
#define MASS_ERR_INVALID_LUN   0x13
 
#define MASS_ERR_WRITE_STALL   0x14
 
#define MASS_ERR_READ_NAKS   0x15
 
#define MASS_ERR_WRITE_NAKS   0x16
 
#define MASS_ERR_WRITE_PROTECTED   0x17
 
#define MASS_ERR_GENERAL_SCSI_ERROR   0xFE
 
#define MASS_ERR_GENERAL_USB_ERROR   0xFF
 
#define MASS_ERR_USER   0xA0
 
#define MASS_TRANS_FLG_CALLBACK   0x01
 
#define MASS_TRANS_FLG_NO_STALL_CHECK   0x02
 
#define MASS_TRANS_FLG_NO_PHASE_CHECK   0x04
 
#define MASS_MAX_ENDPOINTS   3
 

Macro Definition Documentation

#define MASS_MAX_SUPPORTED_LUN   8

Definition at line 12 of file masstorage.h.

#define SWAP (   a,
 
)    (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))

Definition at line 34 of file masstorage.h.

Definition at line 36 of file masstorage.h.

Definition at line 37 of file masstorage.h.

#define MASS_SUBCLASS_SCSI_NOT_REPORTED   0x00

Definition at line 40 of file masstorage.h.

#define MASS_SUBCLASS_RBC   0x01

Definition at line 41 of file masstorage.h.

#define MASS_SUBCLASS_ATAPI   0x02

Definition at line 42 of file masstorage.h.

#define MASS_SUBCLASS_OBSOLETE1   0x03

Definition at line 43 of file masstorage.h.

#define MASS_SUBCLASS_UFI   0x04

Definition at line 44 of file masstorage.h.

#define MASS_SUBCLASS_OBSOLETE2   0x05

Definition at line 45 of file masstorage.h.

#define MASS_SUBCLASS_SCSI   0x06

Definition at line 46 of file masstorage.h.

#define MASS_SUBCLASS_LSDFS   0x07

Definition at line 47 of file masstorage.h.

#define MASS_SUBCLASS_IEEE1667   0x08

Definition at line 48 of file masstorage.h.

#define MASS_PROTO_CBI   0x00

Definition at line 51 of file masstorage.h.

#define MASS_PROTO_CBI_NO_INT   0x01

Definition at line 52 of file masstorage.h.

#define MASS_PROTO_OBSOLETE   0x02

Definition at line 53 of file masstorage.h.

#define MASS_PROTO_BBB   0x50

Definition at line 54 of file masstorage.h.

#define MASS_PROTO_UAS   0x62

Definition at line 55 of file masstorage.h.

#define MASS_REQ_ADSC   0x00

Definition at line 58 of file masstorage.h.

#define MASS_REQ_GET   0xFC

Definition at line 59 of file masstorage.h.

#define MASS_REQ_PUT   0xFD

Definition at line 60 of file masstorage.h.

#define MASS_REQ_GET_MAX_LUN   0xFE

Definition at line 61 of file masstorage.h.

#define MASS_REQ_BOMSR   0xFF

Definition at line 62 of file masstorage.h.

#define MASS_CBW_SIGNATURE   0x43425355

Definition at line 64 of file masstorage.h.

#define MASS_CSW_SIGNATURE   0x53425355

Definition at line 65 of file masstorage.h.

#define MASS_CMD_DIR_OUT   (0 << 7)

Definition at line 67 of file masstorage.h.

#define MASS_CMD_DIR_IN   (1 << 7)

Definition at line 68 of file masstorage.h.

#define SCSI_CMD_INQUIRY   0x12

Definition at line 70 of file masstorage.h.

#define SCSI_CMD_REPORT_LUNS   0xA0

Definition at line 71 of file masstorage.h.

#define SCSI_CMD_REQUEST_SENSE   0x03

Definition at line 72 of file masstorage.h.

#define SCSI_CMD_FORMAT_UNIT   0x04

Definition at line 73 of file masstorage.h.

#define SCSI_CMD_READ_6   0x08

Definition at line 74 of file masstorage.h.

#define SCSI_CMD_READ_10   0x28

Definition at line 75 of file masstorage.h.

#define SCSI_CMD_READ_CAPACITY_10   0x25

Definition at line 76 of file masstorage.h.

#define SCSI_CMD_TEST_UNIT_READY   0x00

Definition at line 77 of file masstorage.h.

#define SCSI_CMD_WRITE_6   0x0A

Definition at line 78 of file masstorage.h.

#define SCSI_CMD_WRITE_10   0x2A

Definition at line 79 of file masstorage.h.

#define SCSI_CMD_MODE_SENSE_6   0x1A

Definition at line 80 of file masstorage.h.

#define SCSI_CMD_MODE_SENSE_10   0x5A

Definition at line 81 of file masstorage.h.

#define SCSI_CMD_START_STOP_UNIT   0x1B

Definition at line 82 of file masstorage.h.

#define SCSI_CMD_PREVENT_REMOVAL   0x1E

Definition at line 83 of file masstorage.h.

#define SCSI_S_NOT_READY   0x02

Definition at line 84 of file masstorage.h.

#define SCSI_S_MEDIUM_ERROR   0x03

Definition at line 85 of file masstorage.h.

#define SCSI_S_ILLEGAL_REQUEST   0x05

Definition at line 86 of file masstorage.h.

#define SCSI_S_UNIT_ATTENTION   0x06

Definition at line 87 of file masstorage.h.

#define SCSI_ASC_MEDIUM_NOT_PRESENT   0x3A

Definition at line 89 of file masstorage.h.

#define SCSI_ASC_LBA_OUT_OF_RANGE   0x21

Definition at line 90 of file masstorage.h.

#define SCSI_ASC_MEDIA_CHANGED   0x28

Definition at line 91 of file masstorage.h.

#define MASS_ERR_SUCCESS   0x00

Definition at line 93 of file masstorage.h.

#define MASS_ERR_PHASE_ERROR   0x02

Definition at line 94 of file masstorage.h.

#define MASS_ERR_UNIT_NOT_READY   0x03

Definition at line 95 of file masstorage.h.

#define MASS_ERR_UNIT_BUSY   0x04

Definition at line 96 of file masstorage.h.

#define MASS_ERR_STALL   0x05

Definition at line 97 of file masstorage.h.

#define MASS_ERR_CMD_NOT_SUPPORTED   0x06

Definition at line 98 of file masstorage.h.

#define MASS_ERR_INVALID_CSW   0x07

Definition at line 99 of file masstorage.h.

#define MASS_ERR_NO_MEDIA   0x08

Definition at line 100 of file masstorage.h.

#define MASS_ERR_BAD_LBA   0x09

Definition at line 101 of file masstorage.h.

#define MASS_ERR_MEDIA_CHANGED   0x0A

Definition at line 102 of file masstorage.h.

#define MASS_ERR_DEVICE_DISCONNECTED   0x11

Definition at line 103 of file masstorage.h.

#define MASS_ERR_UNABLE_TO_RECOVER   0x12

Definition at line 104 of file masstorage.h.

#define MASS_ERR_INVALID_LUN   0x13

Definition at line 105 of file masstorage.h.

#define MASS_ERR_WRITE_STALL   0x14

Definition at line 106 of file masstorage.h.

#define MASS_ERR_READ_NAKS   0x15

Definition at line 107 of file masstorage.h.

#define MASS_ERR_WRITE_NAKS   0x16

Definition at line 108 of file masstorage.h.

#define MASS_ERR_WRITE_PROTECTED   0x17

Definition at line 109 of file masstorage.h.

#define MASS_ERR_GENERAL_SCSI_ERROR   0xFE

Definition at line 110 of file masstorage.h.

#define MASS_ERR_GENERAL_USB_ERROR   0xFF

Definition at line 111 of file masstorage.h.

#define MASS_ERR_USER   0xA0

Definition at line 112 of file masstorage.h.

#define MASS_TRANS_FLG_CALLBACK   0x01

Definition at line 114 of file masstorage.h.

#define MASS_TRANS_FLG_NO_STALL_CHECK   0x02

Definition at line 115 of file masstorage.h.

#define MASS_TRANS_FLG_NO_PHASE_CHECK   0x04

Definition at line 116 of file masstorage.h.

#define MASS_MAX_ENDPOINTS   3

Definition at line 118 of file masstorage.h.