00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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