LUFA Library  210130
ConfigDescriptors.h File Reference

USB Configuration Descriptor definitions. More...

#include "../../../Common/Common.h"
#include "USBMode.h"
#include "HostStandardReq.h"
#include "StdDescriptors.h"

Macros

#define DESCRIPTOR_CAST(DescriptorPtr, Type)   (*DESCRIPTOR_PCAST(DescriptorPtr, Type))
 
#define DESCRIPTOR_PCAST(DescriptorPtr, Type)   ((Type*)(DescriptorPtr))
 
#define DESCRIPTOR_SIZE(DescriptorPtr)   DESCRIPTOR_PCAST(DescriptorPtr, USB_Descriptor_Header_t)->Size
 
#define DESCRIPTOR_TYPE(DescriptorPtr)   DESCRIPTOR_PCAST(DescriptorPtr, USB_Descriptor_Header_t)->Type
 

Typedefs

typedef uint8_t(* ConfigComparatorPtr_t) (void *)
 

Enumerations

enum  DSearch_Comp_Return_ErrorCodes_t {
  DESCRIPTOR_SEARCH_COMP_Found = 0 ,
  DESCRIPTOR_SEARCH_COMP_Fail = 1 ,
  DESCRIPTOR_SEARCH_COMP_EndOfDescriptor = 2
}
 
enum  DSearch_Return_ErrorCodes_t {
  DESCRIPTOR_SEARCH_Found = 0 ,
  DESCRIPTOR_SEARCH_Fail = 1 ,
  DESCRIPTOR_SEARCH_NotFound = 2
}
 
enum  USB_Host_GetConfigDescriptor_ErrorCodes_t {
  HOST_GETCONFIG_Successful = 0 ,
  HOST_GETCONFIG_DeviceDisconnect = 1 ,
  HOST_GETCONFIG_PipeError = 2 ,
  HOST_GETCONFIG_SetupStalled = 3 ,
  HOST_GETCONFIG_SoftwareTimeOut = 4 ,
  HOST_GETCONFIG_BuffOverflow = 5 ,
  HOST_GETCONFIG_InvalidData = 6
}
 

Functions

static void USB_GetNextDescriptor (uint16_t *const BytesRem, void **CurrConfigLoc) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2)
 
uint8_t USB_GetNextDescriptorComp (uint16_t *const BytesRem, void **const CurrConfigLoc, ConfigComparatorPtr_t const ComparatorRoutine) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3)
 
void USB_GetNextDescriptorOfType (uint16_t *const BytesRem, void **const CurrConfigLoc, const uint8_t Type) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2)
 
void USB_GetNextDescriptorOfTypeAfter (uint16_t *const BytesRem, void **const CurrConfigLoc, const uint8_t Type, const uint8_t AfterType) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2)
 
void USB_GetNextDescriptorOfTypeBefore (uint16_t *const BytesRem, void **const CurrConfigLoc, const uint8_t Type, const uint8_t BeforeType) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2)
 
uint8_t USB_Host_GetDeviceConfigDescriptor (const uint8_t ConfigNumber, uint16_t *const ConfigSizePtr, void *const BufferPtr, const uint16_t BufferSize) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3)
 

Detailed Description

This section of the library gives a friendly API which can be used in host applications to easily parse an attached device's configuration descriptor so that endpoint, interface and other descriptor data can be extracted and used as needed.

Note
This file should not be included directly. It is automatically included as needed by the USB driver dispatch header located in LUFA/Drivers/USB/USB.h.