Changeset 186d630 in mainline
- Timestamp:
- 2010-10-20T20:44:55Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bbfb86c
- Parents:
- 47e3a8e
- Location:
- uspace/lib/usbvirt
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbvirt/device.h
r47e3a8e r186d630 128 128 usb_endpoint_t endpoint, void *buffer, size_t size); 129 129 130 131 132 130 /* Device attributes. */ 133 131 … … 152 150 */ 153 151 int device_id_; 152 153 /** Main routine called when data is received from HC. 154 * @warning Do not change after initializing with 155 * usbvirt_device_init(). 156 * This function is here merely to make the interface more OOP. 157 */ 158 int (*receive_data)(struct usbvirt_device *dev, 159 usb_endpoint_t endpoint, void *buffer, size_t size); 160 154 161 } usbvirt_device_t; 155 162 -
uspace/lib/usbvirt/hub.h
r47e3a8e r186d630 46 46 int usbvirt_connect(usbvirt_device_t *, const char *); 47 47 int usbvirt_disconnect(void); 48 int usbvirt_connect_local(usbvirt_device_t *); 48 49 49 50 #endif -
uspace/lib/usbvirt/incoming.c
r47e3a8e r186d630 38 38 #include "private.h" 39 39 40 int handle_incoming_data(usb_endpoint_t endpoint, void *buffer, size_t size) 40 int handle_incoming_data(struct usbvirt_device *dev, 41 usb_endpoint_t endpoint, void *buffer, size_t size) 41 42 { 42 43 /* -
uspace/lib/usbvirt/main.c
r47e3a8e r186d630 69 69 } 70 70 71 handle_incoming_data(endpoint, buffer, len);71 device->receive_data(device, endpoint, buffer, len); 72 72 73 73 free(buffer); … … 104 104 { 105 105 dev->send_data = usbvirt_data_to_host; 106 dev->receive_data = handle_incoming_data; 106 107 dev->state = USBVIRT_STATE_DEFAULT; 107 108 dev->address = 0; … … 160 161 * @param hcd_path HCD identification under devfs 161 162 * (without <code>/dev/usb/</code>). 162 * @param device_id Internal device identification (used by HCD). 163 * @param callback Handler for callbacks from HCD. 163 * @param dev Device to connect. 164 164 * @return EOK on success or error code from errno.h. 165 165 */ … … 197 197 } 198 198 199 199 /** Prepares device as local. 200 * This is useful if you want to have a virtual device in the same task 201 * as HCD. 202 * 203 * @param dev Device to connect. 204 * @return Always EOK. 205 */ 206 int usbvirt_connect_local(usbvirt_device_t *dev) 207 { 208 dev->vhcd_phone_ = -1; 209 device_init(dev); 210 211 return EOK; 212 } 213 214 /** Disconnects device from HCD. 215 * 216 * @return Always EOK. 217 */ 200 218 int usbvirt_disconnect(void) 201 219 { -
uspace/lib/usbvirt/private.h
r47e3a8e r186d630 51 51 usb_endpoint_t endpoint, void *buffer, size_t size); 52 52 53 int handle_incoming_data(usb_endpoint_t endpoint, void *buffer, size_t size); 53 int handle_incoming_data(struct usbvirt_device *dev, 54 usb_endpoint_t endpoint, void *buffer, size_t size); 54 55 55 56 int control_pipe(void *buffer, size_t size);
Note:
See TracChangeset
for help on using the changeset viewer.