Keyboard firmwares for Atmel AVR and Cortex-M
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.

Descriptors.h 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2014.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2014 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 <LUFA/Drivers/USB/USB.h>
  34. #include <avr/pgmspace.h>
  35. #include "Config/AppConfig.h"
  36. /* Macros: */
  37. /** Endpoint address of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
  38. #define MIDI_STREAM_IN_EPADDR (ENDPOINT_DIR_IN | 2)
  39. /** Endpoint address of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
  40. #define MIDI_STREAM_OUT_EPADDR (ENDPOINT_DIR_OUT | 1)
  41. /** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */
  42. #define MIDI_STREAM_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. // MIDI Audio Control Interface
  52. USB_Descriptor_Interface_t Audio_ControlInterface;
  53. USB_Audio_Descriptor_Interface_AC_t Audio_ControlInterface_SPC;
  54. // MIDI Audio Streaming Interface
  55. USB_Descriptor_Interface_t Audio_StreamInterface;
  56. USB_MIDI_Descriptor_AudioInterface_AS_t Audio_StreamInterface_SPC;
  57. USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Emb;
  58. USB_MIDI_Descriptor_InputJack_t MIDI_In_Jack_Ext;
  59. USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Emb;
  60. USB_MIDI_Descriptor_OutputJack_t MIDI_Out_Jack_Ext;
  61. USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_In_Jack_Endpoint;
  62. USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_In_Jack_Endpoint_SPC;
  63. USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
  64. USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
  65. } USB_Descriptor_Configuration_t;
  66. /** Enum for the device interface descriptor IDs within the device. Each interface descriptor
  67. * should have a unique ID index associated with it, which can be used to refer to the
  68. * interface from other descriptors.
  69. */
  70. enum InterfaceDescriptors_t
  71. {
  72. INTERFACE_ID_AudioControl = 0, /**< Audio control interface descriptor ID */
  73. INTERFACE_ID_AudioStream = 1, /**< Audio stream interface descriptor ID */
  74. };
  75. /** Enum for the device string descriptor IDs within the device. Each string descriptor should
  76. * have a unique ID index associated with it, which can be used to refer to the string from
  77. * other descriptors.
  78. */
  79. enum StringDescriptors_t
  80. {
  81. STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
  82. STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
  83. STRING_ID_Product = 2, /**< Product string ID */
  84. };
  85. /* Function Prototypes: */
  86. uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
  87. const uint8_t wIndex,
  88. const void** const DescriptorAddress)
  89. ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
  90. #endif