Descriptors.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2018.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2018 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  9. Permission to use, copy, modify, distribute, and sell this
  10. software and its documentation for any purpose is hereby granted
  11. without fee, provided that the above copyright notice appear in
  12. all copies and that both that the copyright notice and this
  13. permission notice and warranty disclaimer appear in supporting
  14. documentation, and that the name of the author not be used in
  15. advertising or publicity pertaining to distribution of the
  16. software without specific, written prior permission.
  17. The author disclaims all warranties with regard to this
  18. software, including all implied warranties of merchantability
  19. and fitness. In no event shall the author be liable for any
  20. special, indirect or consequential damages or any damages
  21. whatsoever resulting from loss of use, data or profits, whether
  22. in an action of contract, negligence or other tortious action,
  23. arising out of or in connection with the use or performance of
  24. this software.
  25. */
  26. /** \file
  27. *
  28. * Header file for Descriptors.c.
  29. */
  30. #ifndef _DESCRIPTORS_H_
  31. #define _DESCRIPTORS_H_
  32. /* Includes: */
  33. #include <avr/pgmspace.h>
  34. #include <LUFA/Drivers/USB/USB.h>
  35. #include "BootloaderAPI.h"
  36. /* Macros: */
  37. /** Endpoint address of the Mass Storage device-to-host data IN endpoint. */
  38. #define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
  39. /** Endpoint address of the Mass Storage host-to-device data OUT endpoint. */
  40. #define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
  41. /** Size in bytes of the Mass Storage data endpoints. */
  42. #define MASS_STORAGE_IO_EPSIZE 64
  43. /* Type Defines: */
  44. /** Type define for the device configuration descriptor structure. This must be defined in the
  45. * application code, as the configuration descriptor contains several sub-descriptors which
  46. * vary between devices, and which describe the device's usage to the host.
  47. */
  48. typedef struct
  49. {
  50. USB_Descriptor_Configuration_Header_t Config;
  51. // Mass Storage Interface
  52. USB_Descriptor_Interface_t MS_Interface;
  53. USB_Descriptor_Endpoint_t MS_DataInEndpoint;
  54. USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
  55. } USB_Descriptor_Configuration_t;
  56. /** Enum for the device interface descriptor IDs within the device. Each interface descriptor
  57. * should have a unique ID index associated with it, which can be used to refer to the
  58. * interface from other descriptors.
  59. */
  60. enum InterfaceDescriptors_t
  61. {
  62. INTERFACE_ID_MassStorage = 0, /**< Mass storage interface descriptor ID */
  63. };
  64. /* Function Prototypes: */
  65. uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
  66. const uint16_t wIndex,
  67. const void** const DescriptorAddress)
  68. ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3) AUX_BOOT_SECTION;
  69. #endif