3      Copyright (C) Dean Camera, 2009. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, and distribute this software 
  13   and its documentation for any purpose and without fee is hereby 
  14   granted, provided that the above copyright notice appear in all 
  15   copies and that both that the copyright notice and this 
  16   permission notice and warranty disclaimer appear in supporting 
  17   documentation, and that the name of the author not be used in 
  18   advertising or publicity pertaining to distribution of the 
  19   software without specific, written prior permission. 
  21   The author disclaim all warranties with regard to this 
  22   software, including all implied warranties of merchantability 
  23   and fitness.  In no event shall the author be liable for any 
  24   special, indirect or consequential damages or any damages 
  25   whatsoever resulting from loss of use, data or profits, whether 
  26   in an action of contract, negligence or other tortious action, 
  27   arising out of or in connection with the use or performance of 
  31 /** \ingroup Group_USBClassHID 
  32  *  @defgroup Group_USBClassHIDHost HID Class Host Mode Driver 
  34  *  \section Sec_Dependencies Module Source Dependencies 
  35  *  The following files must be built with any user project that uses this module: 
  36  *    - LUFA/Drivers/USB/Class/Host/HID.c 
  38  *  \section Module Description 
  39  *  Host Mode USB Class driver framework interface, for the HID USB Class driver. 
  44 #ifndef __HID_CLASS_HOST_H__ 
  45 #define __HID_CLASS_HOST_H__ 
  48                 #include "../../USB.h" 
  49                 #include "../Common/HID.h" 
  50                 #include "HIDParser.h" 
  52         /* Enable C linkage for C++ Compilers: */ 
  53                 #if defined(__cplusplus) 
  57         /* Public Interface - May be used in end-application: */ 
  59                         /** Class state structure. An instance of this structure should be made within the user application, 
  60                          *  and passed to each of the HID class driver functions as the HIDInterfaceInfo parameter. This 
  61                          *  stores each HID interface's configuration and state information. 
  67                                         uint8_t  DataINPipeNumber
; /**< Pipe number of the HID interface's IN data pipe */ 
  68                                         uint8_t  DataOUTPipeNumber
; /**< Pipe number of the HID interface's OUT data pipe */ 
  70                                         uint8_t  HIDInterfaceProtocol
; /**< HID interface protocol value to match against if a specific 
  71                                                                         *   boot subclass protocol is required (e.g. keyboard, mouse), or 
  72                                                                         *   leave as 0 to match against the first HID interface found 
  74                                 } Config
; /**< Config data for the USB class interface within the device. All elements in this section 
  75                                            *   <b>must</b> be set or the interface will fail to enumerate and operate correctly. 
  79                                         bool Active
; /**< Indicates if the current interface instance is connected to an attached device, valid 
  80                                                       *   after \ref HID_Host_ConfigurePipes() is called and the Host state machine is in the 
  83                                         uint8_t InterfaceNumber
; /**< Interface index of the HID interface within the attached device */ 
  85                                         uint16_t DataINPipeSize
; /**< Size in bytes of the HID interface's IN data pipe */ 
  86                                         uint16_t DataOUTPipeSize
;  /**< Size in bytes of the HID interface's OUT data pipe */ 
  88                                         bool SupportsBootSubClass
; /**< Indicates if the current interface instance supports the HID Boot 
  89                                                                     *   Protocol when enabled via \ref USB_HID_Host_SetProtocol() 
  91                                 } State
; /**< State data for the USB class interface within the device. All elements in this section 
  92                                                   *   <b>may</b> be set to initial values, but may also be ignored to default to sane values when 
  93                                                   *   the interface is enumerated. 
  95                         } USB_ClassInfo_HID_Host_t
; 
  98                         enum HIDHost_EnumerationFailure_ErrorCodes_t
 
 100                                 HID_ENUMERROR_NoError                    
= 0, /**< Configuration Descriptor was processed successfully */ 
 101                                 HID_ENUMERROR_InvalidConfigDescriptor    
= 1, /**< The device returned an invalid Configuration Descriptor */ 
 102                                 HID_ENUMERROR_NoHIDInterfaceFound        
= 2, /**< A compatible HID interface was not found in the device's Configuration Descriptor */ 
 103                                 HID_ENUMERROR_EndpointsNotFound          
= 3, /**< Compatible HID endpoints were not found in the device's HID interface */ 
 106                 /* Function Prototypes: */ 
 107                         void HID_Host_USBTask(USB_ClassInfo_HID_Host_t
* HIDInterfaceInfo
) ATTR_NON_NULL_PTR_ARG(1); 
 108                         uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t
* HIDInterfaceInfo
, uint16_t ConfigDescriptorLength
, 
 109                                                         uint8_t* DeviceConfigDescriptor
) ATTR_NON_NULL_PTR_ARG(1, 3); 
 111                         bool    HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t
* HIDInterfaceInfo
) ATTR_NON_NULL_PTR_ARG(1); 
 112                         uint8_t USB_HID_Host_SetProtocol(USB_ClassInfo_HID_Host_t
* HIDInterfaceInfo
, bool UseReportProtocol
) ATTR_NON_NULL_PTR_ARG(1); 
 114         /* Private Interface - For use in library only: */ 
 115         #if !defined(__DOXYGEN__) 
 117                         #define HID_INTERFACE_CLASS             0x03 
 119                         #define HID_FOUND_DATAPIPE_IN           (1 << 0) 
 120                         #define HID_FOUND_DATAPIPE_OUT          (1 << 1) 
 122                 /* Function Prototypes: */ 
 123                         #if defined(INCLUDE_FROM_HID_CLASS_HOST_C) 
 124                                 static uint8_t DComp_HID_Host_NextHIDInterface(void* CurrentDescriptor
) ATTR_NON_NULL_PTR_ARG(1); 
 125                                 static uint8_t DComp_HID_Host_NextHIDInterfaceEndpoint(void* CurrentDescriptor
) ATTR_NON_NULL_PTR_ARG(1); 
 129         /* Disable C linkage for C++ Compilers: */ 
 130                 #if defined(__cplusplus)