Driver_USBH.c 4.8 KB
Newer Older
Nameless-Y's avatar
Nameless-Y 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
/*
 * Copyright (c) 2013-2018 Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the License); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * www.apache.org/licenses/LICENSE-2.0
 *
 * 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.
 */
 
#include "Driver_USBH.h"

/* USB Host Driver */

#define ARM_USBH_DRV_VERSION    ARM_DRIVER_VERSION_MAJOR_MINOR(2, 0) /* driver version */

/* Driver Version */
static const ARM_DRIVER_VERSION usbh_driver_version = { 
    ARM_USBH_API_VERSION,
    ARM_USBH_DRV_VERSION
};

/* Driver Capabilities */
static const ARM_USBH_CAPABILITIES usbd_driver_capabilities = {
    0x0001, /* Root HUB available Ports Mask   */
    0,      /* Automatic SPLIT packet handling */
    0,      /* Signal Connect event */
    0,      /* Signal Disconnect event */
    0       /* Signal Overcurrent event */
};

//
// Functions
//

ARM_DRIVER_VERSION ARM_USBH_GetVersion(void)
{
}

ARM_USBH_CAPABILITIES ARM_USBH_GetCapabilities(void)
{
}

int32_t ARM_USBH_Initialize(ARM_USBH_SignalPortEvent_t cb_port_event,
                            ARM_USBH_SignalEndpointEvent_t cb_endpoint_event)
{
}

int32_t ARM_USBH_Uninitialize(void)
{
}

int32_t ARM_USBH_PowerControl(ARM_POWER_STATE state)
{
    switch (state)
    {
    case ARM_POWER_OFF:
        break;

    case ARM_POWER_LOW:
        break;

    case ARM_POWER_FULL:
        break;

    default:
        return ARM_DRIVER_ERROR_UNSUPPORTED;
    }
}

int32_t ARM_USBH_PortVbusOnOff(uint8_t port, bool vbus)
{
}

int32_t ARM_USBH_PortReset(uint8_t port)
{
}

int32_t ARM_USBH_PortSuspend(uint8_t port)
{
}

int32_t ARM_USBH_PortResume(uint8_t port)
{
}

ARM_USBH_PORT_STATE ARM_USBH_PortGetState(uint8_t port)
{
}

ARM_USBH_EP_HANDLE ARM_USBH_EndpointCreate(uint8_t dev_addr,
                                           uint8_t dev_speed,
                                           uint8_t hub_addr,
                                           uint8_t hub_port,
                                           uint8_t ep_addr,
                                           uint8_t ep_type,
                                           uint16_t ep_max_packet_size,
                                           uint8_t ep_interval)
{
}

int32_t ARM_USBH_EndpointModify(ARM_USBH_EP_HANDLE ep_hndl,
                                uint8_t dev_addr,
                                uint8_t dev_speed,
                                uint8_t hub_addr,
                                uint8_t hub_port,
                                uint16_t ep_max_packet_size)
{
}

int32_t ARM_USBH_EndpointDelete(ARM_USBH_EP_HANDLE ep_hndl)
{
}

int32_t ARM_USBH_EndpointReset(ARM_USBH_EP_HANDLE ep_hndl)
{
}

int32_t ARM_USBH_EndpointTransfer(ARM_USBH_EP_HANDLE ep_hndl,
                                  uint32_t packet,
                                  uint8_t *data,
                                  uint32_t num)
{
}

uint32_t ARM_USBH_EndpointTransferGetResult(ARM_USBH_EP_HANDLE ep_hndl)
{
}

int32_t ARM_USBH_EndpointTransferAbort(ARM_USBH_EP_HANDLE ep_hndl)
{
}

uint16_t ARM_USBH_GetFrameNumber(void)
{
}

void ARM_USBH_SignalPortEvent(uint8_t port, uint32_t event)
{
    // function body
}

void ARM_USBH_SignalEndpointEvent(ARM_USBH_EP_HANDLE ep_hndl, uint32_t event)
{
    // function body
}

/* USB Host HCI (OHCI/EHCI) Driver */

/* Driver Version */
static const ARM_DRIVER_VERSION usbh_hci_driver_version = { 
    ARM_USBH_API_VERSION,
    ARM_USBH_DRV_VERSION
};

/* Driver Capabilities */
static const ARM_USBH_HCI_CAPABILITIES usbh_hci_driver_capabilities = {
    0x0001  /* Root HUB available Ports Mask   */
};

//
// Functions
//

ARM_DRIVER_VERSION ARM_USBH_HCI_GetVersion(void)
{
}

ARM_USBH_HCI_CAPABILITIES ARM_USBH_HCI_GetCapabilities(void)
{
}

int32_t ARM_USBH_HCI_Initialize(ARM_USBH_HCI_Interrupt_t cb_interrupt)
{
}

int32_t ARM_USBH_HCI_Uninitialize(void)
{
}

int32_t ARM_USBH_HCI_PowerControl(ARM_POWER_STATE state)
{
    switch (state)
    {
    case ARM_POWER_OFF:
        break;

    case ARM_POWER_LOW:
        break;

    case ARM_POWER_FULL:
        break;

    default:
        return ARM_DRIVER_ERROR_UNSUPPORTED;
    }
}

int32_t ARM_USBH_HCI_PortVbusOnOff(uint8_t port, bool vbus)
{
}

void ARM_USBH_HCI_Interrupt(void)
{
    // function body
}

// End USBH Interface

ARM_DRIVER_USBH_HCI Driver_USBH_HCI = {
    ARM_USBH_HCI_GetVersion,
    ARM_USBH_HCI_GetCapabilities,
    ARM_USBH_HCI_Initialize,
    ARM_USBH_HCI_Uninitialize,
    ARM_USBH_HCI_PowerControl,
    ARM_USBH_HCI_PortVbusOnOff
};