My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

msc.h 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*----------------------------------------------------------------------------
  2. * U S B - K e r n e l
  3. *----------------------------------------------------------------------------
  4. * Name: MSC.H
  5. * Purpose: USB Mass Storage Class Definitions
  6. * Version: V1.10
  7. *----------------------------------------------------------------------------
  8. * This software is supplied "AS IS" without any warranties, express,
  9. * implied or statutory, including but not limited to the implied
  10. * warranties of fitness for purpose, satisfactory quality and
  11. * noninfringement. Keil extends you a royalty-free right to reproduce
  12. * and distribute executable files created using this software for use
  13. * on NXP Semiconductors LPC family microcontroller devices only. Nothing
  14. * else gives you the right to use this software.
  15. *
  16. * Copyright (c) 2005-2009 Keil Software.
  17. *---------------------------------------------------------------------------*/
  18. #ifndef __MSC_H__
  19. #define __MSC_H__
  20. #if defined ( __GNUC__ )
  21. #define __packed __attribute__((__packed__))
  22. #endif
  23. /* MSC Subclass Codes */
  24. #define MSC_SUBCLASS_RBC 0x01
  25. #define MSC_SUBCLASS_SFF8020I_MMC2 0x02
  26. #define MSC_SUBCLASS_QIC157 0x03
  27. #define MSC_SUBCLASS_UFI 0x04
  28. #define MSC_SUBCLASS_SFF8070I 0x05
  29. #define MSC_SUBCLASS_SCSI 0x06
  30. /* MSC Protocol Codes */
  31. #define MSC_PROTOCOL_CBI_INT 0x00
  32. #define MSC_PROTOCOL_CBI_NOINT 0x01
  33. #define MSC_PROTOCOL_BULK_ONLY 0x50
  34. /* MSC Request Codes */
  35. #define MSC_REQUEST_RESET 0xFF
  36. #define MSC_REQUEST_GET_MAX_LUN 0xFE
  37. /* MSC Bulk-only Stage */
  38. #define MSC_BS_CBW 0 /* Command Block Wrapper */
  39. #define MSC_BS_DATA_OUT 1 /* Data Out Phase */
  40. #define MSC_BS_DATA_IN 2 /* Data In Phase */
  41. #define MSC_BS_DATA_IN_LAST 3 /* Data In Last Phase */
  42. #define MSC_BS_DATA_IN_LAST_STALL 4 /* Data In Last Phase with Stall */
  43. #define MSC_BS_CSW 5 /* Command Status Wrapper */
  44. #define MSC_BS_ERROR 6 /* Error */
  45. /* Bulk-only Command Block Wrapper */
  46. #if defined ( __CC_ARM )
  47. typedef __packed struct _MSC_CBW {
  48. #elif defined ( __GNUC__ )
  49. typedef struct __packed _MSC_CBW {
  50. #elif defined ( __IAR_SYSTEMS_ICC__ )
  51. typedef __packed struct _MSC_CBW {
  52. #endif
  53. uint32_t dSignature;
  54. uint32_t dTag;
  55. uint32_t dDataLength;
  56. uint8_t bmFlags;
  57. uint8_t bLUN;
  58. uint8_t bCBLength;
  59. uint8_t CB[16];
  60. } MSC_CBW;
  61. /* Bulk-only Command Status Wrapper */
  62. #if defined ( __CC_ARM )
  63. typedef __packed struct _MSC_CSW {
  64. #elif defined ( __GNUC__ )
  65. typedef struct __packed _MSC_CSW {
  66. #elif defined ( __IAR_SYSTEMS_ICC__ )
  67. typedef __packed struct _MSC_CSW {
  68. #endif
  69. uint32_t dSignature;
  70. uint32_t dTag;
  71. uint32_t dDataResidue;
  72. uint8_t bStatus;
  73. } MSC_CSW;
  74. #define MSC_CBW_Signature 0x43425355
  75. #define MSC_CSW_Signature 0x53425355
  76. /* CSW Status Definitions */
  77. #define CSW_CMD_PASSED 0x00
  78. #define CSW_CMD_FAILED 0x01
  79. #define CSW_PHASE_ERROR 0x02
  80. /* SCSI Commands */
  81. #define SCSI_TEST_UNIT_READY 0x00
  82. #define SCSI_REQUEST_SENSE 0x03
  83. #define SCSI_FORMAT_UNIT 0x04
  84. #define SCSI_INQUIRY 0x12
  85. #define SCSI_MODE_SELECT6 0x15
  86. #define SCSI_MODE_SENSE6 0x1A
  87. #define SCSI_START_STOP_UNIT 0x1B
  88. #define SCSI_MEDIA_REMOVAL 0x1E
  89. #define SCSI_READ_FORMAT_CAPACITIES 0x23
  90. #define SCSI_READ_CAPACITY 0x25
  91. #define SCSI_READ10 0x28
  92. #define SCSI_WRITE10 0x2A
  93. #define SCSI_VERIFY10 0x2F
  94. #define SCSI_MODE_SELECT10 0x55
  95. #define SCSI_MODE_SENSE10 0x5A
  96. #endif /* __MSC_H__ */