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.

mscuser.h 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*----------------------------------------------------------------------------
  2. * U S B - K e r n e l
  3. *----------------------------------------------------------------------------
  4. * Name: MSCUSER.H
  5. * Purpose: Mass Storage Class Custom User 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 __MSCUSER_H__
  19. #define __MSCUSER_H__
  20. /* Max In/Out Packet Size */
  21. #define MSC_MAX_PACKET 64
  22. #define MSC_BLOCK_SIZE 512
  23. /* MSC In/Out Endpoint Address */
  24. #define MSC_EP_IN 0x85
  25. #define MSC_EP_OUT 0x05
  26. /* MSC Requests Callback Functions */
  27. extern uint32_t MSC_Reset (void);
  28. extern uint32_t MSC_GetMaxLUN (void);
  29. /* MSC Bulk Callback Functions */
  30. extern void MSC_GetCBW (void);
  31. extern void MSC_SetCSW (void);
  32. extern void MSC_BulkIn (void);
  33. extern void MSC_BulkOut(void);
  34. enum struct Sense_KEY : uint8_t {
  35. NO_SENSE,
  36. RECOVERED_ERROR,
  37. NOT_READY,
  38. MEDIUM_ERROR,
  39. HARDWARE_ERROR,
  40. ILLEGAL_REQUEST,
  41. UNIT_ATTENTION,
  42. DATA_PROTECT
  43. };
  44. enum struct Sense_ASC : uint8_t {
  45. NONE = 0x0,
  46. LOGICAL_UNIT_NOT_READY = 0x04,
  47. CANNOT_READ_MEDIUM = 0x30,
  48. MEDIUM_NOT_PRESENT = 0x3A,
  49. MEDIA_CHANGED = 0x28
  50. };
  51. enum struct Sense_ASCQ : uint8_t {
  52. // ASC: LOGICAL_UNIT_NOT_READY
  53. CAUSE_NOT_REPORTABLE = 0x00,
  54. UNIT_IS_IN_PROCESS_OF_BECOMING_READY,
  55. INITIALIZING_COMMAND_REQUIRED,
  56. MANUAL_INTERVENTION_REQUIRED,
  57. FORMAT_IN_PROGRESS,
  58. DEVICE_IS_BUSY = 0xFF,
  59. // ASC: CANNOT_READ_MEDIUM
  60. UNKNOWN_FORMAT = 0x01,
  61. // ASC: MEDIUM_NOT_PRESENT
  62. REASON_UNKNOWN = 0x00,
  63. TRAY_CLOSED,
  64. TRAY_OPEN,
  65. LOADABLE,
  66. AUXILIARY_MEMORY_ACCESSIBLE
  67. };
  68. struct Sense {
  69. Sense() {
  70. reset();
  71. }
  72. void set(Sense_KEY key_val, Sense_ASC asc_val = Sense_ASC::NONE, Sense_ASCQ ascq_val = Sense_ASCQ::REASON_UNKNOWN) {
  73. key = key_val;
  74. asc = asc_val;
  75. ascq = ascq_val;
  76. }
  77. void reset() {
  78. key = Sense_KEY::NO_SENSE;
  79. asc = Sense_ASC::NONE;
  80. ascq = Sense_ASCQ::REASON_UNKNOWN;
  81. }
  82. bool has_sense() {
  83. return key != Sense_KEY::NO_SENSE;
  84. }
  85. Sense_KEY key;
  86. Sense_ASC asc;
  87. Sense_ASCQ ascq;
  88. };
  89. #endif /* __MSCUSER_H__ */