ARMEBS4  revision-26.06.2015
usbh_hid_core.h
1 #include "heivs/config.h"
2 #if (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE)
3 /**
4  ******************************************************************************
5  * @file usbh_hid_core.h
6  * @author MCD Application Team
7  * @version V2.1.0
8  * @date 19-March-2012
9  * @brief This file contains all the prototypes for the usbh_hid_core.c
10  ******************************************************************************
11  * @attention
12  *
13  * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>
14  *
15  * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
16  * You may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at:
18  *
19  * http://www.st.com/software_license_agreement_liberty_v2
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  *
27  ******************************************************************************
28  */
29 
30 /* Define to prevent recursive ----------------------------------------------*/
31 #ifndef __USBH_HID_CORE_H
32 #define __USBH_HID_CORE_H
33 
34 /* Includes ------------------------------------------------------------------*/
35 #include "config/usb_conf.h"
36 #if defined(USE_HOST_MODE)
37 
38 #include "stm32/usb/usbh_core.h"
39 #include "stm32/usb/usbh_stdreq.h"
40 #include "stm32/usb/usb_bsp.h"
41 #include "stm32/usb/usbh_ioreq.h"
42 #include "stm32/usb/usbh_hcs.h"
43 
44 /** @addtogroup USBH_LIB
45  * @{
46  */
47 
48 /** @addtogroup USBH_CLASS
49  * @{
50  */
51 
52 /** @addtogroup USBH_HID_CLASS
53  * @{
54  */
55 
56 /** @defgroup USBH_HID_CORE
57  * @brief This file is the Header file for USBH_HID_CORE.c
58  * @{
59  */
60 
61 
62 /** @defgroup USBH_HID_CORE_Exported_Types
63  * @{
64  */
65 
66 #define HID_MIN_POLL 10
67 
68 /* States for HID State Machine */
69 typedef enum
70 {
71  HID_IDLE= 0,
72  HID_SEND_DATA,
73  HID_BUSY,
74  HID_GET_DATA,
75  HID_SYNC,
76  HID_POLL,
77  HID_ERROR,
78 }
79 HID_State;
80 
81 typedef enum
82 {
83  HID_REQ_IDLE = 0,
84  HID_REQ_GET_REPORT_DESC,
85  HID_REQ_GET_HID_DESC,
86  HID_REQ_SET_IDLE,
87  HID_REQ_SET_PROTOCOL,
88  HID_REQ_SET_REPORT,
89 
90 }
91 HID_CtlState;
92 
93 typedef struct HID_cb
94 {
95  void (*Init) (void);
96  void (*Decode) (uint8_t *data);
97 
98 } HID_cb_TypeDef;
99 
100 typedef struct _HID_Report
101 {
102  uint8_t ReportID;
103  uint8_t ReportType;
104  uint16_t UsagePage;
105  uint32_t Usage[2];
106  uint32_t NbrUsage;
107  uint32_t UsageMin;
108  uint32_t UsageMax;
109  int32_t LogMin;
110  int32_t LogMax;
111  int32_t PhyMin;
112  int32_t PhyMax;
113  int32_t UnitExp;
114  uint32_t Unit;
115  uint32_t ReportSize;
116  uint32_t ReportCnt;
117  uint32_t Flag;
118  uint32_t PhyUsage;
119  uint32_t AppUsage;
120  uint32_t LogUsage;
121 }
122 HID_Report_TypeDef;
123 
124 /* Structure for HID process */
125 typedef struct _HID_Process
126 {
127  uint8_t buff[64];
128  uint8_t hc_num_in;
129  uint8_t hc_num_out;
130  HID_State state;
131  uint8_t HIDIntOutEp;
132  uint8_t HIDIntInEp;
133  HID_CtlState ctl_state;
134  uint16_t length;
135  uint8_t ep_addr;
136  uint16_t poll;
137  __IO uint16_t timer;
138  HID_cb_TypeDef *cb;
139 }
140 HID_Machine_TypeDef;
141 
142 /**
143  * @}
144  */
145 
146 /** @defgroup USBH_HID_CORE_Exported_Defines
147  * @{
148  */
149 
150 #define USB_HID_REQ_GET_REPORT 0x01
151 #define USB_HID_GET_IDLE 0x02
152 #define USB_HID_GET_PROTOCOL 0x03
153 #define USB_HID_SET_REPORT 0x09
154 #define USB_HID_SET_IDLE 0x0A
155 #define USB_HID_SET_PROTOCOL 0x0B
156 /**
157  * @}
158  */
159 
160 /** @defgroup USBH_HID_CORE_Exported_Macros
161  * @{
162  */
163 /**
164  * @}
165  */
166 
167 /** @defgroup USBH_HID_CORE_Exported_Variables
168  * @{
169  */
170 extern USBH_Class_cb_TypeDef HID_cb;
171 /**
172  * @}
173  */
174 
175 /** @defgroup USBH_HID_CORE_Exported_FunctionsPrototype
176  * @{
177  */
178 
179 USBH_Status USBH_Set_Report (USB_OTG_CORE_HANDLE *pdev,
180  USBH_HOST *phost,
181  uint8_t reportType,
182  uint8_t reportId,
183  uint8_t reportLen,
184  uint8_t* reportBuff);
185 /**
186  * @}
187  */
188 
189 
190 #endif /* __USBH_HID_CORE_H */
191 
192 /**
193  * @}
194  */
195 
196 /**
197  * @}
198  */
199 
200 /**
201  * @}
202  */
203 
204 /**
205  * @}
206  */
207 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
208 #endif
209 #endif /* (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE) */
libheivs configuration file