Changeset 747ef72 in mainline for uspace/lib/drv
- Timestamp:
- 2011-11-10T11:29:10Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 54464f6a, c2245a3, c6f189f7
- Parents:
- 2e1b9dc (diff), 2d1ba51 (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/drv
- Files:
-
- 4 edited
-
generic/remote_usb.c (modified) (3 diffs)
-
generic/remote_usbhc.c (modified) (4 diffs)
-
include/usb_iface.h (modified) (2 diffs)
-
include/usbhc_iface.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usb.c
r2e1b9dc r747ef72 40 40 41 41 42 static void remote_usb_get_ address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);42 static void remote_usb_get_my_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 43 43 static void remote_usb_get_interface(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 44 44 static void remote_usb_get_hc_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); … … 47 47 /** Remote USB interface operations. */ 48 48 static remote_iface_func_ptr_t remote_usb_iface_ops [] = { 49 remote_usb_get_address,50 remote_usb_get_interface,51 remote_usb_get_hc_handle49 [IPC_M_USB_GET_MY_ADDRESS] = remote_usb_get_my_address, 50 [IPC_M_USB_GET_INTERFACE] = remote_usb_get_interface, 51 [IPC_M_USB_GET_HOST_CONTROLLER_HANDLE] = remote_usb_get_hc_handle, 52 52 }; 53 53 … … 61 61 62 62 63 void remote_usb_get_ address(ddf_fun_t *fun, void *iface,63 void remote_usb_get_my_address(ddf_fun_t *fun, void *iface, 64 64 ipc_callid_t callid, ipc_call_t *call) 65 65 { 66 66 usb_iface_t *usb_iface = (usb_iface_t *) iface; 67 67 68 if (usb_iface->get_ address == NULL) {68 if (usb_iface->get_my_address == NULL) { 69 69 async_answer_0(callid, ENOTSUP); 70 70 return; 71 71 } 72 72 73 devman_handle_t handle = DEV_IPC_GET_ARG1(*call);74 75 73 usb_address_t address; 76 int rc = usb_iface->get_ address(fun, handle, &address);74 int rc = usb_iface->get_my_address(fun, &address); 77 75 if (rc != EOK) { 78 76 async_answer_0(callid, rc); -
uspace/lib/drv/generic/remote_usbhc.c
r2e1b9dc r747ef72 55 55 static remote_iface_func_ptr_t remote_usbhc_iface_ops[] = { 56 56 [IPC_M_USBHC_REQUEST_ADDRESS] = remote_usbhc_request_address, 57 [IPC_M_USBHC_RELEASE_ADDRESS] = remote_usbhc_release_address, 57 58 [IPC_M_USBHC_BIND_ADDRESS] = remote_usbhc_bind_address, 58 59 [IPC_M_USBHC_GET_HANDLE_BY_ADDRESS] = remote_usbhc_find_by_address, 59 [IPC_M_USBHC_RELEASE_ADDRESS] = remote_usbhc_release_address,60 60 61 61 [IPC_M_USBHC_REGISTER_ENDPOINT] = remote_usbhc_register_endpoint, … … 118 118 } 119 119 120 usb_speed_t speed = DEV_IPC_GET_ARG1(*call); 121 122 usb_address_t address; 123 int rc = usb_iface->request_address(fun, speed, &address); 120 usb_address_t address = DEV_IPC_GET_ARG1(*call); 121 const bool strict = DEV_IPC_GET_ARG2(*call); 122 const usb_speed_t speed = DEV_IPC_GET_ARG3(*call); 123 124 const int rc = usb_iface->request_address(fun, &address, strict, speed); 124 125 if (rc != EOK) { 125 126 async_answer_0(callid, rc); … … 233 234 234 235 #define _INIT_FROM_HIGH_DATA2(type, var, arg_no) \ 235 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 <<16)236 type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) >> 16) 236 237 #define _INIT_FROM_LOW_DATA2(type, var, arg_no) \ 237 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 16) 238 #define _INIT_FROM_HIGH_DATA3(type, var, arg_no) \ 239 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16) 240 #define _INIT_FROM_MIDDLE_DATA3(type, var, arg_no) \ 241 type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) / (1 << 8)) % (1 << 8) 242 #define _INIT_FROM_LOW_DATA3(type, var, arg_no) \ 243 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 8) 238 type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) & 0xffff) 244 239 245 240 const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) }; 246 241 247 _INIT_FROM_HIGH_DATA3(usb_speed_t, speed, 2); 248 _INIT_FROM_MIDDLE_DATA3(usb_transfer_type_t, transfer_type, 2); 249 _INIT_FROM_LOW_DATA3(usb_direction_t, direction, 2); 242 _INIT_FROM_HIGH_DATA2(usb_transfer_type_t, transfer_type, 2); 243 _INIT_FROM_LOW_DATA2(usb_direction_t, direction, 2); 250 244 251 245 _INIT_FROM_HIGH_DATA2(size_t, max_packet_size, 3); … … 254 248 #undef _INIT_FROM_HIGH_DATA2 255 249 #undef _INIT_FROM_LOW_DATA2 256 #undef _INIT_FROM_HIGH_DATA3 257 #undef _INIT_FROM_MIDDLE_DATA3 258 #undef _INIT_FROM_LOW_DATA3 259 260 int rc = usb_iface->register_endpoint(fun, target.address, speed, 250 251 int rc = usb_iface->register_endpoint(fun, target.address, 261 252 target.endpoint, transfer_type, direction, max_packet_size, interval); 262 253 -
uspace/lib/drv/include/usb_iface.h
r2e1b9dc r747ef72 65 65 * handle must be resolved by its parent. 66 66 */ 67 IPC_M_USB_GET_ ADDRESS,67 IPC_M_USB_GET_MY_ADDRESS, 68 68 69 69 /** Tell interface number given device can use. … … 90 90 /** USB device communication interface. */ 91 91 typedef struct { 92 int (*get_ address)(ddf_fun_t *, devman_handle_t, usb_address_t *);92 int (*get_my_address)(ddf_fun_t *, usb_address_t *); 93 93 int (*get_interface)(ddf_fun_t *, devman_handle_t, int *); 94 94 int (*get_hc_handle)(ddf_fun_t *, devman_handle_t *); -
uspace/lib/drv/include/usbhc_iface.h
r2e1b9dc r747ef72 170 170 /** USB host controller communication interface. */ 171 171 typedef struct { 172 int (*request_address)(ddf_fun_t *, usb_ speed_t, usb_address_t *);172 int (*request_address)(ddf_fun_t *, usb_address_t *, bool, usb_speed_t); 173 173 int (*bind_address)(ddf_fun_t *, usb_address_t, devman_handle_t); 174 174 int (*find_by_address)(ddf_fun_t *, usb_address_t, devman_handle_t *); … … 176 176 177 177 int (*register_endpoint)(ddf_fun_t *, 178 usb_address_t, usb_ speed_t, usb_endpoint_t,178 usb_address_t, usb_endpoint_t, 179 179 usb_transfer_type_t, usb_direction_t, size_t, unsigned int); 180 180 int (*unregister_endpoint)(ddf_fun_t *, usb_address_t, usb_endpoint_t,
Note:
See TracChangeset
for help on using the changeset viewer.
