kopia lustrzana https://github.com/micropython/micropython
271 wiersze
7.7 KiB
C
271 wiersze
7.7 KiB
C
![]() |
/**
|
||
|
******************************************************************************
|
||
|
* @file usb_bsp.c
|
||
|
* @author MCD Application Team
|
||
|
* @version V3.0.0
|
||
|
* @date 18-February-2014
|
||
|
* @brief This file implements the board support package for the USB host library
|
||
|
******************************************************************************
|
||
|
* @attention
|
||
|
*
|
||
|
* <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2>
|
||
|
*
|
||
|
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
|
||
|
* You may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at:
|
||
|
*
|
||
|
* http://www.st.com/software_license_agreement_liberty_v2
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*
|
||
|
******************************************************************************
|
||
|
*/
|
||
|
|
||
|
/* Includes ------------------------------------------------------------------*/
|
||
|
#include "usbh_core.h"
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_Init
|
||
|
* Initialize the Low Level portion of the Host driver.
|
||
|
* @param phost: Host handle
|
||
|
* @retval USBH Status
|
||
|
*/
|
||
|
USBH_StatusTypeDef USBH_LL_Init (USBH_HandleTypeDef *phost)
|
||
|
{
|
||
|
|
||
|
return USBH_OK;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_DeInit
|
||
|
* De-Initialize the Low Level portion of the Host driver.
|
||
|
* @param phost: Host handle
|
||
|
* @retval USBH Status
|
||
|
*/
|
||
|
USBH_StatusTypeDef USBH_LL_DeInit (USBH_HandleTypeDef *phost)
|
||
|
{
|
||
|
|
||
|
return USBH_OK;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_Start
|
||
|
* Start the Low Level portion of the Host driver.
|
||
|
* @param phost: Host handle
|
||
|
* @retval USBH Status
|
||
|
*/
|
||
|
USBH_StatusTypeDef USBH_LL_Start(USBH_HandleTypeDef *phost)
|
||
|
{
|
||
|
|
||
|
return USBH_OK;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_Stop
|
||
|
* Stop the Low Level portion of the Host driver.
|
||
|
* @param phost: Host handle
|
||
|
* @retval USBH Status
|
||
|
*/
|
||
|
USBH_StatusTypeDef USBH_LL_Stop (USBH_HandleTypeDef *phost)
|
||
|
{
|
||
|
|
||
|
return USBH_OK;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_GetSpeed
|
||
|
* Return the USB Host Speed from the Low Level Driver.
|
||
|
* @param phost: Host handle
|
||
|
* @retval USBH Speeds
|
||
|
*/
|
||
|
USBH_SpeedTypeDef USBH_LL_GetSpeed (USBH_HandleTypeDef *phost)
|
||
|
{
|
||
|
USBH_SpeedTypeDef speed = 0;
|
||
|
|
||
|
|
||
|
return speed;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_ResetPort
|
||
|
* Reset the Host Port of the Low Level Driver.
|
||
|
* @param phost: Host handle
|
||
|
* @retval USBH Status
|
||
|
*/
|
||
|
USBH_StatusTypeDef USBH_LL_ResetPort (USBH_HandleTypeDef *phost)
|
||
|
{
|
||
|
|
||
|
return USBH_OK;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_GetLastXferSize
|
||
|
* Return the last transfered packet size.
|
||
|
* @param phost: Host handle
|
||
|
* @param pipe: Pipe index
|
||
|
* @retval Packet Size
|
||
|
*/
|
||
|
uint32_t USBH_LL_GetLastXferSize (USBH_HandleTypeDef *phost, uint8_t pipe)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_OpenPipe
|
||
|
* Open a pipe of the Low Level Driver.
|
||
|
* @param phost: Host handle
|
||
|
* @param pipe_num: Pipe index
|
||
|
* @param epnum: Endpoint Number
|
||
|
* @param dev_address: Device USB address
|
||
|
* @param speed: Device Speed
|
||
|
* @param ep_type: Endpoint Type
|
||
|
* @param mps: Endpoint Max Packet Size
|
||
|
* @retval USBH Status
|
||
|
*/
|
||
|
USBH_StatusTypeDef USBH_LL_OpenPipe (USBH_HandleTypeDef *phost,
|
||
|
uint8_t pipe_num,
|
||
|
uint8_t epnum,
|
||
|
uint8_t dev_address,
|
||
|
uint8_t speed,
|
||
|
uint8_t ep_type,
|
||
|
uint16_t mps)
|
||
|
{
|
||
|
|
||
|
return USBH_OK;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_ClosePipe
|
||
|
* Close a pipe of the Low Level Driver.
|
||
|
* @param phost: Host handle
|
||
|
* @param pipe_num: Pipe index
|
||
|
* @retval USBH Status
|
||
|
*/
|
||
|
USBH_StatusTypeDef USBH_LL_ClosePipe (USBH_HandleTypeDef *phost, uint8_t pipe)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
/**
|
||
|
* @brief USBH_LL_SubmitURB
|
||
|
* Submit a new URB to the low level driver.
|
||
|
* @param phost: Host handle
|
||
|
* @param pipe: Pipe index
|
||
|
* This parameter can be a value from 1 to 15
|
||
|
* @param direction : Channel number
|
||
|
* This parameter can be one of the these values:
|
||
|
* 0 : Output
|
||
|
* 1 : Input
|
||
|
* @param ep_type : Endpoint Type
|
||
|
* This parameter can be one of the these values:
|
||
|
* @arg EP_TYPE_CTRL: Control type
|
||
|
* @arg EP_TYPE_ISOC: Isochrounous type
|
||
|
* @arg EP_TYPE_BULK: Bulk type
|
||
|
* @arg EP_TYPE_INTR: Interrupt type
|
||
|
* @param token : Endpoint Type
|
||
|
* This parameter can be one of the these values:
|
||
|
* @arg 0: PID_SETUP
|
||
|
* @arg 1: PID_DATA
|
||
|
* @param pbuff : pointer to URB data
|
||
|
* @param length : Length of URB data
|
||
|
* @param do_ping : activate do ping protocol (for high speed only)
|
||
|
* This parameter can be one of the these values:
|
||
|
* 0 : do ping inactive
|
||
|
* 1 : do ping active
|
||
|
* @retval Status
|
||
|
*/
|
||
|
|
||
|
USBH_StatusTypeDef USBH_LL_SubmitURB (USBH_HandleTypeDef *phost,
|
||
|
uint8_t pipe,
|
||
|
uint8_t direction ,
|
||
|
uint8_t ep_type,
|
||
|
uint8_t token,
|
||
|
uint8_t* pbuff,
|
||
|
uint16_t length,
|
||
|
uint8_t do_ping )
|
||
|
{
|
||
|
|
||
|
return USBH_OK;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_GetURBState
|
||
|
* Get a URB state from the low level driver.
|
||
|
* @param phost: Host handle
|
||
|
* @param pipe: Pipe index
|
||
|
* This parameter can be a value from 1 to 15
|
||
|
* @retval URB state
|
||
|
* This parameter can be one of the these values:
|
||
|
* @arg URB_IDLE
|
||
|
* @arg URB_DONE
|
||
|
* @arg URB_NOTREADY
|
||
|
* @arg URB_NYET
|
||
|
* @arg URB_ERROR
|
||
|
* @arg URB_STALL
|
||
|
*/
|
||
|
USBH_URBStateTypeDef USBH_LL_GetURBState (USBH_HandleTypeDef *phost, uint8_t pipe)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_DriverVBUS
|
||
|
* Drive VBUS.
|
||
|
* @param phost: Host handle
|
||
|
* @param state : VBUS state
|
||
|
* This parameter can be one of the these values:
|
||
|
* 0 : VBUS Active
|
||
|
* 1 : VBUS Inactive
|
||
|
* @retval Status
|
||
|
*/
|
||
|
|
||
|
USBH_StatusTypeDef USBH_LL_DriverVBUS (USBH_HandleTypeDef *phost, uint8_t state)
|
||
|
{
|
||
|
|
||
|
return USBH_OK;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_SetToggle
|
||
|
* Set toggle for a pipe.
|
||
|
* @param phost: Host handle
|
||
|
* @param pipe: Pipe index
|
||
|
* @param pipe_num: Pipe index
|
||
|
* @param toggle: toggle (0/1)
|
||
|
* @retval Status
|
||
|
*/
|
||
|
USBH_StatusTypeDef USBH_LL_SetToggle (USBH_HandleTypeDef *phost, uint8_t pipe, uint8_t toggle)
|
||
|
{
|
||
|
|
||
|
return USBH_OK;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @brief USBH_LL_GetToggle
|
||
|
* Return the current toggle of a pipe.
|
||
|
* @param phost: Host handle
|
||
|
* @param pipe: Pipe index
|
||
|
* @retval toggle (0/1)
|
||
|
*/
|
||
|
uint8_t USBH_LL_GetToggle (USBH_HandleTypeDef *phost, uint8_t pipe)
|
||
|
{
|
||
|
uint8_t toggle = 0;
|
||
|
|
||
|
|
||
|
return toggle;
|
||
|
}
|
||
|
/**
|
||
|
* @brief USBH_Delay
|
||
|
* Delay routine for the USB Host Library
|
||
|
* @param Delay: Delay in ms
|
||
|
* @retval None
|
||
|
*/
|
||
|
void USBH_Delay (uint32_t Delay)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|