vhcd.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2010 Vojtech Horky
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef VHCD_VHCD_H_
00036 #define VHCD_VHCD_H_
00037 
00038 #include <usb/debug.h>
00039 #include <usbvirt/device.h>
00040 #include <usb/host/usb_endpoint_manager.h>
00041 #include <usb/host/device_keeper.h>
00042 #include <usbhc_iface.h>
00043 
00044 #define NAME "vhc"
00045 
00046 typedef struct {
00047         link_t link;
00048         int dev_phone;
00049         usbvirt_device_t *dev_local;
00050         bool plugged;
00051         usb_address_t address;
00052         fibril_mutex_t guard;
00053         link_t transfer_queue;
00054 } vhc_virtdev_t;
00055 
00056 typedef struct {
00057         uint32_t magic;
00058         link_t devices;
00059         fibril_mutex_t guard;
00060         usb_endpoint_manager_t ep_manager;
00061         usb_device_keeper_t dev_keeper;
00062         usbvirt_device_t *hub;
00063         ddf_fun_t *hc_fun;
00064 } vhc_data_t;
00065 
00066 typedef struct {
00067         link_t link;
00068         usb_address_t address;
00069         usb_endpoint_t endpoint;
00070         usb_direction_t direction;
00071         usb_transfer_type_t transfer_type;
00072         void *setup_buffer;
00073         size_t setup_buffer_size;
00074         void *data_buffer;
00075         size_t data_buffer_size;
00076         ddf_fun_t *ddf_fun;
00077         void *callback_arg;
00078         usbhc_iface_transfer_in_callback_t callback_in;
00079         usbhc_iface_transfer_out_callback_t callback_out;
00080 } vhc_transfer_t;
00081 
00082 vhc_transfer_t *vhc_transfer_create(usb_address_t, usb_endpoint_t,
00083     usb_direction_t, usb_transfer_type_t, ddf_fun_t *, void *);
00084 int vhc_virtdev_plug(vhc_data_t *, int, uintptr_t *);
00085 int vhc_virtdev_plug_local(vhc_data_t *, usbvirt_device_t *, uintptr_t *);
00086 int vhc_virtdev_plug_hub(vhc_data_t *, usbvirt_device_t *, uintptr_t *);
00087 void vhc_virtdev_unplug(vhc_data_t *, uintptr_t);
00088 int vhc_virtdev_add_transfer(vhc_data_t *, vhc_transfer_t *);
00089 
00090 int vhc_transfer_queue_processor(void *arg);
00091 
00092 
00093 #endif
00094 

Generated on Thu Jun 2 07:45:45 2011 for HelenOS/USB by  doxygen 1.4.7