2 * Copyright (c) 2013-2018 Arm Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #include "Driver_USBH.h"
23 #define ARM_USBH_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1, 0) /* driver version */
26 static const ARM_DRIVER_VERSION usbh_driver_version = {
31 /* Driver Capabilities */
32 static const ARM_USBH_CAPABILITIES usbd_driver_capabilities = {
33 0x0001, /* Root HUB available Ports Mask */
34 0, /* Automatic SPLIT packet handling */
35 0, /* Signal Connect event */
36 0, /* Signal Disconnect event */
37 0 /* Signal Overcurrent event */
44 static ARM_DRIVER_VERSION ARM_USBH_GetVersion(void)
46 return usbh_driver_version;
49 static ARM_USBH_CAPABILITIES ARM_USBH_GetCapabilities(void)
51 return usbd_driver_capabilities;
54 static int32_t ARM_USBH_Initialize(ARM_USBH_SignalPortEvent_t cb_port_event,
55 ARM_USBH_SignalPipeEvent_t cb_pipe_event)
59 static int32_t ARM_USBH_Uninitialize(void)
63 static int32_t ARM_USBH_PowerControl(ARM_POWER_STATE state)
77 return ARM_DRIVER_ERROR_UNSUPPORTED;
81 static int32_t ARM_USBH_PortVbusOnOff(uint8_t port, bool vbus)
85 static int32_t ARM_USBH_PortReset(uint8_t port)
89 static int32_t ARM_USBH_PortSuspend(uint8_t port)
93 static int32_t ARM_USBH_PortResume(uint8_t port)
97 static ARM_USBH_PORT_STATE ARM_USBH_PortGetState(uint8_t port)
101 static ARM_USBH_PIPE_HANDLE ARM_USBH_PipeCreate(uint8_t dev_addr,
107 uint16_t ep_max_packet_size,
112 static int32_t ARM_USBH_PipeModify(ARM_USBH_PIPE_HANDLE pipe_hndl,
117 uint16_t ep_max_packet_size)
121 static int32_t ARM_USBH_PipeDelete(ARM_USBH_PIPE_HANDLE pipe_hndl)
125 static int32_t ARM_USBH_PipeReset(ARM_USBH_PIPE_HANDLE pipe_hndl)
129 static int32_t ARM_USBH_PipeTransfer(ARM_USBH_PIPE_HANDLE pipe_hndl,
136 static uint32_t ARM_USBH_PipeTransferGetResult(ARM_USBH_PIPE_HANDLE pipe_hndl)
140 static int32_t ARM_USBH_PipeTransferAbort(ARM_USBH_PIPE_HANDLE pipe_hndl)
144 static uint16_t ARM_USBH_GetFrameNumber(void)
148 static void ARM_USBH_SignalPortEvent(uint8_t port, uint32_t event)
153 static void ARM_USBH_SignalPipeEvent(ARM_USBH_PIPE_HANDLE pipe_hndl, uint32_t event)
158 // End USBH Interface
160 ARM_DRIVER_USBH Driver_USBH0 = {
162 ARM_USBH_GetCapabilities,
164 ARM_USBH_Uninitialize,
165 ARM_USBH_PowerControl,
166 ARM_USBH_PortVbusOnOff,
168 ARM_USBH_PortSuspend,
170 ARM_USBH_PortGetState,
175 ARM_USBH_PipeTransfer,
176 ARM_USBH_PipeTransferGetResult,
177 ARM_USBH_PipeTransferAbort,
178 ARM_USBH_GetFrameNumber