Changeset 818dc00 in mainline for uspace/lib
- Timestamp:
- 2010-12-09T00:02:25Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 040068c
- Parents:
- aca85e4 (diff), 07b9203e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib
- Files:
-
- 3 added
- 6 edited
-
c/include/ipc/dev_iface.h (modified) (1 diff)
-
drv/generic/remote_usbhc.c (modified) (8 diffs)
-
usb/Makefile (modified) (1 diff)
-
usb/include/usb/debug.h (added)
-
usb/include/usb/usb.h (modified) (1 diff)
-
usb/include/usb/usbdrv.h (modified) (4 diffs)
-
usb/src/debug.c (added)
-
usb/src/drvpsync.c (added)
-
usb/src/usbdrvreq.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/ipc/dev_iface.h
raca85e4 r818dc00 54 54 DEV_IFACE_ID(DEV_FIRST_CUSTOM_METHOD_IDX) 55 55 56 /* 57 * The first argument is actually method (as the "real" method is used 58 * for indexing into interfaces. 59 */ 60 61 #define DEV_IPC_GET_ARG1(call) IPC_GET_ARG2((call)) 62 #define DEV_IPC_GET_ARG2(call) IPC_GET_ARG3((call)) 63 #define DEV_IPC_GET_ARG3(call) IPC_GET_ARG4((call)) 64 #define DEV_IPC_GET_ARG4(call) IPC_GET_ARG5((call)) 65 56 66 57 67 #endif -
uspace/lib/drv/generic/remote_usbhc.c
raca85e4 r818dc00 108 108 } 109 109 110 devman_handle_t handle = IPC_GET_ARG1(*call);110 devman_handle_t handle = DEV_IPC_GET_ARG1(*call); 111 111 112 112 usb_address_t address; … … 122 122 ipc_callid_t callid, ipc_call_t *call) 123 123 { 124 ipcarg_t buffer_hash = IPC_GET_ARG1(*call);124 ipcarg_t buffer_hash = DEV_IPC_GET_ARG1(*call); 125 125 async_transaction_t * trans = (async_transaction_t *)buffer_hash; 126 126 if (trans == NULL) { … … 144 144 accepted_size = trans->size; 145 145 } 146 async_data_read_finalize(c allid, trans->buffer, accepted_size);146 async_data_read_finalize(cid, trans->buffer, accepted_size); 147 147 148 148 ipc_answer_1(callid, EOK, accepted_size); … … 211 211 } 212 212 213 usb_address_t address = (usb_address_t) IPC_GET_ARG1(*call);214 devman_handle_t handle = (devman_handle_t) IPC_GET_ARG2(*call);213 usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call); 214 devman_handle_t handle = (devman_handle_t) DEV_IPC_GET_ARG2(*call); 215 215 216 216 int rc = usb_iface->bind_address(device, address, handle); … … 229 229 } 230 230 231 usb_address_t address = (usb_address_t) IPC_GET_ARG1(*call);231 usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call); 232 232 233 233 int rc = usb_iface->release_address(device, address); … … 275 275 } 276 276 277 size_t expected_len = IPC_GET_ARG3(*call);277 size_t expected_len = DEV_IPC_GET_ARG3(*call); 278 278 usb_target_t target = { 279 .address = IPC_GET_ARG1(*call),280 .endpoint = IPC_GET_ARG2(*call)279 .address = DEV_IPC_GET_ARG1(*call), 280 .endpoint = DEV_IPC_GET_ARG2(*call) 281 281 }; 282 282 … … 327 327 } 328 328 329 size_t len = IPC_GET_ARG3(*call);329 size_t len = DEV_IPC_GET_ARG3(*call); 330 330 usb_target_t target = { 331 .address = IPC_GET_ARG1(*call),332 .endpoint = IPC_GET_ARG2(*call)331 .address = DEV_IPC_GET_ARG1(*call), 332 .endpoint = DEV_IPC_GET_ARG2(*call) 333 333 }; 334 334 … … 384 384 385 385 usb_target_t target = { 386 .address = IPC_GET_ARG1(*call),387 .endpoint = IPC_GET_ARG2(*call)386 .address = DEV_IPC_GET_ARG1(*call), 387 .endpoint = DEV_IPC_GET_ARG2(*call) 388 388 }; 389 389 -
uspace/lib/usb/Makefile
raca85e4 r818dc00 34 34 SOURCES = \ 35 35 src/addrkeep.c \ 36 src/debug.c \ 37 src/drvpsync.c \ 36 38 src/hcdhubd.c \ 37 39 src/hcdrv.c \ -
uspace/lib/usb/include/usb/usb.h
raca85e4 r818dc00 71 71 /** Default USB address. */ 72 72 #define USB_ADDRESS_DEFAULT 0 73 /** Maximum address number in USB 1.1. */ 74 #define USB11_ADDRESS_MAX 128 73 75 74 76 /** USB endpoint number type. -
uspace/lib/usb/include/usb/usbdrv.h
raca85e4 r818dc00 38 38 #include <usb/usb.h> 39 39 #include <driver.h> 40 #include <usb/devreq.h> 41 #include <usb/descriptor.h> 40 42 41 43 int usb_drv_hc_connect(device_t *, unsigned int); … … 54 56 void *, size_t, size_t *, usb_handle_t *); 55 57 58 int usb_drv_psync_interrupt_out(int, usb_target_t, void *, size_t); 59 int usb_drv_psync_interrupt_in(int, usb_target_t, void *, size_t, size_t *); 60 61 62 56 63 int usb_drv_async_control_write_setup(int, usb_target_t, 57 64 void *, size_t, usb_handle_t *); … … 60 67 int usb_drv_async_control_write_status(int, usb_target_t, 61 68 usb_handle_t *); 69 70 int usb_drv_psync_control_write_setup(int, usb_target_t, void *, size_t); 71 int usb_drv_psync_control_write_data(int, usb_target_t, void *, size_t); 72 int usb_drv_psync_control_write_status(int, usb_target_t); 73 62 74 63 75 int usb_drv_async_control_read_setup(int, usb_target_t, … … 68 80 usb_handle_t *); 69 81 82 int usb_drv_psync_control_read_setup(int, usb_target_t, void *, size_t); 83 int usb_drv_psync_control_read_data(int, usb_target_t, void *, size_t, size_t *); 84 int usb_drv_psync_control_read_status(int, usb_target_t); 85 86 70 87 int usb_drv_async_wait_for(usb_handle_t); 71 88 72 89 73 90 int usb_drv_req_set_address(int, usb_address_t, usb_address_t); 91 int usb_drv_req_get_device_descriptor(int, usb_address_t, 92 usb_standard_device_descriptor_t *); 74 93 75 94 #endif -
uspace/lib/usb/src/usbdrvreq.c
raca85e4 r818dc00 34 34 */ 35 35 #include <usb/usbdrv.h> 36 #include <usb/devreq.h>37 36 #include <errno.h> 38 37 … … 95 94 } 96 95 96 /** Retrieve device descriptor of connected USB device. 97 * 98 * @param[in] phone Open phone to HC driver. 99 * @param[in] address Device USB address. 100 * @param[out] descriptor Storage for the device descriptor. 101 * @return Error code. 102 * @retval EBADMEM @p descriptor is NULL. 103 */ 104 int usb_drv_req_get_device_descriptor(int phone, usb_address_t address, 105 usb_standard_device_descriptor_t *descriptor) 106 { 107 if (descriptor == NULL) { 108 return EBADMEM; 109 } 110 111 /* Prepare the target. */ 112 usb_target_t target = { 113 .address = address, 114 .endpoint = 0 115 }; 116 117 /* Prepare the setup packet. */ 118 usb_device_request_setup_packet_t setup_packet = { 119 .request_type = 128, 120 .request = USB_DEVREQ_GET_DESCRIPTOR, 121 .index = 0, 122 .length = sizeof(usb_standard_device_descriptor_t) 123 }; 124 setup_packet.value_high = USB_DESCTYPE_DEVICE; 125 setup_packet.value_low = 0; 126 127 usb_handle_t handle; 128 int rc; 129 130 /* Start the control read transfer. */ 131 rc = usb_drv_async_control_read_setup(phone, target, 132 &setup_packet, sizeof(usb_device_request_setup_packet_t), &handle); 133 if (rc != EOK) { 134 return rc; 135 } 136 rc = usb_drv_async_wait_for(handle); 137 if (rc != EOK) { 138 return rc; 139 } 140 141 /* Retrieve the descriptor. */ 142 size_t actually_transferred = 0; 143 usb_standard_device_descriptor_t descriptor_tmp; 144 rc = usb_drv_async_control_read_data(phone, target, 145 &descriptor_tmp, sizeof(usb_standard_device_descriptor_t), 146 &actually_transferred, &handle); 147 if (rc != EOK) { 148 return rc; 149 } 150 rc = usb_drv_async_wait_for(handle); 151 if (rc != EOK) { 152 return rc; 153 } 154 155 /* Finish the control read transfer. */ 156 rc = usb_drv_async_control_read_status(phone, target, &handle); 157 if (rc != EOK) { 158 return rc; 159 } 160 rc = usb_drv_async_wait_for(handle); 161 if (rc != EOK) { 162 return rc; 163 } 164 165 if (actually_transferred < sizeof(usb_standard_device_descriptor_t)) { 166 return ELIMIT; 167 } 168 169 /* 170 * Everything is okay, copy the descriptor. 171 */ 172 memcpy(descriptor, &descriptor_tmp, 173 sizeof(usb_standard_device_descriptor_t)); 174 175 return EOK; 176 } 177 178 179 97 180 /** 98 181 * @}
Note:
See TracChangeset
for help on using the changeset viewer.
