1 /**
2   ******************************************************************************
3   * @file    usbh_core.h
4   * @author  MCD Application Team
5   * @version V3.0.0
6   * @date    18-February-2014
7   * @brief   Header file for usbh_core.c
8   ******************************************************************************
9   * @attention
10   *
11   * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
12   *
13   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14   * You may not use this file except in compliance with the License.
15   * You may obtain a copy of the License at:
16   *
17   *        http://www.st.com/software_license_agreement_liberty_v2
18   *
19   * Unless required by applicable law or agreed to in writing, software
20   * distributed under the License is distributed on an "AS IS" BASIS,
21   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22   * See the License for the specific language governing permissions and
23   * limitations under the License.
24   *
25   ******************************************************************************
26   */
27 
28 /* Define to prevent recursive  ----------------------------------------------*/
29 #ifndef __USBH_CORE_H
30 #define __USBH_CORE_H
31 
32 /* Includes ------------------------------------------------------------------*/
33 #include "usbh_conf.h"
34 #include "usbh_def.h"
35 #include "usbh_ioreq.h"
36 #include "usbh_pipes.h"
37 #include "usbh_ctlreq.h"
38 
39 /** @addtogroup USBH_LIB
40   * @{
41   */
42 
43 /** @addtogroup USBH_LIB_CORE
44 * @{
45 */
46 
47 /** @defgroup USBH_CORE
48   * @brief This file is the Header file for usbh_core.c
49   * @{
50   */
51 
52 
53 /** @defgroup USBH_CORE_Exported_Defines
54   * @{
55   */
56 
57 /**
58   * @}
59   */
60 #define HOST_USER_SELECT_CONFIGURATION          1
61 #define HOST_USER_CLASS_ACTIVE                  2
62 #define HOST_USER_CLASS_SELECTED                3
63 #define HOST_USER_CONNECTION                    4
64 #define HOST_USER_DISCONNECTION                 5
65 
66 
67 
68 /**
69   * @}
70   */
71 
72 
73 
74 /** @defgroup USBH_CORE_Exported_Macros
75   * @{
76   */
77 
78 /**
79   * @}
80   */
81 
82 /** @defgroup USBH_CORE_Exported_Variables
83   * @{
84   */
85 
86 /**
87   * @}
88   */
89 
90 /** @defgroup USBH_CORE_Exported_FunctionsPrototype
91   * @{
92   */
93 
94 
95 USBH_StatusTypeDef  USBH_Init(USBH_HandleTypeDef *phost, void (*pUsrFunc)(USBH_HandleTypeDef *phost, uint8_t ), uint8_t id);
96 USBH_StatusTypeDef  USBH_DeInit(USBH_HandleTypeDef *phost);
97 USBH_StatusTypeDef  USBH_RegisterClass(USBH_HandleTypeDef *phost, USBH_ClassTypeDef *pclass);
98 USBH_StatusTypeDef  USBH_SelectInterface(USBH_HandleTypeDef *phost, uint8_t interface);
99 uint8_t             USBH_FindInterface(USBH_HandleTypeDef *phost,
100                                             uint8_t Class,
101                                             uint8_t SubClass,
102                                             uint8_t Protocol);
103 uint8_t             USBH_GetActiveClass(USBH_HandleTypeDef *phost);
104 
105 uint8_t             USBH_FindInterfaceIndex(USBH_HandleTypeDef *phost,
106                                             uint8_t interface_number,
107                                             uint8_t alt_settings);
108 
109 USBH_StatusTypeDef  USBH_Start            (USBH_HandleTypeDef *phost);
110 USBH_StatusTypeDef  USBH_Stop             (USBH_HandleTypeDef *phost);
111 USBH_StatusTypeDef  USBH_Process          (USBH_HandleTypeDef *phost);
112 USBH_StatusTypeDef  USBH_ReEnumerate      (USBH_HandleTypeDef *phost);
113 
114 /* USBH Low Level Driver */
115 USBH_StatusTypeDef   USBH_LL_Init         (USBH_HandleTypeDef *phost);
116 USBH_StatusTypeDef   USBH_LL_DeInit       (USBH_HandleTypeDef *phost);
117 USBH_StatusTypeDef   USBH_LL_Start        (USBH_HandleTypeDef *phost);
118 USBH_StatusTypeDef   USBH_LL_Stop         (USBH_HandleTypeDef *phost);
119 
120 USBH_StatusTypeDef   USBH_LL_Connect      (USBH_HandleTypeDef *phost);
121 USBH_StatusTypeDef   USBH_LL_Disconnect   (USBH_HandleTypeDef *phost);
122 USBH_SpeedTypeDef    USBH_LL_GetSpeed     (USBH_HandleTypeDef *phost);
123 USBH_StatusTypeDef   USBH_LL_ResetPort    (USBH_HandleTypeDef *phost);
124 uint32_t             USBH_LL_GetLastXferSize   (USBH_HandleTypeDef *phost, uint8_t );
125 USBH_StatusTypeDef   USBH_LL_DriverVBUS   (USBH_HandleTypeDef *phost, uint8_t );
126 
127 USBH_StatusTypeDef   USBH_LL_OpenPipe     (USBH_HandleTypeDef *phost, uint8_t, uint8_t, uint8_t, uint8_t , uint8_t, uint16_t );
128 USBH_StatusTypeDef   USBH_LL_ClosePipe    (USBH_HandleTypeDef *phost, uint8_t );
129 USBH_StatusTypeDef   USBH_LL_SubmitURB    (USBH_HandleTypeDef *phost, uint8_t, uint8_t,uint8_t,  uint8_t, uint8_t*, uint16_t, uint8_t );
130 USBH_URBStateTypeDef USBH_LL_GetURBState  (USBH_HandleTypeDef *phost, uint8_t );
131 #if (USBH_USE_OS == 1)
132 USBH_StatusTypeDef  USBH_LL_NotifyURBChange (USBH_HandleTypeDef *phost);
133 #endif
134 USBH_StatusTypeDef   USBH_LL_SetToggle    (USBH_HandleTypeDef *phost, uint8_t , uint8_t );
135 uint8_t              USBH_LL_GetToggle    (USBH_HandleTypeDef *phost, uint8_t );
136 
137 /* USBH Time base */
138 void                 USBH_Delay (uint32_t Delay);
139 void                 USBH_LL_SetTimer     (USBH_HandleTypeDef *phost, uint32_t );
140 void                 USBH_LL_IncTimer     (USBH_HandleTypeDef *phost);
141 /**
142   * @}
143   */
144 
145 #endif /* __CORE_H */
146 /**
147   * @}
148   */
149 
150 /**
151   * @}
152   */
153 
154 /**
155 * @}
156 */
157 
158 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
159 
160 
161 
162