usbd_msc_mem.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*!
  2. \file usbd_msc_mem.h
  3. \brief header file for storage memory
  4. \version 2020-08-01, V3.0.0, firmware for GD32F4xx
  5. \version 2022-03-09, V3.1.0, firmware for GD32F4xx
  6. \version 2022-06-30, V3.2.0, firmware for GD32F4xx
  7. */
  8. /*
  9. Copyright (c) 2022, GigaDevice Semiconductor Inc.
  10. Redistribution and use in source and binary forms, with or without modification,
  11. are permitted provided that the following conditions are met:
  12. 1. Redistributions of source code must retain the above copyright notice, this
  13. list of conditions and the following disclaimer.
  14. 2. Redistributions in binary form must reproduce the above copyright notice,
  15. this list of conditions and the following disclaimer in the documentation
  16. and/or other materials provided with the distribution.
  17. 3. Neither the name of the copyright holder nor the names of its contributors
  18. may be used to endorse or promote products derived from this software without
  19. specific prior written permission.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  22. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  23. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  24. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  25. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  26. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  27. WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  29. OF SUCH DAMAGE.
  30. */
  31. #ifndef __USBD_MSC_MEM_H
  32. #define __USBD_MSC_MEM_H
  33. #include "usbd_conf.h"
  34. #define USBD_STD_INQUIRY_LENGTH 36U
  35. typedef struct
  36. {
  37. int8_t (*mem_init) (uint8_t lun);
  38. int8_t (*mem_ready) (uint8_t lun);
  39. int8_t (*mem_protected) (uint8_t lun);
  40. int8_t (*mem_read) (uint8_t lun, uint8_t *buf, uint32_t block_addr, uint16_t block_len);
  41. int8_t (*mem_write) (uint8_t lun, uint8_t *buf, uint32_t block_addr, uint16_t block_len);
  42. int8_t (*mem_maxlun) (void);
  43. uint8_t *mem_toc_data;
  44. uint8_t *mem_inquiry_data[MEM_LUN_NUM];
  45. uint32_t mem_block_size[MEM_LUN_NUM];
  46. uint32_t mem_block_len[MEM_LUN_NUM];
  47. } usbd_mem_cb;
  48. extern usbd_mem_cb *usbd_mem_fops;
  49. #endif /* __USBD_MSC_MEM_H */