Changes in uspace/lib/drv/generic/remote_usbhc.c [50b581d:7f80313] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbhc.c
r50b581d r7f80313 37 37 #include <errno.h> 38 38 #include <assert.h> 39 #include <macros.h> 39 40 40 41 #include "usbhc_iface.h" … … 165 166 { 166 167 if (!exch || !address) 167 return E INVAL;168 return EBADMEM; 168 169 sysarg_t new_address; 169 170 const int ret = async_req_4_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), … … 173 174 return ret; 174 175 } 175 /*----------------------------------------------------------------------------*/ 176 176 177 int usbhc_bind_address(async_exch_t *exch, usb_address_t address, 177 178 devman_handle_t handle) 178 179 { 179 180 if (!exch) 180 return E INVAL;181 return EBADMEM; 181 182 return async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 182 183 IPC_M_USBHC_BIND_ADDRESS, address, handle); 183 184 } 184 /*----------------------------------------------------------------------------*/ 185 185 186 int usbhc_get_handle(async_exch_t *exch, usb_address_t address, 186 187 devman_handle_t *handle) 187 188 { 188 189 if (!exch) 189 return E INVAL;190 return EBADMEM; 190 191 sysarg_t h; 191 192 const int ret = async_req_2_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), … … 195 196 return ret; 196 197 } 197 /*----------------------------------------------------------------------------*/ 198 198 199 int usbhc_release_address(async_exch_t *exch, usb_address_t address) 199 200 { 200 201 if (!exch) 201 return E INVAL;202 return EBADMEM; 202 203 return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 203 204 IPC_M_USBHC_RELEASE_ADDRESS, address); 204 205 } 205 /*----------------------------------------------------------------------------*/ 206 206 207 int usbhc_register_endpoint(async_exch_t *exch, usb_address_t address, 207 208 usb_endpoint_t endpoint, usb_transfer_type_t type, … … 209 210 { 210 211 if (!exch) 211 return E INVAL;212 return EBADMEM; 212 213 const usb_target_t target = 213 214 {{ .address = address, .endpoint = endpoint }}; … … 220 221 #undef _PACK2 221 222 } 222 /*----------------------------------------------------------------------------*/ 223 223 224 int usbhc_unregister_endpoint(async_exch_t *exch, usb_address_t address, 224 225 usb_endpoint_t endpoint, usb_direction_t direction) 225 226 { 226 227 if (!exch) 227 return E INVAL;228 return EBADMEM; 228 229 return async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 229 230 IPC_M_USBHC_UNREGISTER_ENDPOINT, address, endpoint, direction); 230 231 } 231 /*----------------------------------------------------------------------------*/ 232 232 233 int usbhc_read(async_exch_t *exch, usb_address_t address, 233 234 usb_endpoint_t endpoint, uint64_t setup, void *data, size_t size, 234 235 size_t *rec_size) 235 236 { 237 if (!exch) 238 return EBADMEM; 239 236 240 if (size == 0 && setup == 0) 237 241 return EOK; 238 242 239 if (!exch)240 return EINVAL;241 243 const usb_target_t target = 242 244 {{ .address = address, .endpoint = endpoint }}; … … 284 286 return EOK; 285 287 } 286 /*----------------------------------------------------------------------------*/ 288 287 289 int usbhc_write(async_exch_t *exch, usb_address_t address, 288 290 usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size) 289 291 { 292 if (!exch) 293 return EBADMEM; 294 290 295 if (size == 0 && setup == 0) 291 296 return EOK; 292 297 293 if (!exch)294 return EINVAL;295 298 const usb_target_t target = 296 299 {{ .address = address, .endpoint = endpoint }}; … … 319 322 return (int) opening_request_rc; 320 323 } 321 /*----------------------------------------------------------------------------*/ 324 322 325 323 326 static void remote_usbhc_request_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); … … 332 335 333 336 /** Remote USB host controller interface operations. */ 334 static remote_iface_func_ptr_t remote_usbhc_iface_ops[] = {337 static const remote_iface_func_ptr_t remote_usbhc_iface_ops[] = { 335 338 [IPC_M_USBHC_REQUEST_ADDRESS] = remote_usbhc_request_address, 336 339 [IPC_M_USBHC_RELEASE_ADDRESS] = remote_usbhc_release_address, … … 347 350 /** Remote USB host controller interface structure. 348 351 */ 349 remote_iface_t remote_usbhc_iface = { 350 .method_count = sizeof(remote_usbhc_iface_ops) / 351 sizeof(remote_usbhc_iface_ops[0]), 352 const remote_iface_t remote_usbhc_iface = { 353 .method_count = ARRAY_SIZE(remote_usbhc_iface_ops), 352 354 .methods = remote_usbhc_iface_ops 353 355 }; … … 384 386 return trans; 385 387 } 386 /*----------------------------------------------------------------------------*/ 388 387 389 void remote_usbhc_request_address(ddf_fun_t *fun, void *iface, 388 390 ipc_callid_t callid, ipc_call_t *call) … … 406 408 } 407 409 } 408 /*----------------------------------------------------------------------------*/ 410 409 411 void remote_usbhc_bind_address(ddf_fun_t *fun, void *iface, 410 412 ipc_callid_t callid, ipc_call_t *call) … … 423 425 async_answer_0(callid, ret); 424 426 } 425 /*----------------------------------------------------------------------------*/ 427 426 428 void remote_usbhc_get_handle(ddf_fun_t *fun, void *iface, 427 429 ipc_callid_t callid, ipc_call_t *call) … … 444 446 } 445 447 } 446 /*----------------------------------------------------------------------------*/ 448 447 449 void remote_usbhc_release_address(ddf_fun_t *fun, void *iface, 448 450 ipc_callid_t callid, ipc_call_t *call) … … 460 462 async_answer_0(callid, ret); 461 463 } 462 /*----------------------------------------------------------------------------*/ 464 463 465 static void callback_out(ddf_fun_t *fun, 464 466 int outcome, void *arg) … … 470 472 async_transaction_destroy(trans); 471 473 } 472 /*----------------------------------------------------------------------------*/ 474 473 475 static void callback_in(ddf_fun_t *fun, 474 476 int outcome, size_t actual_size, void *arg) … … 494 496 async_transaction_destroy(trans); 495 497 } 496 /*----------------------------------------------------------------------------*/ 498 497 499 void remote_usbhc_register_endpoint(ddf_fun_t *fun, void *iface, 498 500 ipc_callid_t callid, ipc_call_t *call) … … 594 596 } 595 597 } 596 /*----------------------------------------------------------------------------*/ 598 597 599 void remote_usbhc_write( 598 600 ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
Note:
See TracChangeset
for help on using the changeset viewer.