source: mainline/uspace/drv/vhc/vhcd.h@ d3b6d5e

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since d3b6d5e was 6cb58e6, checked in by Vojtech Horky <vojtechhorky@…>, 14 years ago

Virtual USB layer rewritten

Major changes include

  • IPC sends whole transfers (not transactions)
  • separate transfer queues for each device in host controller
  • possibility to return NAK from virtual device (handled by HC)
  • better implementation of callbacks for non-zero endpoints

Still missing

  • communication for some transfer types (bulk)
  • face-lift ;-)
  • documentation
  • Property mode set to 100644
File size: 3.0 KB
Line 
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 drvusbvhc
30 * @{
31 */
32/** @file
33 * @brief Virtual USB host controller common definitions.
34 */
35#ifndef VHCD_VHCD_H_
36#define VHCD_VHCD_H_
37
38#include <usb/debug.h>
39#include <usbvirt/device.h>
40#include <usb/host/usb_endpoint_manager.h>
41#include <usb/host/device_keeper.h>
42#include <usbhc_iface.h>
43
44#define NAME "vhc"
45
46typedef struct {
47 link_t link;
48 int dev_phone;
49 usbvirt_device_t *dev_local;
50 bool plugged;
51 usb_address_t address;
52 fibril_mutex_t guard;
53 link_t transfer_queue;
54} vhc_virtdev_t;
55
56typedef struct {
57 uint32_t magic;
58 link_t devices;
59 fibril_mutex_t guard;
60 usb_endpoint_manager_t ep_manager;
61 usb_device_keeper_t dev_keeper;
62 usbvirt_device_t *hub;
63 ddf_fun_t *hc_fun;
64} vhc_data_t;
65
66typedef struct {
67 link_t link;
68 usb_address_t address;
69 usb_endpoint_t endpoint;
70 usb_direction_t direction;
71 usb_transfer_type_t transfer_type;
72 void *setup_buffer;
73 size_t setup_buffer_size;
74 void *data_buffer;
75 size_t data_buffer_size;
76 ddf_fun_t *ddf_fun;
77 void *callback_arg;
78 usbhc_iface_transfer_in_callback_t callback_in;
79 usbhc_iface_transfer_out_callback_t callback_out;
80} vhc_transfer_t;
81
82vhc_transfer_t *vhc_transfer_create(usb_address_t, usb_endpoint_t,
83 usb_direction_t, usb_transfer_type_t, ddf_fun_t *, void *);
84int vhc_virtdev_plug(vhc_data_t *, int, uintptr_t *);
85int vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *);
86int vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *);
87void vhc_virtdev_unplug(vhc_data_t *, uintptr_t);
88int vhc_virtdev_add_transfer(vhc_data_t *, vhc_transfer_t *);
89
90int vhc_transfer_queue_processor(void *arg);
91
92
93#endif
94/**
95 * @}
96 */
Note: See TracBrowser for help on using the repository browser.