usb_msc.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*!
  2. \file usb_msc.h
  3. \brief definitions for the USB MSC class
  4. \version 2023-06-30, V2.1.6, firmware for GD32F30x
  5. */
  6. /*
  7. Copyright (c) 2023, GigaDevice Semiconductor Inc.
  8. Redistribution and use in source and binary forms, with or without modification,
  9. are permitted provided that the following conditions are met:
  10. 1. Redistributions of source code must retain the above copyright notice, this
  11. list of conditions and the following disclaimer.
  12. 2. Redistributions in binary form must reproduce the above copyright notice,
  13. this list of conditions and the following disclaimer in the documentation
  14. and/or other materials provided with the distribution.
  15. 3. Neither the name of the copyright holder nor the names of its contributors
  16. may be used to endorse or promote products derived from this software without
  17. specific prior written permission.
  18. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  22. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  23. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  24. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  25. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  26. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  27. OF SUCH DAMAGE.
  28. */
  29. #ifndef __USB_MSC_H
  30. #define __USB_MSC_H
  31. #include "usb_ch9_std.h"
  32. /* mass storage device class code */
  33. #define USB_CLASS_MSC 0x08U
  34. /* mass storage subclass code */
  35. #define USB_MSC_SUBCLASS_RBC 0x01U
  36. #define USB_MSC_SUBCLASS_ATAPI 0x02U
  37. #define USB_MSC_SUBCLASS_UFI 0x04U
  38. #define USB_MSC_SUBCLASS_SCSI 0x06U
  39. #define USB_MSC_SUBCLASS_LOCKABLE 0x07U
  40. #define USB_MSC_SUBCLASS_IEEE1667 0x08U
  41. /* mass storage interface class control protocol codes */
  42. #define USB_MSC_PROTOCOL_CBI 0x00U
  43. #define USB_MSC_PROTOCOL_CBI_ALT 0x01U
  44. #define USB_MSC_PROTOCOL_BBB 0x50U
  45. /* mass storage request codes */
  46. #define USB_MSC_REQ_CODES_ADSC 0x00U
  47. #define USB_MSC_REQ_CODES_GET 0xFCU
  48. #define USB_MSC_REQ_CODES_PUT 0xFDU
  49. #define USB_MSC_REQ_CODES_GML 0xFEU
  50. #define USB_MSC_REQ_CODES_BOMSR 0xFFU
  51. #define BBB_GET_MAX_LUN 0xFEU
  52. #define BBB_RESET 0xFFU
  53. #define SCSI_CMD_LENGTH 16U
  54. #endif /* __USB_MSC_H */