SAMV71 Xplained Ultra Software Package 1.4

HIDRequests.h

Go to the documentation of this file.
00001 /* ----------------------------------------------------------------------------
00002  *         SAM Software Package License 
00003  * ----------------------------------------------------------------------------
00004  * Copyright (c) 2014, Atmel Corporation
00005  *
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are met:
00010  *
00011  * - Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the disclaimer below.
00013  *
00014  * Atmel's name may not be used to endorse or promote products derived from
00015  * this software without specific prior written permission.
00016  *
00017  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
00020  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00022  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00023  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00026  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  * ----------------------------------------------------------------------------
00028  */
00029 
00030 /**\file
00031  *
00032  * \section Purpose
00033  *
00034  * Definitions used for declaring the requests of a HID device.
00035  *
00036  * -# Receive a GET_REPORT or SET_REPORT request from the host.
00037  * -# Retrieve the report type using HIDReportRequest_GetReportType.
00038  * -# Retrieve the report ID using HIDReportRequest_GetReportId.
00039  * -# Retrieve the idle rate indicated by a GET_IDLE or SET_IDLE request
00040  *    with HIDIdleRequest_GetIdleRate.
00041  */
00042 
00043 #ifndef _HIDREQUESTS_H_
00044 #define _HIDREQUESTS_H_
00045 /** \addtogroup usb_hid
00046  *@{
00047  */
00048 
00049 /*----------------------------------------------------------------------------
00050  *         Includes
00051  *----------------------------------------------------------------------------*/
00052 
00053 #include <stdint.h>
00054 #include <USBRequests.h>
00055 
00056 /*----------------------------------------------------------------------------
00057  *         Definitions
00058  *----------------------------------------------------------------------------*/
00059 
00060 /** \addtogroup usb_hid_request_codes HID Request Codes
00061  *      @{
00062  *
00063  * \section Codes
00064  * - HIDGenericRequest_GETREPORT
00065  * - HIDGenericRequest_GETIDLE
00066  * - HIDGenericRequest_GETPROTOCOL
00067  * - HIDGenericRequest_SETREPORT
00068  * - HIDGenericRequest_SETIDLE
00069  * - HIDGenericRequest_SETPROTOCOL
00070  */
00071 
00072 /** GetReport request code. */
00073 #define HIDGenericRequest_GETREPORT             0x01
00074 /** GetIdle request code. */
00075 #define HIDGenericRequest_GETIDLE               0x02
00076 /** GetProtocol request code. */
00077 #define HIDGenericRequest_GETPROTOCOL           0x03
00078 /** SetReport request code. */
00079 #define HIDGenericRequest_SETREPORT             0x09
00080 /** SetIdle request code. */
00081 #define HIDGenericRequest_SETIDLE               0x0A
00082 /** SetProtocol request code. */
00083 #define HIDGenericRequest_SETPROTOCOL           0x0B
00084 /**      @}*/
00085 
00086 /** \addtogroup usb_hid_report_types HID Report Types
00087  *      @{
00088  * This page lists the types for USB HID Reports.
00089  *
00090  * \section Types
00091  * - HIDReportRequest_INPUT
00092  * - HIDReportRequest_OUTPUT
00093  * - HIDReportRequest_FEATURE
00094  */
00095 
00096 /** Input report. */
00097 #define HIDReportRequest_INPUT                  1
00098 /** Output report. */
00099 #define HIDReportRequest_OUTPUT                 2
00100 /** Feature report. */
00101 #define HIDReportRequest_FEATURE                3
00102 /**      @}*/
00103 
00104 /** \addtogroup usb_hid_protocol_types HID Protocol Types
00105  *      @{
00106  */
00107 /** Boot Protocol */
00108 #define HIDProtocol_BOOT                        0
00109 /** Report Protocol */
00110 #define HIDProtocol_REPORT                      1
00111 
00112 /** Infinite idle rate.*/
00113 #define HIDIdleRequest_INFINITE                 0
00114 
00115 /*----------------------------------------------------------------------------
00116  *         Types
00117  *----------------------------------------------------------------------------*/
00118 
00119 #pragma pack(1)
00120 #if defined   ( __CC_ARM   ) /* Keil ¦̀Vision 4 */
00121 #elif defined ( __ICCARM__ ) /* IAR Ewarm 5.41+ */
00122 #define __attribute__(...)
00123 #elif defined (  __GNUC__  ) /* GCC CS3 2009q3-68 */
00124 #endif
00125 
00126 
00127 
00128 #pragma pack()
00129 
00130 /*----------------------------------------------------------------------------
00131  *         Functions
00132  *----------------------------------------------------------------------------*/
00133 
00134 extern uint8_t HIDReportRequest_GetReportType(
00135     const USBGenericRequest *request);
00136 
00137 extern uint8_t HIDReportRequest_GetReportId(
00138     const USBGenericRequest *request);
00139 
00140 
00141 static inline uint16_t HIDProtocolRequest_GetProtocol(
00142     const USBGenericRequest *request)
00143 {
00144     return USBGenericRequest_GetValue(request);
00145 }
00146 
00147 extern uint8_t HIDIdleRequest_GetReportId(
00148     const USBGenericRequest * request);
00149 
00150 extern uint8_t HIDIdleRequest_GetIdleRate(
00151     const USBGenericRequest *request);
00152 
00153 /**@}*/
00154 #endif /* #define _HIDREQUESTS_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines