#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
#include "Config/AppConfig.h"
#define MASS_STORAGE_IN_EPADDR (ENDPOINT_DIR_IN | 3)
#define MASS_STORAGE_OUT_EPADDR (ENDPOINT_DIR_OUT | 4)
#define MASS_STORAGE_IO_EPSIZE 64
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 5)
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 1)
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 2)
#define CDC_NOTIFICATION_EPSIZE 8
#define CDC_TXRX_EPSIZE 64
#define VENDOR_REQUEST_ID_MS_COMPAT 0x01
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
USB_Descriptor_Interface_Association_t CDC_IAD;
USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t RNDIS_DataOutEndpoint;
USB_Descriptor_Endpoint_t RNDIS_DataInEndpoint;
USB_Descriptor_Interface_t MS_Interface;
USB_Descriptor_Endpoint_t MS_DataInEndpoint;
USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
} USB_Descriptor_Configuration_t;
typedef struct
{
uint32_t dwLength;
uint16_t bcdVersion;
uint16_t wIndex;
uint8_t bCount;
uint8_t bReserved[7];
uint8_t bFirstInterfaceNumber;
uint8_t bReserved2;
char compatibleID[8];
char subCompatibleID[8];
uint8_t bReserved3[6];
} USB_Descriptor_MSCompatibility_t;
enum InterfaceDescriptors_t
{
INTERFACE_ID_CDC_CCI = 0,
INTERFACE_ID_CDC_DCI = 1,
INTERFACE_ID_MassStorage = 2,
};
enum StringDescriptors_t
{
STRING_ID_Language = 0,
STRING_ID_Manufacturer = 1,
STRING_ID_Product = 2,
STRING_ID_MS_Compat = 0xEE,
};
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint16_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
void CheckIfMSCompatibilityDescriptorRequest(void);
#endif