]> git.sur5r.net Git - armstart-ibdap/blobdiff - inc/usbd/usbd_msc.h
initial commit
[armstart-ibdap] / inc / usbd / usbd_msc.h
diff --git a/inc/usbd/usbd_msc.h b/inc/usbd/usbd_msc.h
new file mode 100644 (file)
index 0000000..d17e150
--- /dev/null
@@ -0,0 +1,119 @@
+/***********************************************************************\r
+* $Id:: mw_usbd_msc.h 331 2012-08-09 18:54:34Z usb10131                       $\r
+*\r
+* Project: USB device ROM Stack\r
+*\r
+* Description:\r
+*     Mass Storage Class definitions.\r
+*\r
+***********************************************************************\r
+*   Copyright(C) 2011, NXP Semiconductor\r
+*   All rights reserved.\r
+*\r
+* Software that is described herein is for illustrative purposes only\r
+* which provides customers with programming information regarding the\r
+* products. This software is supplied "AS IS" without any warranties.\r
+* NXP Semiconductors assumes no responsibility or liability for the\r
+* use of the software, conveys no license or title under any patent,\r
+* copyright, or mask work right to the product. NXP Semiconductors\r
+* reserves the right to make changes in the software without\r
+* notification. NXP Semiconductors also make no representation or\r
+* warranty that such application will be suitable for the specified\r
+* use without further testing or modification.\r
+**********************************************************************/\r
+\r
+#ifndef __MSC_H__\r
+#define __MSC_H__\r
+\r
+#include "usbd.h"\r
+\r
+/** \file\r
+ *  \brief Mass Storage class (MSC) descriptors.\r
+ *\r
+ *  Definition of MSC class descriptors and their bit defines.\r
+ *\r
+ */\r
+\r
+/* MSC Subclass Codes */\r
+#define MSC_SUBCLASS_RBC                0x01\r
+#define MSC_SUBCLASS_SFF8020I_MMC2      0x02\r
+#define MSC_SUBCLASS_QIC157             0x03\r
+#define MSC_SUBCLASS_UFI                0x04\r
+#define MSC_SUBCLASS_SFF8070I           0x05\r
+#define MSC_SUBCLASS_SCSI               0x06\r
+\r
+/* MSC Protocol Codes */\r
+#define MSC_PROTOCOL_CBI_INT            0x00\r
+#define MSC_PROTOCOL_CBI_NOINT          0x01\r
+#define MSC_PROTOCOL_BULK_ONLY          0x50\r
+\r
+\r
+/* MSC Request Codes */\r
+#define MSC_REQUEST_RESET               0xFF\r
+#define MSC_REQUEST_GET_MAX_LUN         0xFE\r
+\r
+\r
+/* MSC Bulk-only Stage */\r
+#define MSC_BS_CBW                      0       /* Command Block Wrapper */\r
+#define MSC_BS_DATA_OUT                 1       /* Data Out Phase */\r
+#define MSC_BS_DATA_IN                  2       /* Data In Phase */\r
+#define MSC_BS_DATA_IN_LAST             3       /* Data In Last Phase */\r
+#define MSC_BS_DATA_IN_LAST_STALL       4       /* Data In Last Phase with Stall */\r
+#define MSC_BS_CSW                      5       /* Command Status Wrapper */\r
+#define MSC_BS_ERROR                    6       /* Error */\r
+\r
+\r
+/* Bulk-only Command Block Wrapper */\r
+PRE_PACK struct POST_PACK _MSC_CBW\r
+{\r
+  uint32_t dSignature;\r
+  uint32_t dTag;\r
+  uint32_t dDataLength;\r
+  uint8_t  bmFlags;\r
+  uint8_t  bLUN;\r
+  uint8_t  bCBLength;\r
+  uint8_t  CB[16];\r
+} ;\r
+typedef struct _MSC_CBW MSC_CBW;\r
+\r
+/* Bulk-only Command Status Wrapper */\r
+PRE_PACK struct POST_PACK _MSC_CSW\r
+{\r
+  uint32_t dSignature;\r
+  uint32_t dTag;\r
+  uint32_t dDataResidue;\r
+  uint8_t  bStatus;\r
+} ;\r
+typedef struct _MSC_CSW MSC_CSW;\r
+\r
+#define MSC_CBW_Signature               0x43425355\r
+#define MSC_CSW_Signature               0x53425355\r
+\r
+\r
+/* CSW Status Definitions */\r
+#define CSW_CMD_PASSED                  0x00\r
+#define CSW_CMD_FAILED                  0x01\r
+#define CSW_PHASE_ERROR                 0x02\r
+\r
+\r
+/* SCSI Commands */\r
+#define SCSI_TEST_UNIT_READY            0x00\r
+#define SCSI_REQUEST_SENSE              0x03\r
+#define SCSI_FORMAT_UNIT                0x04\r
+#define SCSI_INQUIRY                    0x12\r
+#define SCSI_MODE_SELECT6               0x15\r
+#define SCSI_MODE_SENSE6                0x1A\r
+#define SCSI_START_STOP_UNIT            0x1B\r
+#define SCSI_MEDIA_REMOVAL              0x1E\r
+#define SCSI_READ_FORMAT_CAPACITIES     0x23\r
+#define SCSI_READ_CAPACITY              0x25\r
+#define SCSI_READ10                     0x28\r
+#define SCSI_WRITE10                    0x2A\r
+#define SCSI_VERIFY10                   0x2F\r
+#define SCSI_READ12                     0xA8\r
+#define SCSI_WRITE12                    0xAA\r
+#define SCSI_MODE_SELECT10              0x55\r
+#define SCSI_MODE_SENSE10               0x5A\r
+\r
+\r
+#endif  /* __MSC_H__ */\r