1 /** 2 ****************************************************************************** 3 * @file usbh_core.h 4 * @author MCD Application Team 5 * @brief Header file for usbh_core.c 6 ****************************************************************************** 7 * @attention 8 * 9 * <h2><center>© Copyright (c) 2015 STMicroelectronics. 10 * All rights reserved.</center></h2> 11 * 12 * This software component is licensed by ST under Ultimate Liberty license 13 * SLA0044, the "License"; You may not use this file except in compliance with 14 * the License. You may obtain a copy of the License at: 15 * www.st.com/SLA0044 16 * 17 ****************************************************************************** 18 */ 19 /* Define to prevent recursive ----------------------------------------------*/ 20 #ifndef __USBH_CORE_H 21 #define __USBH_CORE_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* Includes ------------------------------------------------------------------*/ 28 #include "usbh_conf.h" 29 #include "usbh_def.h" 30 #include "usbh_ioreq.h" 31 #include "usbh_pipes.h" 32 #include "usbh_ctlreq.h" 33 34 /** @addtogroup USBH_LIB 35 * @{ 36 */ 37 38 /** @addtogroup USBH_LIB_CORE 39 * @{ 40 */ 41 42 /** @defgroup USBH_CORE 43 * @brief This file is the Header file for usbh_core.c 44 * @{ 45 */ 46 47 48 /** @defgroup USBH_CORE_Exported_Defines 49 * @{ 50 */ 51 52 /** 53 * @} 54 */ 55 #define HOST_USER_SELECT_CONFIGURATION 0x01U 56 #define HOST_USER_CLASS_ACTIVE 0x02U 57 #define HOST_USER_CLASS_SELECTED 0x03U 58 #define HOST_USER_CONNECTION 0x04U 59 #define HOST_USER_DISCONNECTION 0x05U 60 #define HOST_USER_UNRECOVERED_ERROR 0x06U 61 62 63 /** 64 * @} 65 */ 66 67 68 69 /** @defgroup USBH_CORE_Exported_Macros 70 * @{ 71 */ 72 73 /** 74 * @} 75 */ 76 77 /** @defgroup USBH_CORE_Exported_Variables 78 * @{ 79 */ 80 81 /** 82 * @} 83 */ 84 85 /** @defgroup USBH_CORE_Exported_FunctionsPrototype 86 * @{ 87 */ 88 89 90 USBH_StatusTypeDef USBH_Init(USBH_HandleTypeDef *phost, void (*pUsrFunc)(USBH_HandleTypeDef *phost, uint8_t id), uint8_t id); 91 USBH_StatusTypeDef USBH_DeInit(USBH_HandleTypeDef *phost); 92 USBH_StatusTypeDef USBH_RegisterClass(USBH_HandleTypeDef *phost, USBH_ClassTypeDef *pclass); 93 USBH_StatusTypeDef USBH_SelectInterface(USBH_HandleTypeDef *phost, uint8_t interface); 94 uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost, 95 uint8_t Class, 96 uint8_t SubClass, 97 uint8_t Protocol); 98 uint8_t USBH_GetActiveClass(USBH_HandleTypeDef *phost); 99 100 uint8_t USBH_FindInterfaceIndex(USBH_HandleTypeDef *phost, 101 uint8_t interface_number, 102 uint8_t alt_settings); 103 104 uint8_t USBH_IsPortEnabled(USBH_HandleTypeDef *phost); 105 106 USBH_StatusTypeDef USBH_Start(USBH_HandleTypeDef *phost); 107 USBH_StatusTypeDef USBH_Stop(USBH_HandleTypeDef *phost); 108 USBH_StatusTypeDef USBH_Process(USBH_HandleTypeDef *phost); 109 USBH_StatusTypeDef USBH_ReEnumerate(USBH_HandleTypeDef *phost); 110 111 /* USBH Low Level Driver */ 112 USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost); 113 USBH_StatusTypeDef USBH_LL_DeInit(USBH_HandleTypeDef *phost); 114 USBH_StatusTypeDef USBH_LL_Start(USBH_HandleTypeDef *phost); 115 USBH_StatusTypeDef USBH_LL_Stop(USBH_HandleTypeDef *phost); 116 117 USBH_StatusTypeDef USBH_LL_Connect(USBH_HandleTypeDef *phost); 118 USBH_StatusTypeDef USBH_LL_Disconnect(USBH_HandleTypeDef *phost); 119 USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost); 120 USBH_StatusTypeDef USBH_LL_ResetPort(USBH_HandleTypeDef *phost); 121 uint32_t USBH_LL_GetLastXferSize(USBH_HandleTypeDef *phost, 122 uint8_t pipe); 123 124 USBH_StatusTypeDef USBH_LL_DriverVBUS(USBH_HandleTypeDef *phost, 125 uint8_t state); 126 127 USBH_StatusTypeDef USBH_LL_OpenPipe(USBH_HandleTypeDef *phost, 128 uint8_t pipe, 129 uint8_t epnum, 130 uint8_t dev_address, 131 uint8_t speed, 132 uint8_t ep_type, 133 uint16_t mps); 134 135 USBH_StatusTypeDef USBH_LL_ClosePipe(USBH_HandleTypeDef *phost, 136 uint8_t pipe); 137 138 USBH_StatusTypeDef USBH_LL_SubmitURB(USBH_HandleTypeDef *phost, 139 uint8_t pipe, 140 uint8_t direction, 141 uint8_t ep_type, 142 uint8_t token, 143 uint8_t *pbuff, 144 uint16_t length, 145 uint8_t do_ping); 146 147 USBH_URBStateTypeDef USBH_LL_GetURBState(USBH_HandleTypeDef *phost, 148 uint8_t pipe); 149 150 #if (USBH_USE_OS == 1U) 151 USBH_StatusTypeDef USBH_LL_NotifyURBChange(USBH_HandleTypeDef *phost); 152 #endif 153 154 USBH_StatusTypeDef USBH_LL_SetToggle(USBH_HandleTypeDef *phost, 155 uint8_t pipe, uint8_t toggle); 156 157 uint8_t USBH_LL_GetToggle(USBH_HandleTypeDef *phost, uint8_t pipe); 158 159 void USBH_LL_PortDisabled(USBH_HandleTypeDef *phost); 160 void USBH_LL_PortEnabled(USBH_HandleTypeDef *phost); 161 162 /* USBH Time base */ 163 void USBH_LL_SetTimer(USBH_HandleTypeDef *phost, uint32_t time); 164 void USBH_LL_IncTimer(USBH_HandleTypeDef *phost); 165 166 void USBH_Delay(uint32_t Delay); 167 168 /** 169 * @} 170 */ 171 172 #ifdef __cplusplus 173 } 174 #endif 175 176 #endif /* __USBH_CORE_H */ 177 /** 178 * @} 179 */ 180 181 /** 182 * @} 183 */ 184 185 /** 186 * @} 187 */ 188 189 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 190 191 192 193