| 1 |
/** |
| 2 |
****************************************************************************** |
| 3 |
* @file usb_bsp.c |
| 4 |
* @author MCD Application Team |
| 5 |
* @version V3.0.0 |
| 6 |
* @date 18-February-2014 |
| 7 |
* @brief This file implements the board support package for the USB host library |
| 8 |
****************************************************************************** |
| 9 |
* @attention |
| 10 |
* |
| 11 |
* <h2><center>© 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 |
/* Includes ------------------------------------------------------------------*/ |
| 29 |
#include "usbh_core.h" |
| 30 |
|
| 31 |
/** |
| 32 |
* @brief USBH_LL_Init |
| 33 |
* Initialize the Low Level portion of the Host driver. |
| 34 |
* @param phost: Host handle |
| 35 |
* @retval USBH Status |
| 36 |
*/ |
| 37 |
USBH_StatusTypeDef USBH_LL_Init (USBH_HandleTypeDef *phost) |
| 38 |
{ |
| 39 |
|
| 40 |
return USBH_OK; |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* @brief USBH_LL_DeInit |
| 45 |
* De-Initialize the Low Level portion of the Host driver. |
| 46 |
* @param phost: Host handle |
| 47 |
* @retval USBH Status |
| 48 |
*/ |
| 49 |
USBH_StatusTypeDef USBH_LL_DeInit (USBH_HandleTypeDef *phost) |
| 50 |
{ |
| 51 |
|
| 52 |
return USBH_OK; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* @brief USBH_LL_Start |
| 57 |
* Start the Low Level portion of the Host driver. |
| 58 |
* @param phost: Host handle |
| 59 |
* @retval USBH Status |
| 60 |
*/ |
| 61 |
USBH_StatusTypeDef USBH_LL_Start(USBH_HandleTypeDef *phost) |
| 62 |
{ |
| 63 |
|
| 64 |
return USBH_OK; |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* @brief USBH_LL_Stop |
| 69 |
* Stop the Low Level portion of the Host driver. |
| 70 |
* @param phost: Host handle |
| 71 |
* @retval USBH Status |
| 72 |
*/ |
| 73 |
USBH_StatusTypeDef USBH_LL_Stop (USBH_HandleTypeDef *phost) |
| 74 |
{ |
| 75 |
|
| 76 |
return USBH_OK; |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* @brief USBH_LL_GetSpeed |
| 81 |
* Return the USB Host Speed from the Low Level Driver. |
| 82 |
* @param phost: Host handle |
| 83 |
* @retval USBH Speeds |
| 84 |
*/ |
| 85 |
USBH_SpeedTypeDef USBH_LL_GetSpeed (USBH_HandleTypeDef *phost) |
| 86 |
{ |
| 87 |
USBH_SpeedTypeDef speed = 0; |
| 88 |
|
| 89 |
|
| 90 |
return speed; |
| 91 |
} |
| 92 |
|
| 93 |
/** |
| 94 |
* @brief USBH_LL_ResetPort |
| 95 |
* Reset the Host Port of the Low Level Driver. |
| 96 |
* @param phost: Host handle |
| 97 |
* @retval USBH Status |
| 98 |
*/ |
| 99 |
USBH_StatusTypeDef USBH_LL_ResetPort (USBH_HandleTypeDef *phost) |
| 100 |
{ |
| 101 |
|
| 102 |
return USBH_OK; |
| 103 |
} |
| 104 |
|
| 105 |
/** |
| 106 |
* @brief USBH_LL_GetLastXferSize |
| 107 |
* Return the last transfered packet size. |
| 108 |
* @param phost: Host handle |
| 109 |
* @param pipe: Pipe index |
| 110 |
* @retval Packet Size |
| 111 |
*/ |
| 112 |
uint32_t USBH_LL_GetLastXferSize (USBH_HandleTypeDef *phost, uint8_t pipe) |
| 113 |
{ |
| 114 |
|
| 115 |
} |
| 116 |
|
| 117 |
/** |
| 118 |
* @brief USBH_LL_OpenPipe |
| 119 |
* Open a pipe of the Low Level Driver. |
| 120 |
* @param phost: Host handle |
| 121 |
* @param pipe_num: Pipe index |
| 122 |
* @param epnum: Endpoint Number |
| 123 |
* @param dev_address: Device USB address |
| 124 |
* @param speed: Device Speed |
| 125 |
* @param ep_type: Endpoint Type |
| 126 |
* @param mps: Endpoint Max Packet Size |
| 127 |
* @retval USBH Status |
| 128 |
*/ |
| 129 |
USBH_StatusTypeDef USBH_LL_OpenPipe (USBH_HandleTypeDef *phost, |
| 130 |
uint8_t pipe_num, |
| 131 |
uint8_t epnum, |
| 132 |
uint8_t dev_address, |
| 133 |
uint8_t speed, |
| 134 |
uint8_t ep_type, |
| 135 |
uint16_t mps) |
| 136 |
{ |
| 137 |
|
| 138 |
return USBH_OK; |
| 139 |
} |
| 140 |
|
| 141 |
/** |
| 142 |
* @brief USBH_LL_ClosePipe |
| 143 |
* Close a pipe of the Low Level Driver. |
| 144 |
* @param phost: Host handle |
| 145 |
* @param pipe_num: Pipe index |
| 146 |
* @retval USBH Status |
| 147 |
*/ |
| 148 |
USBH_StatusTypeDef USBH_LL_ClosePipe (USBH_HandleTypeDef *phost, uint8_t pipe) |
| 149 |
{ |
| 150 |
|
| 151 |
} |
| 152 |
/** |
| 153 |
* @brief USBH_LL_SubmitURB |
| 154 |
* Submit a new URB to the low level driver. |
| 155 |
* @param phost: Host handle |
| 156 |
* @param pipe: Pipe index |
| 157 |
* This parameter can be a value from 1 to 15 |
| 158 |
* @param direction : Channel number |
| 159 |
* This parameter can be one of the these values: |
| 160 |
* 0 : Output |
| 161 |
* 1 : Input |
| 162 |
* @param ep_type : Endpoint Type |
| 163 |
* This parameter can be one of the these values: |
| 164 |
* @arg EP_TYPE_CTRL: Control type |
| 165 |
* @arg EP_TYPE_ISOC: Isochrounous type |
| 166 |
* @arg EP_TYPE_BULK: Bulk type |
| 167 |
* @arg EP_TYPE_INTR: Interrupt type |
| 168 |
* @param token : Endpoint Type |
| 169 |
* This parameter can be one of the these values: |
| 170 |
* @arg 0: PID_SETUP |
| 171 |
* @arg 1: PID_DATA |
| 172 |
* @param pbuff : pointer to URB data |
| 173 |
* @param length : Length of URB data |
| 174 |
* @param do_ping : activate do ping protocol (for high speed only) |
| 175 |
* This parameter can be one of the these values: |
| 176 |
* 0 : do ping inactive |
| 177 |
* 1 : do ping active |
| 178 |
* @retval Status |
| 179 |
*/ |
| 180 |
|
| 181 |
USBH_StatusTypeDef USBH_LL_SubmitURB (USBH_HandleTypeDef *phost, |
| 182 |
uint8_t pipe, |
| 183 |
uint8_t direction , |
| 184 |
uint8_t ep_type, |
| 185 |
uint8_t token, |
| 186 |
uint8_t* pbuff, |
| 187 |
uint16_t length, |
| 188 |
uint8_t do_ping ) |
| 189 |
{ |
| 190 |
|
| 191 |
return USBH_OK; |
| 192 |
} |
| 193 |
|
| 194 |
/** |
| 195 |
* @brief USBH_LL_GetURBState |
| 196 |
* Get a URB state from the low level driver. |
| 197 |
* @param phost: Host handle |
| 198 |
* @param pipe: Pipe index |
| 199 |
* This parameter can be a value from 1 to 15 |
| 200 |
* @retval URB state |
| 201 |
* This parameter can be one of the these values: |
| 202 |
* @arg URB_IDLE |
| 203 |
* @arg URB_DONE |
| 204 |
* @arg URB_NOTREADY |
| 205 |
* @arg URB_NYET |
| 206 |
* @arg URB_ERROR |
| 207 |
* @arg URB_STALL |
| 208 |
*/ |
| 209 |
USBH_URBStateTypeDef USBH_LL_GetURBState (USBH_HandleTypeDef *phost, uint8_t pipe) |
| 210 |
{ |
| 211 |
|
| 212 |
} |
| 213 |
|
| 214 |
/** |
| 215 |
* @brief USBH_LL_DriverVBUS |
| 216 |
* Drive VBUS. |
| 217 |
* @param phost: Host handle |
| 218 |
* @param state : VBUS state |
| 219 |
* This parameter can be one of the these values: |
| 220 |
* 0 : VBUS Active |
| 221 |
* 1 : VBUS Inactive |
| 222 |
* @retval Status |
| 223 |
*/ |
| 224 |
|
| 225 |
USBH_StatusTypeDef USBH_LL_DriverVBUS (USBH_HandleTypeDef *phost, uint8_t state) |
| 226 |
{ |
| 227 |
|
| 228 |
return USBH_OK; |
| 229 |
} |
| 230 |
|
| 231 |
/** |
| 232 |
* @brief USBH_LL_SetToggle |
| 233 |
* Set toggle for a pipe. |
| 234 |
* @param phost: Host handle |
| 235 |
* @param pipe: Pipe index |
| 236 |
* @param pipe_num: Pipe index |
| 237 |
* @param toggle: toggle (0/1) |
| 238 |
* @retval Status |
| 239 |
*/ |
| 240 |
USBH_StatusTypeDef USBH_LL_SetToggle (USBH_HandleTypeDef *phost, uint8_t pipe, uint8_t toggle) |
| 241 |
{ |
| 242 |
|
| 243 |
return USBH_OK; |
| 244 |
} |
| 245 |
|
| 246 |
/** |
| 247 |
* @brief USBH_LL_GetToggle |
| 248 |
* Return the current toggle of a pipe. |
| 249 |
* @param phost: Host handle |
| 250 |
* @param pipe: Pipe index |
| 251 |
* @retval toggle (0/1) |
| 252 |
*/ |
| 253 |
uint8_t USBH_LL_GetToggle (USBH_HandleTypeDef *phost, uint8_t pipe) |
| 254 |
{ |
| 255 |
uint8_t toggle = 0; |
| 256 |
|
| 257 |
|
| 258 |
return toggle; |
| 259 |
} |
| 260 |
/** |
| 261 |
* @brief USBH_Delay |
| 262 |
* Delay routine for the USB Host Library |
| 263 |
* @param Delay: Delay in ms |
| 264 |
* @retval None |
| 265 |
*/ |
| 266 |
void USBH_Delay (uint32_t Delay) |
| 267 |
{ |
| 268 |
|
| 269 |
} |
| 270 |
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |