Changeset ca07cd3 in mainline for uspace/lib/usbvirt/device.h
- Timestamp:
- 2010-10-25T13:23:33Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 23cb44b
- Parents:
- 355f7c2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbvirt/device.h
r355f7c2 rca07cd3 40 40 #include <usb/devreq.h> 41 41 42 struct usbvirt_device;42 typedef struct usbvirt_device usbvirt_device_t; 43 43 struct usbvirt_control_transfer; 44 44 45 typedef int (*usbvirt_on_device_request_t)( struct usbvirt_device*dev,45 typedef int (*usbvirt_on_device_request_t)(usbvirt_device_t *dev, 46 46 usb_device_request_setup_packet_t *request, 47 47 uint8_t *data); … … 72 72 usbvirt_on_device_request_t on_class_device_request; 73 73 74 int (*on_control_transfer)( struct usbvirt_device*dev,74 int (*on_control_transfer)(usbvirt_device_t *dev, 75 75 usb_endpoint_t endpoint, struct usbvirt_control_transfer *transfer); 76 76 77 77 /** Callback for all other incoming data. */ 78 int (*on_data)( struct usbvirt_device*dev,78 int (*on_data)(usbvirt_device_t *dev, 79 79 usb_endpoint_t endpoint, void *buffer, size_t size); 80 80 81 81 /** Callback for host request for data. */ 82 int (*on_data_request)( struct usbvirt_device*dev,82 int (*on_data_request)(usbvirt_device_t *dev, 83 83 usb_endpoint_t endpoint, void *buffer, size_t size, size_t *actual_size); 84 84 … … 133 133 */ 134 134 typedef struct usbvirt_control_transfer { 135 /** Transfer direction (read/write control transfer). */ 135 136 usb_direction_t direction; 137 /** Request data. */ 136 138 void *request; 139 /** Size of request data. */ 137 140 size_t request_size; 141 /** Payload. */ 138 142 void *data; 143 /** Size of payload. */ 139 144 size_t data_size; 140 145 } usbvirt_control_transfer_t; 141 146 142 147 /** Virtual USB device. */ 143 typedefstruct usbvirt_device {148 struct usbvirt_device { 144 149 /** Callback device operations. */ 145 150 usbvirt_device_ops_t *ops; 146 151 147 148 152 /** Reply onto control transfer. 149 153 */ 150 int (*control_transfer_reply)( struct usbvirt_device*dev,154 int (*control_transfer_reply)(usbvirt_device_t *dev, 151 155 usb_endpoint_t endpoint, void *buffer, size_t size); 152 156 153 /* Device attributes. */ 157 /** Device name. 158 * Used in debug prints and sent to virtual host controller. 159 */ 160 const char *name; 154 161 155 162 /** Standard descriptors. */ … … 158 165 /** Current device state. */ 159 166 usbvirt_device_state_t state; 167 160 168 /** Device address. */ 161 169 usb_address_t address; 170 /** New device address. 171 * This field is used during SET_ADDRESS request. 172 * On all other occasions, it holds invalid address (e.g. -1). 173 */ 174 usb_address_t new_address; 162 175 163 /* Private attributes. */ 164 165 /** Phone to HC. 166 * @warning Do not change, this is private variable. 167 */ 168 int vhcd_phone_; 169 170 /** Device id. 171 * This item will be removed when device enumeration and 172 * recognition is implemented. 173 */ 174 int device_id_; 175 176 int (*transaction_out)(struct usbvirt_device *dev, 176 /** Process OUT transaction. */ 177 int (*transaction_out)(usbvirt_device_t *dev, 177 178 usb_endpoint_t endpoint, void *buffer, size_t size); 178 int (*transaction_setup)(struct usbvirt_device *dev, 179 /** Process SETUP transaction. */ 180 int (*transaction_setup)(usbvirt_device_t *dev, 179 181 usb_endpoint_t endpoint, void *buffer, size_t size); 180 int (*transaction_in)(struct usbvirt_device *dev, 182 /** Process IN transaction. */ 183 int (*transaction_in)(usbvirt_device_t *dev, 181 184 usb_endpoint_t endpoint, void *buffer, size_t size, size_t *data_size); 182 185 186 /** State information on control-transfer endpoints. */ 183 187 usbvirt_control_transfer_t current_control_transfers[USB11_ENDPOINT_MAX]; 184 } usbvirt_device_t;188 }; 185 189 186 190 #endif
Note:
See TracChangeset
for help on using the changeset viewer.