Changes in uspace/lib/usb/src/hc.c [48fa501:56fd7cf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hc.c
r48fa501 r56fd7cf 108 108 } else (void)0 109 109 110 /** Initialize connection to USB host controller. 111 * 112 * @param connection Connection to be initialized. 113 * @param device Device connecting to the host controller. 114 * @return Error code. 115 */ 116 int usb_hc_connection_initialize_from_device(usb_hc_connection_t *connection, 117 ddf_dev_t *device) 118 { 119 if (device == NULL) 120 return EBADMEM; 121 122 devman_handle_t hc_handle; 123 const int rc = usb_get_hc_by_handle(ddf_dev_get_handle(device), &hc_handle); 124 if (rc == EOK) { 125 usb_hc_connection_initialize(connection, hc_handle); 126 } 127 128 return rc; 129 } 110 130 111 131 void usb_hc_connection_deinitialize(usb_hc_connection_t *connection) … … 144 164 } 145 165 166 /** Ask host controller for free address assignment. 167 * 168 * @param connection Opened connection to host controller. 169 * @param preferred Preferred SUB address. 170 * @param strict Fail if the preferred address is not avialable. 171 * @param speed Speed of the new device (device that will be assigned 172 * the returned address). 173 * @return Assigned USB address or negative error code. 174 */ 175 usb_address_t usb_hc_request_address(usb_hc_connection_t *connection, 176 usb_address_t preferred, bool strict, usb_speed_t speed) 177 { 178 async_exch_t *exch; 179 EXCH_INIT(connection, exch); 180 181 usb_address_t address = preferred; 182 const int ret = usbhc_request_address(exch, &address, strict, speed); 183 184 EXCH_FINI(connection, exch); 185 return ret == EOK ? address : ret; 186 } 187 188 int usb_hc_bind_address(usb_hc_connection_t * connection, 189 usb_address_t address, devman_handle_t handle) 190 { 191 async_exch_t *exch; 192 EXCH_INIT(connection, exch); 193 194 const int ret = usbhc_bind_address(exch, address, handle); 195 196 EXCH_FINI(connection, exch); 197 return ret; 198 } 146 199 147 200 /** Get handle of USB device with given address. … … 164 217 } 165 218 219 int usb_hc_release_address(usb_hc_connection_t *connection, 220 usb_address_t address) 221 { 222 async_exch_t *exch; 223 EXCH_INIT(connection, exch); 224 225 const int ret = usbhc_release_address(exch, address); 226 227 EXCH_FINI(connection, exch); 228 return ret; 229 } 230 231 int usb_hc_register_endpoint(usb_hc_connection_t *connection, 232 usb_address_t address, usb_endpoint_t endpoint, usb_transfer_type_t type, 233 usb_direction_t direction, size_t packet_size, unsigned interval) 234 { 235 async_exch_t *exch; 236 EXCH_INIT(connection, exch); 237 238 const int ret = usbhc_register_endpoint(exch, address, endpoint, 239 type, direction, packet_size, interval); 240 241 EXCH_FINI(connection, exch); 242 return ret; 243 } 244 245 int usb_hc_unregister_endpoint(usb_hc_connection_t *connection, 246 usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction) 247 { 248 async_exch_t *exch; 249 EXCH_INIT(connection, exch); 250 251 const int ret = 252 usbhc_unregister_endpoint(exch, address, endpoint, direction); 253 254 EXCH_FINI(connection, exch); 255 return ret; 256 } 257 166 258 int usb_hc_read(usb_hc_connection_t *connection, usb_address_t address, 167 259 usb_endpoint_t endpoint, uint64_t setup, void *data, size_t size,
Note:
See TracChangeset
for help on using the changeset viewer.