[b371844] | 1 | /*
|
---|
| 2 | * Copyright (c) 2010 Vojtech Horky
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /** @addtogroup usb
|
---|
| 30 | * @{
|
---|
| 31 | */
|
---|
| 32 | /** @file
|
---|
| 33 | * @brief Connection handling of calls from host (implementation).
|
---|
| 34 | */
|
---|
| 35 | #include <assert.h>
|
---|
| 36 | #include <errno.h>
|
---|
[4b4c797] | 37 | #include <usb/usb.h>
|
---|
[b371844] | 38 |
|
---|
| 39 | #include "vhcd.h"
|
---|
| 40 | #include "conn.h"
|
---|
| 41 | #include "hc.h"
|
---|
| 42 |
|
---|
[63b4f90] | 43 | static int enqueue_transfer_out(usb_hc_device_t *hc,
|
---|
| 44 | usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
|
---|
| 45 | void *buffer, size_t size,
|
---|
| 46 | usb_hcd_transfer_callback_out_t callback, void *arg)
|
---|
| 47 | {
|
---|
| 48 | printf(NAME ": transfer OUT [%d.%d (%s); %u]\n",
|
---|
| 49 | dev->address, endpoint->endpoint,
|
---|
| 50 | usb_str_transfer_type(endpoint->transfer_type),
|
---|
| 51 | size);
|
---|
| 52 | return ENOTSUP;
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | static int enqueue_transfer_setup(usb_hc_device_t *hc,
|
---|
| 56 | usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
|
---|
| 57 | void *buffer, size_t size,
|
---|
| 58 | usb_hcd_transfer_callback_out_t callback, void *arg)
|
---|
| 59 | {
|
---|
| 60 | printf(NAME ": transfer SETUP [%d.%d (%s); %u]\n",
|
---|
| 61 | dev->address, endpoint->endpoint,
|
---|
| 62 | usb_str_transfer_type(endpoint->transfer_type),
|
---|
| 63 | size);
|
---|
| 64 | return ENOTSUP;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | static int enqueue_transfer_in(usb_hc_device_t *hc,
|
---|
| 68 | usb_hcd_attached_device_info_t *dev, usb_hc_endpoint_info_t *endpoint,
|
---|
| 69 | void *buffer, size_t size,
|
---|
| 70 | usb_hcd_transfer_callback_in_t callback, void *arg)
|
---|
| 71 | {
|
---|
| 72 | printf(NAME ": transfer IN [%d.%d (%s); %u]\n",
|
---|
| 73 | dev->address, endpoint->endpoint,
|
---|
| 74 | usb_str_transfer_type(endpoint->transfer_type),
|
---|
| 75 | size);
|
---|
| 76 | return ENOTSUP;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 |
|
---|
| 80 | usb_hcd_transfer_ops_t vhc_transfer_ops = {
|
---|
| 81 | .transfer_out = enqueue_transfer_out,
|
---|
| 82 | .transfer_in = enqueue_transfer_in,
|
---|
| 83 | .transfer_setup = enqueue_transfer_setup
|
---|
| 84 | };
|
---|
| 85 |
|
---|
[b371844] | 86 | /**
|
---|
| 87 | * @}
|
---|
| 88 | */
|
---|